关于teeChart 空间用法 大侠帮忙

fangkuai3 2009-04-05 11:10:51
相关用法 代码最好。还有就是我想实现那种动态的图,不知道该控件是否可以实现。
...全文
1095 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
wolfxin2010 2011-01-05
  • 打赏
  • 举报
回复
请问各位大侠,关于Teechart中的Add与AddArray的方法有什么区别,在.NET中好像没有AddArray方法...
beizu 2009-04-15
  • 打赏
  • 举报
回复
private void SetData(DataTable mydt,string title)
{
try
{
Steema.TeeChart.Styles.Line tmpLineSerise = new Steema.TeeChart.Styles.Line();

tmpLineSerise.DataSource = mydt;

tmpLineSerise.YValues.DataMember = mydt.Columns[2].ToString();
tmpLineSerise.LabelMember = mydt.Columns[1].ToString();
tmpLineSerise.Title = title;

tmpLineSerise.Pointer.Pen.Color = Color.Black;
tmpLineSerise.Pointer.Pen.Width = 1;
tmpLineSerise.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
tmpLineSerise.Pointer.VertSize = 1;
tmpLineSerise.Pointer.HorizSize = 1;
tmpLineSerise.Pointer.Visible = true;

this.tChart.Axes.Bottom.Title.Caption = "周期时间";
this.tChart.Series.Add(tmpLineSerise);
}
catch(Exception ee)
{
MessageBox.Show(ee.Message);
}
}
fangkuai3 2009-04-14
  • 打赏
  • 举报
回复
foreach (TeeChart.Styles.Series s in chart.Series)
{
// show only 50 points - delete the rest
while (s.Count > 50) s.Delete(0);
if(s.Count > 50) s.Delete(0);
newX = s.XValues.Last + 1;
newY = s.YValues.Last + 1000*rnd.Next(2) - 500;
if (Math.Abs(newY)>1.0e+4) newY = 0.0;
s.Add(newX,newY);
}
我跟踪代码 走不到这里面
深海之蓝 2009-04-13
  • 打赏
  • 举报
回复
不用发邮箱了,上边的代码我三次 发完了。。。
主要就是 那个核心函数
fangkuai3 2009-04-13
  • 打赏
  • 举报
回复
分数可以再加
fangkuai3 2009-04-13
  • 打赏
  • 举报
回复
哈哈··代码长可以发我邮箱332891525@qq.com
zzxap 2009-04-13
  • 打赏
  • 举报
回复
TeeChart控件的常见使用方法
http://download.csdn.net/source/796700
深海之蓝 2009-04-13
  • 打赏
  • 举报
回复
前边很多都是声明,可以拖控件自动填写
核心的代码是
private void AnimateSeries(Steema.TeeChart.TChart chart)
{
Random rnd = new Random();
double newX, newY;
chart.AutoRepaint = false;
foreach (TeeChart.Styles.Series s in chart.Series)
{
// show only 50 points - delete the rest
while (s.Count > 50) s.Delete(0);
if(s.Count > 50) s.Delete(0);
newX = s.XValues.Last + 1;
newY = s.YValues.Last + 1000*rnd.Next(2) - 500;
if (Math.Abs(newY)>1.0e+4) newY = 0.0;
s.Add(newX,newY);
}
chart.AutoRepaint = true;
chart.Refresh();
}

在这里调用
private void timer1_Tick(object sender, System.EventArgs e)
{
AnimateSeries(this.tChart1);
}

其他的你根据实际情况自己改一下就可以了,经测试通过!
深海之蓝 2009-04-13
  • 打赏
  • 举报
回复
//
// checkBox1
//
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkBox1.Location = new System.Drawing.Point(16, 7);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(67, 21);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "&Animate";
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// checkBox2
//
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkBox2.Location = new System.Drawing.Point(112, 7);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(46, 21);
this.checkBox2.TabIndex = 1;
this.checkBox2.Text = "&3D";
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 50;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// checkBox3
//
this.checkBox3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkBox3.Location = new System.Drawing.Point(192, 5);
this.checkBox3.Name = "checkBox3";
this.checkBox3.TabIndex = 2;
this.checkBox3.Text = "&Legend";
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
//
// Realtime
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 317);
this.Name = "Realtime";
this.Load += new System.EventHandler(this.Realtime_Load);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

private void AnimateSeries(Steema.TeeChart.TChart chart)
{
Random rnd = new Random();
double newX, newY;
chart.AutoRepaint = false;
foreach (TeeChart.Styles.Series s in chart.Series)
{
// show only 50 points - delete the rest
while (s.Count > 50) s.Delete(0);
if(s.Count > 50) s.Delete(0);
newX = s.XValues.Last + 1;
newY = s.YValues.Last + 1000*rnd.Next(2) - 500;
if (Math.Abs(newY)>1.0e+4) newY = 0.0;
s.Add(newX,newY);
}
chart.AutoRepaint = true;
chart.Refresh();
}

