Step area Chart in EJ2 TypeScript control
28 Sep 20235 minutes to read
Step Area
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>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
Series customization
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.
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: 'blue', xName: 'x', yName: 'y', border: { width:2, color: 'red'}
},
],
},
'#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>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>