majorUnit 1 with large number in valueAxis

11 posts, 0 answers
  1. DVS InteleStream
    DVS InteleStream avatar
    20 posts
    Member since:
    Oct 2009

    Posted 24 Jun Link to this post

    Hello,

    We'd like only show whole numbers in the valueAxis - see example: http://dojo.telerik.com/ElobA/16

    So, to solve this we added 'majorUnit: 1', which works fine.

    However, we don't always know the data we are going to receive, and sometimes the values can be quite large.

    If majorUnit is set to '1' with large values it will crash the browser.  See example (uncomment majorUnit for crash): http://dojo.telerik.com/ElobA/13.

    Is there a better recommended way of handling this?  Or is it possible to set a value that determines the 'minimumMajorUnit' that won't crash the chart with large values?

    Thanks for your help.

    --Jeff

  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 27 Jun Link to this post

    Hi Jeff,

    There is no minimumMajorUnit option available in Kendo UI Chart. What I would suggest as workaround is dynamically setting the majorUnit depending on the data: 
    var chart = $('#chartTest').data("kendoChart");
    chart.setOptions({
       valueAxis: {
          majorUnit: 1
       }
    })


    Regards,
    Iliana Nikolova
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
  4. DVS InteleStream
    DVS InteleStream avatar
    20 posts
    Member since:
    Oct 2009

    Posted 27 Jun in reply to Iliana Nikolova Link to this post

    Ok, thanks Iliana.

    Is there a way to clear out the majorUnit, so it reverts to default behavior?

    We can set it to 1, but then if the chart is updated with newer data we'd like not to have to calculate each time.

    Or, if we do have to calculate, is there a way to rely on kendo's formula?

    Thanks,

    Jeff

  5. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 29 Jun Link to this post

    Hi Jeff,

    Setting valueAxis majorUnit to null should help to achieve this: 
    chart.setOptions({valueAxis: { majorUnit: null}});


    Regards,
    Iliana Nikolova
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  6. DVS InteleStream
    DVS InteleStream avatar
    20 posts
    Member since:
    Oct 2009

    Posted 29 Jun in reply to Iliana Nikolova Link to this post

    Hi Iliana,

    I tried that, it seems to crash the browser when setting it to null, see example: http://dojo.telerik.com/ElobA/25.

    Click 'update major unit' to test.

    Thanks,

    Jeff

  7. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 01 Jul Link to this post

    Hi Jeff,

    Thank you for pointed our attention to this issue - it appears that if valueAxis.max is not explicitly set the majorUnit cannot be cleared via the setOptions method. I forwarded this case to the developers for further investigation and consideration.

    Meanwhile, the only solution which I could suggest is changing it via the chart.options and redrawing the chart (updated dojo). 

    Regards,
    Iliana Nikolova
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  8. DVS InteleStream
    DVS InteleStream avatar
    20 posts
    Member since:
    Oct 2009

    Posted 01 Jul in reply to Iliana Nikolova Link to this post

    Ok, however, this solution doesn't seem to work when we need to update the data, which is the only reason we'd want to change the majorUnit.

    See dojo - http://dojo.telerik.com/oFeki/3

    After the redraw if we want to update the data the majorUnit will go back to what it was set to originally.  Any thoughts?

    Thanks,

    Jeff

  9. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 05 Jul Link to this post

    Hi Jeff,

    You should change the majorUnit after updating the data - updated dojo.

    Regards,
    Iliana Nikolova
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  10. DVS InteleStream
    DVS InteleStream avatar
    20 posts
    Member since:
    Oct 2009

    Posted 05 Jul in reply to Iliana Nikolova Link to this post

    Updating the data first crashes the browser, which was the original issue.

    dojo: http://dojo.telerik.com/UNAqu.

  11. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 05 Jul Link to this post

    Hi Jeff,

    In this case you could try setting the new data via the dataSource data method (updated example).

    Regards,
    Iliana Nikolova
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  12. DVS InteleStream
    DVS InteleStream avatar
    20 posts
    Member since:
    Oct 2009

    Posted 05 Jul in reply to Iliana Nikolova Link to this post

    Ah, ok, that's helpful, thanks!  Will give this a shot.
Back to Top
Kendo UI is VS 2017 Ready