2013-05-31 1 views
0

를 고정합니다. 양식에 나는 또한 타이머를 시작하는 엉덩이가 있습니다. 모든 타이머 경과 이벤트에서 2048 개의 무작위 데이터 샘플을 생성하고 Fasline 시리즈를 업데이트합니다. 타이머를 시작하면 TChart에는 애니메이션이 없습니다! 그것은 무작위로 작동하는 것 같다 ... 그리고 내가 숨기고 양식을 (최소화/최대화, 또는 tChart1.Hide()/tChart1.Show()) 다음 애니메이션을 다시 시작하거나, 또는 내가 타이머를 시작하기 전에 ColorBand 라인 중 하나를 드래그하면 애니메이션이 작동합니다. 하지만 먼저 타이머를 시작하면 애니메이션이 작동하지 않습니다. 그리고, 그것이 작동하지 않을 때, TChart가 고정되어있는 것처럼 보입니다. 즉, 팬이나 확대/축소 같은 마우스 명령에 응답하지 않습니다. 내 form.designer.cs에서TChart입니다 Control은 Fastline 시리즈와 ColorBand 도구를 사용하여, 나는 TChart입니다 구성 요소가

: 내 form.cs에서

partial class Form1 
{ 
    /// <summary> 
    /// Required designer variable. 
    /// </summary> 
    private System.ComponentModel.IContainer components = null; 

    /// <summary> 
    /// Clean up any resources being used. 
    /// </summary> 
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 
    protected override void Dispose(bool disposing) 
    { 
     if (disposing && (components != null)) 
     { 
      components.Dispose(); 
     } 
     base.Dispose(disposing); 
    } 

    #region Windows Form Designer generated code 

    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor. 
    /// </summary> 
    private void InitializeComponent() 
    { 
     this.button1 = new System.Windows.Forms.Button(); 
     this.tChart1 = new Steema.TeeChart.TChart(); 
     this.checkBox1 = new System.Windows.Forms.CheckBox(); 
     this.SuspendLayout(); 
     // 
     // button1 
     // 
     this.button1.BackColor = System.Drawing.SystemColors.Control; 
     this.button1.Location = new System.Drawing.Point(12, 12); 
     this.button1.Name = "button1"; 
     this.button1.Size = new System.Drawing.Size(60, 23); 
     this.button1.TabIndex = 1; 
     this.button1.Text = "Start"; 
     this.button1.UseVisualStyleBackColor = false; 
     this.button1.Click += new System.EventHandler(this.button1_Click); 
     // 
     // tChart1 
     // 
     // 
     // 
     // 
     // 
     // 
     // 
     this.tChart1.Axes.Depth.LabelsAsSeriesTitles = true; 
     // 
     // 
     // 
     this.tChart1.Axes.DepthTop.LabelsAsSeriesTitles = true; 
     this.tChart1.Location = new System.Drawing.Point(12, 41); 
     this.tChart1.Name = "tChart1"; 
     this.tChart1.Size = new System.Drawing.Size(789, 318); 
     this.tChart1.TabIndex = 2; 
     // 
     // checkBox1 
     // 
     this.checkBox1.AutoSize = true; 
     this.checkBox1.Location = new System.Drawing.Point(78, 16); 
     this.checkBox1.Name = "checkBox1"; 
     this.checkBox1.Size = new System.Drawing.Size(49, 17); 
     this.checkBox1.TabIndex = 3; 
     this.checkBox1.Text = "Drag"; 
     this.checkBox1.UseVisualStyleBackColor = true; 
     this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click); 
     // 
     // Form1 
     // 
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
     this.ClientSize = new System.Drawing.Size(823, 371); 
     this.Controls.Add(this.checkBox1); 
     this.Controls.Add(this.tChart1); 
     this.Controls.Add(this.button1); 
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; 
     this.Name = "Form1"; 
     this.Text = "Form1"; 
     this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); 
     this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged); 
     this.ResumeLayout(false); 
     this.PerformLayout(); 

    } 

    #endregion 

    private System.Windows.Forms.Button button1; 
    private Steema.TeeChart.TChart tChart1; 
    private System.Windows.Forms.CheckBox checkBox1; 
} 

: 그리고

