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

majorUnit 1 with large number in valueAxis

10 Answers 252 Views
Charts
This is a migrated thread and some comments may be shown as answers.
DVS InteleStream
Top achievements
Rank 1
DVS InteleStream asked on 24 Jun 2016, 05:15 AM

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

10 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 27 Jun 2016, 03:22 PM
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.
 
0
DVS InteleStream
Top achievements
Rank 1
answered on 27 Jun 2016, 05:12 PM

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

0
Iliana Dyankova
Telerik team
answered on 29 Jun 2016, 12:15 PM
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.
 
0
DVS InteleStream
Top achievements
Rank 1
answered on 29 Jun 2016, 05:03 PM

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

0
Iliana Dyankova
Telerik team
answered on 01 Jul 2016, 01:08 PM
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.
 
0
DVS InteleStream
Top achievements
Rank 1
answered on 02 Jul 2016, 01:40 AM

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

0
Iliana Dyankova
Telerik team
answered on 05 Jul 2016, 06:53 AM
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.
 
0
DVS InteleStream
Top achievements
Rank 1
answered on 05 Jul 2016, 07:19 AM

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

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

0
Iliana Dyankova
Telerik team
answered on 05 Jul 2016, 01:19 PM
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.
 
0
DVS InteleStream
Top achievements
Rank 1
answered on 05 Jul 2016, 07:17 PM
Ah, ok, that's helpful, thanks!  Will give this a shot.
Tags
Charts
Asked by
DVS InteleStream
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
DVS InteleStream
Top achievements
Rank 1
Share this question
or