Free Support Forum - aspose.com

How can I set series name as a cell reference - bubble chart - aspose.cells java?

Hi,

How can I set series name as a cell reference?

Chart chart = chartSheet.getCharts().addChart(ChartType.BUBBLE, 0, 0, 1, 1, 500, 400);

int rowIndex = 0;

for (int i = 0; i < 9; i++) {

String dataRef = dataSheet.getName() + "!$" + CellsHelper.convertColumnIndexToName(i) + "$" + (rowIndex + 3);

int index = chart.getNSeries().add(dataRef, true);

ASeries series = chart.getNSeries().get(index);

String nameRef = dataSheet.getName() + "!$" + CellsHelper.convertColumnIndexToName(lid) + "$" + (rowIndex + 1);

//series.setName(dataSheet.getCells().getCell(rowIndex, i).getStringValue());
series.setName(nameRef );

String xRef = dataSheet.getName() + "!$" + CellsHelper.convertColumnIndexToName(i) + "$" + (rowIndex + 2);

series.setXValues(xRef);

String bRef = dataSheet.getName() + "!$" + CellsHelper.convertColumnIndexToName(i) + "$" + (rowIndex + 4);

series.setBubbleSizes(bRef);

}

-Muhammed

Hi,

I have tested your scenario regarding Bubble Chart with v2.1.2 and it works fine. The series names are set as Cell references rather values or else.

I think you need to change your code a bit, you need to add “=” sign string before referencing the data sheet.

e.g

String nameRef = “=” + dataSheet.getName() + “!$” + CellsHelper.convertColumnIndexToName(lid) + “$” + (rowIndex + 1);

//series.setName(dataSheet.getCells().getCell(rowIndex, i).getStringValue());
series.setName(nameRef );


Thank you.


Thanks..

Muhammmed