HelpBot Assistant

How can I help you?

Stacked Step Area Chart in React Charts

3 Feb 202624 minutes to read

Stacked Step Area

To render a stacked step area series in your chart, you need to follow a few steps to configure it correctly. Here’s a concise guide on how to do this:

  1. Set the series type: Define the series type as StackingStepArea in your chart configuration. This indicates that the data should be represented as a stacked step area chart, which is a combination of a stacked area chart and a step area chart. It connects the data points with vertical and horizontal lines, creating a step like appearance.

  2. Inject the StackingStepAreaSeries module: Inject StackingStepAreaSeries module into the services. This step is essential, as it ensures that the necessary functionalities for rendering stacked step area series are available in your chart.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' >
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Binding data with series

You can bind data to the chart using the dataSource property within the series configuration. This allows you to connect a JSON dataset or remote data to your chart. To display the data correctly, map the fields from the data to the chart series xName and yName properties.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' >
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Series customization

The following properties can be used to customize the stacked step area series.

Fill

The fill property determines the color applied to the series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' fill="red">
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' fill="green">
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' fill='red'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' fill='green'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

The fill property can be used to apply a gradient color to the stacked step area series. By configuring this property with gradient values, you can create a visually appealing effect in which the color transitions smoothly from one shade to another.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' fill="url(#gradient1)">
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' fill="url(#gradient2)">
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' fill='url(#gradient1)'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' fill='url(#gradient2)'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Opacity

The opacity property controls the transparency of the fill and affects how the series blends with background or overlapping series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' opacity={0.5}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' opacity={0.5}>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' opacity={0.5}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' opacity={0.5}>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Border

Use the border property to configure the border width, color, and dasharray of the stacked step area series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis = {
    title: 'Years',
    edgeLabelPlacement: 'Shift',
    majorTickLines: { width: 0 }
  };
  const primaryyAxis = {
    title: 'Spend in Billions',
    minimum: 0,
    maximum: 4,
    interval: 1,
    labelFormat: '{value}B',
    majorTickLines: { width: 0 }
  };
  const border = { width: 2, color: '#ff4251', dashArray: '5,5' };
  const border1 = { width: 2, color: '#4C4C4C', dashArray: '5,5' };
  const border2 = { width: 2, color: '#794F1B', dashArray: '5,5' };

  return <ChartComponent id='charts'
    primaryXAxis={primaryxAxis}
    primaryYAxis={primaryyAxis}
    title='Trend in Sales of Ethical Produce'>
    <Inject services={[StackingStepAreaSeries, Legend]} />
    <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='Organic' type='StackingStepArea' border={border}>
      </SeriesDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='Fair-trade' type='StackingStepArea' border={border1}>
      </SeriesDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y2' name='Fair-trade' type='StackingStepArea' border={border2}>
      </SeriesDirective>
    </SeriesCollectionDirective>
  </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, AxisModel, BorderModel, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = {
    title: 'Years',
    edgeLabelPlacement: 'Shift',
    majorTickLines: { width: 0 }
  };
  const primaryyAxis: AxisModel = {
    title: 'Spend in Billions',
    minimum: 0,
    maximum: 4,
    interval: 1,
    labelFormat: '{value}B',
    majorTickLines: { width: 0 }
  };
  const border: BorderModel = { width: 2, color: '#ff4251', dashArray: '5,5' };
  const border1: BorderModel = { width: 2, color: '#4C4C4C', dashArray: '5,5' };
  const border2: BorderModel = { width: 2, color: '#794F1B', dashArray: '5,5' };

  return <ChartComponent id='charts'
    primaryXAxis={primaryxAxis}
    primaryYAxis={primaryyAxis}
    title='Trend in Sales of Ethical Produce'>
    <Inject services={[StackingStepAreaSeries, Legend]} />
    <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='Organic' type='StackingStepArea' border={border}>
      </SeriesDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='Fair-trade' type='StackingStepArea' border={border1}>
      </SeriesDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y2' name='Fair-trade' type='StackingStepArea' border={border2}>
      </SeriesDirective>
    </SeriesCollectionDirective>
  </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 2000, y: 0.61, y1: 0.03, y2: 0.48},
    { x: 2001, y: 0.81, y1: 0.05, y2: 0.53 },
    { x: 2002, y: 0.91, y1: 0.06, y2: 0.57 },
    { x: 2003, y: 1,    y1: 0.09, y2: 0.61 }, 
    { x: 2004, y: 1.19, y1: 0.14, y2: 0.63 },
    { x: 2005, y: 1.47, y1: 0.20, y2: 0.64 },
    { x: 2006, y: 1.74, y1: 0.29, y2: 0.66 }, 
    { x: 2007, y: 1.98, y1: 0.46, y2: 0.76 },
    { x: 2008, y: 1.99, y1: 0.64, y2: 0.77 },
    { x: 2009, y: 1.70, y1: 0.75, y2: 0.55 }
];
export let stepAreaData: Object[] = [
    { x: 2000, y: 0.61, y1: 0.03, y2: 0.48},
    { x: 2001, y: 0.81, y1: 0.05, y2: 0.53 },
    { x: 2002, y: 0.91, y1: 0.06, y2: 0.57 },
    { x: 2003, y: 1,    y1: 0.09, y2: 0.61 }, 
    { x: 2004, y: 1.19, y1: 0.14, y2: 0.63 },
    { x: 2005, y: 1.47, y1: 0.20, y2: 0.64 },
    { x: 2006, y: 1.74, y1: 0.29, y2: 0.66 }, 
    { x: 2007, y: 1.98, y1: 0.46, y2: 0.76 },
    { x: 2008, y: 1.99, y1: 0.64, y2: 0.77 },
    { x: 2009, y: 1.70, y1: 0.75, y2: 0.55 }
];

