[]
DsExcel supports Pareto chart, also known as Pareto distribution diagram. It is a vertical bar graph in which values are plotted left to right, in decreasing order of relative frequency. Pareto charts are useful for task prioritizing. The chart gives a hint about the variables that have the greatest effect on a given system.
Pareto chart can be used to highlight the most important factor from a given set of factors. For example, quality control, inventory control, and customer grievance handling are some areas where Pareto chart analysis can be used.
Refer the following code to add Pareto chart:
public void ParetoChart()
{
// Initialize workbook
Workbook workbook = new Workbook();
// Fetch default worksheet
IWorksheet worksheet = workbook.Worksheets[0];
// Prepare data for chart
worksheet.Range["A1:B11"].Value = new object[,]
{
{"Complaint", "Count"},
{"Too noisy", 27},
{"Overpriced", 789},
{"Food is tasteless", 65},
{"Food is not fresh", 19},
{"Food is too salty", 15},
{"Not clean", 30},
{"Unfriendly staff", 12},
{"Wait time", 109},
{ "No atmosphere", 45},
{"Small portions", 621 }
};
worksheet.Range["A:B"].Columns.AutoFit();
// Add Pareto Chart
IShape paretochartShape = worksheet.Shapes.AddChart(ChartType.Pareto, 300, 30, 300, 250);
// Set range"A1:B11" as the pareto chart series
paretochartShape.Chart.SeriesCollection.Add(worksheet.Range["A1:B11"]);
// Configure Chart Title
paretochartShape.Chart.ChartTitle.Text = "Pareto Chart";
// Saving workbook to Xlsx
workbook.Save(@"31-ParetoChart.xlsx", SaveFileFormat.Xlsx);
}