title |
---|
Stacked bar chart |
A stacked bar chart provides a way of showing data values represented as vertical bars
See the Pen chart.xkcd stacked bar by timqian (@timqian) on CodePen.
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>new chartXkcd.StackedBar(svg, {
title: 'Issues and PR Submissions',
xLabel: 'Month',
yLabel: 'Count',
data: {
labels: ['Jan', 'Feb', 'Mar', 'April', 'May'],
datasets: [{
label: 'Issues',
data: [12, 19, 11, 29, 17],
}, {
label: 'PRs',
data: [3, 5, 2, 4, 1],
}, {
label: 'Merges',
data: [2, 3, 0, 1, 1],
}],
},
});
yTickCount
: customize tick numbers you want to see on the y axisdataColors
: array of colors for different datasetsfontFamily
: customize font family used in the chartunxkcdify
: disable xkcd effect (defaultfalse
)strokeColor
: stroke colors (defaultblack
)backgroundColor
: color for BG (defaultwhite
)showLegend
: display legend near chart (defaulttrue
)legendPosition
: specify where you want to place the legend (defaultchartXkcd.config.positionType.upLeft
) Possible values:- up left:
chartXkcd.config.positionType.upLeft
- up right:
chartXkcd.config.positionType.upLeft
- bottom left:
chartXkcd.config.positionType.downLeft
- bottom right:
chartXkcd.config.positionType.downRight
- up left: