Constructor
new StackedChart(options)
- Source:
Examples
browser usage:
const StackedChartExample = new OECDCharts.StackedChart({
container: '#StackedChartExample',
title: 'Stacked Bar Chart',
renderInfoButton: true,
data: [
{
values: [1,2,3,4,5],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#900c3f'],
stackLabels: ['I', 'II', 'III', 'IV', 'V']
},
{
values: [2,4,6,8,20],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#189aa8']
}
]
});
ES6 modules usage:
import { StackedChart } from 'oecd-simple-charts';
import 'oecd-simple-charts/build/oecd-simple-charts.css'
const stackedChart = new StackedChart({ chartOptions });
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | The options object for the stacked chart Properties
|
Methods
update(data)
- Source:
Example
StackedChartExample.update([
{
values: [1,10,3,4,5],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#900c3f'],
stackLabels: ['1', '2', '3', '4', '5']
},
{
values: [2,4,10,15,20],
barLabels: ['0%', '100%'],
colors: ['#fddd5d', '#189aa8']
}
]);
Parameters:
Name | Type | Description |
---|---|---|
data |
array | an array containing objects with the new data |