ChartDataTable never displays


I can’t display chart data table. Here is my code :

	//Instantiating a Workbook object
	Workbook workbook = new Workbook();

	//Obtaining the reference of the first worksheet
	Worksheet worksheet = workbook.getWorksheets().get(0);

	//Adding a sample value to "A1" cell

	//Adding a sample value to "B1" cell

	//Adding a chart to the worksheet
	int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 25, 10);

	//Accessing the instance of the newly added chart
	Chart chart = worksheet.getCharts().get(chartIndex);

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


	//Getting Chart Table
	ChartDataTable chartTable = chart.getChartDataTable();

	//Setting Chart Table Font Color
	//Setting Legend Key Visibility

	// Save the Microsoft Excel file. + "MyBook.xls");

I tried other charts and settings - no way :disappointed:

Please, need help!

Thanks in advance and have a nice day


Please try our latest version/fix: Aspose.Cells for Java v18.6.4

I have tested your sample code using v18.6.4 and it works fine and chart’s data table is displayed fine, see the screenshot for your reference:

Thank you, but it still doesn’t work for me :

2018-07-06_08h13_14.png (46.6 KB)

I have another question (don’t know if I should open a new topic): I need to do a chart like this one :

2018-07-06_08h44_07.png (124.3 KB)

but I didn’t find how to make the parts of columns above the chart line (orange) to be also orange and to have a value of this difference on it. Is it possible to do?


Thanks for the screenshots.

  1. It looks like you are using OpenOffice to open the Excel file. Please use MS Excel as OpenOffice has limited set of features and chart’s data table won’t be shown in it.

  2. Please create your desired chart in MS Excel manually and save the file to provide us here, we will check on how to do it via Aspose.Cells APIs.

Amjad, thank you very much! :pray:
There is no problem with chart’s data table in MS Excel.
So I will create the second chart manually and send it to you

Have a nice weekend!


Good to know that chart’s data table is displayed fine in MS Excel.

Take your time to create your second chart and send the file to us.