Open GoogleCodeExporter opened 8 years ago
Any updates on this? This is the only hurdle preventing me from using it as I
am rendering line charts with decimal values.
Original comment by dwaynech...@gmail.com
on 23 Nov 2010 at 5:38
Try this:
topValue: function(){
var topValue = 0;
var allData = this.allData().join(',').split(',');
$(allData).each(function(){
if(parseFloat(this,10)>topValue) topValue = parseFloat(this);
});
var topValue = Math.ceil(topValue) + '';
return (Math.ceil(topValue/Math.pow(10,topValue.length-1)))*Math.pow(10,topValue.length-1);
},
This line solves the decimal problem, by simply rounding the numbers: var
topValue = Math.ceil(topValue)
The next line makes the y-axis go higher than the the bars. It rounds up to 10
to the power of the number of digits in your highest value. If you have 10 y
axis lables, then they will be nice round numbers (with only or two significant
figures). A simple way to have 10 y axis lables is by setting your graph height
to 300px when you call it).
Original comment by adri...@gmail.com
on 11 Feb 2011 at 2:22
Original issue reported on code.google.com by
fg.mag...@gmail.com
on 17 Mar 2010 at 3:13