Package com.aspose.cells

Examples of com.aspose.cells.Chart


        ChartCollection charts = sheet.getCharts();

        // Adding a chart to the worksheet
        int chartIndex = charts.add(ChartType.PYRAMID,5,0,15,5);
        Chart chart = charts.get(chartIndex);

        // Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
        SeriesCollection serieses = chart.getNSeries();
        serieses.add("A1:B3", true);

        // Saving the Excel file
        workbook.save("data/AsposeChart.xls");
       
View Full Code Here


        ChartCollection charts = sheet.getCharts();

        // Adding a chart to the worksheet
        int chartIndex = charts.add(ChartType.PYRAMID,5,0,15,5);
        Chart chart = charts.get(chartIndex);

        // Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
        SeriesCollection serieses = chart.getNSeries();
        serieses.add("A1:B3", true);

        // Saving the Excel file
        workbook.save("data/AsposeChart.xls");
       
View Full Code Here

    // Naming the sheet
    sheet3.setName("PivotChart");
   
    // Adding a column chart
    int chartIndex = sheet3.getCharts().add(ChartType.COLUMN, 0, 5, 28, 16);
    Chart chart = sheet3.getCharts().get(chartIndex);
   
    // Setting the pivot chart data source
    chart.setPivotSource("PivotTable!PivotTable1");
    chart.setHidePivotFieldButtons(false);
   
    // Saving the Excel file
    workbook.save("data/Aspose_PivotChart.xls");
   
    // Print Message
View Full Code Here

    cells.get("B7").setValue(32000);
    cells.get("B8").setValue(10000);

    //Create chart
    int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 12, 1, 33, 12);
    Chart chart = sheet.getCharts().get(chartIndex);

    //Set properties of chart title
    chart.getTitle().setText("Sales By Region");
    chart.getTitle().getTextFont().setBold(true);
    chart.getTitle().getTextFont().setSize(12);

    //Set properties of nseries
    chart.getNSeries().add("Data!B2:B8", true);
    chart.getNSeries().setCategoryData("Data!A2:A8");

    //Set the fill colors for the series's data points (France - Portugal(7 points))
    ChartPointCollection chartPoints = chart.getNSeries().get(0).getPoints();

    ChartPoint point = chartPoints.get(0);
    point.getArea().setForegroundColor(Color.getCyan());

    point = chartPoints.get(1);
    point.getArea().setForegroundColor(Color.getBlue());

    point = chartPoints.get(2);
    point.getArea().setForegroundColor(Color.getYellow());

    point = chartPoints.get(3);
    point.getArea().setForegroundColor(Color.getRed());

    point = chartPoints.get(4);
    point.getArea().setForegroundColor(Color.getBlack());

    point = chartPoints.get(5);
    point.getArea().setForegroundColor(Color.getGreen());

    point = chartPoints.get(6);
    point.getArea().setForegroundColor(Color.getMaroon());

    //Set the legend invisible
    chart.setShowLegend(false);

    //Get the Chart image
    ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();
    imgOpts.setImageFormat(ImageFormat.getPng());

    //Save the chart image file.
    chart.toImage(new FileOutputStream("data/AsposeChartImage.png"), imgOpts);
 
View Full Code Here

TOP

Related Classes of com.aspose.cells.Chart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.