2013-03-20 4 views
0

나는 각 그래프에 4 개의 속기가있는 16 개의 그래프 [최대]를가집니다. 각 그래프에서 3 개의 괄호는 최소, 최대 및 이상적인 값을 나타냅니다. 제 4 속보는 하드웨어의 실제 값입니다. 18,000 개의 샘플을 테스트해야합니다. 따라서 처음 세 줄은 이미 그려져 있고 스위치가 켜져 있고 데이터가 들어 오면 네 번째 줄이 그려집니다. 네 번째 줄을 그리기 위해 Series4.Add (actualvalue, "", color.red) 메서드를 사용합니다. 여기에 문제가 있습니다. 4 번째 줄에 샘플을 그릴 때마다 그 표본의 플롯을보기 위해 표를 새로 고쳐야합니다. 또한 각각 18,000 개의 샘플로 다른 3 개의 fastline을 다시 그립니다. 그래서 많은 샘플을 반복해서 사용하지 않고 다시 그립니다. 나는 단 4 번째 단도를 그릴 필요가있다. 배열을 사용하여 값을 채운 다음 미리 값이 없기 때문에 패스트 라인의 소스로 지정할 수 없습니다. 내가 series4.repaint() 메소드와 series4.refreshseries() 메소드를 시도했지만 실제로 4th 시리즈를 다시 칠하지 않았다. 전체 차트를 새로 고쳐야합니다. 따라서 각각의 고속도로 [18,000]에서 많은 수의 샘플과 4 개의 고속도로가있는 하나의 그래프와 이와 같이 총 16 개의 그래프로 인해 성능이 저하됩니다.tchart refresh()의 속도를 높이는 방법은 무엇입니까?

이미 완료했습니다 Series4.AutoRepaint = false, Series4.DrawAllPoints = false; Series4.XValues.Order = ValueListOrder.None, Series4.YValues.Order = ValueListOrder.None

성능을 향상시킬 수있는 방법이 있습니까? 감사합니다.

답변

2

