Bug in Hotfix 1.8.8 "chart.NSeries[i].DataLabels.Font.Size = 6;"

Hi Laurence,

in your new feature “chart.NSeries[i].DataLabels.Font” is a bug.

My code:
for(int i = 0; i < chart.NSeries.Count; i ++)
{
chart.NSeries[i].DataLabels.IsValueShown = true;
chart.NSeries[i].DataLabels.Font.Size = 6;
chart.NSeries[i].DataLabels.Font.Color = Color.Red;
chart.NSeries[i].Name = “=A”+(i+3).ToString();
}

The font-size will only be seated for “i=0”.
The color is not assisted at the moment.

Or doing I’m wrong coding?

Regards, Stefan

Hi Stefan,

Color setting is a bug. I will check it. But in my machine all data series’ font size is set.

Following is my sample:

Excel excel = new Excel();
Cells cells = excel.Worksheets[0].Cells;
Worksheet sheet = excel.Worksheets[0];


cells[“A1”].PutValue(100);
cells[“A2”].PutValue(200);
cells[“A3”].PutValue(300);
cells[“A4”].PutValue(“A”);

cells[“b1”].PutValue(400);
cells[“b2”].PutValue(500);
cells[“b3”].PutValue(600);
cells[“b4”].PutValue(“B”);

int chartIndex = sheet.Charts.Add(ChartType.ColumnStacked, 5, 5, 20, 10);
Chart chart = sheet.Charts[chartIndex];
chart.NSeries.Add(“A1:B3”, true);
chart.Legend.Position = LegendPositionType.Top;
chart.Legend.X = 1000;
chart.Legend.Width = 50;
chart.Legend.Height = 50;

for(int i = 0; i < chart.NSeries.Count; i ++)
{
chart.NSeries[i].DataLabels.IsValueShown = true;
chart.NSeries[i].DataLabels.Font.Size = 6;
chart.NSeries[i].DataLabels.Font.Color = Color.Red;
}

chart.NSeries[0].Name = “=A4”;
chart.NSeries[1].Name = “=B4”;




chart.ValueAxis.Title.Rotation = 90;
chart.ValueAxis.Title.Text = “Anzahl Fzg. (Anlieferung Montage) pro KW”;
chart.ValueAxis.Title.TextHorizontalAlignment = TextAlignmentType.Right;



chart.PlotArea.Width = 2500;
chart.PlotArea.X = 500;
chart.PlotArea.Y = 800;

excel.Save(“abc.xls”, SaveType.OpenInExcel, FileFormatType.Default, this.Response);

Could you send me your code and created file for this issue?

Thanks for your cooperation.

Hi Laurence,

I tried your example, works great on my machine.

But for my chart it has no effect, maybe I’m doing some wrong!?
I have tried to comment out all other code so my code is no more then yours but same effect, only NSeries[0] is working.

I eMail you my generated sheet and my code!

Thanks for supporting!!!

-Stefan

Hi Stefan,

The problem is fixed. Please download fix 1.8.8.1.

Hi Laurence,

thanks for new release!

but I get still errors when setting font-color

"chart.NSeries[i].DataLabels.Font.Color = Color.FromArgb(255,255,255);"

This error is not so bad but needed in near future.

Thanks for supporting me!

-Stefan