Page 1 of 1
Using as SQLmobile datasource with TeeChart.Pocket
Posted: Wed Oct 18, 2006 1:11 pm
by 9642764
I'm trying to use a SQLmobile datasource to fill my TeeChart (Ce 5.0).
But it doesn't work at all.
Can someone help me out?
I have allready tried to fill it from a dataset but nothing
Help!!
Posted: Mon Oct 23, 2006 4:20 pm
by narcis
Hi Jelob,
TeeChart.Pocket.dll doesn't support DataSources for its series because Compact Framework 1.1 didn't support them. We will add this feature request to our wish-list to be implemented for future releases.
In the meantime, the solution is manually assigning data from a datasource to the series doing something like this:
Code: Select all
public Form1()
{
InitializeComponent();
#if VS2005
tChart1 = new TChart();
bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
tChart1.Location = new System.Drawing.Point(0, 0);
tChart1.Series.Add(this.bar1);
tChart1.Size = new System.Drawing.Size(this.Width, this.Height);
Controls.Add(this.tChart1);
#endif
tChart1.Panel.Color = Color.Wheat;
tChart1.Header.Text = "TeeChart for SmartDevice";
tChart1.Legend.Visible = false;
DataTable data = CreateDataSet();
for (int i = 0; i < data.Rows.Count; i++)
{
DataRow dr = data.Rows[i];
bar1.Add((Int32)dr["ID"], (Int32)dr["SALARY"], (String)dr["LASTNAME"]);
}
}
private DataTable CreateDataSet()
{
DataTable Employee = new DataTable();
DataColumn SALARY = new DataColumn("SALARY", Type.GetType("System.Int32"));
DataColumn ID = new DataColumn("ID", Type.GetType("System.Int32"));
DataColumn LASTNAME = new DataColumn("LASTNAME", Type.GetType("System.String"));
Employee.Columns.Add(SALARY);
Employee.Columns.Add(ID);
Employee.Columns.Add(LASTNAME);
DataRow dataRow;
dataRow = Employee.NewRow();
dataRow[SALARY] = 10000;
dataRow[ID] = 1;
dataRow[LASTNAME] = "Jones";
Employee.Rows.Add(dataRow);
dataRow = Employee.NewRow();
dataRow[SALARY] = 9000;
dataRow[ID] = 2;
dataRow[LASTNAME] = "Brown";
Employee.Rows.Add(dataRow);
dataRow = Employee.NewRow();
dataRow[SALARY] = 15000;
dataRow[ID] = 3;
dataRow[LASTNAME] = "Johnson";
Employee.Rows.Add(dataRow);
return Employee;
}
Posted: Thu Oct 26, 2006 6:36 am
by 9642764
Hi narcis,
I'm looking forward to the future releases. In the mean time i can live with the given solotion,
Thanks