nivo icon indicating copy to clipboard operation
nivo copied to clipboard

Points on a small line chart will be in wrong position

Open MasterOdin opened this issue 3 years ago • 0 comments

Describe/explain the bug A clear and concise description of what the bug is.

When generating a Line chart, some points will sometimes be generated and shown in a wrong position initially:

Screen Shot 2022-05-25 at 8 50 24 AM

On changing the width of the chart, or any other render property of it, the chart would then render as expected subsequently, until it randomly messes up again on some later page reload. I've not figured out the rhyme or reason for it.

I would replicate the behavior from 0.69.0 to 0.79.1.

To Reproduce I created https://codesandbox.io/s/attempt-at-bugged-points-bqdddy to try and reproduce the effect, but it seems to work fine here, so I'm not sure what could be causing the difference in behavior within my application, and nivo.

For one such bugged chart, the generated SVG line was:

<path d="M24.942040111899335,140.00882945248392L12.633333333333333,153L25.266666666666666,49L37.9,29L50.53333333333333,40L63.166666666666664,61L75.8,45L88.43333333333334,139L101.06666666666666,150L113.7,18L126.33333333333333,41L138.96666666666667,56L151.6,41L164.23333333333335,64L176.86666666666667,151L189.5,148L202.13333333333333,80L214.76666666666665,30L227.4,22L240.03333333333333,25L252.66666666666666,38L265.3,146L277.93333333333334,148L290.56666666666666,0L303.2,18L315.83333333333337,38L328.4666666666667,30L341.1,51L353.73333333333335,139L366.3666666666667,146L379,40" fill="none" stroke-width="2.5" stroke="#3182EB"></path>

As soon as I shifted the width a pixel, it snapped back into expected ordering:

<path d="M0,164L12.633333333333333,158L25.266666666666666,122L37.9,99L50.53333333333333,87L63.166666666666664,83L75.8,77L88.43333333333334,73L101.06666666666666,73L113.7,68L126.33333333333333,70L138.96666666666667,73L151.6,70L164.23333333333335,73L176.86666666666667,74L189.5,74L202.13333333333333,83L214.76666666666665,81L227.4,77L240.03333333333333,74L252.66666666666666,71L265.3,70L277.93333333333334,70L290.56666666666666,59L303.2,57L315.83333333333337,59L328.4666666666667,60L341.1,62L353.73333333333335,61L366.3666666666667,60L379,66" fill="none" stroke-width="2.5" stroke="#FF7D1B"></path>

Expected behavior

Points to not be in the wrong order on initial render.

Desktop (please complete the following information):

  • OS: [e.g. iOS] macOS
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22] 101.0.4951.64

MasterOdin avatar Jun 01 '22 17:06 MasterOdin

@MasterOdin, I suppose it has to do with https://github.com/plouc/nivo/pull/1644, a fix was made and released.

plouc avatar Sep 10 '22 02:09 plouc