How to change chart titel?

Hello collegues,


I have tried change chart titel but for some reason it does not work at all. What I have done wrong?

            FlexCel.Core.ExcelChart chart1 = xls.FXLS.GetChart(1, String.Empty);
            FlexCel.Core.TDataLabel[] label1 = chart1.GetDataLabels ();
            
            System.Text.StringBuilder titel1 = new System.Text.StringBuilder("Total Pax " + currentYear.ToString());
            label1[0].LabelValues.SetValue(titel1, 0);

            chart1.SetDataLabels(label1);
            

            FlexCel.Core.ExcelChart chart2 = xls.FXLS.GetChart(2, String.Empty);
            FlexCel.Core.TDataLabel[] label2 = chart1.GetDataLabels ();
            
            System.Text.StringBuilder titel2 = new System.Text.StringBuilder("Total Aircraft Movements " + currentYear.ToString());
            label2[0].LabelValues.SetValue(titel2, 0);

            chart2.SetDataLabels(label2);

            
            FlexCel.Core.ExcelChart chart3 = xls.FXLS.GetChart(4, String.Empty);
            FlexCel.Core.TDataLabel[] label3 = chart3.GetDataLabels();

            System.Text.StringBuilder titel3 = new System.Text.StringBuilder("Total Cargo Handled " + currentYear.ToString());
            label3[0].LabelValues.SetValue(titel3, 0);

            chart3.SetDataLabels(label3);

Hi,

Currently SetDataLabels doesn't really work, since it is expecting that you call a "SetChart" method that doesn't exist to apply those changes to the chart. This is because originally the ida was to keep the Chart object isolated from the worksheet, so you would need to do:

Chart = xls.GetChart(...)
Chart.SetSeries(...)
Chart.SetDatalabels(...)
...
xls.SetChart(Chart);

When we actually implemented SetSeries and the other methods, having an isolated chart object proved too expensive, so those change directly the chart, and SetChart never was created. 

Sadly SetDataLabels  is still on the old idea of needing a SetChart to actually modify the spreadsheet, and so it doesn't currently work.

Now, I think it should be simple to change SetDataLabels so it doesn't just modify the Chart object but also the  spreadsheet it is in. I'll try to implement it in what is left of the week, and we should have a new release next week with this working.

Regards,
   Adrian.