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

Free Support Forum - aspose.com

Problem in Are Chart during run time

Hi All,

I generated Area chart and got generated successfully only when I hard code values in C#.

But when I generate data table and bind to excel using (WorkSheet.Cells.ImportDataTable(dt,true,"A1")) and try to generate Area chart, it is blank.

My code is given below.

Worksheet sheet = workbook.Worksheets[0];

sheet.Cells.ImportDataTable(dtBaseLoad, true, "A1");

int chartIndex = 0;

chartIndex = sheet.Charts.Add(Aspose.Cells.ChartType.Area, 9, 1, 33, 10);

Aspose.Cells.Chart chart = sheet.Charts[chartIndex];

chart.Legend.Position = Aspose.Cells.LegendPositionType.Top;

chart.CategoryAxis.MajorGridLines.IsVisible = false;

chart.Title.Text = "Sales By Region";

chart.Title.TextFont.Color = System.Drawing.Color.Black;

chart.Title.TextFont.IsBold = true;

chart.Title.TextFont.Size = 12;

chart.NSeries.Add("B2:M6", false);

chart.NSeries.CategoryData = "B1:M1";

chart.NSeries.IsColorVaried = true;

chart.CategoryAxis.Title.Text = "Year(2002-2006)";

chart.CategoryAxis.Title.TextFont.Color = System.Drawing.Color.Black;

chart.CategoryAxis.Title.TextFont.IsBold = true;

chart.CategoryAxis.Title.TextFont.Size = 10;

chart.CategoryAxis.AxisBetweenCategories = false;

When I double click on data in excel, then the graph is getting displayed.

What could be the problem and how to resolve it.

Please advise.

Sweatha

Hi,

Thanks for your posting and using Aspose.Cells for .NET

Please also provide your data table so that we could be able to run your code.

Please also download and try the latest version:
Aspose.Cells
for .NET v7.1.2.2

and see if it resolves your problem.