public partial class Form1 : Form 
{ 
    System.Timers.Timer timer; 
    private Steema.TeeChart.Tools.ColorBand tool; 
    Steema.TeeChart.Styles.FastLine primaryLine; 
    double w = 0; 
    bool enabled = false; 

    public Form1() 
    { 
     InitializeComponent(); 
     initPrimaryGraph(); 
     initTool(); 

     timer = new System.Timers.Timer(); 
     timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); 
     timer.Interval = 50; 
     timer.Stop(); 
    } 

    private void timer_Elapsed(object sender, ElapsedEventArgs e) 
    { 
     Random rnd = new Random(); 
     for (int i = 0; i < 2048; i++) 
     { 
      primaryLine.XValues[i] = i; 
      primaryLine.YValues[i] = 20 + rnd.Next(50); 
     } 
     primaryLine.BeginUpdate(); 
     primaryLine.EndUpdate(); 
    } 

    private void initTool() 
    { 
     tool = new Steema.TeeChart.Tools.ColorBand(); 
     tChart1.Tools.Add(tool); 
     tool.Axis = tChart1.Axes.Bottom; 
     tool.Start = 300; 
     tool.End = 400; 
     tool.Brush.Color = Color.Yellow; 
     tool.Pen.Color = Color.Blue; 
     tool.Pen.Width = 2; 
     tool.Transparency = 60; 

     tool.StartLine.AllowDrag = true; 
     tool.StartLine.DragRepaint = true; 
     tool.ResizeStart = true; 
     tool.StartLine.DragLine += new EventHandler(StartLine_DragLine); 

     tool.EndLine.AllowDrag = true; 
     tool.EndLine.DragRepaint = true; 
     tool.ResizeEnd = true; 
     tool.EndLine.DragLine += new EventHandler(EndLine_DragLine); 
    } 

    void StartLine_DragLine(object sender, EventArgs e) 
    { 
     if (enabled) 
     { 
      tool.End = tool.Start + w; 
     } 
    } 

    void EndLine_DragLine(object sender, EventArgs e) 
    { 
     if (enabled) 
     { 
      tool.Start = tool.End - w; 
     } 
    } 

    private void initPrimaryGraph() 
    { 
     tChart1.Header.Visible = true; 

     tChart1.Axes.Bottom.Automatic = false; 
     tChart1.Axes.Bottom.Minimum = 0; 
     tChart1.Axes.Bottom.Maximum = 2048; 
     tChart1.Axes.Bottom.Labels.Font.Color = Color.White; 
     tChart1.Axes.Bottom.Grid.Visible = false; 

     tChart1.Axes.Left.Automatic = false; 
     tChart1.Axes.Left.Minimum = 0; 
     tChart1.Axes.Left.Maximum = 300; 
     tChart1.Axes.Left.Labels.Font.Color = Color.White; 

     tChart1.Aspect.View3D = false; 

     tChart1.Walls.Back.Visible = false; 
     tChart1.Walls.Bottom.Visible = false; 
     tChart1.Walls.Left.Visible = false; 
     tChart1.Walls.Right.Visible = false; 

     tChart1.Legend.Visible = false; 
     tChart1.BackColor = Color.Black; 
     tChart1.Panel.Visible = false; 

     //PRIMARY GRAPH..... 
     primaryLine = new Steema.TeeChart.Styles.FastLine(); 
     tChart1.Series.Add(primaryLine); 
     Random rnd = new Random(); 
     for (int i = 0; i < 2048; i++) 
     { 
      double x = i; 
      double y = 20 + rnd.Next(50); 
      primaryLine.Add(x, y); 
     } 
     primaryLine.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Solid; 
     primaryLine.LinePen.Color = Color.White; 
     primaryLine.LinePen.Width = 1; 
     primaryLine.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left; 
    } 

    private void tool_DragLine(object sender, EventArgs e) 
    { 
     Steema.TeeChart.Tools.ColorLine t = sender as Steema.TeeChart.Tools.ColorLine; 
     this.Text = t.Value.ToString(); 
    } 

    private void button1_Click(object sender, EventArgs e) 
    { 
     if (timer.Enabled) 
     { 
      timer.Stop(); 
      button1.Text = "Start"; 
     } 
     else 
     { 
      timer.Start(); 
      button1.Text = "Stop"; 
     } 
    } 

    private void Form1_FormClosing(object sender, FormClosingEventArgs e) 
    { 
     timer.Stop(); 
    } 

    private void checkBox1_Click(object sender, EventArgs e) 
    { 
     if (checkBox1.Checked) 
     { 
      w = tool.End - tool.Start; 
     } 
     enabled = checkBox1.Checked; 
    } 
} 

