Home Forums Chart Support Dynamically parse 2 separate JSON outputs for the same chart

Dynamically parse 2 separate JSON outputs for the same chart

Viewing 3 posts - 1 through 3 (of 3 total)
  • #36104

    I have a php file getjson.php that can generate 2 different json outputs from a SQL query based on the GET variables with a startDate and EndDate, for example:

    getjson.php – returns all values without date range in this format {“column1”: 123, “column2”: 456, “column3”: 789}

    getjson.php?startDate=YYYY-MM-DD&EndDate=YYYY-MM-DD – returns values in specific date range in the same format as the previous one

    The problem is when I try to load 2 chart variables that support 2 different dataPoints for the same chart and this cause a conflict of chart rendering

    Take a look at my JSFiddle: https://jsfiddle.net/cy6zxhnp/

    #36121

    SOLVED!

    I’ve solved it by cleaning the arrays before parsing JSON outputs inside the dropdown menu

    #36127

    @marco1987,

    You will have to create a separate chart container with a unique id for each chart. You can use the CSS display property to hide/unhide a chart based on the option selected from the dropdown menu.

    Please take a look at this JSFiddle for a working example.

    render chart using drop-down

    Thangaraj Raman
    Team CanvasJS

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

You must be logged in to reply to this topic.