This is a migrated thread and some comments may be shown as answers.

Issue with Charts with long numbers

1 Answer 13 Views
Let's talk about telerik (the good and the bad)
This is a migrated thread and some comments may be shown as answers.
Joy
Top achievements
Rank 1
Joy asked on 24 Mar 2016, 06:27 PM
I wanted to make you aware of an issue that I have encountered in your Charts.
I am creating a simple line chart with data.

My data has a min value of -8735800
My data has a max value of 9.59129166666667e+36 

The logic in the initDefaults function creates a majorUnit from the large max number, and then 
in the floor method applies that to the min value, leaving the min value as 
2e+36 and the max value of either 1.1999999999999998e+37 or 1.0000000000000001e+37 
(depending on whether the roundToMajorUnit option is specified).  So far, this makes sense.

However, this causes an issue because later, when we get to the formatNumber function (if using the default format of #.##########, or any format with a similar structure, I imagine), it tries to call:
round(number, Math.abs(fraction[1]))
where number=2e+36 and fraction[1]=+36 (Math.abs(fraction[1])=36
which then errors out in the round function because the precision is 36 which is > 20 (javascript toFixed function is the culprit here).

This should not have been an issue since my values are all valid values and I even made sure that I 
didn't have any decimal places longer than 20 places.  Your logic should account for very large whole numbers.

I resolved this for my situation by specifying that the format for the labels was = null, but this should be
addressed in your code since using the default format #.########## with large numbers will break the series on the chart.

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 29 Mar 2016, 03:35 PM
Hello,

Thank you for your the heads-up. The default format is there to enable automatic localization according to the current culture.

At the time we didn't realize it will break a certain class of numbers. We'll consider our options here and try to figure out a way to fix it without breaking the existing functionality.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Let's talk about telerik (the good and the bad)
Asked by
Joy
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or