Pareto in ASP.NET CORE Charts Component

8 Oct 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 as Pareto 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.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

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.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

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.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-paretooptions fill="#F7523F">
            </e-series-paretooptions>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

Width

Use the width property to control the thickness of the line for the pareto series, which affects its visual weight on the chart.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-paretooptions fill="#F7523F" width="2">
            </e-series-paretooptions>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

Dash array

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

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-paretooptions fill="#F7523F" width="2" dashArray="3,3">
            </e-series-paretooptions>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

Marker

Use the marker property to display and customize markers for individual points in a pareto line.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-paretooptions fill="#F7523F">
                <e-marker visible="true" height="7" width="7" isFilled="true"></e-marker>
            </e-series-paretooptions>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

Show axis

Use the showAxis property to show or hide the secondary axis for the pareto series.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-paretooptions fill="#F7523F" showAxis="false">
                <e-marker visible="true" height="7" width="7" isFilled="true"></e-marker>
            </e-series-paretooptions>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

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.

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
            <e-series-emptypointSettings mode="Average"></e-series-emptypointSettings>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=null },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=null},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double? y;
        };

Fill

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

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
            <e-series-emptypointSettings mode="Average" fill="red"></e-series-emptypointSettings>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=null },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=null},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double? y;
        };

Border

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

<ejs-chart id="container" enableAnimation="true">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
            <e-series-emptypointSettings mode="Average">
                <e-emptyppointSettings-border width="2" color="red"></e-emptyppointSettings-border>
            </e-series-emptypointSettings>
        </e-series>
    </e-series-collection>
</ejs-chart>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=null },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=null},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double? y;
        };

##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.

<ejs-chart id="container" enableAnimation="true" seriesRender="changeColor">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>

 <script>
      function changeColor(args) {
         args.fill = 'green';
      }
   </script>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

Point render

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

<ejs-chart id="container" enableAnimation="true" pointRender="changeColor">
    <e-chart-primaryyaxis title="Frequency">
    </e-chart-primaryyaxis>
    <e-chart-primaryxaxis title="Defect" valueType="Category">
    </e-chart-primaryxaxis>
    <e-series-collection>
        <e-series dataSource="ViewBag.dataSource" name="Gold" xName="x" yName="y"
                  type="@Syncfusion.EJ2.Charts.ChartSeriesType.Pareto">
            <e-series-marker visible="true" width="10" height="10">
            </e-series-marker>
        </e-series>
    </e-series-collection>
</ejs-chart>

 <script>
      function changeColor(args) {
        if (args.point.index % 2 !== 0) {
            args.fill = '#ff6347';
        }
        else {
            args.fill = '#009cb8';
        }
      }
   </script>
public ActionResult Index()
        {
            List<ColumnChartData> chartData = new List<ColumnChartData>
            {
                new ColumnChartData{ x= "Traffic", y=56  },
                new ColumnChartData{ x="Child care", y=44.8 },
                new ColumnChartData{ x= "Transport", y=27.2 },
                new ColumnChartData{ x= "Weather", y=19.6},
                new ColumnChartData{ x= "Emergency", y=6.6 }
            };
            ViewBag.dataSource = chartData;
            return View();
        }

        public class ColumnChartData
        {
            public string x;
            public double y;
        };

See also