Home forums Using CanvasJS need to create chart where number of charts to be created is dynamic

This topic contains 3 replies, has 2 voices, and was last updated by  Priyanka M S 2 months, 2 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #22729

    desen17
    Member

    Hi,
    I have a situation where i have to create multiple charts dynamically.the number of charts r n and on document ready the data will be fetched from db in array or array format.and based on that data n number of charts will b created along with the div to contain the chart..
    Any help or any jsfiddle to help with that?

    #22736

    Priyanka M S
    Member

    @desen17,

    Please take a look at this jsfiddle which demonstrates the dynamic creation of chart containers and rendering chart within that. Also, refer to these examples on creating a dynamic chart and rendering a chart with data from database using PHP.
    __
    Priyanka M S
    Team CanvasJS

    #22737

    desen17
    Member

    Hi priyanka,
    Thanks for the help.now multiple charts r coming but one issue ,the datapoints r getting updated for each of the charts even if i explicitly want to update chart[i].I have tweaked the fiddle to replicate the issue..Please have a look into it.
    https://jsfiddle.net/u1h7vrcp/

    #22749

    Priyanka M S
    Member

    @desen17,

    In the jsfiddle you have shared, after creating 5 charts you are looping through each chart and adding dataPoints(‘i’ number of dataPoints) to them, this logic updates every chart and not just one as it’s in a loop. The jsfiddle shared seems to be working fine. If you are still facing any issue with this, please brief us further about it.

    __
    Priyanka M S
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.