andreaferretti / paths-js

Generate SVG paths for geometric shapes :bar_chart:
http://andreaferretti.github.io/paths-js-react-demo/
Apache License 2.0
1.72k stars 84 forks source link

scaling a chart #32

Closed Bondifrench closed 8 years ago

Bondifrench commented 8 years ago

Hi, let's say I have the following set of data:

var data = [{year: 2008, val: 7.2},
{year: 2009, val: 8.1},
{year: 2010, val: 7.7},
{year: 2011, val: 6.8},
{year: 2012, val: 6.7}]

If I use data as parameter for a Stock chart for instance, with year on the x-axis and val on the y-axis, by default when using the Stock chart, paths-js scales automatically using the maximum value of val for y. Is there a way to use a different scale, for instance [0,15] so the values appear more in the middle of the chart instead of the top? Is there a method for it? Thx

andreaferretti commented 8 years ago

Hi, I was sure there min and max parameters, but it turns out they are missing :-/ I will certainly add them (I am starting a new version in a few days), but right now your best bet is to use a smaller height than the container SVG height

andreaferretti commented 8 years ago

Sorry I had no time to work on the library in the past month. Your issue is now fixed in version 0.4.0, which allows you to specify a fidex min and max