chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
725 stars 197 forks source link

improve vertical "whitespace" calculation #17

Closed aranlunzer closed 6 years ago

aranlunzer commented 6 years ago

The whitespace calculation at

https://github.com/chartjs/chartjs-chart-financial/blob/c3f235676fb6876a52a603a1ccc4e49fe10edee8/src/scale.financialLinear.js#L80

...is unhelpful for charts that have small movements around a high value. For example, if Bitcoin has recently moved within the range 10700 to 10710, the proposed scale will be from 10165 to 11245.

Perhaps the following code would provide something closer to the intention: me.min -= (me.max - me.min) * 0.05; me.max += (me.max - me.min) * 0.05;

benmccann commented 6 years ago

That seems like a reasonable change. If you send a pull request, I'll merge it

benmccann commented 6 years ago

Thanks!