Documentation

Replace chart data

In this section we are going to offer a couple of examples to illustrate how to replace data in an existing chart.

Notice that using a predefined template chart has its pros and cons: one may fully customize the chart format and display but one is limited to susbtitute pre-existing values, i.e you can not add new data or remove existing ones but just replace their numerical values. If you need more flexibility you should combine block type variables with chart content in extended HTML format.

Pie chart

For a pie chart with alt text "my_pie" and predefined categories under the name "First data", "Second data" and "Third data" we need the following JSON:

{
"charts": 
    [
        {
            "var": "my_pie",
            "data": 
                {
                    "First data": 10, 
                    "Second data": 20, 
                    "Third data": 10
                }
        }
    ]
}

DOWNLOAD: Template JSON Doc

replace pie chart data

Bar chart

For a bar chart with alt text "my_barchart" and predefined series "1990", "2000" and "2010" and categories under the name "First", "Second" and "Third" we need the following JSON:

{
"charts": 
    [
        {
            "var": "my_barchart",
            "data": 
                "series": ["1990", "2000", "2010"],
                "First": [10,20, 10], 
                "Second": [30,10, 30], 
                "Third": [12.5, 50, 5]
        }
    ]
}

DOWNLOAD: Template JSON Doc

replace bar chart data