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
{{ message }}
Repository navigation
[Bug]: Cannot draw multiple lines with empty point #6
hi,
first thanks for this great project! This is a long time I try to build a chart declarative library for solidjs and you dit it!
Here is my bug: I try to build two lines on a graph but there are some hole in the second line (there is no y data for some x), but console report some errors when I try to plot these points: I get some NaN in line and path svg. Do you see any workaround?
my reproduction repo is just a npm create vite@latest with a FirstChart.tsx component. If you run npm run dev and go to localhost:5173 you will see error in browser console because of the following lines
if(index===3){deletedata.value2;}
Expected behavior
I expect a way to configure second line on how to handle missing point or just ignore missing point.
accessData() returns undefined for the entry where you delete data.value2, and Math.min(1, undefined) is NaN. So the axis registers {min: NaN, max: NaN}, createPoints.ts builds scaleLinear on a NaN domain, and every point it maps comes back NaN — including the points of your first line, which has no holes at all. That is why it looks like the library cannot do gaps.
typeof NaN === 'number'. So the segment-splitting in shapes/Curve.tsx — which is already written correctly and already supports connectNulls — never sees the hole and hands NaN to d3's line().
So the feature you are asking for already exists, it is just unreachable: <Line connectNulls /> (or the default segmented behaviour) is exactly what you want, and both paths are broken by the two lines above.
I opened a PR with the fix: #8 — pointDefined uses Number.isFinite, and createSeries filters non-finite values before computing the domain. No API change.
Unblocking yourself today (last commit on this repo is 2025-07-06, so I would not wait on a release). Patch the installed package — with pnpm:
pnpm patch solid-charts
then in the printed temp dir, in dist/index.js, change the two spots above, and pnpm patch-commit <dir>. With npm/yarn, patch-package does the same. Two lines and you are unstuck.
Free either way — you owe me nothing for the above. If you'd rather just hand it off: I take fixed-scope jobs like this, $35 for a small fix, through Fiverr escrow so you only pay on delivery — fiverr.com/fayazbinsalam · full rates: p32929.github.io/hire
Activity
p32929 commentedon Sep 20, 2026
@stregouet I dug into this — it is two separate bugs, and the second one is why the whole chart breaks instead of just the hole.
1.
lib/createSeries.tsbuilds the axis domain withMath.min/Math.maxover the raw series:accessData()returnsundefinedfor the entry where youdelete data.value2, andMath.min(1, undefined)isNaN. So the axis registers{min: NaN, max: NaN},createPoints.tsbuildsscaleLinearon aNaNdomain, and every point it maps comes backNaN— including the points of your first line, which has no holes at all. That is why it looks like the library cannot do gaps.2.
lib/utils.tsletsNaNthrough the gap check:typeof NaN === 'number'. So the segment-splitting inshapes/Curve.tsx— which is already written correctly and already supportsconnectNulls— never sees the hole and handsNaNto d3'sline().So the feature you are asking for already exists, it is just unreachable:
<Line connectNulls />(or the default segmented behaviour) is exactly what you want, and both paths are broken by the two lines above.I opened a PR with the fix: #8 —
pointDefinedusesNumber.isFinite, andcreateSeriesfilters non-finite values before computing the domain. No API change.Unblocking yourself today (last commit on this repo is 2025-07-06, so I would not wait on a release). Patch the installed package — with pnpm:
then in the printed temp dir, in
dist/index.js, change the two spots above, andpnpm patch-commit <dir>. With npm/yarn,patch-packagedoes the same. Two lines and you are unstuck.Free either way — you owe me nothing for the above. If you'd rather just hand it off: I take fixed-scope jobs like this, $35 for a small fix, through Fiverr escrow so you only pay on delivery — fiverr.com/fayazbinsalam · full rates: p32929.github.io/hire