Closed akileos closed 12 years ago
Sample graph :
var data = [ { x: 0, y: -40 }, { x: 1, y: 3 }, { x: 2, y: -17 }, { x: 3, y: -42 } ];
var graph = new Rickshaw.Graph( { element: document.querySelector("#chart"), width: 580, height: 250, series: [ { color: 'steelblue', data: data } ] } );
graph.render();
The minimum graph value is hardcoded to 0 in all of the renders, for instance: https://github.com/shutterstock/rickshaw/blob/master/src/js/Rickshaw.Graph.Renderer.Line.js#L35
I've fixed it in my fork here: https://github.com/andrew/rickshaw/commit/7dc125e79326d94bdbf44d5337c78050757dd9c5
Any chance this change can be merged in the main project? We have a few data sets with negative values, would be very nice to have ...
I'll send a pull request
Thank you, much appreciated.
I've implemented a fix, where you can set a min-property on your graph. Being any number you wish, 'auto' (picks the lowest value in your current dataset), or just not define it (will fall back to the current default; 0).
https://github.com/kvisle/rickshaw/commit/a834029022a2177deb3c471b7b8a8b8b575d536d
Pull request sent, should apply to current HEAD.
This is merged in with 6a75eae7fb
If you specify min: 'auto', in the Rickshaw.Graph constructor, you should be able to graph negative values.
IT seems that we are unable to display negative values on the chart. I didn't find any param to set Y-Axis min to anything that is not "zero". Is there a clean way to do this ?