To render a 100% stacked bar series, use series type
as
StackingBar100
and inject StackingBarSeries
module using Chart.Inject(StackingBarSeries)
method.
import { Chart, StackingBarSeries, Category } from '@syncfusion/ej2-charts';
import { stackedData } from './datasource.ts';
Chart.Inject(StackingBarSeries, Category);
let chart: Chart = new Chart({
series: [
{
//Series type as 100% stacked bar
type: 'StackingBar100',
dataSource: stackedData, xName: 'x', yName: 'y'
}, {
type: 'StackingBar100',
dataSource: stackedData, xName: 'x', yName: 'y1'
}, {
type: 'StackingBar100',
dataSource: stackedData, xName: 'x', yName: 'y2'
}
],
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
The following properties can be used to customize the 100% stacked column
series.
fill
– Specifies the color of the series.opacity
– Specifies the opacity of fill
.dashArray
– Specifies the dashes of series.border
– Specifies the color
and width
of series border.import { Chart, StackingBarSeries, Category } from '@syncfusion/ej2-charts';
import { stackedData } from './datasource.ts';
Chart.Inject(StackingBarSeries, Category);
let chart: Chart = new Chart({
series: [
{
//Series type as 100% stacked bar
type: 'StackingBar100',border: { width: 1.5, color: 'red'},
dataSource: stackedData, xName: 'x', yName: 'y', dashArray: '2.2'
}, {
type: 'StackingBar100',border: { width: 1.5, color: 'red'},
dataSource: stackedData, xName: 'x', yName: 'y1', dashArray: '2.2'
}, {
type: 'StackingBar100',border: { width: 1.5, color: 'red'},
dataSource: stackedData, xName: 'x', yName: 'y2', dashArray: '2.2'
}
],
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>