private void checkBox2_CheckedChanged(object sender, System.EventArgs e)
{
this.tChart1.Aspect.View3D = this.checkBox2.Checked;
}

private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
this.timer1.Enabled = this.checkBox1.Checked;
}

private void timer1_Tick(object sender, System.EventArgs e)
{
AnimateSeries(this.tChart1);
}

private void Realtime_Load(object sender, System.EventArgs e)
{
tChart1.Axes.Bottom.Increment = 5;
// add one sample value to each Series
lineSeries1.Add (1000);
lineSeries2.Add (1000);
lineSeries3.Add (1000);
lineSeries4.Add (1000);
}

private void checkBox3_CheckedChanged(object sender, System.EventArgs e)
{
tChart1.Legend.Visible=checkBox3.Checked;
}
}
}
深海之蓝 2009-04-13
  • 打赏
  • 举报
回复
//
// tChart1.Legend
//
this.tChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.LastValues;
this.tChart1.Legend.Visible = false;
this.tChart1.Location = new System.Drawing.Point(0, 80);
this.tChart1.Name = "tChart1";
//
// tChart1.Panel
//
//
// tChart1.Panel.Brush
//
this.tChart1.Panel.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)(254)), ((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(255)));
this.tChart1.Series.Add(this.lineSeries1);
this.tChart1.Series.Add(this.lineSeries2);
this.tChart1.Series.Add(this.lineSeries3);
this.tChart1.Series.Add(this.lineSeries4);
this.tChart1.Size = new System.Drawing.Size(488, 237);
//
// tChart1.Walls
//
//
// tChart1.Walls.Bottom
//
//
// tChart1.Walls.Bottom.Pen
//
this.tChart1.Walls.Bottom.Pen.Visible = false;
this.tChart1.Walls.Bottom.Size = 5;
//
// tChart1.Walls.Left
//
//
// tChart1.Walls.Left.Pen
//
this.tChart1.Walls.Left.Pen.Visible = false;
this.tChart1.Walls.Left.Size = 5;
//
// lineSeries1
//
//
// lineSeries1.Brush
//
this.lineSeries1.Brush.Color = System.Drawing.Color.Red;
//
// lineSeries1.Marks
//
//
// lineSeries1.Marks.Symbol
//
//
// lineSeries1.Marks.Symbol.Shadow
//
this.lineSeries1.Marks.Symbol.Shadow.Height = 1;
this.lineSeries1.Marks.Symbol.Shadow.Visible = true;
this.lineSeries1.Marks.Symbol.Shadow.Width = 1;
//
// lineSeries1.Pointer
//
//
// lineSeries1.Pointer.Brush
//
this.lineSeries1.Pointer.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)(254)), ((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(0)));
this.lineSeries1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.lineSeries1.Title = "lineSeries1";
//
// lineSeries1.XValues
//
this.lineSeries1.XValues.DataMember = "X";
this.lineSeries1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
// lineSeries1.YValues
//
this.lineSeries1.YValues.DataMember = "Y";
//
// lineSeries2
//
//
// lineSeries2.Brush
//
this.lineSeries2.Brush.Color = System.Drawing.Color.Green;
//
// lineSeries2.Marks
//
//
// lineSeries2.Marks.Symbol
//
//
// lineSeries2.Marks.Symbol.Shadow
//
this.lineSeries2.Marks.Symbol.Shadow.Height = 1;
this.lineSeries2.Marks.Symbol.Shadow.Visible = true;
this.lineSeries2.Marks.Symbol.Shadow.Width = 1;
//
// lineSeries2.Pointer
//
//
// lineSeries2.Pointer.Brush
//
this.lineSeries2.Pointer.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)(254)), ((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(0)));
this.lineSeries2.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.lineSeries2.Title = "lineSeries2";
//
// lineSeries2.XValues
//
this.lineSeries2.XValues.DataMember = "X";
this.lineSeries2.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
// lineSeries2.YValues
//
this.lineSeries2.YValues.DataMember = "Y";
//
// lineSeries3
//
//
// lineSeries3.Brush
//
this.lineSeries3.Brush.Color = System.Drawing.Color.Yellow;
//
// lineSeries3.Marks
//
//
// lineSeries3.Marks.Symbol
//
//
// lineSeries3.Marks.Symbol.Shadow
//
this.lineSeries3.Marks.Symbol.Shadow.Height = 1;
this.lineSeries3.Marks.Symbol.Shadow.Visible = true;
this.lineSeries3.Marks.Symbol.Shadow.Width = 1;
//
// lineSeries3.Pointer
//
//
// lineSeries3.Pointer.Brush
//
this.lineSeries3.Pointer.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)(254)), ((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(0)));
this.lineSeries3.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.lineSeries3.Title = "lineSeries3";
//
// lineSeries3.XValues
//
this.lineSeries3.XValues.DataMember = "X";
this.lineSeries3.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
// lineSeries3.YValues
//
this.lineSeries3.YValues.DataMember = "Y";
//
// lineSeries4
//
//
// lineSeries4.Brush
//
this.lineSeries4.Brush.Color = System.Drawing.Color.Blue;
//
// lineSeries4.Marks
//
//
// lineSeries4.Marks.Symbol
//
//
// lineSeries4.Marks.Symbol.Shadow
//
this.lineSeries4.Marks.Symbol.Shadow.Height = 1;
this.lineSeries4.Marks.Symbol.Shadow.Visible = true;
this.lineSeries4.Marks.Symbol.Shadow.Width = 1;
//
// lineSeries4.Pointer
//
//
// lineSeries4.Pointer.Brush
//
this.lineSeries4.Pointer.Brush.Color = System.Drawing.Color.FromArgb(((System.Byte)(254)), ((System.Byte)(0)), ((System.Byte)(0)), ((System.Byte)(0)));
this.lineSeries4.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.lineSeries4.Title = "lineSeries4";
//
// lineSeries4.XValues
//
this.lineSeries4.XValues.DataMember = "X";
this.lineSeries4.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
// lineSeries4.YValues
//
this.lineSeries4.YValues.DataMember = "Y";
深海之蓝 2009-04-13
  • 打赏
  • 举报
