You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
I am using chartjs v3.6.0 and moment (with moment adapter) i faced an issue while i am trying to use this plugin. Here is the problem;
After some investigations i found the problem;
functioncomputeMinSampleSize(scale,pixels){letmin=scale._length;letprev,curr,i,ilen;for(i=1,ilen=pixels.length;i<ilen;++i){min=Math.min(min,Math.abs(pixels[i]-pixels[i-1]));}for(i=0,ilen=scale.ticks.length;i<ilen;++i){curr=scale.getPixelForTick(i);min=i>0 ? Math.min(min,Math.abs(curr-prev)) : min;// here min value is becaming NaN because of curr and prev can be NaNprev=curr;}returnmin;}
My solution was (for very quick fix);
functioncomputeMinSampleSize(scale,pixels){letmin=scale._length;letprev,curr,i,ilen;for(i=1,ilen=pixels.length;i<ilen;++i){min=Math.min(min,Math.abs(pixels[i]-pixels[i-1]));}for(i=0,ilen=scale.ticks.length;i<ilen;++i){curr=scale.getPixelForTick(i);min=i>0&&!isNaN(curr)&&!isNaN(prev) ? Math.min(min,Math.abs(curr-prev)) : min;// add check for NaN valuesprev=curr;}returnmin;}
and the result is;
but as i see scale.getPixelForTick() always returns NaN and it can be because of wrong date parsing but anyway it should not cause wrong output.
This is all i found in couple of hours please add, share your thoughts and i hope it helps everyone who faced this issue!
Thank you.
The text was updated successfully, but these errors were encountered:
Hi there,
I am using chartjs v3.6.0 and moment (with moment adapter) i faced an issue while i am trying to use this plugin. Here is the problem;
After some investigations i found the problem;
My solution was (for very quick fix);
and the result is;
but as i see scale.getPixelForTick() always returns NaN and it can be because of wrong date parsing but anyway it should not cause wrong output.
This is all i found in couple of hours please add, share your thoughts and i hope it helps everyone who faced this issue!
Thank you.
The text was updated successfully, but these errors were encountered: