The series' datasource I used in the teechart is "text file" under "Edit" style, but when I update the data in the text file, the chart does not change at the same time. so I want to know how to realize the synchronous changes?
the version we used is "TeeChart2.0 for .net" and the control in asp.net we used is "WebChart".
Thanks a lot and looking forward the answer!!
A question about dataSource under Edit style
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi madis_xsy,
You can try updating your series data using:
You can try updating your series data using:
Code: Select all
WebChart1.Chart[0].CheckDataSource();
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I try the sentence "this.WebChart1.Chart[0].CheckDataSource();",but it still doesn't work, the chart is not update. i paste the code below, please check it for me ,thanks!
Code: Select all
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using Steema.TeeChart;
namespace _20060210CsChart
{
/// <summary>
/// test 的摘要说明。
/// </summary>
public class test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected Steema.TeeChart.Styles.Bar bar1;
protected Steema.TeeChart.Data.TextSource textSource1;
protected Steema.TeeChart.Web.WebChart WebChart1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
this.WebChart1.Visible=false;
this.WebChart1.Chart[0].CheckDataSource();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.bar1 = new Steema.TeeChart.Styles.Bar();
this.textSource1 = new Steema.TeeChart.Data.TextSource();
this.Button1.Click += new System.EventHandler(this.Button1_Click);
//
// bar1
//
//
// bar1.Brush
//
this.bar1.Brush.Color = System.Drawing.Color.Red;
this.bar1.DataSource = this.textSource1;
//
// bar1.Pen
//
this.bar1.Pen.Color = System.Drawing.Color.FromArgb(((System.Byte)(153)), ((System.Byte)(0)), ((System.Byte)(0)));
this.bar1.Title = "bar1";
//
// bar1.XValues
//
this.bar1.XValues.DataMember = "X";
this.bar1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
// bar1.YValues
//
this.bar1.YValues.DataMember = "Bar";
//
// textSource1
//
this.textSource1.DecimalSeparator = '.';
this.textSource1.Fields.AddRange(new Steema.TeeChart.Data.TextField[] {
new Steema.TeeChart.Data.TextField(2, "Text"),
new Steema.TeeChart.Data.TextField(0, "X"),
new Steema.TeeChart.Data.TextField(1, "Bar")});
this.textSource1.FileName = "C:\\Inetpub\\wwwroot\\20060210CsChart\\DataBar.txt";
this.textSource1.HeaderLines = 2;
this.textSource1.Series = this.bar1;
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
this.bar1.CheckDataSource();
this.WebChart1.Visible=true;
}
}
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi madis_xsy,
You should do something like this:
You should do something like this:
Code: Select all
private void button1_Click(object sender, System.EventArgs e)
{
TeeChart.Data.TextSource ts = new TeeChart.Data.TextSource(textBox2.Text);
try
{
Cursor = Cursors.WaitCursor;
if (ts.IsURL())
{
ts.HeaderLines = 2;
ts.Separator = ',';
ts.Fields.Add(0,"X");
ts.Fields.Add(1,"Bar");
ts.Fields.Add(2,"Text");
bar1.DataSource = ts;
}
}
finally
{
Cursor = Cursors.Default;
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |