Package org.openxmlformats.schemas.drawingml.x2006.chart

Examples of org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource


    protected void addToChart(CTScatterChart ctScatterChart) {
      CTScatterSer scatterSer = ctScatterChart.addNewSer();
      scatterSer.addNewIdx().setVal(this.id);
      scatterSer.addNewOrder().setVal(this.order);

      CTAxDataSource xVal = scatterSer.addNewXVal();
      CTNumRef numRef = xVal.addNewNumRef();
      numRef.setF(xAddress.formatAsString(xSheet.getSheetName(), true));

      CTNumDataSource yVal = scatterSer.addNewYVal();
      numRef = yVal.addNewNumRef();
      numRef.setF(yAddress.formatAsString(ySheet.getSheetName(), true));
View Full Code Here


        String titleRef = new CellReference(sheet.getSheetName(), 0, 1, true, true).formatAsString();
        tx.getStrRef().setF(titleRef);


        // Category Axis Data
        CTAxDataSource cat = ser.getCat();
        CTStrData strData = cat.getStrRef().getStrCache();

        // Values
        CTNumDataSource val = ser.getVal();
        CTNumData numData = val.getNumRef().getNumCache();

        strData.setPtArray(null)// unset old axis text
        numData.setPtArray(null)// unset old values


        // set model
        int idx = 0;
        int rownum = 1;
        String ln;
        while((ln = modelReader.readLine()) != null){
            String[] vals = ln.split("\\s+");
            CTNumVal numVal = numData.addNewPt();
            numVal.setIdx(idx);
            numVal.setV(vals[1]);

            CTStrVal sVal = strData.addNewPt();
            sVal.setIdx(idx);
            sVal.setV(vals[0]);

            idx++;
            XSSFRow row = sheet.createRow(rownum++);
            row.createCell(0).setCellValue(vals[0]);
            row.createCell(1).setCellValue(Double.valueOf(vals[1]));
        }
        numData.getPtCount().setVal(idx);
        strData.getPtCount().setVal(idx);

        String numDataRange = new CellRangeAddress(1, rownum-1, 1, 1).formatAsString(sheet.getSheetName(), true);
        val.getNumRef().setF(numDataRange);
        String axisDataRange = new CellRangeAddress(1, rownum-1, 0, 0).formatAsString(sheet.getSheetName(), true);
        cat.getStrRef().setF(axisDataRange);

        // updated the embedded workbook with the data
        OutputStream xlsOut = xlsPart.getPackagePart().getOutputStream();
        wb.write(xlsOut);
        xlsOut.close();
View Full Code Here

            ctLineSer.addNewOrder().setVal(order);

            // No marker symbol on the chart line.
            ctLineSer.addNewMarker().addNewSymbol().setVal(STMarkerStyle.NONE);

            CTAxDataSource catDS = ctLineSer.addNewCat();
            XSSFChartUtil.buildAxDataSource(catDS, categories);
            CTNumDataSource valueDS = ctLineSer.addNewVal();
            XSSFChartUtil.buildNumDataSource(valueDS, values);

            if (isTitleSet()) {
View Full Code Here

        protected void addToChart(CTScatterChart ctScatterChart) {
            CTScatterSer scatterSer = ctScatterChart.addNewSer();
            scatterSer.addNewIdx().setVal(this.id);
            scatterSer.addNewOrder().setVal(this.order);

            CTAxDataSource xVal = scatterSer.addNewXVal();
            XSSFChartUtil.buildAxDataSource(xVal, xs);

            CTNumDataSource yVal = scatterSer.addNewYVal();
            XSSFChartUtil.buildNumDataSource(yVal, ys);
View Full Code Here

      /* TODO: add some logic to automatically recognize cell
       * types and choose appropriate data representation for
       * X axis.
       */
      CTAxDataSource xVal = scatterSer.addNewXVal();
      CTNumRef xNumRef = xVal.addNewNumRef();
      xNumRef.setF(xMarker.formatAsString());

      CTNumDataSource yVal = scatterSer.addNewYVal();
      CTNumRef yNumRef = yVal.addNewNumRef();
      yNumRef.setF(yMarker.formatAsString());
View Full Code Here

  /**
   * Create a new SpreadsheetML chart legend
   */
  public XSSFChartLegend(XSSFChart chart) {
    CTChart ctChart = chart.getCTChart();
    this.legend = (ctChart.isSetLegend()) ?
      ctChart.getLegend() :
      ctChart.addNewLegend();
  }
View Full Code Here

   */
  private void createChart() {
    chartSpace = CTChartSpace.Factory.newInstance();
    chart = chartSpace.addNewChart();
    CTPlotArea plotArea = chart.addNewPlotArea();
    CTLayout layout = plotArea.addNewLayout();
    CTManualLayout manualLayout = layout.addNewManualLayout();
    manualLayout.addNewLayoutTarget().setVal(STLayoutTarget.INNER);
    manualLayout.addNewXMode().setVal(STLayoutMode.EDGE);
    manualLayout.addNewYMode().setVal(STLayoutMode.EDGE);
    manualLayout.addNewX().setVal(0);
    manualLayout.addNewY().setVal(0);
View Full Code Here

      scaling.addNewLogBase().setVal(logBase);
    }
  }

  public double getLogBase() {
    CTLogBase logBase = getCTScaling().getLogBase();
    if (logBase != null) {
      return logBase.getVal();
    }
    return 0.0;
  }
View Full Code Here

  private void createChart() {
    chartSpace = CTChartSpace.Factory.newInstance();
    chart = chartSpace.addNewChart();
    CTPlotArea plotArea = chart.addNewPlotArea();
    CTLayout layout = plotArea.addNewLayout();
    CTManualLayout manualLayout = layout.addNewManualLayout();
    manualLayout.addNewLayoutTarget().setVal(STLayoutTarget.INNER);
    manualLayout.addNewXMode().setVal(STLayoutMode.EDGE);
    manualLayout.addNewYMode().setVal(STLayoutMode.EDGE);
    manualLayout.addNewX().setVal(0);
    manualLayout.addNewY().setVal(0);
    manualLayout.addNewW().setVal(0.65);
    manualLayout.addNewH().setVal(0.8);
    chart.addNewPlotVisOnly().setVal(true);
    CTPrintSettings printSettings = chartSpace.addNewPrintSettings();
    printSettings.addNewHeaderFooter();

    CTPageMargins pageMargins = printSettings.addNewPageMargins();
View Full Code Here

      CTAxDataSource xVal = scatterSer.addNewXVal();
      CTNumRef numRef = xVal.addNewNumRef();
      numRef.setF(xAddress.formatAsString(xSheet.getSheetName(), true));

      CTNumDataSource yVal = scatterSer.addNewYVal();
      numRef = yVal.addNewNumRef();
      numRef.setF(yAddress.formatAsString(ySheet.getSheetName(), true));
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource

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.