public void replaceData(XDDFDataSource<?> category, XDDFNumericalDataSource<? extends Number> values) { if (category == null || values == null) { throw new IllegalStateException("Category and values must be defined before filling chart data."); } int numOfPoints = category.getPointCount(); if (numOfPoints != values.getPointCount()) { throw new IllegalStateException("Category and values must have the same point count."); } this.categoryData = category; this.valuesData = values; }
/** * this method writes the data into sheet * * @param sheet * sheet of embedded excel * @param categoryData * category values * @param valuesData * data values * @since POI 4.0.0 */ protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) { int numOfPoints = categoryData.getPointCount(); for (int i = 0; i < numOfPoints; i++) { XSSFRow row = this.getRow(sheet, i + 1); // first row is for title this.getCell(row, categoryData.getColIndex()).setCellValue(categoryData.getPointAt(i).toString()); this.getCell(row, valuesData.getColIndex()).setCellValue(valuesData.getPointAt(i).doubleValue()); } }
public void plot() { int numOfPoints = categoryData.getPointCount(); if (categoryData.isNumeric()) { CTNumData cache = retrieveNumCache(getAxDS(), categoryData); fillNumCache(cache, numOfPoints, (XDDFNumericalDataSource<?>) categoryData); } else { CTStrData cache = retrieveStrCache(getAxDS(), categoryData); fillStringCache(cache, numOfPoints, categoryData); } CTNumData cache = retrieveNumCache(getNumDS(), valuesData); fillNumCache(cache, numOfPoints, valuesData); }
public void replaceData(XDDFDataSource<?> category, XDDFNumericalDataSource<? extends Number> values) { if (category == null || values == null) { throw new IllegalStateException("Category and values must be defined before filling chart data."); } int numOfPoints = category.getPointCount(); if (numOfPoints != values.getPointCount()) { throw new IllegalStateException("Category and values must have the same point count."); } this.categoryData = category; this.valuesData = values; }
/** * this method writes the data into sheet * * @param sheet * sheet of embedded excel * @param categoryData * category values * @param valuesData * data values * @since POI 4.0.0 */ protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) { int numOfPoints = categoryData.getPointCount(); for (int i = 0; i < numOfPoints; i++) { XSSFRow row = this.getRow(sheet, i + 1); // first row is for title this.getCell(row, categoryData.getColIndex()).setCellValue(categoryData.getPointAt(i).toString()); this.getCell(row, valuesData.getColIndex()).setCellValue(valuesData.getPointAt(i).doubleValue()); } }
public void plot() { int numOfPoints = categoryData.getPointCount(); if (categoryData.isNumeric()) { CTNumData cache = retrieveNumCache(getAxDS(), categoryData); fillNumCache(cache, numOfPoints, (XDDFNumericalDataSource<?>) categoryData); } else { CTStrData cache = retrieveStrCache(getAxDS(), categoryData); fillStringCache(cache, numOfPoints, categoryData); } CTNumData cache = retrieveNumCache(getNumDS(), valuesData); fillNumCache(cache, numOfPoints, valuesData); }