public class JSONHistoricalReporter extends Object
| Constructor and Description |
|---|
JSONHistoricalReporter(File basePath) |
| Modifier and Type | Method and Description |
|---|---|
void |
generateHistoricalJSON(clover.org.apache.velocity.VelocityContext context,
Map<Long,HasMetrics> data,
String title)
Generates historical JSON data using a subset of the
Google Visualisation DataSource response format.
|
public JSONHistoricalReporter(File basePath)
public void generateHistoricalJSON(clover.org.apache.velocity.VelocityContext context,
Map<Long,HasMetrics> data,
String title)
throws Exception
table: {
cols: [{id: 'timestamp', label: 'Date', type: 'date'}, ...],
rows: [{c:[{v: new Date(0), f: '1 January 1970 00:00'}, ...]}]
}
This data may be used directly with the
google.visualization javascript Library.
ie - the above JSON object
may be passed directly to a google.visualization.DataTable
constructor like so:
new google.visualization.DataTable(json.table[0], 0.5);
e.g.
var data = new google.visualization.DataTable(json.table[0], 0.5);
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, {width: 800, height: 400, legend: 'bottom', title: 'Clover Historical Chart'});
context - the velocity context to use when renderingdata - the map of historical data pointsException - if an error occurs while writing the JSONCopyright © 2024 OpenClover.org. All rights reserved.