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

Free Support Forum - aspose.com

Neither FormatSetType.None nor Transparency Working

Simplest example I could muster:

xls.Worksheets.Add();
wks = xls.Worksheets[xls.Worksheets.Count - 1];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 10; j++)
wks.Cells[j, i].PutValue((i + 1) * j);
Chart c = wks.Charts[wks.Charts.Add(ChartType.Column, 10, 0, 30, 10)];
c.NSeries.Add(“A1:B10”, true);


//add third series on secondary axis
c.NSeries.Add(“C1:C10”, true);
Series series = c.NSeries[c.NSeries.Count - 1];
series.DataLabels.IsValueShown = true;
series.DataLabels.Separator = DataLablesSeparatorType.NewLine;

//applying colors to a data point makes it disappear:
series.Points[5].DataLabels.Area.ForegroundColor = Color.Red;
series.Points[5].DataLabels.TextFont.Color = Color.Green;

series.Area.FillFormat.SetType = FormatSetType.None;
series.Area.Transparency = 1.0;


I expect setting fill format to none or transparency to 1.0 would hide that series on the chart, but neither one does. Note this also demonstrates the previously reported problem that setting a data label’s color hides the label.

Hi,

Please see the code below, how to hide the series by making it transparent. The code below reads the source.xlsx file and hides the first series by setting it transparent.

Please see the source and output file generated by the following code. I have also attached a screenshot.

C#


string path = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(path);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


//Hide first series by making it transparent

Series series1 = chart.NSeries[0];


series1.Area.Formatting = FormattingType.Custom;

series1.Area.Transparency = 1.0;


workbook.Save(path + “.out.xlsx”);


Screenshot: