Code: Select all
using System;
using System.Windows;
using System.Windows.Threading;
using Arction.WPF.LightningChartUltimate;
using Arction.WPF.LightningChartUltimate.SeriesXY;
namespace ArrayPoints
{
public partial class MainWindow : Window
{
private LightningChartUltimate m_chart;
private PointLineSeries m_pls;
private DispatcherTimer dt;
private Random rand = new Random();
SeriesPoint[] sp;
public MainWindow()
{
InitializeComponent();
m_chart = new LightningChartUltimate();
m_chart.BeginUpdate();
m_chart.ViewXY.Margins = new Thickness(60, 30, 20, 40);
m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
m_pls = new PointLineSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0]);
m_chart.ViewXY.PointLineSeries.Add(m_pls);
sp = new SeriesPoint[10];
for (int ii = 0; ii < 10; ++ii)
{
sp[ii].X = (double)ii;
sp[ii].Y = (double)rand.Next(0, 100) / 10.0;
}
m_pls.Points = sp; // Update points !
m_chart.EndUpdate();
this.chart1.Children.Add(m_chart);
dt = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 100) };
dt.Tick += (s, e) =>
{
for (int ii = 0; ii < 10; ++ii)
{
sp[ii].Y = (double)rand.Next(0, 100) / 10.0;
}
m_chart.BeginUpdate();
//m_pls.Points = null;
m_pls.Points = sp; // Update points !
m_chart.EndUpdate();
};
dt.Start();
}
}
}
The waveform changes in real time.
v.6:
The waveform does not change in real time.
![Surprised :o](./images/smilies/icon_e_surprised.gif)
If m_pls.Points = null beforehand, the waveform changes. ( line 50 )
But, it is not beautiful.
![Wink ;)](./images/smilies/icon_e_wink.gif)
Dependency property of the array has become so.
Regards,
Minoru