Step

Use the step property to change the position of the steps in a stacked step area series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const border = { width: 2, color: 'red'};
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' step='Center'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' step='Center'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const border: object = { width: 2, color: 'red'};
  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' step='Center'>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' step='Center'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

No risers

You can eliminate the vertical lines between points by using the ‘noRisers’property in a series. This approach is useful for highlighting trends without the distraction of risers.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { percentData } from "../datasource";

function App() {

  return <ChartComponent  id="charts"    primaryXAxis={{
    title: 'Years',
    edgeLabelPlacement: 'Shift',
    majorTickLines: { width: 0 }
}}  
primaryYAxis={
{
    title: 'Spend in Billions',
    minimum: 0,
    maximum: 4,
    interval: 1,
    labelFormat: '{value}B',
    majorTickLines: { width: 0 }
}}
 title = 'Annual Temperature Comparison' >
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective  dataSource = {percentData}   type='StackingStepArea' xName='x' yName='y' name='Organic' opacity= {0.1} border= {{width:1.5}} noRisers={true}>
        </SeriesDirective>
        <SeriesDirective  dataSource = {percentData}   type='StackingStepArea' xName='x' yName='y2' name='Others' opacity= {0.1} border= {{width:1.5}} noRisers={true}>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { percentData } from "../datasource";

function App() {

  return <ChartComponent  id="charts"    primaryXAxis={{
    title: 'Years',
    edgeLabelPlacement: 'Shift',
    majorTickLines: { width: 0 }
}}  
primaryYAxis={
{
    title: 'Spend in Billions',
    minimum: 0,
    maximum: 4,
    interval: 1,
    labelFormat: '{value}B',
    majorTickLines: { width: 0 }
}}
 title = 'Annual Temperature Comparison' >
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
        <SeriesDirective  dataSource = {percentData}   type='StackingStepArea' xName='x' yName='y' name='Organic' opacity= {0.1} border= {{width:1.5}} noRisers={true}>
        </SeriesDirective>
        <SeriesDirective  dataSource = {percentData}   type='StackingStepArea' xName='x' yName='y2' name='Others' opacity= {0.1} border= {{width:1.5}} noRisers={true}>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let percentData: Object[] = [
    { x: 2000, y: 0.61, y1: 0.03, y2: 0.48},
    { x: 2001, y: 0.81, y1: 0.05, y2: 0.53 },
    { x: 2002, y: 0.91, y1: 0.06, y2: 0.57 },
    { x: 2003, y: 1,    y1: 0.09, y2: 0.61 }, 
    { x: 2004, y: 1.19, y1: 0.14, y2: 0.63 },
    { x: 2005, y: 1.47, y1: 0.20, y2: 0.64 },
    { x: 2006, y: 1.74, y1: 0.29, y2: 0.66 }, 
    { x: 2007, y: 1.98, y1: 0.46, y2: 0.76 },
    { x: 2008, y: 1.99, y1: 0.64, y2: 0.77 },
    { x: 2009, y: 1.70, y1: 0.75, y2: 0.55 }
];

Empty points

Data points with null or undefined values are considered empty. Empty data points are ignored and not plotted on the chart.

Mode

Use the mode property to control handling of empty points. Available modes: Gap, Drop, Zero, Average. The default mode is Gap.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const emptyPoint = { mode: 'Gap' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' emptyPointSettings={emptyPoint}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const emptyPoint: object = { mode: 'Gap' };
  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' emptyPointSettings={emptyPoint}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: null,  y1: 14 },  { x: 10, y: null, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: null,  y1: 14 },  { x: 10, y: null, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Fill

Use the fill property to set the fill color for empty points.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const emptyPoint = { mode: 'Average', fill: 'red' };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker= emptyPointSettings={emptyPoint}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const emptyPoint: object = { mode: 'Average', fill: 'red' };
  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker= emptyPointSettings={emptyPoint}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: null,  y1: 14 },  { x: 10, y: null, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: null,  y1: 14 },  { x: 10, y: null, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Border

Use the border property to customize the border width and color for empty points.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const emptyPoint = { mode: 'Average', fill: 'red', border: {width: 1.5, fill: 'green'} };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker= emptyPointSettings={emptyPoint}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const emptyPoint: object = { mode: 'Average', fill: 'red', border: {width: 1.5, fill: 'green'} };
  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker= emptyPointSettings={emptyPoint}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: null,  y1: 14 },  { x: 10, y: null, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: null,  y1: 14 },  { x: 10, y: null, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Stack labels

The stack labels in stacked charts display cumulative total values for stack segments directly using data labels. If a stacked point has negative values, the stack labels are displayed below the point.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries, DataLabel } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    return <ChartComponent id='charts'
    primaryXAxis={primaryxAxis}
    primaryYAxis={primaryyAxis}
    title='Annual Temperature Comparison'
    stackLabels={{ visible: true }}
    >
    <Inject services={[StackingStepAreaSeries, Legend, DataLabel]} />
    <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker={{ dataLabel: { visible: true } }}>
      </SeriesDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' marker={{ dataLabel: { visible: true } }}>
      </SeriesDirective>
    </SeriesCollectionDirective>
  </ChartComponent>
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries, DataLabel}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'
    stackLabels={{ visible: true }}
      >
      <Inject services={[StackingStepAreaSeries, Legend, DataLabel]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker={{ dataLabel: { visible: true } }}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' marker={{ dataLabel: { visible: true } }}>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Stack labels customization

Stack labels have various properties for customization to enhance the visual based on your requirements:

  • visible - Specifies whether stack labels are visible. Setting to true will display the labels. Default is false.
  • fill - Defines the background color of the stack labels. Accepts valid CSS color strings (hex, RGBA, etc.). Default is transparent.
  • format - Formats the text displayed in the stack labels. Supports placeholders like {value}. Default is null.
  • angle - Specifies the rotation angle for stack labels in degrees. Default is 0.
  • rx - Defines the rounded corner radius along the X-axis (horizontal direction) for the stack label background. Default is 5.
  • ry - Defines the rounded corner radius along the Y-axis (vertical direction) for the stack label background. Default is 5.
  • margin - Configures the margin around the stack label (left, right, top, and bottom).
  • border - Configures the appearance of the stack label’s border.
  • font - Customizes the stack label text, including font size, color, style, weight, and family.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries, DataLabel } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const stackLabels = { visible: true, fill: 'rgba(0, 123, 255, 0.5)', format: '{value}', angle: 45, rx: 10, ry: 10, margin: { left: 10, right: 10, top: 10, bottom: 10 }, border: { width: 2, color: '#000' }, font: { size: '14px', color: '#fff', weight: 'bold', family: 'Arial', textAlignment: 'Left' } };
    const marker = { dataLabel: { visible: true } };
    return <ChartComponent id='charts'
    primaryXAxis={primaryxAxis}
    primaryYAxis={primaryyAxis}
    title='Annual Temperature Comparison'
    stackLabels={stackLabels}
    >
    <Inject services={[StackingStepAreaSeries, Legend, DataLabel]} />
    <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker={marker}>
      </SeriesDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' marker={marker}>
      </SeriesDirective>
    </SeriesCollectionDirective>
  </ChartComponent>
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, DataLabel
         Legend, StackingStepAreaSeries}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const stackLabels: Object = { visible: true, fill: 'rgba(0, 123, 255, 0.5)', format: '{value}', angle: 45, rx: 10, ry: 10, margin: { left: 10, right: 10, top: 10, bottom: 10 }, border: { width: 2, color: '#000' }, font: { size: '14px', color: '#fff', weight: 'bold', family: 'Arial', textAlignment: 'Left' } };
  const marker: Object = { dataLabel: { visible: true } };

  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'
      stackLabels={stackLabels}
      >
      <Inject services={[StackingStepAreaSeries, Legend, DataLabel]} />
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker={marker}>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea' marker={marker}>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Events

