Home forums Chart Support Parse json with Index

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27692

    Hi,

    how to parse json with parent index element and multi series. Every “temp*” should render a single chart, so i need to assign the parents index separate data series.

    {
    “Temp1”: [
    {
    “time”: 1576144810,
    “value”: 159
    },
    {
    “time”: 1576144810,
    “value”: 194
    },
    {
    “time”: 1576144810,
    “value”: 169
    },
    {
    “time”: 1576144810,
    “value”: 182
    },
    {
    “time”: 1576144810,
    “value”: 198
    },
    {
    “time”: 1576144810,
    “value”: 156
    }
    ],
    “Temp2”: [
    {
    “time”: 1576144810,
    “value”: 168
    },
    {
    “time”: 1576144810,
    “value”: 170
    },
    {
    “time”: 1576144810,
    “value”: 162
    },
    {
    “time”: 1576144810,
    “value”: 184
    },
    {
    “time”: 1576144810,
    “value”: 175
    },
    {
    “time”: 1576144810,
    “value”: 167
    }
    ],
    “Temp3”: [
    {
    “time”: 1576144810,
    “value”: 171
    },
    {
    “time”: 1576144810,
    “value”: 162
    },
    {
    “time”: 1576144810,
    “value”: 154
    },
    {
    “time”: 1576144810,
    “value”: 189
    },
    {
    “time”: 1576144810,
    “value”: 166
    },
    {
    “time”: 1576144810,
    “value”: 183
    }
    ]
    }

    #27754

    @mwick,

    Looping through the JSON and parsing it to the format accepted by CanvasJS before passing to the chart options should work fine in your case. Please take a look at this JSFiddle.

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.