Given JSON’s origin as a data exchange format for the web, many libraries expect to receive input in this format. The Google
Chart library is such an example. The following example is from the Google Chart project web site. Notice that the var data is populated with JSON data. Replacing hard-coded data with the output from a suitably-configured JSON schema in your station
draws a chart from the
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart
(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px height: 500px"></div>
</body>
</html>chart.vm and paste into it the code example of a sample chart from the json-consuming-charting library of your choice.$schema.output,var data = google.visualization.arrayToDataTable([
$schema.output
])Template File property to point to the chart.vm file you created earlier.ContextOrdElement named Schema to the VelocityContext of your VelocityDocument.SeriesTransform Rollup function.
If you add a WebBrowser from the workbench palette to a Px Page and set the ord property to http:\\127.0.0.1\velocity\chart, you should see a chart when you view the page in a web browser. If not, use the developer tools to view the source code
and ensure that the output of your schema is replacing the $schema.output variable.