Search code examples
javascriptreactjsvictory-charts

React Victory chart displays different line lengths for straight lines


I'm using the Victory library to draw a line chart in React, but it seems to draw lines with different widths depending on whether the line is straight or is at an angle.

Screenshot of the line it's drawing:

enter image description here

In the screenshot, the dots are drawn using VictoryScatter and the line(s) using VictoryLine. I noticed that VictoryLine draws using path, so is this a limitation of SVG's path to draw like this? Because this seems weird to me!


Solution

  • This is happening because of the order or rendering of the SVG components. The ones at the top and the bottom appear to be thinner because they are rendered behind the axes (this is explained here)

    I'm not sure why, but changing the order didn't work for me, so I had to use VictoryPortal to bring my components to the front.