PieChart.js

Summary
PieChart.js
PieChartA visualization that displays stacked bar charts.
Functions
loadJSONLoads JSON data into the visualization.
updateJSONUse this method when updating values for the current JSON data.
getLegendReturns an object containing as keys the legend names and as values hex strings with color values.
getMaxValueReturns the maximum accumulated value for the stacks.

PieChart

A visualization that displays stacked bar charts.

Constructor Options

See Options.PieChart.

Summary
Functions
loadJSONLoads JSON data into the visualization.
updateJSONUse this method when updating values for the current JSON data.
getLegendReturns an object containing as keys the legend names and as values hex strings with color values.
getMaxValueReturns the maximum accumulated value for the stacks.

Functions

loadJSON

loadJSON: function(json)

Loads JSON data into the visualization.

Parameters

jsonThe JSON data format.  This format is described in http://blog.thejit.org/2010/04/24/new-javascript-infovis-toolkit-visualizations/#json-data-format.

Example

var pieChart = new $jit.PieChart(options);
pieChart.loadJSON(json);

updateJSON

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.

Parameters

json(object) JSON data to be updated.  The JSON format corresponds to the one described in PieChart.loadJSON.
onComplete(object) A callback object to be called when the animation transition when updating the data end.

Example

pieChart.updateJSON(json, {
  onComplete: function() {
    alert('update complete!');
  }
});

getLegend

getLegend: function()

Returns an object containing as keys the legend names and as values hex strings with color values.

Example

var legend = pieChart.getLegend();

getMaxValue

getMaxValue: function()

Returns the maximum accumulated value for the stacks.  This method is used for normalizing the graph heights according to the canvas height.

Example

var ans = pieChart.getMaxValue();

In some cases it could be useful to override this method to normalize heights for a group of PieCharts, like when doing small multiples.

Example

//will return 100 for all PieChart instances,
//displaying all of them with the same scale
$jit.PieChart.implement({
  'getMaxValue': function() {
    return 100;
  }
});
loadJSON: function(json)
Loads JSON data into the visualization.
updateJSON: function(json,
onComplete)
Use this method when updating values for the current JSON data.
getLegend: function()
Returns an object containing as keys the legend names and as values hex strings with color values.
getMaxValue: function()
Returns the maximum accumulated value for the stacks.
PieChart options.
Close