How to connect teechart to sql server dataset/database

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

How to connect teechart to sql server dataset/database

Post by TelventUser » Wed May 02, 2012 10:11 pm

Can you please provide some details about teechart and sql server database connection. There is a series tab and a sub tab called data source in tee chart editor. when we select database from dropdown then dataset is empty. Can you please shed some light on it. How to utilize this feature.

Thanks.
Telvent user

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Thu May 03, 2012 12:03 pm

Hello TelventUser,

I recommend that take a look in the Asp Demo C:\Program Files\Steema Software\TeeChart for .NET 2010\TeeChartForNET concretely in Datasets examples and in the Tutorial8 - ADO.NET Database Access, if you have more problems or demo doesn't help you, please let me know.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Fri May 11, 2012 5:47 pm

Thanks Sandra,
with your help I am able to load data. Although I have another question.
In the .net sample examples , I am able to select right,left bottom and top axis at run time or design time using editor window properties.

But when I do the same thing with my database loaded graph using editor it is not displaying right or top axis.
Do you have any idea what step I am missing.

Thanks
Telvent user.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Mon May 14, 2012 9:24 am

Hello TelventUser,
But when I do the same thing with my database loaded graph using editor it is not displaying right or top axis. Do you have any idea what step I am missing.
Besides using to visible the right or top axis, you need assign the series HorizAxis and VerticalAxis to both. You can do it in run time or in design time with editor, you only need follow next steps:

Run time:
You must use next code to achieve as you want:

Code: Select all

  Series1.VertAxis = VerticalAxis.Both; or  line1.VertAxis = VerticalAxis.Right;
            Series1.HorizAxis = HorizontalAxis.Both; or  line1.HorizAxis = HorizontalAxis.Top;
Design time:
You must follow next steps:
1.- Open Editor
2.- Go to tab Series\General
3.- Select Horizontal and Vertical axes you want works as Horizontal or Vertical.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Wed May 23, 2012 11:13 pm

Thanks Sandra for your help. I am able to generate graphs from database using different axis with your help.
Another issue I am experiencing is, I installed infragistics win form on my server to use infragistics datagrid binded with the TChart object.

When I switch to design view in visual studio 2008 I am getting System.OutofMemoryException on UI window.
(I am using windows server 2008 server R2). My rest of the forms are correctly displaying designer windows along with all the infragistics controls e.g datagrid, comboboxes etc. But the forms on which I am using Steema TChart object are not showing up in designer window. And I am getting system.outofMemoryException error.

Do you have any idea what could be the reason of this.

Thanks for your help.
Telvent User.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Thu May 24, 2012 10:57 am

Hello TelventUser,
Another issue I am experiencing is, I installed infragistics win form on my server to use infragistics datagrid binded with the TChart object.
When I switch to design view in visual studio 2008 I am getting System.OutofMemoryException on UI window.
(I am using windows server 2008 server R2). My rest of the forms are correctly displaying designer windows along with all the infragistics controls e.g datagrid, comboboxes etc. But the forms on which I am using Steema TChart object are not showing up in designer window. And I am getting system.outofMemoryException error.
Can you tell us if you reproduce the same problem using TeeChart without infragistics components? On the other hand, would be very helpful for us, if you could say us, what is the control you are used in the WinForm where is produced the exception and standard component of where it is inherited?

Thanks,
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Fri May 25, 2012 3:13 pm

Yes, Actually I created a Test form without any infragistics control and when I switched to designer window I am getting the same error. Error screen shot is are attached. Although my code is successfully compiled and I am able to view the form and the graph at run time.

Below is my code behind file.

Thanks
Telvent User.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security;
using System.Security.Permissions;
using Steema.TeeChart;

namespace OASySDNA.GasHMI.MultiGraphForms
{
public partial class TestGraph : Form
{


private Steema.TeeChart.Axis leftAxis;
private Steema.TeeChart.Axis rightAxis;

private Steema.TeeChart.Styles.Bar volumeBar;
private Steema.TeeChart.Styles.Bar pressureBar;
//private Steema.TeeChart.Styles.Bar series;
Steema.TeeChart.TChart tChart1;

private void TestGraph_Load(object sender, EventArgs e)
{

}


public TestGraph()
{
// This call is required by the Windows Form Designer.
InitializeComponent();
InitializeChart();
volumeBar.CustomVertAxis = leftAxis;
pressureBar.CustomVertAxis = rightAxis;
volumeBar.Title = "Volume";
pressureBar.Title = "Pressure";

//Use of elected Partner Axes to limit GridLine zone
tChart1.Series[0].DataSource = GetGraphData("Meter1");
tChart1.Series[0].XValues.DateTime = true;
tChart1.Series[0].XValues.DataMember = "contractTime";
tChart1.Series[0].YValues.DataMember = "pressure";


tChart1.Series[1].DataSource = GetGraphData("Meter1");
tChart1.Series[1].XValues.DateTime = true;
tChart1.Series[1].XValues.DataMember = "contractTime";
tChart1.Series[1].YValues.DataMember = "volume";


}


private void InitializeChart()
{
tChart1.Dock = DockStyle.Fill;
this.Controls.Add(tChart1);
tChart1.DoubleClick += new EventHandler(tChart1_DoubleClick);
}


public DataSet GetGraphData(string objName)
{
DataSet TeeDataSet = new DataSet();
DataTable TeeDataTable = new DataTable();
MultiGraphProxy.ReadhourlyMeterReadings(TeeDataTable, objName);
TeeDataSet.Tables.Add(TeeDataTable);
return TeeDataSet;
}

void tChart1_DoubleClick(object sender, EventArgs e)
{
tChart1.ShowEditor();
}

}
}
Attachments
error1.png
error1.png (55.86 KiB) Viewed 15588 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Mon May 28, 2012 1:34 pm