Series render

The seriesRender event enables modification of series properties (for example, data, fill, or name) immediately before rendering. Use this event to adjust series appearance or to dynamically swap data sources.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const seriesRender = (args) => {
      if (args.series.index === 0) {
          args.fill = '#ff4251';
      }
      else if (args.series.index === 1) {
          args.fill = '#4C4C4C';
      }
      else if (args.series.index === 2) {
          args.fill = '#794F1B';
      }
  };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison' seriesRender={seriesRender}>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker=>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries, ISeriesRenderEventArgs}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const seriesRender = (args: ISeriesRenderEventArgs) => {
    if (args.series.index === 0) {
        args.fill = '#ff4251';
    }
    else if (args.series.index === 1) {
        args.fill = '#4C4C4C';
    }
    else if (args.series.index === 2) {
        args.fill = '#794F1B';
    }
};
  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'
      seriesRender={seriesRender}>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker=>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

Point render

The pointRender event provides a hook to customize each data point (for example, marker shape, border, or fill) before it is drawn. Use this to apply per-point styling rules or conditional formatting.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, StackingStepAreaSeries } from '@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';
function App() {
    const primaryxAxis = { valueType: 'Double', title: 'Overs' };
    const primaryyAxis = { title: 'Runs' };
    const pointRender = (args) => {
      if (args.point.index % 2 !== 0) {
        args.fill = '#ff6347';
    }
    else {
        args.fill = '#009cb8';
    }
  };
    return <ChartComponent id='charts' primaryXAxis={primaryxAxis} primaryYAxis={primaryyAxis} title='Annual Temperature Comparison' pointRender={pointRender}>
      <Inject services={[StackingStepAreaSeries, Legend]}/>
      <SeriesCollectionDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker=>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { AxisModel, ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, StackingStepAreaSeries, IPointRenderEventArgs}
from'@syncfusion/ej2-react-charts';
import { stepAreaData } from './datasource';

function App() {
  const primaryxAxis: AxisModel = { valueType: 'Double', title: 'Overs' };
  const primaryyAxis: AxisModel = { title: 'Runs' };
  const pointRender = (args: IPointRenderEventArgs) => {
    if (args.point.index % 2 !== 0) {
      args.fill = '#ff6347';
  }
  else {
      args.fill = '#009cb8';
  }
};
  return <ChartComponent id='charts'
      primaryXAxis={primaryxAxis}
      primaryYAxis={primaryyAxis}
      title='Annual Temperature Comparison'
      pointRender={pointRender}>
      <Inject services={[StackingStepAreaSeries, Legend]} />
      <SeriesCollectionDirective>
      <SeriesDirective dataSource={stepAreaData} xName='x' yName='y' name='England' type='StackingStepArea' marker=>
        </SeriesDirective>
        <SeriesDirective dataSource={stepAreaData} xName='x' yName='y1' name='India' type='StackingStepArea'>
        </SeriesDirective>
      </SeriesCollectionDirective>
    </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let stepAreaData = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];
export let stepAreaData: Object[] = [
    { x: 1,  y: 7,   y1: 10 },  { x: 2,  y: 1,  y1: 5 }, 
    { x: 3,  y: 1,   y1: 7 },   { x: 4,  y: 14, y1: 12 }, 
    { x: 5,  y: 1,   y1: 4 },   { x: 6,  y: 10, y1: 15 },
    { x: 7,  y: 8,   y1: 12 },  { x: 8,  y: 6,  y1: 10 }, 
    { x: 9,  y: 10,  y1: 14 },  { x: 10, y: 10, y1: 15 }, 
    { x: 11, y: 16,  y1: 18 },  { x: 12, y: 6,  y1: 10 },
    { x: 13, y: 14,  y1: 18 },  { x: 14, y: 7,  y1: 11 }, 
    { x: 15, y: 5,   y1: 9 },   { x: 16, y: 2,  y1: 5 }, 
    { x: 17, y: 14,  y1: 18 },  { x: 18, y: 7,  y1: 11 },
    { x: 19, y: 7,   y1: 10 },  { x: 20, y: 10, y1: 14 }
];

See also