Using as SQLmobile datasource with TeeChart.Pocket

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jelob
Newbie
Newbie
Posts: 2
Joined: Mon Oct 16, 2006 12:00 am

Using as SQLmobile datasource with TeeChart.Pocket

Post by Jelob » Wed Oct 18, 2006 1:11 pm

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!!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Oct 23, 2006 4:20 pm

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;
    }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Jelob
Newbie
Newbie
Posts: 2
Joined: Mon Oct 16, 2006 12:00 am

Post by Jelob » Thu Oct 26, 2006 6:36 am

Hi narcis,

I'm looking forward to the future releases. In the mean time i can live with the given solotion,

Thanks

Post Reply