Change datasource of dynamically created chart

3 posts, 0 answers
  1. Ant
    Ant avatar
    18 posts
    Member since:
    Dec 2013

    Posted 07 Mar Link to this post

    Hi,
     
    How can I dynamically create multiple charts and then change their datasource independently? 
     
    Thanks
     
     
  2. Ant
    Ant avatar
    18 posts
    Member since:
    Dec 2013

    Posted 07 Mar Link to this post

    Here's a bit more information with an example of a dynamically generated chart:

     

      var div = $("<div/>");
      $(document.body).append(div);
      
      div.kendoChart({
        series: [ 
          { data: [1, 2] }
        ]
      });

    Here is a live demo showing that: http://jsbin.com/ixupix/1/editBut how would i go about changing it's datasource as it has now id selector? I could use var div = $("<div id="chart />"); But when i do var c = $("#chart").data("kendoChart") i get undefined.

  3. Kendo UI is VS 2017 Ready
  4. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 09 Mar Link to this post

    Hi Ant,

    You could use the setOptions method to change the chart series data. Take a look at this dojo which demonstrates a possible implementation.

    Regards,
    Iliana Nikolova
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top