Chart no showing in excel file properly

I have inserted charts into my excel workbook. When I open the workbook the chart is there, but it isn't displaying the information. I right-click and choose Source Data and it shows the proper source data and columns is selected. I select rows then back to columns and it displays. Anyway to force the chart to redraw after setting the data series?

Thanks,

James

Hi James,

Which version of Aspose.Cells for .Net or Java you are using? Please post your sample test code with the excel file(s) here to reproduce the problem. So that we may check and figure out the issue soon.

And by the way Could you try the attached Aspose.Cells for Net version if it works fine (I guess, you are using the .Net version of Aspose.Cells )

Thank you.

below is the code. File is attached

private void InsertCoverCharts(Excel.Workbook wbNiche)
{
int n = wbNiche.Worksheets.AddCopy("Cover");
wbNiche.Worksheets["Cover"].Name = "Remove";
wbNiche.Worksheets[n].Name = "Cover";
Excel.Charts wbCharts = wbNiche.Worksheets[n].Charts;
NicheCharts charts = GetCoverCharts();
foreach (NicheChart chart in charts)
{
int i = wbCharts.Add(chart.TypeOfChart(), chart.nUpperLeftRow(), chart.nUpperLeftColumn(), chart.nLowerRightRow(), chart.nLowerRightColumn());
wbCharts[i].ChartArea.Border.IsVisible = chart.bBorderShown();
wbCharts[i].Title.Text = chart.sTitle();
wbCharts[i].IsLegendShown = chart.bLegendShown();
string[] Data = chart.sDataSeriesArray();
for (int y = 0; y <= Data.GetUpperBound(0); y++)
{
int nSeries = wbCharts[i].NSeries.Add(wbNiche.Worksheets[n].Name + "!" + Data[y],true);
wbCharts[i].NSeries[nSeries].DataLabels.IsCategoryNameShown = chart.bCategrogyNameShown();
wbCharts[i].NSeries[nSeries].DataLabels.IsPercentageShown = chart.bPercentShown();
wbCharts[i].NSeries[nSeries].DataLabels.IsLegendKeyShown = chart.bLegendKeyShown();


}


}

}

.Net, and I tried your attached file, which generated the output attached.

Hi,

Well, your code does not make much sense as you have used a lots of custom methods and other objects etc. Your charts are based on some source cells which contain reference formulas. And I tried your template file, add a new worksheet in it and create a sample 3D Pie chart in it based on the data source (M499:N501) in the first sheet "Cover". The resultant chart is absolutely fine when I open the output file (attached) in MS Excel.

My Sample code:

Workbook workbook = new Workbook();
workbook.Open("d:\\test\\ToAspose.xls");
Worksheet worksheet = workbook.Worksheets[workbook.Worksheets.Add()];
int intChartIndex = worksheet.Charts.Add(ChartType.Pie3D, 5, 1, 35, 11);
Chart chart = worksheet.Charts[intChartIndex];
chart.NSeries.Add("Cover!N499:N501", true);
chart.NSeries.CategoryData = "Cover!M499:M501";
chart.PlotArea.Border.IsVisible = false;
chart.NSeries[0].DataLabels.IsCategoryNameShown = true;
chart.NSeries[0].DataLabels.IsPercentageShown = true;
chart.NSeries[0].DataLabels.IsLegendKeyShown = true;
chart.Title.Text = "Firm Public-Private-Other";
chart.Title.TextFont.Size = 9;
chart.Title.TextFont.Color = System.Drawing.Color.Black;
chart.Title.TextFont.IsBold = true;
chart.Legend.Height = 0;
chart.Legend.Width = 0;
workbook.Save(@"d:\test\tpie3dchart.xls");
Could you create a test with complete code (similar to my code) using your template file which could produce the issue and paste it here. So that we may easily reproduce the problem.
Thank you.