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

Change labels after or during render

1 Answer 20 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Andrew asked on 26 Apr 2021, 11:33 PM



I have a similar post here where we discuss the problem but the crux of the matter is that we want to be able to change the labels on a stacked bar chart after the render process.  Does anyone know if this is possible?

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 29 Apr 2021, 07:10 PM

Hello Andrew,

There are a few label configurations in regards to the Kendo UI Stacked Bar Chart, so I have created a Progress Kendo UI Dojo where when the user presses a button, the labels will change using their templates in the legend, categoryAxis, valueAxis, and series.  

      click: function(e){

        //Reference the Kendo UI Chart
        var chart = $("#chart").data("kendoChart");

        //Change Legend labels
        chart.options.legend.labels.template = "Legend: #: text #";

        //Change ValueAxis Labels
        chart.options.valueAxis.labels.template = "ValueAxis: #: value #";

        //Change CategoryAxis Labels
        chart.options.categoryAxis.labels.template = "CategoryAxis: #: value #";

        //Change series.labels values in stack
        chart.options.seriesDefaults.labels.template = "Series: #: value #";

        //Repaints chart with newly loaded data

There are other options for changing the labels like color, background, and border.  For example, the seriesDefaults.labels has a number of related properties which can be modified. 

I hope this information helps!  Please let me know if you have any questions regarding the label changes.

Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place:

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question