Dynamically changing chart title

2 posts, 0 answers
  1. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 07 Aug 2013 Link to this post

    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"
               },
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 08 Aug 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top