Bar Chart - mwasiluk/ODC-d3 GitHub Wiki
Bar Chart extends [Chart With Color Groups](Chart With Color Groups).
#Demo Online demo
Sample usage
Bar Chart is created using an ODCD3.BarChart function:
var placeholderSelector = "#plot";
var data = [ ... ]; // array of arrays/objects
var config = { //optional config object
...
};
var plot = new ODCD3.BarChart(placeholderSelector, data, config);
#Configuration
The ODCD3.BarChart function takes 3 parameters:
- selector for plot placeholder element - d3.select compatible (string or node)
- data to plot (array of numbers; array of arrays / objects)
- optional config object
Configuration object properties (not inherited from [Chart With Color Groups](Chart With Color Groups)):
- x - X axis configuration object:
- title - axis title, default: ''
- key - object property name or array index with X axis value, default: 0
- scale - axis scale, default: 'ordinal'
- ticks - ticks number
- value - X value accessor function, may be used to override default accessor:
function (datum, key) { return Utils.isNumber(datum) ? datum : datum[key]; }
- y - Y axis configuration object:
- label - axis label, default: ''
- key - object property name or array index with Y axis value, default: 1
- scale - axis scale, default: 'linear'
- value - Y value accessor function, may be used to override default accessor:
function (datum, key) { return Utils.isNumber(datum) ? datum : datum[key]; }