간단한 코드를 만들었습니다. 여기서는 초기화 값을 추가하는 테이블과 Series4의 값만 업데이트 한 후 각 고속 회선에 대해 4 개의 FastLines 및 18000 개의 점을 추가했습니다. 성능은 드로잉 할 값의 수에 유용합니다.

 public Form1() 
    { 
     InitializeComponent(); 
     InitializeChart(); 
    } 

    // Steema.TeeChart.Styles.FastLine Series1; 

    Timer timer1, timer2,timer3, timer4; 
    Random r; 
    DateTime dt; 
    DateTime[] Xvalues1; 
    double[] Yvalues1; 
    Steema.TeeChart.TChart tChart1, tChart2, tChart3,tChart4; 
    private void InitializeChart() 
    { 

     tChart1 = new TChart(); 
     tChart2 = new TChart(); 
     tChart3 = new TChart(); 
     tChart4 = new TChart(); 
     this.Controls.Add(tChart1); 
     this.Controls.Add(tChart2); 
     this.Controls.Add(tChart3); 
     this.Controls.Add(tChart4); 

     //Initialize Locations and size 

     this.Width = 908; 
     this.Height = 600; 

     //Location 
     tChart1.Left = 12; 
     tChart1.Top = 53; 
     tChart2.Left = 468; 
     tChart2.Top = 53; 
     tChart3.Left = 12; 
     tChart3.Top = 318; 
     tChart4.Left = 468; 
     tChart4.Top = 318; 

     //Size 
     tChart1.Width = 373; 
     tChart1.Height = 236; 
     tChart2.Width = 373; 
     tChart2.Height = 236; 
     tChart3.Width = 373; 
     tChart3.Height = 236; 
     tChart4.Width = 373; 
     tChart4.Height = 236;  

     tChart1.Aspect.View3D = false; 
     tChart2.Aspect.View3D = false; 
     tChart3.Aspect.View3D = false; 
     tChart4.Aspect.View3D = false; 

     tChart1.Legend.Visible = false; 
     tChart2.Legend.Visible = false; 
     tChart3.Legend.Visible = false; 
     tChart4.Legend.Visible = false; 


     tChart1.Panel.Gradient.Visible = false; 
     tChart2.Panel.Gradient.Visible = false; 
     tChart3.Panel.Gradient.Visible = false; 
     tChart4.Panel.Gradient.Visible = false; 


     tChart1.Axes.Bottom.AxisPen.Visible = false; 
     tChart2.Axes.Bottom.AxisPen.Visible = false; 
     tChart3.Axes.Bottom.AxisPen.Visible = false; 
     tChart4.Axes.Bottom.AxisPen.Visible = false; 

     tChart1.Axes.Left.AxisPen.Visible = false; 
     tChart2.Axes.Left.AxisPen.Visible = false; 
     tChart3.Axes.Left.AxisPen.Visible = false; 
     tChart4.Axes.Left.AxisPen.Visible = false; 

     //Series 
     tChart1.AutoRepaint = false; 
     tChart2.AutoRepaint = false; 
     tChart3.AutoRepaint = false; 
     tChart4.AutoRepaint = false; 

     for (int i = 0; i < 4; i++) 
     { 
      new Steema.TeeChart.Styles.FastLine(tChart1.Chart); 
      new Steema.TeeChart.Styles.FastLine(tChart2.Chart); 
      new Steema.TeeChart.Styles.FastLine(tChart3.Chart); 
      new Steema.TeeChart.Styles.FastLine(tChart4.Chart); 

      tChart1[i].XValues.DateTime=true; 
      tChart2[i].XValues.DateTime = true; 
      tChart3[i].XValues.DateTime = true; 
      tChart4[i].XValues.DateTime = true; 
      InitialDataSeries(tChart1[i]); 
      InitialDataSeries(tChart2[i]); 
      InitialDataSeries(tChart3[i]); 
      InitialDataSeries(tChart4[i]); 

     } 

     //Axes labels 
     tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM"; 
     tChart1.Axes.Bottom.Labels.Angle = 90; 
     tChart2.Axes.Bottom.Labels.DateTimeFormat = "dd/MM"; 
     tChart2.Axes.Bottom.Labels.Angle = 90; 
     tChart3.Axes.Bottom.Labels.DateTimeFormat = "dd/MM"; 
     tChart3.Axes.Bottom.Labels.Angle = 90; 
     tChart4.Axes.Bottom.Labels.DateTimeFormat = "dd/MM"; 
     tChart4.Axes.Bottom.Labels.Angle = 90; 
     tChart1.AutoRepaint = true; 
     tChart2.AutoRepaint = true; 
     tChart3.AutoRepaint = true; 
     tChart4.AutoRepaint = true; 
     tChart1.Refresh(); 
     tChart2.Refresh(); 
     tChart3.Refresh(); 
     tChart4.Refresh(); 

     //Timer 
     timer1 = new Timer(); 
     timer1.Start(); 
     timer1.Interval = 100; 
     timer1.Tick += new EventHandler(timer1_Tick); 

    } 

    void timer1_Tick(object sender, EventArgs e) 
    { 
     //See the chart data updated. 
     tChart1[0].Visible = false; 
     tChart1[1].Visible = false; 
     tChart1[2].Visible = false; 
     PopulateSeries(tChart1[3]); 
     PopulateSeries(tChart2[3]); 
     PopulateSeries(tChart3[3]); 
     PopulateSeries(tChart4[3]); 

    } 
    private void PopulateSeries(Steema.TeeChart.Styles.Series Series1) 
    { 
     r = new Random(); 
     dt = DateTime.Now; 
     tChart1.AutoRepaint = false; 
     tChart2.AutoRepaint = false; 
     tChart3.AutoRepaint = false; 
     tChart4.AutoRepaint = false; 
     // show only 50 points - delete the rest 
     while (Series1.Count > 10000) 
     { 
      Series1.Delete(0); 

     } 
     if (Series1.Count > 10000) 
     { 
      Series1.Delete(0); 

     } 
     else 
     { 
      for (int t = 0; t < 100; t++) 
      { 

       Series1.Add(dt, r.Next(1000)); 
       dt = dt.AddSeconds(15); 
      } 
     } 
     tChart1.AutoRepaint = true; 
     tChart2.AutoRepaint = true; 
     tChart3.AutoRepaint = true; 
     tChart4.AutoRepaint = true; 
     tChart1.Refresh(); 
     tChart2.Refresh(); 
     tChart3.Refresh(); 
     tChart4.Refresh(); 
    } 

    private void InitialDataSeries(Steema.TeeChart.Styles.Series Series1) 
    {  
     //Arrays 
     dt = DateTime.Now; 
     r = new Random(); 
     Xvalues1 = new DateTime[18000]; 
     Yvalues1 = new double[18000]; 
     (Series1 as Steema.TeeChart.Styles.FastLine).DrawAllPoints = false; 
     for (int j = 0; j < 18000; j++) 
     { 
      Xvalues1[j] = dt; 
      dt = dt.AddSeconds(15); 
      Yvalues1[j] = r.Next(1000); 
     } 

     Series1.Add(Xvalues1, Yvalues1); 
    } 

도움이 될지 알려주세요. 반면, 내 코드가 도움이되지 않으면 TeeChartDirect2D를 사용하는 것이 좋습니다. 이는 DSP 실시간 애플리케이션에 필요한 고속 데이터 처리량에 이상적입니다. 자세한 내용은 백서, Boosting graphics-rendering performance in Windows Forms을 참조하십시오.

고마워요,

+0

고맙습니다.하지만 다른 3 줄을 보이지 않게 할 수는 없습니다. 나는 min 최대 및 이상 한계로 실시간으로 네 번째 줄의 위치를보고 싶습니다. 그래서 그들을 보이지 않게 만든 후에, 그것은 훌륭한 속도로 끌립니다. 하지만 난 다른 3 라인을 숨길 수 없다. 그래서, 나는 fastline.visible = false와 fastline.active = false를 할 수 없다. 놀랍게도 활성 상태는 또한 빠른 회선을 숨 깁니다. 그래서 똑같은 목적으로 활동적이고 가시적 인 것처럼 보입니다. Fastline.draw(), fastline.repaint(), fastline.refreshseries()를 사용하여 4 번째 행만 업데이트 할 수있는 방법이 있습니까? –

+0

나는 또한 direct2d 데모를 다운로드하려고 시도했다. graphicscontrol.dll이 winforms 앱에 없습니다. zip 파일을 검색했지만 그와 같은 dll 파일이 없습니다. Matrix3x2가 존재하지 않는다고 말합니다. –

+0

또한 private void PopulateSeries (Steema.TeeChart.Styles.Series Series1) 및 private void InitialDataSeries (Steema.TeeChart.Styles.Series Series1)입니다. 그것은 Steema.TeeChart.Styles가 아니어야합니다. Steema.TeeChart.Styles.Series 대신 –

관련 문제