Pareto Chart in TypeScript Charts
Pareto
The Pareto series visualizes the 80/20 principle by sorting categories in descending order by value and overlaying a cumulative percentage line. Use it to identify the few categories that contribute the majority of an effect (defects, complaints, costs, and so on).
To render a Pareto series in your chart, configure the series as follows:
-
Set the series type: Define the series
typeasPareto. Renders the data as a Pareto chart, which uses a combination of column and line series. -
Inject the necessary modules: Use the
Chart.Inject(ParetoSeries, ColumnSeries, LineSeries)method to inject theParetoSeries,ColumnSeries,LineSeriesmodules into your chart. This step is essential, as it ensures that the necessary functionalities for rendering pareto series are available in your chart.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
width: 2
}
}
],
//Initializing Chart title
title: 'Pareto chart - Defects in Shirts',
legendSettings: { visible: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Coller Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];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 { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
width: 2
}
}
],
//Initializing Chart title
title: 'Pareto chart - Defects in Shirts',
legendSettings: { visible: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Coller Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Pareto customization
The following properties can be used to customize the Pareto series.
Fill
Use the fill property to apply a color to the Pareto line. By default, a color based on the active theme is used.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
fill: '#F7523F'
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 }
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Width
Use the width property to control the thickness of the line for the pareto series, which affects its visual weight on the chart.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
fill: '#F7523F',
width: 2
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 }
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Dash array
The dashArray property determines the pattern of dashes and gaps in the Pareto line series.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
fill: '#F7523F',
width: 2,
dashArray: '3,3'
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 }
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Marker
Use the marker property to display and customize markers for individual points in a pareto line.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 }
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Show axis
Use the showAxis property to show or hide the secondary axis for the pareto series.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2,
showAxis: false
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 }
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Empty points
Data points with null or undefined values are considered empty. Empty data points are handled according to the configured mode.
Mode
Use the mode property to control how empty points are rendered. Available modes are Gap, Drop, Zero, and Average. The default mode is Gap.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 },
emptyPointSettings: {
mode: 'Average'
}
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: null },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 },
{ x: 'Stitching Defect', y: null },
{ x: 'Zipper Defect', y: 3 },
{ x: 'Fabric Defect', y: 9 }
];Fill
Use the fill property to set the fill color for empty points.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 },
emptyPointSettings: {
mode: 'Average',
fill: 'red'
}
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: null },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 },
{ x: 'Stitching Defect', y: null },
{ x: 'Zipper Defect', y: 3 },
{ x: 'Fabric Defect', y: 9 }
];Border
Use the border property to customize the border width and color for empty points.
import { Chart, ColumnSeries, Legend, Tooltip } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries, Highlight } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
import { Browser } from '@syncfusion/ej2-base';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip, Highlight);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2, opacity: 0.75, columnWidth: 0.4,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2
},
cornerRadius: { topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6 },
emptyPointSettings: {
mode: 'Average',
fill: 'red',
border: { width: 2, color: 'green' }
}
}
],
//Initializing Chart title
title: 'Defects in Shirts',
legendSettings: { visible: true, enableHighlight: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true,
format: '${series.name} : <b>${point.y}</b>'
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Collar Defect', y: null },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 },
{ x: 'Stitching Defect', y: null },
{ x: 'Zipper Defect', y: 3 },
{ x: 'Fabric Defect', y: 9 }
];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 { Chart, ColumnSeries, Legend, Tooltip, ISeriesRenderEventArgs } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
width: 2
}
}
],
//Initializing Chart title
title: 'Pareto chart - Defects in Shirts',
legendSettings: { visible: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true
},
seriesRender: (args: ISeriesRenderEventArgs) => {
args.fill = 'green';
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Coller Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];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 { Chart, ColumnSeries, Legend, Tooltip, IPointRenderEventArgs } from '@syncfusion/ej2-charts';
import { ParetoSeries, Category, LineSeries } from '@syncfusion/ej2-charts';
import { paretoData } from './datasource.ts';
Chart.Inject(ColumnSeries, Category, ParetoSeries, LineSeries, Legend, Tooltip);
/**
* Sample for Pareto chart
*/
let chart: Chart = new Chart({
//Initializing Primary X Axis
primaryXAxis: {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 }, labelIntersectAction: 'Rotate45'
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Frequency of Occurence',
minimum: 0,
maximum: 25,
interval: 5,
lineStyle: { width: 0 },
majorTickLines: { width: 0 }, majorGridLines: { width: 1 },
minorGridLines: { width: 1 }, minorTickLines: { width: 0 }
},
chartArea: {
border: {
width: 0
}
},
//Initializing Chart Series
series: [
{
type: 'Pareto',
dataSource: paretoData,
xName: 'x', yName: 'y', name: 'Defect', width: 2,
paretoOptions: {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
width: 2
}
}
],
//Initializing Chart title
title: 'Pareto chart - Defects in Shirts',
legendSettings: { visible: true },
//Initializing User Interaction
tooltip: {
enable: true,
shared: true
},
pointRender: (args: IPointRenderEventArgs) => {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
}
});
chart.appendTo('#element');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>export let paretoData: Object[] = [
{ x: 'Button Defect', y: 23 },
{ x: 'Pocket Defect', y: 16 },
{ x: 'Coller Defect', y: 10 },
{ x: 'Cuff Defect', y: 7 },
{ x: 'Sleeve Defect', y: 6 },
{ x: 'Other Defect', y: 2 }
];Troubleshooting
The following list describes common issues you may encounter when working with the Pareto series and how to resolve them.
Chart does not render the line or column series: Confirm the type property of the series is set to Pareto. In JavaScript, the ParetoSeries, ColumnSeries, LineSeries, and Category modules are loaded through the script bundle; no explicit Chart.Inject(...) call is required.
Pareto line color does not change: Confirm the fill property is set on the paretoOptions configuration object (not on the series root). The line color is controlled independently of the column color.
Secondary axis does not appear or is hidden unexpectedly: Confirm the showAxis property on paretoOptions is set to true (or false to hide). The secondary axis is required to display the cumulative percentage scale.
Events fire but changes are not visible: The seriesRender and pointRender events let you modify the rendered series or point. Mutate the args object (for example, args.fill) inside the handler; setting properties on the series object directly is overwritten during rendering.
Data does not appear at the expected x position: Confirm the data item fields match the series xName and yName values. Mismatched field names silently produce empty points.