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

Chart scaling and manual calculation for max

1 Answer 615 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Andrii
Top achievements
Rank 1
Andrii asked on 26 Apr 2017, 06:41 AM
Hi,

Take a look at this example:
http://dojo.telerik.com/uFEsi/3

It looks good, but if uncomment "min: 0" so scaling will change and the chart will become unobvious.

I have a few questions:

1) How to dynamically calculate max and set max + 10% in this case?
2) How to dynamically calculate max for stacked chart? 
3) How to always show the label on Y axis with max value for a chart?

I think about using event for 1 and 2 and about using majorUnit for 3, but maybe I'm wrong.

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 27 Apr 2017, 01:49 PM
Hello ,

Indeed the first two can be achieved using the render event of the Chart, to retrieve the current min and max by looping the data items and then set the new min and max and redraw the Chart:

http://dojo.telerik.com/uFEsi/11

http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#events-render

As for the third question, it can be achieved with majorUnits, but the majorUnit have to be equal to the smallest difference in the numbers which in this case is 0.01 but this will create thousands of units based on the min and max and can make the page unresponsible.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Charts
Asked by
Andrii
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or