나는 또 다른 질문이 몇 가지 코드입니다. TeeChart 구성 요소의 블랙 박스 구현을 만들려면 특정 기능을 노출 할 수있는 사용자 지정 API (사용자 지정 사용자 정의 컨트롤)를 작성하여 다른 프로젝트에서 사용할 수있게하고 직장 동료 중 한 명 이상이 프로젝트에서 사용하십시오. 다양한 프로젝트/컴퓨터에서 사용할 수있는 사용자 정의 구성 요소/dll에 TeeChart 기능을 포함시킬 수있는 TeeChart의 어떤 버전/라이센스를 구입해야합니까? 사전에

덕분에

답변

0

:-) 나는 Fastline 시리즈와 ColorBand 도구와 더불어, TChart입니다 구성 요소가 있습니다. 양식에 나는 또한 타이머를 시작하는 엉덩이가 있습니다. 모든 타이머 경과 이벤트에 나는 무작위 데이터 및 업데이트 Fasline 시리즈의 2048 개 샘플을 생성합니다. 타이머를 시작하면 에 애니메이션이 없습니다! 그것은 무작위,하지만 ... 그리고, 나는 숨길 때 이 양식을 보여 작동하는 것 같다 (또는) tChart1.Hide (가/최소화 극대화/tChart1.Show은()) 다음 애니메이션이 다시 작동하기 시작, 또는 타이머를 시작하기 전에 ColorBand 선 중 하나를 끌면 애니메이션이 작동합니다. 하지만 애니메이션이 작동하지 않습니다 타이머를 먼저 시작합니다. 그리고, additionaly, 그것이 작동하지 않는 경우에는 TChart입니다은 즉, 구약 패닝 또는 확대 등의 명령을 어떤 마우스에 응답하지 않는, 냉동 것으로 보인다. 다음은 몇 가지 코드입니다.

약간의 코드가 수정되었지만 이제는 제 코드가 작동합니다. 다음을 참조하십시오 :

