无法在 react-vis 和 clojurescript 中的自定义 SVG 系列的 g 元素中画一条线



在以下工作代码中:

[:> rvis/CustomSVGSeries {:data [{:x x :y y 
:customComponent (fn []
(r/as-element [:g {:className "etiqueta"}
[:text
[:tspan {:x 0 :y 0} "Hidrógeno "]
[:tspan {:x 0 :y "1em"} "Alfa"]]]))}]}]

我正在尝试添加一个line元素:

[:> rvis/CustomSVGSeries {:data [{:x x :y y 
:customComponent (fn []
(r/as-element [:g {:className "etiqueta"}
[:line {:x1 0 :y1 0 :x2 600 :y2 600 :strokeWidth 5 :fill "red"}]
[:text
[:tspan {:x 0 :y 0} "Hidrógeno "]
[:tspan {:x 0 :y "1em"} "Alfa"]]]))}]}]

但不起作用。

对我来说,更奇怪的是,其他一些SVG元素也能工作;例如CCD_ 2和CCD_。。。

我也试过[:polyline {:points [0 0 600 600]}],但也没有运气。。。

感谢@cfrick的评论,我用:stroke更改了:fill,它对:line:polyline都很好。

最新更新