jQWidgets Forums
jQuery UI Widgets › Forums › Chart › Range axis values shows long value in between
Tagged: chart, formatFunction, formatSettings, jqxChart
This topic contains 5 replies, has 2 voices, and was last updated by Dimitar 11 years, 8 months ago.
-
Author
-
I have vertical bar chart, it range axis values in between shows long values, like the range axis values are 0, 5.4, 10.8, 16.200000000000003, 21.6, 27, 32.400000000000006, 37.800000000000004, 43.2, 48.6, 54
I tried with format settings property decimalPlaces, doesn’t solves the problem, will you suggest on how could i resolve this issue.
Thanks
Shailaja
Hello Shailaja,
Please post a sample code so that we may determine the source of the issue.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
Please check below my code i have in the value axis
valueAxis:
{showGridLines: ${reportData.rangeGridLine[0]},
gridLinesColor :’#’+rangeGridColor,displayValueAxis: true,
flip:true,
axisSize: ‘auto’,
formatSettings:
{
//decimalPlaces: 0
},
description: “${fn:replace(reportData.rangeAxisLabel, ‘\”‘, ‘\\\”‘)}”,
minValue: ${reportData.minValue},
maxValue: ${reportData.maxValue},
unitInterval: ${reportData.unitInterval},
formatFunction: function(value){
for(i in primRangeAxisData){
var val = primRangeAxisData[i];
for(j in val){
if(value == j){
return primRangeAxisData[i][value];
}
}
}
return value;
},
},Hi Shailaja,
The issue may come from your custom formatFunction. Try modifying/removing it and check if the issue persists.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
Thanks for your feedback, I did some test research on it and found that on commenting the custom formatFunction, it shows proper avoiding those long decimal values.
the concern is that on overriding this function, the formatSettings:{decimalPlaces: 2}, does not works because in new test set i just added
formatFunction: function(value){
return value;
},
this code doesn’t do anything returns as it is, so just want to confirm does any issue persist like such, or any workaround suggestion for I need to take careHi Shailaja,
The formatFunction indeed overrides the formatSettings. This is not an issue. If you want your formatFunction to return numbers with two decimal places, you would have to write a custom code that does it, e.g.:
formatFunction: function(value){return value.toFixed(2);},
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.