Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Button handy
blanktrue
color#0052CC
nameSend Feedback
linkhttps://docs.google.com/forms/d/e/1FAIpQLScmToBe3vynAlb5fdKwCGxYqnTbDc66sIBgeecG2BuFDuHc7g/viewform?entry.2002826954=Chart+from+JSON+-+15482164
widthauto

In order to generate a chart report from a JSON file you have to :

  1. Write the JSON file with the chart configuration.

    {
        "type""line",
        "data": {
            "datasets": [{
                "data": [205010075250],
                "label""Left dataset",
                "fill" true,
                "backgroundColor" "rgba(66, 182, 244, 0.2)",
                "borderColor" "#42b6f4",
                "yAxisID""left-y-axis"
            }, {
                "data": [0.10.51.02.01.50],
                "label""Right dataset",
                "fill" true,
                "backgroundColor" "rgba(244, 65, 86, 0.2)",
                "borderColor" "#f44156",
                "yAxisID""right-y-axis"
            }],
            "labels": ["Jan""Feb""Mar""Apr""May""Jun"]
        },
        "options": {
            "scales": {
                "yAxes": [{
                    "id""left-y-axis",
                    "type""linear",
                    "position""left"
                }, {
                    "id""right-y-axis",
                    "type""linear",
                    "position""right"
                }]
            }
        }
    }


  2. Write the SIL script which reads the JSON file.

    string json = readFromTextFile("multipleAxes.json");
    SILReportingChart chart = fromJson(json);
     
    return chart;


The generated report:

Image Added