chart.xkcd
chart.xkcd copied to clipboard
Control the SVG size and width/height ratio
Hi @timqian, Is there a easy way to control the SVG size?
I try to set width
and height
attr like this
<svg class="line-chart" width="800px" height="600px"></svg>
but it seem doesn't work. :)
The width of the svg depends on its parent. You can change the width of its parent to change its size.
The ratio of with and height is hard coded to 4/3. Adding a setting to config it might be good. I am considering adding this
Now div
is the parent tag,
<div width="800px" height="600px" width="800px">
<svg class="line-chart"></svg>
</div>
but.. SVG shows incomplete
It would be nice if added a new setting opts for it.
Try
<div style="width:800px;">
<svg class="line-chart"></svg>
</div>
It works, :)
The ratio of with and height is hard coded to 4/3.
and is this will be changed in the future?
The default will always be 4/3, I think adding an option to change it might be good
I will keep this issue open for size & ratio related updates
@timqian I'm the author of pyecharts. Echarts is a great visualization library created by Baidu frontend team.
I got an idea that combines chart.xkcd with python. Because your charts lib is so adorable and I like such hand drawing style things.
But now it just an idea and not on the shedule temporarily :)
@timqian cutecharts opensouce today!
https://github.com/chenjiandongx/cutecharts
@chenjiandongx Nice job! I listed your tool in "who is using chart.xkcd" issue here https://github.com/timqian/chart.xkcd/issues/14
@timqian Yes, 👍 already.