ico
ico copied to clipboard
Incorrect graph with all zero values
The graph is shown incorrectly when all the values are zero:
- Line graph: straight line above the graph, no labels
- Bar graph: all full bars
- Etc.
Expected outcome is have flat line/bars at level 0.
var placeholder = document.getElementById('graph');
// var values = [0, 1, 4, 3]; // <-- OK
var values = [0, 0, 0, 0]; // <-- NOK
new Ico.LineGraph(placeholder, values,
{colour:'#ff0000', labels:['one', 'two', 'three', 'four'], height:300, width: 300}
);
Used versions:
- Ico (latest from master): 15e69ac4da850c0639f1569f2f408e0b57471b86
- Raphael.js: 2.0.1
I'll take a look
The values were coming out as NaN
I just pushed a fix for this, let me know if it does what you want.
Looks quite good: Line graph is shown as expected, but bar graph is not showing any bars (it could show flat bars at zero level as well).
However, I'm fine with the current solution - thanks for the quick response and fix!
Yeah, I think the bar should show at least a line at zero else it might be misread as a missing value rather than 0. I'll keep this open until I figure that out.