Document Solutions for Excel, Java Edition | Document Solutions
Features / Chart / Chart Types / Statistical Chart / Pareto Chart
In This Topic
    Pareto Chart
    In This Topic

    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.

    Using code

    Refer the following code to add Pareto chart:

    Java
    Copy Code
    private static void ParetoChart() {
        // Initialize workbook
        Workbook workbook = new Workbook();
        // Fetch default worksheet
        IWorksheet worksheet = workbook.getWorksheets().get(0);
    
        // Prepare data for chart
        worksheet.getRange("A1:B11")
                .setValue(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.getRange("A:B").getColumns().autoFit();
        // Add Pareto Chart
        IShape paretochartShape = worksheet.getShapes().addChart(ChartType.Pareto, 300, 30, 300, 250);
    
        // Set range"A1:B11" as the pareto chart series
        paretochartShape.getChart().getSeriesCollection().add(worksheet.getRange("A1:B11"));
    
        // Configure Chart Title
        paretochartShape.getChart().getChartTitle().setText("Pareto Chart");
    
        // Saving workbook to Xlsx
        workbook.save("31-ParetoChart.xlsx", SaveFileFormat.Xlsx);