嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
C#使用oxyplot绘制曲线图
public class DataInfo
{
public double Time { get; set; }
public double Value { get; set; }
public DataInfo(double time, double value)
{
Time = time;
Value = value;
}
}
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public List<DataInfo> mListDataInfo1 { get; private set; } = new List<DataInfo>();
public List<DataInfo> mListDataInfo2 { get; private set; } = new List<DataInfo>();
Timer timer5 = new Timer();
public MainWindow()
{
InitializeComponent();
timer5.Interval = 200;
timer5.Elapsed = Timer5_Elapsed;
timer5.Start();
}
int timerCnt = 0;
DateTime dateTime = DateTime.Today.Add(TimeSpan.FromHours(9));
private void Timer5_Elapsed(object sender, ElapsedEventArgs e)
{
timerCnt ;
Dispatcher.Invoke(new Action(() =>
{
DateTime dateTime = DateTime.Now;
mListDataInfo1.Add(new DataInfo(timerCnt, 45*Math.Sin(Math.PI*(timerCnt/10f))));
mListDataInfo2.Add(new DataInfo(timerCnt, 10));
//dateTime = dateTime.AddMinutes(1);
myLineSeries.DataContext = this;
//myLineSeries2.DataContext =this;
if (mListDataInfo1.Count > 200)
{
mListDataInfo1.RemoveRange(0,150);
}
myPlot.InvalidatePlot(true);
}), null);
}
}