100% Stacked Line in React Chart component

17 Oct 202424 minutes to read

100% Stacked Line

To render a 100% stacked line 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 StackingLine100 in your chart configuration. This indicates that the data should be represented as a 100% stacked line chart, with each data series shown as a percentage of the total. This chart type ensures that all lines are stacked to always reach 100% at each data point, allowing for easy comparison of the proportional relationships between the series without the influence of absolute values.

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

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </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,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

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, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' width='2' type='StackingLine100' marker={{ visible: true }} dashArray='5,1'>
              </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,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' width='2' type='StackingLine100' marker= {{visible: true}} dashArray='5,1'>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

Series customization

The following properties can be used to customize the 100% stacked line 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, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} fill='blue'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} fill='yellow'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} fill='red'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} fill='grey'>
              </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,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} fill='blue'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} fill='yellow'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} fill='red'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} fill='grey'>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

The fill property can be used to apply a gradient color to the 100% stacked line 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, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient1)'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient2)'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient3)'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient4)'>
              </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,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient1)'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient2)'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient3)'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} fill='url(#gradient4)'>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

Opacity

The opacity property specifies the transparency level of the fill. Adjusting this property allows you to control how opaque or transparent the fill color of the series appears.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} 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 { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} opacity={0.5}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

Dash array

The dashArray property determines the pattern of dashes and gaps in the series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </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,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} dashArray='3'>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

Width

The width property specifies the stroke width applied to the series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} width={3}>
              </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,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };

  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }} width={3}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food',          y: 90,  y1: 40, y2: 70,  y3: 120 },
    { x: 'Transport',     y: 80,  y1: 90, y2: 110, y3: 70 },
    { x: 'Medical',       y: 50,  y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes',       y: 70,  y1: 30, y2: 60,  y3: 180 },
    { x: 'Personal Care', y: 30,  y1: 80, y2: 80,  y3: 30 },
    { x: 'Books',         y: 10,  y1: 40, y2: 30,  y3: 270 },
    { x: 'Fitness',       y: 100, y1: 30, y2: 70,  y3: 40 },
    { x: 'Electricity',   y: 55,  y1: 95, y2: 55,  y3: 75 },
    { x: 'Tax',           y: 20,  y1: 50, y2: 40,  y3: 65 },
    { x: 'Pet Care',      y: 40,  y1: 20, y2: 80,  y3: 95 },
    { x: 'Education',     y: 45,  y1: 15, y2: 45,  y3: 195 },
    { x: 'Entertainment', y: 75,  y1: 45, y2: 65,  y3: 115 }
];

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 define how empty or missing data points are handled in the series. The default mode for empty points is Gap.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    const emptyPoint = { mode: 'Average' };
    const emptyPoint1 = { mode: 'Gap' };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint1}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ 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 { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
  const emptyPoint: object = { mode: 'Average' };
  const emptyPoint1: object = { mode: 'Gap' };
  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint1}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: null, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: undefined, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: null, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: undefined, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];

Fill

Use the fill property to customize the fill color of empty points in the series.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    const emptyPoint = { mode: 'Average', fill: 'red' };
    const emptyPoint1 = { mode: 'Gap' };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint1}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ 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 { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
  const emptyPoint: object = { mode: 'Average', fill: 'red' };
  const emptyPoint1: object = { mode: 'Gap' };
  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint1}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: null, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: undefined, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: null, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: undefined, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];

Border

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

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    const emptyPoint = { mode: 'Average', fill: 'red', border: {width: 1.5, fill: 'green'} };
    const emptyPoint1 = { mode: 'Gap' };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint1}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ 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 { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, Selection}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
  const emptyPoint: object = { mode: 'Average', fill: 'red', border: {width: 1.5, fill: 'green'} };
  const emptyPoint1: object = { mode: 'Gap' };
  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }} emptyPointSettings={emptyPoint1}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: null, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: undefined, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: null, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: undefined, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];

Events

Series render

The seriesRender event allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    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';
        }
        else if (args.series.index === 3) {
            args.fill = '#1a9a6f';
        }
    };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month' seriesRender={seriesRender}>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ 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 { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, ISeriesRenderEventArgs}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
  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';
    }
    else if (args.series.index === 3) {
        args.fill = '#1a9a6f';
    }
}
  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'
          seriesRender={seriesRender}>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: 70, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: 55, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: 70, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: 55, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];

Point render

The pointRender event allows you to customize each data point before it is rendered on the chart.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, Legend, Category, Tooltip, DataLabel, StackingLineSeries } from '@syncfusion/ej2-react-charts';
import { chartData } from './datasource';
function App() {
    const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
    const pointRender = (args) => {
        if (args.point.y < 70) {
            args.fill = '#ff6347';
        }
        else {
            args.fill = '#009cb8';
        }
    };
    return <ChartComponent id='charts' primaryXAxis={{ interval: 1, valueType: 'Category' }} primaryYAxis={{ title: 'Expense', interval: 20 }} title='Family Expense for Month' pointRender={pointRender}>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]}/>
          <SeriesCollectionDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ 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 { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
         Legend, Category, Tooltip, DataLabel, Zoom, Crosshair, StackingLineSeries, IPointRenderEventArgs}
from'@syncfusion/ej2-react-charts';
import { chartData } from './datasource';

function App() {

  const marker = { visible: true, width: 10, height: 10, border: { width: 2, color: '#F8AB1D' } };
  const pointRender= (args: IPointRenderEventArgs) => {
    if (args.point.y < 70) {
        args.fill = '#ff6347';
    }
    else {
        args.fill = '#009cb8';
    }
}
  return <ChartComponent id='charts'
          primaryXAxis={{ interval: 1,  valueType: 'Category' }}
          primaryYAxis={{ title: 'Expense', interval: 20 }}
          title='Family Expense for Month'
          pointRender={pointRender}>
          <Inject services={[StackingLineSeries, Legend, Tooltip, DataLabel, Category]} />
          <SeriesCollectionDirective>
          <SeriesDirective dataSource={chartData} xName='x' yName='y' name='John' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y1' name='Peter' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y2' name='Steve' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              <SeriesDirective dataSource={chartData} xName='x' yName='y3' name='Charle' type='StackingLine100' marker={{ visible: true }}>
              </SeriesDirective>
              </SeriesCollectionDirective>
         </ChartComponent>

};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
export let chartData = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: 70, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: 55, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];
export let chartData: Object[] = [
    { x: 'Food', y: 90, y1: 40, y2: 70, y3: 120 },
    { x: 'Transport', y: 80, y1: 90, y2: 110, y3: 70 },
    { x: 'Medical', y: 50, y1: 80, y2: 120, y3: 50 },
    { x: 'Clothes', y: 70, y1: 30, y2: 60, y3: 180 },
    { x: 'Personal Care', y: 30, y1: 80, y2: 80, y3: 30 },
    { x: 'Books', y: 10, y1: 40, y2: 30, y3: 270 },
    { x: 'Fitness', y: 100, y1: 30, y2: 70, y3: 40 },
    { x: 'Electricity', y: 55, y1: 95, y2: 55, y3: 75 },
    { x: 'Tax', y: 20, y1: 50, y2: 40, y3: 65 },
    { x: 'Pet Care', y: 40, y1: 20, y2: 80, y3: 95 },
    { x: 'Education', y: 45, y1: 15, y2: 45, y3: 195 },
    { x: 'Entertainment', y: 75, y1: 45, y2: 65, y3: 115 }
];

See Also