You should do a repaint before the Chart is saved. You can use the Invalidate method :
tChart.Invalidate();
tChart.Chart.Export.Image.PNG.Save("C:\\test.png");
Josep Lluis Jorge
http://support.steema.com
Why get a wrong Pie Chart ?
Using the following code works fine (use Series.Add to add the Series to the Chart) :
Josep Lluis Jorge
http://support.steema.com
Code: Select all
Steema.TeeChart.Chart tChart = new Steema.TeeChart.Chart();
tChart.Width = 600;
tChart.Height= 400;
tChart.Header.Visible = false;
tChart.Panel.Gradient.Visible = true;
tChart.Series.Clear();
tChart.Legend.ResizeChart = true;
tChart.Legend.Symbol.Squared = true;
Steema.TeeChart.Styles.Pie tPie = new Steema.TeeChart.Styles.Pie();
tChart.Series.Add(tPie);
// Steema.TeeChart.Styles.Series tSeries = tChart.Series[0];
tPie.PercentFormat = "###0%";
tPie.CustomXRadius = 0;
tPie.CustomYRadius = 0;
tPie.Marks.Transparent = true;
tPie.ShowInLegend = true;
tChart.Legend.TextStyle = Steema.TeeChart.LegendTextStyles.Plain;
tPie.Marks.Style = Steema.TeeChart.Styles.MarksStyles.LabelPercent;
tPie.FillSampleValues(10);
tChart.Invalidate();
tChart.Chart.Export.Image.PNG.Save("C:\\test.png");
http://support.steema.com