ONSvisual / svelte-charts

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

trimGridlines: which is it? #11

Closed henryjameslau closed 7 months ago

henryjameslau commented 7 months ago

I made trimGridlines take off paddingLeft so the gridlines would just be restricted to the graph https://github.com/ONSvisual/svelte-charts/commit/548d5c54138936590006c1c2bfe0916d8ff7fa15 image

and then @bothness removed it https://github.com/ONSvisual/svelte-charts/commit/c9fcdc283fc6b782c4eff41c635737c73d02155f

So which is it?

bothness commented 7 months ago

Hi Henry. I think we might need to code in some more control over how this operates. For this line chart example, with largely default settings (incl. y axis labels sitting on lines), removing the left + right padding from the length caused the axis lines to terminate before the right side of the chart.

How it is now

Screenshot 2024-01-10 at 13 44 30

How it was with right + left padding subtracted

image
henryjameslau commented 7 months ago

Ah I see. That looks like it's because the gridlines start from before where the lines start so needs a bit extra to make it to the end, whereas with the ordinal scales for categories that wouldn't make sense. Looks like we need something like a trimGridlinesBefore and trimGridlinesAfter

bothness commented 7 months ago

Got it. Sounds like we could just make the left trimming conditional on the scale type, so no need to have any additional props. I'll try to figure out a fix for this today.

bothness commented 7 months ago

This should now be fixed in version 0.3.2.