jQWidgets Forums
jQuery UI Widgets › Forums › Chart › valueAxis Label Bug
This topic contains 3 replies, has 2 voices, and was last updated by Martin 3 years, 10 months ago.
-
AuthorvalueAxis Label Bug Posts
-
Hi,
I have stumbled upon a bug for the labeling of the ValueAxis. I have created a chart in which the user can select a valueAxis and set the min and max values to zoom into the chart.
If the user selects a difference of 0.1 between the min and the max depending on the min and mx the labeling of valueAxis cuts of after the first decimal digit and so I have a chart with the lables: 0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.2 for example.
You can recreate this behaviour with your example javascript_chart_line_series.htm by configuring the valueAxis as follows:
valueAxis: { visible: true, title: { text: 'Daily Closing Price<br>' }, tickMarks: { color: '#BCBCBC' }, minValue: 0.10, maxValue: 0.20 },
So I just added minValue and maxValue. Now if you continue by adding 0.1 to minValue and maxValue you see the problem persists. 0.9 to 1.0 and 1.0 to 1.1 work correctly, 1.1 to 1.2 do not and after that the logic seems to work again (label has 3 decimal digits).
If you start with minValue 0.15 and maxValue 0.25 and go up, it seems to work perfectly, no missing decimal digits.
I thought you might be interested in this.
Best Regards
Klaus HHello Klaus H,
You can specify the decimal places in the format setting of the axis’ labels like this:
labels: { formatSettings: { decimalPlaces: 3 } }
Please, check this Example.
Best Regards,
Martin YotovjQWidgets Team
https://www.jqwidgets.com/Hello Martin,
thanks, I did not know that, but I do not want to specify a specific number for decimalPlaces, because when a user can manipulate the chart he can enter a range between 0 and 0.1 or 0 and 300. If I do that in your example the labels are 0.000, 50.000, 100.000 and so on.
For me the question is why does it work with line chart if I use 0.15 and 0.25 but not 0.1 and 0.2. There seems to be a problem. But I will keep that workaround in mind if my customer thinks this is a problem.
Best Regards
Klaus HHello Klaus H,
This happens because when you use 0.10 and 0.20 the numbers are rounded to the first decimal digit if no
decimalsPlaces
is set.
I would suggest that when you update the axis’ range you also update thedecimalPlaces
property of the labels’ formatSettings.Best Regards,
Martin YotovjQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.