| BarChart.js | |
| BarChart | A visualization that displays stacked bar charts. |
| Functions | |
| loadJSON | Loads JSON data into the visualization. |
| updateJSON | Use this method when updating values for the current JSON data. |
| 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 bar charts.
See Options.BarChart.
| Functions | |
| loadJSON | Loads JSON data into the visualization. |
| updateJSON | Use this method when updating values for the current JSON data. |
| 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 barChart = new $jit.BarChart(options); barChart.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 BarChart.loadJSON. |
| onComplete | (object) A callback object to be called when the animation transition when updating the data end. |
barChart.updateJSON(json, {
onComplete: function() {
alert('update complete!');
}
});
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 = barChart.getMaxValue();
In some cases it could be useful to override this method to normalize heights for a group of BarCharts, like when doing small multiples.
//will return 100 for all BarChart instances,
//displaying all of them with the same scale
$jit.BarChart.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 )
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()