ONSvisual / svelte-charts

Reusable chart templates for Svelte projects.
14 stars 6 forks source link

Trying to add series to line chart but errors when animation is turned on #10

Closed henryjameslau closed 10 months ago

henryjameslau commented 11 months ago

I'm trying to add series to a line chart with a scroller but I get this error "Uncaught Error: Cannot interpolate values of different type". Here's the error in a REPL. It's something to do with can't interpolate between values. I've tried keying the lines and areas. I think it might be something to do with SetCoords.

henryjameslau commented 10 months ago

Logging out $coords and newcoords from SetCoords.svelte and when you add another series, you have 4 elements in the array for $coords and then 8 in newcoords which means it doesn't know how to interpolate when it has to create the elements. image

henryjameslau commented 10 months ago

Have also found this question on twitter which I think is relevant

henryjameslau commented 10 months ago

Have figured out a way of doing it by doing something funny with the data as it's given to the LineChart component and then also adding in a lineOpacity (although not the best way to do this and lacks transition too). But it works well enough. I've saved what I've done to a branch