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
In case where the data array are filled with all zeros, Expected Number error will occurred:
Error: <path> attribute d: Expected number, "M4 NaN L 4 NaN L 29…"
Base on looking at the source, the Y coord of each datapoint is determined by the max values of datapoints. If data arrays are all 0, then you will run into a divide by zero scenario resulting in the above error.
// The maximum value. This is used to calculate the Y coord of
// each sparkline datapoint.
const max = Math.max(...values);
The text was updated successfully, but these errors were encountered:
glaszig
added a commit
to glaszig/sparkline
that referenced
this issue
Dec 3, 2022
calling getY() with 0 value would produce NaN which are invalid in svg where those end up.
in that case, the added condition returns the height in float to draw a data point at y=0.
releated fnando#13, closesfnando#24, fixesfnando#14
In case where the data array are filled with all zeros,
Expected Number
error will occurred:Error: <path> attribute d: Expected number, "M4 NaN L 4 NaN L 29…"
Base on looking at the source, the Y coord of each datapoint is determined by the max values of datapoints. If data arrays are all 0, then you will run into a divide by zero scenario resulting in the above error.
The text was updated successfully, but these errors were encountered: