1金币
本帖最后由 anyczy 于 2020-11-11 22:25 编辑
- public static void drawingXY(C1.WPF.Chart.C1FlexChart flexChart, List<double> DataX, List<double> DataY)
- {
- flexChart.DataContext = CreateData(DataX, DataY);
- C1.WPF.Chart.Series series1 = new C1.WPF.Chart.Series();
- flexChart.Series.Add(series1);
- flexChart.Series[0].BindingX = "dataX";
- flexChart.Series[0].Binding = "dataY";
- //flexChart.ChartType = C1.Chart.ChartType.Area;
- flexChart.LegendPosition = C1.Chart.Position.Right;
- }
- private static List<DataItem> CreateData(List<double> DataX, List<double> DataY)
- {
- var data = new List<DataItem>();
- //fileOper read = new fileOper();
- //read.read();
- for (int i = 0; i < DataY.Count; i++)
- {
- data.Add(new DataItem(DataX[i], DataY[i]));
- }
- return data;
- }
复制代码- public class DataItem
- {
- public double dataX { get; set; }
- public double dataY { get; set; }
- public DataItem(double _X, double _Y)
- {
- dataX = _X;
- dataY = _Y;
- }
-
- }
复制代码
上面是我flex chart画图Draw类的函数
下面是我的线程部分
- DispatcherTimer Timer_paint = new DispatcherTimer(DispatcherPriority.Normal, this.Dispatcher);
- Timer_paint.Interval = new TimeSpan(0, 0, 0, 0, 100);
- Timer_paint.Tick += TimerPaint_Tick;
- Timer_paint.Start();
- private void TimerPaint_Tick(object sender, EventArgs e)
- {
- List<double> x = new List<double>();
- List<double> y = new List<double>();
- //if (variable.bopen232)
- {
-
- for (int i = 0; i < 4096; i++)
- {
- x.Add(i);
- y.Add(variable.paint_wave[i]);
- }
- draw.drawingXY(flexChart1, x, y);
- }
-
- }
复制代码 为什么每次线程没两次运行时间都是差将近400ms而不是100ms左右,是哪里占用了时间
|
|