AreaChart.js | |
AreaChart | A visualization that displays stacked area charts. |
Functions | |
loadJSON | Loads JSON data into the visualization. |
updateJSON | Use this method when updating values for the current JSON data. |
filter | Filter selected stacks, collapsing all other stacks. |
restore | Sets all stacks that could have been filtered visible. |
getLegend | Returns an object containing as keys the legend names and as values hex strings with color values. |
getMaxValue | Returns the maximum accumulated value for the stacks. |
A visualization that displays stacked area charts.
See Options.AreaChart.
Functions | |
loadJSON | Loads JSON data into the visualization. |
updateJSON | Use this method when updating values for the current JSON data. |
filter | Filter selected stacks, collapsing all other stacks. |
restore | Sets all stacks that could have been filtered visible. |
getLegend | Returns an object containing as keys the legend names and as values hex strings with color values. |
getMaxValue | Returns the maximum accumulated value for the stacks. |
loadJSON: function( json )
Loads JSON data into the visualization.
json | The JSON data format. This format is described in http://blog.thejit.org |
var areaChart = new $jit.AreaChart(options); areaChart.loadJSON(json);
updateJSON: function( json, onComplete )
Use this method when updating values for the current JSON data. If the items specified by the JSON data already exist in the graph then their values will be updated.
json | (object) JSON data to be updated. The JSON format corresponds to the one described in AreaChart.loadJSON. |
onComplete | (object) A callback object to be called when the animation transition when updating the data end. |
areaChart.updateJSON(json, { onComplete: function() { alert('update complete!'); } });
filter: function( filters, callback )
Filter selected stacks, collapsing all other stacks. You can filter multiple stacks at the same time.
filters | (array) An array of strings with the name of the stacks to be filtered. |
callback | (object) An object with an onComplete callback method. |
areaChart.filter(['label A', 'label C'], { onComplete: function() { console.log('done!'); } });
getMaxValue: function()
Returns the maximum accumulated value for the stacks. This method is used for normalizing the graph heights according to the canvas height.
var ans = areaChart.getMaxValue();
In some cases it could be useful to override this method to normalize heights for a group of AreaCharts, like when doing small multiples.
//will return 100 for all AreaChart instances, //displaying all of them with the same scale $jit.AreaChart.implement({ 'getMaxValue': function() { return 100; } });
Loads JSON data into the visualization.
loadJSON: function( json )
Use this method when updating values for the current JSON data.
updateJSON: function( json, onComplete )
Filter selected stacks, collapsing all other stacks.
filter: function( filters, callback )
Sets all stacks that could have been filtered visible.
restore: function( callback )
Returns an object containing as keys the legend names and as values hex strings with color values.
getLegend: function()
Returns the maximum accumulated value for the stacks.
getMaxValue: function()