Timer timer; 
    private Steema.TeeChart.Tools.ColorBand tool; 
    Steema.TeeChart.Styles.FastLine primaryLine; 
    double w = 0; 
    bool enabled = false; 

    public Form1() 
    { 
     InitializeComponent(); 
     initPrimaryGraph(); 
     initTool(); 

     timer = new Timer(); 
     //Enable Timer 
     timer.Enabled = true; 
     timer.Interval = 50; 
     timer.Tick += timer_Tick; 
    } 

    void timer_Tick(object sender, EventArgs e) 
    { 

     AnimateSeries(tChart1); 
    } 

    private void AnimateSeries(TChart tChart) 
    { 
     Random rnd = new Random(); 
     tChart.AutoRepaint = false; 
     primaryLine.BeginUpdate(); 
     foreach (Steema.TeeChart.Styles.Series s in tChart.Series) 
     {   
      for (int i = 0; i < 2048; i++) 
      { 
       primaryLine.XValues[i] = i; 
       primaryLine.YValues[i] = 20 + rnd.Next(50); 
      } 

     } 

     tChart.AutoRepaint = true; 
     primaryLine.EndUpdate(); 
    } 
    private void initTool() 
    { 
     tool = new Steema.TeeChart.Tools.ColorBand(); 
     tChart1.Tools.Add(tool); 
     tool.Axis = tChart1.Axes.Bottom; 
     tool.Start = 300; 
     tool.End = 400; 
     tool.Brush.Color = Color.Yellow; 
     tool.Pen.Color = Color.Blue; 
     tool.Pen.Width = 2; 
     tool.Transparency = 60; 

     tool.StartLine.AllowDrag = true; 
     tool.StartLine.DragRepaint = true; 
     tool.ResizeStart = true; 
     tool.StartLine.DragLine += new EventHandler(StartLine_DragLine); 

     tool.EndLine.AllowDrag = true; 
     tool.EndLine.DragRepaint = true; 
     tool.ResizeEnd = true; 
     tool.EndLine.DragLine += new EventHandler(EndLine_DragLine); 
    } 

    void StartLine_DragLine(object sender, EventArgs e) 
    { 
     if (enabled) 
     { 
      tool.End = tool.Start + w; 
     } 
    } 

    void EndLine_DragLine(object sender, EventArgs e) 
    { 
     if (enabled) 
     { 
      tool.Start = tool.End - w; 
     } 
    } 

    private void initPrimaryGraph() 
    { 
     tChart1.Header.Visible = true; 
     tChart1.Aspect.View3D = false; 

     tChart1.Walls.Back.Visible = false; 
     tChart1.Walls.Bottom.Visible = false; 
     tChart1.Walls.Left.Visible = false; 
     tChart1.Walls.Right.Visible = false; 

     tChart1.Legend.Visible = false; 
     tChart1.BackColor = Color.Black; 
     tChart1.Panel.Visible = false; 

     //PRIMARY GRAPH..... 
     primaryLine = new Steema.TeeChart.Styles.FastLine(); 
     tChart1.Series.Add(primaryLine); 
     Random rnd = new Random(); 
     for (int i = 0; i < 2048; i++) 
     { 
      double x = i; 
      double y = 20 + rnd.Next(50); 
      primaryLine.Add(x, y); 
     } 
     primaryLine.LinePen.Style = System.Drawing.Drawing2D.DashStyle.Solid; 
     primaryLine.LinePen.Color = Color.White; 
     primaryLine.LinePen.Width = 1; 
     //AXES 
     tChart1.Axes.Bottom.Automatic = false; 
     tChart1.Axes.Bottom.Minimum = primaryLine.XValues.Minimum; 
     tChart1.Axes.Bottom.Maximum = primaryLine.XValues.Maximum; 
     tChart1.Axes.Bottom.Increment = 200; 
     tChart1.Axes.Bottom.Labels.Font.Color = Color.White; 
     tChart1.Axes.Bottom.Grid.Visible = false; 
     tChart1.Axes.Left.Automatic = false; 
     tChart1.Axes.Left.Minimum = 0; 
     tChart1.Axes.Left.Maximum = 300; 

     tChart1.Axes.Left.Labels.Font.Color = Color.White; 
     primaryLine.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left; 
     tChart1.Draw(); 
    } 

    private void tool_DragLine(object sender, EventArgs e) 
    { 
     Steema.TeeChart.Tools.ColorLine t = sender as Steema.TeeChart.Tools.ColorLine; 
     this.Text = t.Value.ToString(); 
    } 

    private void button1_Click(object sender, EventArgs e) 
    { 
     if (timer.Enabled) 
     { 
      timer.Stop(); 
      button1.Text = "Start"; 
     } 
     else 
     { 
      timer.Start(); 
      button1.Text = "Stop"; 
     } 
    } 

    private void Form1_FormClosing(object sender, FormClosingEventArgs e) 
    { 
     timer.Stop(); 
    } 

을 당신은 내가 더 적절하다고 판단하는 기타에 대한 타이머의 종류를 변경 한 코드에서 볼 수있다. 이전 코드가 예상대로 작동하는지 알려줄 수 있습니까?

나는 또 다른 질문이 있습니다. TeeChart 구성 요소의 블랙 박스 구현을 만들고 특정 기능을 노출하기 위해 사용자 지정 API (사용자 지정 사용자 컨트롤)를 작성하여 다른 프로젝트에서 사용할 수있게하고 하나 이상의 동료 직장에서 프로젝트에서 사용할 수 있습니다. 나는 나를 다양한 프로젝트/컴퓨터를 통해 사용할 수있는 사용자 정의 구성 요소/DLL에서의 TeeChart의 기능을 래핑 할 수 있도록 것이다 TeeChart는 어떤 버전/라이센스를 구입 해야합니까?

teeChart는 teeChart의 특정 특징을 게시하는 다른 designtime 어셈블리 (dll)에 의해 재사용 될 수 있습니다. 제발 구성 요소를 재사용하는 기계는 TeeChart 개발자 라이센스를 설치해야합니다.

희망합니다.

감사합니다,

+0

내가 당신의 제안을 시도하고 내가 :-) 다 했어 때 나중에 당신에게 피드백을 줄 것이다, 당신을 감사 – user1980088