We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to make series invisible in charting

Hi,

In the excel charting, we can make series invisible by uncheck the legend entry in select data source dialog( please see Pic1), I have two questions related to this setting.

1. How I can make the series invisible in the aspose chart, I couldn’t find visible property for series object. So I try to achieve this using the following code.

chartSeries.Area.Formatting = Aspose.Cells.Charts.FormattingType.None
chartSeries.Border.IsVisible = False
'remove legend entry
chart.Legend.LegendEntries(seriesIndex).IsDeleted = True

The problem with this solution is that I can see the white gap left by the invisible series if the chart is column or bar type.

2. If I save the Aspose chart to the excel, how I can make this series unchecked in the select data source dialog.

Please let me know if you have any question.

Thanks,
Wei

Hi Wei,

Thanks for your posting and using Aspose.Cells.

We are afraid, hiding the series is not supported by Aspose.Cells. It is actually an Excel 2013 feature which is also not available in Excel 2010 and Excel 2007.

As a workaround, you can remove the Chart Series using the following code.

I have attached the source xlsx file and output xlsx file generated by the code for your reference.

In order to support this feature in our future versions, we have logged this issue in our database as a New Feature request. We will look into it and implement it if possible. Once, it is available or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-42808 - Support to Hide Chart Series

C#

Workbook workbook = new Workbook(“source.xlsx”);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


chart.NSeries.RemoveAt(1);


workbook.Save(“output.xlsx”);

Thanks for the information.

Do you know whether Aspose.cells will support this feature in the further release? And when will it be available if it does?

Thanks,
Wei

Sorry, Please ignore my previous update. I have found the answer from your post.

Thanks,
Wei

Hi Wei,

Thanks for your posting and using Aspose.Cells.

We have logged a New Feature request for this issue. We will evaluate it and see if it could be supported in our next versions. Please spare us some time. Once, there is some update/ETA for you, we will let you know asap.