Pareto in Angular Chart component
19 Sep 202424 minutes to read
Pareto
Pareto charts are used to find the cumulative values of data in different categories. It is a combination of Column
and Line
series, where the initial values are represented by the column chart and the cumulative values are represented by the line chart.
To render a pareto
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:
-
Set the series type: Define the series
type
asPareto
in your chart configuration. This indicates that the data should be represented as a pareto chart, will use a combination of column and line series. -
Inject the necessary modules: Use the
@NgModule.providers
method to inject theParetoSeriesServices
,ColumnSeriesServices
,LineSeriesServices
modules into your chart. This step is essential, as it ensures that the necessary functionalities for rendering pareto series are available in your chart.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 [marker]='marker'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public marker?: Object;
public tooltip?: Object;
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
title: 'Defects',
valueType: 'Category',
};
this.marker = { visible: true, width: 10, height: 10 };
this.primaryYAxis = {
title: 'Frequency of Occurence',
minimum: 0,
maximum: 150,
interval: 30,
};
this.tooltip = { enable: true, shared: true }
this.title = 'Pareto chart - Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 [marker]='marker'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public marker?: Object;
public tooltip?: Object;
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
title: 'Defects',
valueType: 'Category',
};
this.marker = { visible: true, width: 10, height: 10 };
this.primaryYAxis = {
title: 'Frequency of Occurence',
minimum: 0,
maximum: 150,
interval: 30,
};
this.tooltip = { enable: true, shared: true }
this.title = 'Pareto chart - Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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
Fill
Use the fill
property to apply a color to the pareto line. By default, a color based on the theme is used.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
fill: '#F7523F'
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
fill: '#F7523F',
width: 2
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
fill: '#F7523F',
width: 2,
dashArray: '3,3'
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2,
showAxis: false
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [emptyPointSettings]='emptyPointSettings' [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public emptyPointSettings?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2,
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
this.emptyPointSettings = {
mode: 'Average'
}
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 customize the fill color of empty points in the series.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [emptyPointSettings]='emptyPointSettings' [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public emptyPointSettings?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2,
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
this.emptyPointSettings = {
mode: 'Average', fill: 'red'
}
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 width and color of the border for empty points.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { Browser } from '@syncfusion/ej2-base';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 opacity="0.75" [cornerRadius]="cornerRadius" columnWidth="0.4" [emptyPointSettings]='emptyPointSettings' [paretoOptions]='paretoOptions'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public tooltip?: Object;
public emptyPointSettings?: Object;
public cornerRadius: Object = {
topLeft: Browser.isDevice ? 4 : 6, topRight: Browser.isDevice ? 4 : 6
};
public paretoOptions: Object = {
marker: { visible: true, isFilled: true, width: 7, height: 7 },
fill: '#F7523F',
width: 2,
};
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
interval: 1,
valueType: 'Category',
majorGridLines: { width: 0 }, minorGridLines: { width: 0 },
majorTickLines: { width: 0 }, minorTickLines: { width: 0 },
lineStyle: { width: 0 },
labelIntersectAction: 'Rotate90'
};
this.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 }
};
this.tooltip = { enable: true, shared: true, format: '${series.name} : <b>${point.y}</b>' };
this.title = 'Defects in Shirts';
this.emptyPointSettings = {
mode: 'Average', fill: 'red', border: { width: 2, color: 'green' }
}
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { ISeriesRenderEventArgs } from '@syncfusion/ej2-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" (seriesRender)='seriesRender($event)' [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 [marker]='marker'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public marker?: Object;
public tooltip?: Object;
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
title: 'Defects',
valueType: 'Category',
};
this.marker = { visible: true, width: 10, height: 10 };
this.primaryYAxis = {
title: 'Frequency of Occurence',
minimum: 0,
maximum: 150,
interval: 30,
};
this.tooltip = { enable: true, shared: true }
this.title = 'Pareto chart - Defects in Shirts';
}
public seriesRender(args: ISeriesRenderEventArgs) {
args.fill = 'green';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 allows you to customize each data point before it is rendered on the chart.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ChartModule } from '@syncfusion/ej2-angular-charts'
import { IPointRenderEventArgs } from '@syncfusion/ej2-charts'
import { CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService } from '@syncfusion/ej2-angular-charts'
import { Component, OnInit } from '@angular/core';
import { paretoData } from './datasource';
@Component({
imports: [
ChartModule
],
providers: [ CategoryService, LineSeriesService, StepLineSeriesService, SplineSeriesService, StackingLineSeriesService, DateTimeService,
SplineAreaSeriesService, MultiColoredLineSeriesService, ParetoSeriesService, ColumnSeriesService],
standalone: true,
selector: 'app-container',
template: `<ejs-chart id="chart-container" (pointRender)='pointRender($event)' [primaryXAxis]='primaryXAxis'[primaryYAxis]='primaryYAxis' [title]='title' [tooltip]='tooltip'>
<e-series-collection>
<e-series [dataSource]='chartData' type='Pareto' xName='x' yName='y' name='Defect' width=2 [marker]='marker'></e-series>
</e-series-collection>
</ejs-chart>`
})
export class AppComponent implements OnInit {
public primaryXAxis?: Object;
public chartData?: Object[];
public title?: string;
public primaryYAxis?: Object;
public marker?: Object;
public tooltip?: Object;
ngOnInit(): void {
this.chartData = paretoData;
this.primaryXAxis = {
title: 'Defects',
valueType: 'Category',
};
this.marker = { visible: true, width: 10, height: 10 };
this.primaryYAxis = {
title: 'Frequency of Occurence',
minimum: 0,
maximum: 150,
interval: 30,
};
this.tooltip = { enable: true, shared: true }
this.title = 'Pareto chart - Defects in Shirts';
}
public pointRender(args: IPointRenderEventArgs) {
args.fill = 'green';
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
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 }
];