I am using wpf to create a live data reporting software. I used the radchart control to show the live line graph. Following is the example code:
xaml code:
<chart:RadChart x:Name="chart1" AxisElementBrush="#FFD43636">
<chart:RadChart.SeriesMappings>
<charting:SeriesMapping LegendLabel="Value">
<charting:SeriesMapping.SeriesDefinition>
<charting:LineSeriesDefinition ShowItemLabels="False"></charting:LineSeriesDefinition>
</charting:SeriesMapping.SeriesDefinition>
<charting:ItemMapping FieldName="index" DataPointMember="XValue"></charting:ItemMapping>
<charting:ItemMapping FieldName="value" DataPointMember="YValue"></charting:ItemMapping>
</charting:SeriesMapping>
</chart:RadChart.SeriesMappings>
</chart:RadChart>
Code_behind is:
List<indexsandnumbers> data = new List<indexandnumbers>();
for (int i = 1; i < 999999; i++)
{
index = i;
value = i*1.3;
data.add(new indexsandnumbers(index,value));
chart1.Itemsource = data;
chart1.rebind();
}
However, I can only see the Xvalue increase and there is no Yvalue in the chart1 after I run the application.
The only way to show the line chart is I stop the loop, I can not get the line chart during the loop.
Any helps is appreciated.
Thank you very much.