Free Support Forum - aspose.com

I Need Help to Legend of a data Serie

Hi , I need your help please...

I have a excel sheet , and a default graphic , the question is that I can modify data series "

chart.NSeries.Add("'Gráfico Nº Incidencias'!A1:D4", True)

" ; but I can't acces to legend from graphic.

chart.NSeries.Name = "=A5" or chart.NSeries.Name = "'Gráfico Nº Incidencias'!A5" ; in this cell i have a string data but my legend is "=!REF!A5". I'm using Aspose.Cells.dll 4.0.2.0

Thanks, Dante Oliver.

Could you please post your sample code and file here? I have tried the following code with the attached file and it works fine.

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\book3.xls");

Worksheet sheet = workbook.Worksheets[0];
int chartIndex = sheet.Charts.Add(ChartType.Column, 2, 2, 15, 8);

Chart chart = sheet.Charts[chartIndex];

chart.NSeries.Add("'Gráfico Nº Incidencias'!A1:D4", true);

for(int i = 0; i < chart.NSeries.Count; i ++)
{
chart.NSeriesIdea [I].Name = "='Gráfico Nº Incidencias'!" + CellsHelper.CellIndexToName(4, i);
}
workbook.Save("d:\\test\\abc.xls");

Hi, thi's my code , this acces to graphic in the sheet "Gráfico Nº Incidencias", but my legend is unmodify, is this a error ?, please look my file attachment...

' to graphic in the sheet

Dim charts As Aspose.Cells.Charts = _excelworkbook2.Worksheets("Gráfico Nº Incidencias").DesignCharts

' selecting the default graphic designed by we , in the sheet

Dim chart As Aspose.Cells.Chart = charts(0)

'setting the data series

chart.NSeries.Add("'Gráfico Nº Incidencias'!A1:D4", True)

Dim i As Integer

For i = 0 To chart.NSeries.Count

chart.NSeries(i).Name = "='Gráfico Nº Incidencias'!" & Aspose.Cells.CellsHelper.CellIndexToName(4, i)

Next

chart.IsLegendShown = True

Currently Aspose.Cells doesn't support to change chart legend in template files.

Thanks Laurence…