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: