Issue with Charts with long numbers

2 posts, 0 answers
  1. Joy
    Joy avatar
    2 posts
    Member since:
    Apr 2014

    Posted 24 Mar 2016 Link to this post

    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.
  2. T. Tsonev
    T. Tsonev avatar
    2815 posts

    Posted 29 Mar 2016 Link to this post


    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.

    T. Tsonev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top