Free Support Forum - aspose.com

secondaryCategoryAxis is not shwon in XLSX

Hi,

thnaks for the good work and the big help that u provide us.

i created a 3D area chart and i want to show the labels in the secondCategoryAxis.
automatically thy are shown in xls format but not in the xlsx.
i set the function SeconedcategoryAxis.setVisible to true but i keep having no labels in the xlsx format.

here is the code that i use :

Workbook workbook = new Workbook();
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);
Cells cells = sheet.getCells();
Cell cell = cells.get(“B4”);
cell.setValue(“January”);
cell = cells.get(“C4”);
cell.setValue(“February”);
//soure data
cell = cells.get(“B5”);
cell.setValue(9300);
cell = cells.get(“C5”);
cell.setValue(1280);
cell = cells.get(“B6”);
cell.setValue(11300);
cell = cells.get(“C6”);
cell.setValue(21000);
cell = cells.get(“B7”);
cell.setValue(13200);
cell = cells.get(“C7”);
cell.setValue(11000);
Style style = workbook.createStyle();
style.setNumber(5);
// cells.setRangeStyle(4, 6, 1, 2, style);
//catergory
cell = cells.get(“A5”);
cell.setValue(“Chicago”);
cell = cells.get(“A6”);
cell.setValue(“Dallas”);
cell = cells.get(“A7”);
cell.setValue(“Boston”);

//
//sheet = worksheets.addSheet(SheetType.CHART,“chartsheet”)
ChartCollection charts = sheet.getCharts();

//Adding a chart to the worksheet
int chartIndex = charts.add(ChartType.AREA_3_D, 10, 5, 22, 12);
Chart chart = charts.get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from “B5” cell to “C7”
SeriesCollection nSeries = chart.getNSeries();
nSeries.add(“B5:C7”, true);
chart.getSecondCategoryAxis().setVisible(true);
//Setting the data source for the category data of NSeries
nSeries.setCategoryData(“A5:A7”);
//setting sereis name
Series aSeries = nSeries.get(0);
aSeries.setName("=B4");
aSeries = nSeries.get(1);
aSeries.setName("=C4");
workbook.save(“C:\Users\ark\Desktop\ASPOSE CELL\tests_examples\” + “area.xls”);
workbook.save(“C:\Users\ark\Desktop\ASPOSE CELL\tests_examples\” + “area.xlsx”);


Hi,

I can notice the issue by using your sample code to generate the XLS and XLSX files. The XLS file is fine as we can see the secondary axis but for XLSX, it is not shown as per the screen shots you provided.

I have logged a ticket with an id: "CELLSJAVA-40402" for your issue. We will look into your issue to figure it out soon.

Thank you.

Hi,

Thanks for using Aspose.Cells for Java.

We have fixed this issue. The third axis will be shown by default and it is represented by chart.getSeriesAxis().

Please download and try this fix: Aspose.Cells for Java v7.3.4.4 and let us know your feedback.

Below is sample test code. I have also attached the output files (xls and xlsx) and screenshot showing the third axis (xlsx) for a reference.

Java


Workbook workbook = new Workbook();

WorksheetCollection worksheets = workbook.getWorksheets();

Worksheet sheet = worksheets.get(0);

Cells cells = sheet.getCells();

Cell cell = cells.get(“B4”);

cell.setValue(“January”);

cell = cells.get(“C4”);

cell.setValue(“February”);

//soure data

cell = cells.get(“B5”);

cell.setValue(9300);

cell = cells.get(“C5”);

cell.setValue(1280);

cell = cells.get(“B6”);

cell.setValue(11300);

cell = cells.get(“C6”);

cell.setValue(21000);

cell = cells.get(“B7”);

cell.setValue(13200);

cell = cells.get(“C7”);

cell.setValue(11000);

Style style = workbook.createStyle();

style.setNumber(5);

// cells.setRangeStyle(4, 6, 1, 2, style);

//catergory

cell = cells.get(“A5”);

cell.setValue(“Chicago”);

cell = cells.get(“A6”);

cell.setValue(“Dallas”);

cell = cells.get(“A7”);

cell.setValue(“Boston”);


//

//sheet = worksheets.addSheet(SheetType.CHART,“chartsheet”)

ChartCollection charts = sheet.getCharts();


//Adding a chart to the worksheet

int chartIndex = charts.add(ChartType.AREA_3_D, 10, 5, 22, 12);

Chart chart = charts.get(chartIndex);

//Adding NSeries (chart data source) to the chart ranging from “B5” cell to “C7”

SeriesCollection nSeries = chart.getNSeries();

nSeries.add(“B5:C7”, true);

chart.getSecondCategoryAxis().setVisible(true);

//Setting the data source for the category data of NSeries

nSeries.setCategoryData(“A5:A7”);

//setting sereis name

Series aSeries = nSeries.get(0);

aSeries.setName("=B4");

aSeries = nSeries.get(1);

aSeries.setName("=C4");

workbook.save(DIR + “area.xls”);

workbook.save(DIR + “area.xlsx”);

Screenshot:

The issues you have found earlier (filed as CELLSJAVA-40402) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

thanks,the problem has been fixed in this new version of aspose.

Hi,

Thanks for sharing your feedback.

We are pleased to know that the problem you mentioned is now fixed. We have closed this thread now.

In case you face any other issue, please feel free to post on our forums, we will like to help you further.

Have a good weekend and happy new year to you. :slight_smile: