0

In the following working code:

[:> 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"]]]))}]}]

I'm trying to add a line element:

[:> 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"]]]))}]}]

But doesn't work.

For me it's even stranger that some other SVG elements work; for instance [:circle {:cx 0 :cy 0 :r 20 :fill "orange"}] and [:ellipse {:cx 0 :cy 10 :rx 61 :ry 30 :fill "yellow"}] work perfectly...

I also tried with [:polyline {:points [0 0 600 600]}] but did not have luck either...

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Luis López
  • 159
  • 8
  • 1
    What does "does not work" mean? Also isn't that `:stroke` instead of `:fill`? – cfrick Mar 10 '22 at 19:29
  • @cfrick Ouch! It was as esay as you say! I ommited `:stroke`... ¡my bad! :) I'm editing the post in case someone else falls in my mistake... ¡Thank you! – Luis López Mar 11 '22 at 10:24

1 Answers1

0

Thanks to @cfrick comment, I changed :fill with :stroke and it worked fine, both for :line and :polyline.

Luis López
  • 159
  • 8