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

How to change Chart Theme dynamically

2 Answers 598 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 22 Feb 2017, 09:35 PM

I am attempting to change the chart theme dynamically, but am having some trouble.

I am successfully able to change the Kendo.[theme].min.css sheet on a dropdownlist that dynamically changes the site's kendo widgets. However, this does not propagate to the charts inside the site, but instead sets the theme to "default". I have also tried to set the theme via JavaScript to no avail.

However, if i set the theme statically in the widget using the html helper, it obviously works and changes the theme.

Any ideas?

$("#chart").data("kendoChart").options.theme = localStorageItem;
//localStorageItem = "flat" for example.

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 24 Feb 2017, 07:05 AM
Hi,

You should use the setOptions method to change the theme - example.

Regards,
Daniel
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 visualization (charts) and form elements.
0
Chris
Top achievements
Rank 1
answered on 05 Apr 2017, 10:00 PM
Thank you very much Daniel. It works well!
Bill
Top achievements
Rank 1
commented on 02 Mar 2022, 05:16 PM

How about an example for .Net Core?

 

Mihaela
Telerik team
commented on 04 Mar 2022, 10:53 AM

Hi Bill,

Here you can review the same example implemented with Telerik UI for ASP.NET Core Chart:

https://netcorerepl.telerik.com/cwudaoba51lzX8fU03

If any questions arise, please let me know.

Tags
Chart
Asked by
Chris
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Chris
Top achievements
Rank 1
Share this question
or