找回密码
 立即注册

QQ登录

只需一步,快速开始

anyczy

注册会员

3

主题

15

帖子

105

积分

注册会员

积分
105
最新发帖
anyczy
注册会员   /  发表于:2020-11-11 21:47  /   查看:2147  /  回复:3
  1. <span style="font-size: 14px;">private static List<DataItem> CreateData(List<double> DataX, List<double> DataY)</span>
复制代码
上面是我flex chart画图Draw类的函数
下面是我的线程部分
  1. <blockquote><span style="font-size: 14px;">            DispatcherTimer Timer_paint = new DispatcherTimer(DispatcherPriority.Normal, this.Dispatcher);</span>
复制代码
为什么每次线程没两次运行时间都是差将近400ms而不是100ms左右,是哪里占用了时间

3 个回复

倒序浏览
anyczy
注册会员   /  发表于:2020-11-11 21:49:18
沙发
这个代码不知道为什么看不见,我重新上传一次
下面是画图部分代码
  1. public static void drawingXY(C1.WPF.Chart.C1FlexChart flexChart, List<double> DataX, List<double> DataY)
  2.         {
  3.             flexChart.DataContext = CreateData(DataX, DataY);
  4.             C1.WPF.Chart.Series series1 = new C1.WPF.Chart.Series();
  5.             flexChart.Series.Add(series1);
  6.             flexChart.Series[0].BindingX = "dataX";
  7.             flexChart.Series[0].Binding = "dataY";
  8.             //flexChart.ChartType = C1.Chart.ChartType.Area;
  9.             flexChart.LegendPosition = C1.Chart.Position.Right;
  10.         }
  11.         private static List<DataItem> CreateData(List<double> DataX, List<double> DataY)
  12.         {
  13.             var data = new List<DataItem>();
  14.             //fileOper read = new fileOper();
  15.             //read.read();
  16.             for (int i = 0; i < DataY.Count; i++)
  17.             {
  18.                 data.Add(new DataItem(DataX[i], DataY[i]));
  19.             }
  20.             return data;
  21.         }
复制代码
回复 使用道具 举报
anyczy
注册会员   /  发表于:2020-11-11 21:51:43
板凳
下面是线程部分
  1. DispatcherTimer Timer_paint = new DispatcherTimer(DispatcherPriority.Normal, this.Dispatcher);
  2.             Timer_paint.Interval = new TimeSpan(0, 0, 0, 0, 100);
  3.             Timer_paint.Tick += TimerPaint_Tick;
  4.             Timer_paint.Start();


  5. private void TimerPaint_Tick(object sender, EventArgs e)
  6.         {
  7.             List<double> x = new List<double>();
  8.             List<double> y = new List<double>();
  9.             //if (variable.bopen232)
  10.             {
  11.                
  12.                 for (int i = 0; i < 4096; i++)
  13.                 {
  14.                     x.Add(i);
  15.                     y.Add(variable.paint_wave[i]);
  16.                 }
  17.                 draw.drawingXY(flexChart1, x, y);
  18.             }
  19.             
  20.         }
复制代码
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2020-11-12 09:54:09
地板
我看到你在WPF板块已经发帖,我在那边给你回复。
麻烦后面也在对应的开发平台板块来发帖,
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部