To render a step area series, use series type
as StepArea
and inject StepAreaSeries
module using Chart.Inject(StepAreaSeries)
method.
import { Chart, StepAreaSeries } from '@syncfusion/ej2-charts';
import { numData } from './datasource.ts';
Chart.Inject(StepAreaSeries);
let chart: Chart = new Chart({
series:[{
dataSource: numData,
xName: 'x', yName: 'y',
type: 'StepArea'
}],
}, '#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 step area
series.
fill
– Specifies the color of the area series.opacity
– Specifies the opacity of fill
.dashArray
– Specifies the dashes of series.width
– Specifies the width for series.import {
Chart, DateTime, StepAreaSeries,
} from '@syncfusion/ej2-charts';
Chart.Inject(StepAreaSeries, DateTime);
let chart: Chart = new Chart(
{
series: [
{
type: 'StepArea',
dataSource: [
{ x: 2000, y: 416 }, { x: 2001, y: 490 }, { x: 2002, y: 470 },
{ x: 2003, y: 500 }, { x: 2004, y: 449 }, { x: 2005, y: 470 },
{ x: 2006, y: 437 }, { x: 2007, y: 458 }, { x: 2008, y: 500 },
{ x: 2009, y: 473 }, { x: 2010, y: 520 }, { x: 2011, y: 520 }
],
fill: 'green', xName: 'x', yName: 'y', border: { width:2, color: 'red'}, dashArray: '3',
marker: { visible: true }, opacity: 0.5
},
],
},
'#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>