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

Dynamic Chart labels

3 Answers 137 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 21 Dec 2017, 11:54 PM

I am trying to migrate from HighCharts. One thing it does it auto select the proper amount of labels for the space. See attached. Is there a dynamic way to do something similar. I really like how it breaks date and then time. Where are using heavy one minute data and need to be able to dynamically create the labels.

I see the skip and I see the steps but I really need to be able to have it dynamic.

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 26 Dec 2017, 11:59 AM
Hello, Matt,

Thank you for the screenshots.

The Kendo UI Chart will dynamically set the labels when the baseUnit is set to fit:

https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-categoryAxis.baseUnit

Still in some cases setting a more specific baseUnit will create better results than the automatic fitting. In that scenarios we can recommend based on custom logic over the data to programmatically set the best baseUnit dynamically using the setOptions method of the Chart:

https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#methods-setOptions

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Matt
Top achievements
Rank 1
answered on 28 Dec 2017, 04:06 PM
When I use the Auto it would be super helpful to split the days. Right now it just shows different times. But its kinda hard to see where the days change. 
0
Konstantin Dikov
Telerik team
answered on 01 Jan 2018, 08:31 AM
Hello Matt,

You can use the majorGridLines to set a custom step for the categoryAxis. For example, if you the baseUnit is hours, you can set the step of the majorGridLines to "24", which will mark each day:
categoryAxis: {
    baseUnit: "hours",
    majorGridLines: {
      width: 1,
      step: 24,
        color: "green"
     }
},

For different base unit you can set different step for the majorGridLines.


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