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

Dynamically changing chart title

1 Answer 594 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Lisa
Top achievements
Rank 1
Lisa asked on 07 Aug 2013, 05:17 PM
Hi - we'd like to be able to set our chart titles to include fields returned from our database.  We are using JSON to get the data.

I'm not sure how to do that?  For example, in the below, I'd like to append a school name, say  "ABC Elementary" for example, to the start of the title, and have it change as our users change the school they are looking at.

Thanks
kcSchoolRiskInd = $("#SchoolRiskInd").kendoChart({
 
           title: {
               text: "School Risk Indicators",
               font: "bold 16px Arial,Helvetica,Sans-Serif"
           },

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 08 Aug 2013, 11:43 AM
Hi,

You can use the setOptions method to apply partial changes: 

var chart = $("#chart").data("kendoChart");
    chart.setOptions({
      title: {
        text: "Bar"
      }
    });
    
    chart.redraw();

Live demo


Calling redraw shouldn't be necessary, but it is in the current version. We'll fix this bug in our service releases.

Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Lisa
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or