Hello Vladislav,
Thank you for writing back.
In this case, it is necessary to invalidate the chart with the new date. Instead of using Application.
DoEvents(), you can call the
InvalidateMeasure and
UpdateLayout methods of the
ChartElement:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
RadChartView radChartView1 =
new
RadChartView();
radChartView1.ShowLegend =
true
;
Random rand =
new
Random();
string
filePath;
for
(
int
i = 0; i < 5; i++)
{
radChartView1.Series.Clear();
LineSeries lineSeries =
new
LineSeries();
lineSeries.LegendTitle =
"S "
+ i;
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(rand.Next(1, 20),
"Jan"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(rand.Next(1, 20),
"Apr"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(rand.Next(1, 20),
"Jul"
));
lineSeries.DataPoints.Add(
new
CategoricalDataPoint(rand.Next(1, 20),
"Oct"
));
radChartView1.Series.Add(lineSeries);
radChartView1.ChartElement.InvalidateMeasure();
radChartView1.ChartElement.UpdateLayout();
filePath = @
"..\..\exprtedChart"
+ i +
".png"
;
radChartView1.ExportToImage(filePath, radChartView1.Size, System.Drawing.Imaging.ImageFormat.Png);
}
}
In order to avoid the visual changing of the chart data, use a dummy
RadChartView instance as in my sample code snippet.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this
blog post and share your thoughts.