chartist-js / chartist

Simple responsive charts
https://chartist.dev
MIT License
13.33k stars 2.54k forks source link

feat(SVG): support for viewport in SVG only providing width and height #1403

Open evangelion1204 opened 1 year ago

evangelion1204 commented 1 year ago

For now a draft but this should outline what should be achieved. The charts scale without redrawing and rearranging. The drawback might be that fonts can get too small if no responsive options are used.

I do believe we could also smartly skip redraw in such cases until we hit a breakpoint.

Closes #1402

gionkunz commented 1 year ago

Hey, thanks for your contribution! I guess this would also be relevant for the other chart types, right? https://github.com/chartist-js/chartist/blob/main/src/charts/BarChart/BarChart.ts#L215-L221

evangelion1204 commented 1 year ago

Sure, I just use a fork right now and needed it for Line-Charts although I also have Bar-Chats in use. I am going to add it here too. I will update the PR within the next days.

evangelion1204 commented 1 year ago

@gionkunz the example I added it to is not too great though. Only thing missing are unit tests around the createSvg function.

evangelion1204 commented 1 year ago

Ok, updated the tests.

evangelion1204 commented 1 year ago

@gionkunz In case you got some time please review. I would also like to create more PRs later on.

evangelion1204 commented 1 year ago

@gionkunz Quick reminder 😄