回复
动态的可以
晕 不让贴太长的代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;

using System.Windows.Forms;


namespace Steema.TeeChart.Samples
{
public class Realtime : Steema.TeeChart.Samples.BaseForm
{
private Steema.TeeChart.Styles.Line lineSeries1;
private Steema.TeeChart.Styles.Line lineSeries2;
private Steema.TeeChart.Styles.Line lineSeries3;
private Steema.TeeChart.Styles.Line lineSeries4;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.CheckBox checkBox3;
private System.ComponentModel.IContainer components = null;

public Realtime()
{
// This call is required by the Windows Form Designer.
InitializeComponent();
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region 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.components = new System.ComponentModel.Container();
this.lineSeries1 = new Steema.TeeChart.Styles.Line();
this.lineSeries2 = new Steema.TeeChart.Styles.Line();
this.lineSeries3 = new Steema.TeeChart.Styles.Line();
this.lineSeries4 = new Steema.TeeChart.Styles.Line();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(488, 48);
this.textBox1.Text = "Using series Delete method you can easily do realtime charting. \r\nScrolling and a" +
"xis range scaling is done automatically.";
//
// panel1
//
this.panel1.Controls.Add(this.checkBox3);
this.panel1.Controls.Add(this.checkBox2);
this.panel1.Controls.Add(this.checkBox1);
this.panel1.Location = new System.Drawing.Point(0, 48);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(488, 32);
//
// tChart1
//
//
// tChart1.Aspect
//
this.tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
this.tChart1.Aspect.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
//
// tChart1.Header
//
this.tChart1.Header.Lines = new string[] {
"tChart1"};
this.tChart1.Header.Visible = false;
fangkuai3 2009-04-13
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 assky124 的回复:]
动态图是可以实现的

具体的使用方法看说明书最好,如果安装的是正版的话,应该还有具体的使用例子


C# code
//在你的绘图触发事件中添加下面类似的代码
this.axTChart1.Series(0).Clear();
this.axTChart1.Series(0).AddArray(len,this.m_blockSegment,XArray);
[/Quote]
我从网上下的控件 呵呵。
静态的我可以做出来 就是需要动态的效果。 你要是还有例子的话让我看看。
fangkuai3 2009-04-13
  • 打赏
  • 举报
回复
我要实现的是动态画曲线的效果,要3D效果的。还有被的办法吗?
sushou2009 2009-04-13
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 llwinnner 的回复:]
前边很多都是声明,可以拖控件自动填写
核心的代码是
private void AnimateSeries(Steema.TeeChart.TChart chart)
{
Random rnd = new Random();
double newX, newY;
chart.AutoRepaint = false;
foreach (TeeChart.Styles.Series s in chart.Series)
{
// show only 50 points - delete the rest
while (s.Count > 50) s.Delete(0);
if(s.Count > 50) s.Delete(0);
newX = s.XValues.Last + 1;
newY…
[/Quote]
不错!好有耐心噢
assky124 2009-04-12
  • 打赏
  • 举报
回复
动态图是可以实现的

具体的使用方法看说明书最好,如果安装的是正版的话,应该还有具体的使用例子


//在你的绘图触发事件中添加下面类似的代码
this.axTChart1.Series(0).Clear();
this.axTChart1.Series(0).AddArray(len,this.m_blockSegment,XArray);
sushou2009 2009-04-12
  • 打赏
  • 举报
回复
学习下..不懂...
wuyq11 2009-04-11
  • 打赏
  • 举报
回复
myrroom 2009-04-11
  • 打赏
  • 举报
回复
没用过,我也学学
冷月孤峰 2009-04-06
  • 打赏
  • 举报
回复
没用过,好像是delphi下的控件吧
fanbo 2009-04-06
  • 打赏
  • 举报
回复
好像知道的人不多啊。
加载更多回复(1)

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