Hello TelventUser,

I inform you that I can not reproduce your error using your code and last version of TeeChart. Can you please send us your project so we can try to open it here and reproduce your error that occurs in the designer ?

Thanks
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Mon Jun 04, 2012 7:36 pm

Hi Sandra,

I have few questions.

First question is, On this forum, I did not find any way to start a new post/thread. I only found "Post a reply" link at the bottom of an existing thread and I always click that and ask questions which is very confusing. Is there anyway I can start a totally new post.

Second question is On mouse right click event of the tchart I dont want context menu. I just want to use right click for the movement of the graph. Is there anyway I can hide the context menu on right click.

Thanks for your help.
Telvent User.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Tue Jun 05, 2012 10:31 am

Hello TelventUser,
First question is, On this forum, I did not find any way to start a new post/thread. I only found "Post a reply" link at the bottom of an existing thread and I always click that and ask questions which is very confusing. Is there anyway I can start a totally new post.
To made a New Topic you only need go to Board index ‹ TeeChart ‹ .NET and click NewTopic as you can see in next image:
Forum.jpg
Forum.jpg (300.56 KiB) Viewed 15519 times
Second question is On mouse right click event of the tchart I dont want context menu. I just want to use right click for the movement of the graph. Is there anyway I can hide the context menu on right click.
Can you tell us ican you tell us which IDE are you using(Winforms, Asp.Net, Wpf, Silverlight)? So we can try to find a good solution for you.

Thanks,
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Tue Jun 05, 2012 3:31 pm

Thanks Sandra,

I am using Winforms / visual studio 2008.

Telvent User

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Wed Jun 06, 2012 9:24 am

Hello TelventUser,
I just want to use right click for the movement of the graph. Is there anyway I can hide the context menu on right click.
If you refer to Context Menu appears when you click right button in design time, you need know that in design time you isn't allowed do scroll chart if you want change the axis range you only can do it using Editor->Axes->Axes(bottom, right,left,top or Depth) and change its properties. If you refer to run time, when you works in Winforms if you do click with right button to default the chart is scrolled.

Thanks,
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Wed Jun 06, 2012 2:44 pm

Hi Sandra,
I am refering to runtime. So when I click right mouse button the chart scrolls which is fine but also getting context menu which I do not want. I mean to say I just want to scroll the graph and dont want context menu to pop up. Is there anyway I can disable the context menu.

Thanks
Telvent User.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by Sandra » Thu Jun 07, 2012 9:26 am

Hello TelventUser,

I have made simple code where combine the MouseClick and Scroll Events so that when you scroll the chart the Context Menu is not active and if you do click with Left button the Context Menu is active again.

Code: Select all

        ToolStripMenuItem stripAfficheCharte;
        ContextMenuStrip contextMenu ;
        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {

            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.Line line1 = new Line(tChart1.Chart);
            line1.FillSampleValues();
            stripAfficheCharte = new ToolStripMenuItem("Action here");
            contextMenu = new ContextMenuStrip();
            contextMenu.Items.AddRange(new ToolStripItem[] { stripAfficheCharte });
            tChart1.MouseClick += new MouseEventHandler(tChart1_MouseClick);
        }

        void tChart1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.ContextMenuStrip = contextMenu;
                tChart1.Refresh();
            }
        }

        void tChart1_Scroll(object sender, EventArgs e)
        {
            this.ContextMenuStrip = null;
            tChart1.Refresh();
        }

Can you tell us if previous code works as you expect?

Thanks,
Best Regards,
Sandra Pazos / 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

TelventUser
Newbie
Newbie
Posts: 14
Joined: Mon Sep 12, 2011 12:00 am

Re: How to connect teechart to sql server dataset/database

Post by TelventUser » Thu Jun 07, 2012 4:01 pm

Hi Sandra,
I don't think the code is working as I am expecting. Look at the attachment, when I scroll the graph using right mouse button I am getting the menu which I want to disable or hide.
So basically I don't want the menu on left click neither on right click.

Thanks.
Attachments
ContextMenu.JPG
ContextMenu.JPG (56.49 KiB) Viewed 15456 times

Post Reply