Chart from JSON
In order to generate a chart report from a JSON file you have to :
Write the JSON file with the chart configuration.
{
   Â
"type"
:Â
"line"
,
   Â
"data"
: {
       Â
"datasets"
: [{
           Â
"data"
: [
20
,Â
50
,Â
100
,Â
75
,Â
25
,Â
0
],
           Â
"label"
:Â
"Left dataset"
,
           Â
"fill"
Â:Â
true
,
           Â
"backgroundColor"
Â:Â
"rgba(66, 182, 244, 0.2)"
,
           Â
"borderColor"
Â:Â
"#42b6f4"
,
           Â
"yAxisID"
:Â
"left-y-axis"
       Â
}, {
           Â
"data"
: [
0.1
,Â
0.5
,Â
1.0
,Â
2.0
,Â
1.5
,Â
0
],
           Â
"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"
           Â
}]
       Â
}
   Â
}
}
Write the SIL script which reads the JSON file.
string json = readFromTextFile(
"multipleAxes.json"
);
SILReportingChart chart = fromJson(json);
Âreturn
Âchart;
The generated report: