Exception with Pie Chart with no data
Exception with Pie Chart with no data
Hi
I have a pie chart with a MarksTip and with one series however there is no data in the series ( Chart.Series[0].Count == 0 ) . When displaying it
I get the title with nothing displayed in the graph area. That is OK.
HOWEVER When the mouse is on the empty graph area I get an exception . I removed the marks tip from my code but then got a second exception .
See both exceptions below
EXCEPTION With MarksTip
System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.Styles.Pie.CalcClickedPie(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Pie.Clicked(Int32 x, Int32 y)
at Steema.TeeChart.Tools.MarksTip.FindClickedSeries(Int32 x, Int32 y, Int32& index)
at Steema.TeeChart.Tools.MarksTip.MouseEvent(MouseEventKinds kind, MouseEventArgs e, Cursor& c)
at Steema.TeeChart.Chart.BroadcastMouseEvent(MouseEventKinds kind, MouseEventArgs e, Cursor& c)
at Steema.TeeChart.Chart.BroadcastMouseEvent(MouseEventKinds kind, MouseEventArgs e)
at Steema.TeeChart.TChart.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
EXCEPTION without MarksTip
reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.Styles.Pie.CalcClickedPie(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Pie.Clicked(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Series.CheckMouse(Cursor& c, Int32 x, Int32 y)
at Steema.TeeChart.Chart.CheckMouseSeries(Cursor& c, Int32 X, Int32 Y)
at Steema.TeeChart.Chart.DoMouseMove(Int32 x, Int32 y, Cursor& c)
at Steema.TeeChart.TChart.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Please help me avoid getting an exception when mouse hovers over graph area.
Thanks.
I have a pie chart with a MarksTip and with one series however there is no data in the series ( Chart.Series[0].Count == 0 ) . When displaying it
I get the title with nothing displayed in the graph area. That is OK.
HOWEVER When the mouse is on the empty graph area I get an exception . I removed the marks tip from my code but then got a second exception .
See both exceptions below
EXCEPTION With MarksTip
System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.Styles.Pie.CalcClickedPie(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Pie.Clicked(Int32 x, Int32 y)
at Steema.TeeChart.Tools.MarksTip.FindClickedSeries(Int32 x, Int32 y, Int32& index)
at Steema.TeeChart.Tools.MarksTip.MouseEvent(MouseEventKinds kind, MouseEventArgs e, Cursor& c)
at Steema.TeeChart.Chart.BroadcastMouseEvent(MouseEventKinds kind, MouseEventArgs e, Cursor& c)
at Steema.TeeChart.Chart.BroadcastMouseEvent(MouseEventKinds kind, MouseEventArgs e)
at Steema.TeeChart.TChart.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
EXCEPTION without MarksTip
reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.Styles.Pie.CalcClickedPie(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Pie.Clicked(Int32 x, Int32 y)
at Steema.TeeChart.Styles.Series.CheckMouse(Cursor& c, Int32 x, Int32 y)
at Steema.TeeChart.Chart.CheckMouseSeries(Cursor& c, Int32 X, Int32 Y)
at Steema.TeeChart.Chart.DoMouseMove(Int32 x, Int32 y, Cursor& c)
at Steema.TeeChart.TChart.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Please help me avoid getting an exception when mouse hovers over graph area.
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qcrnd,
I'm not able to reproduce those issues here using v3's 3rd November release and this code:
Which TeeChart version are you using? Could you please modify code snippet above so that I can reproduce the problem here?
Thanks in advance.
I'm not able to reproduce those issues here using v3's 3rd November release and this code:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
//Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
//marksTip1.Series = pie1;
}
Thanks in advance.
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 |
Hi Narcis
Our chart registers to different events If you try in your code to add Event Handlers for example
Chart.Series[0].MouseEnter += OnPieSeriesMouseEnter;
Chart.Series[0].MouseLeave += OnPieSeriesMouseLeave;
You should get the error.
The callbacks arent called , the error happens before they are called.
We are using V2.
Our chart registers to different events If you try in your code to add Event Handlers for example
Chart.Series[0].MouseEnter += OnPieSeriesMouseEnter;
Chart.Series[0].MouseLeave += OnPieSeriesMouseLeave;
You should get the error.
The callbacks arent called , the error happens before they are called.
We are using V2.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qcrnd,
Thanks for the info.
I could not reproduce the issue here using code snippet below with latest v2 and v3 releases. Does code below work fine for you? Could you please check if latest version solves the problem at your end¿
Thanks in advance.
Thanks for the info.
I could not reproduce the issue here using code snippet below with latest v2 and v3 releases. Does code below work fine for you? Could you please check if latest version solves the problem at your end¿
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
//Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
//marksTip1.Series = pie1;
pie1.MouseEnter += new EventHandler(pie1_MouseEnter);
pie1.MouseLeave += new EventHandler(pie1_MouseLeave);
}
void pie1_MouseLeave(object sender, EventArgs e)
{
this.Text = "entered";
}
void pie1_MouseEnter(object sender, EventArgs e)
{
this.Text = "left";
}
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 |
Hi Narcis
Here is the version which is written in our license file. We currently cannot risk changing the version since we are in the final QA stages.
Steema.TeeChart.TChart, TeeChart, Version=2.0.2306.26232,
In our application I made a test like your code
void OnTestChart()
{
Form f = new Form();
f.Size = new Size(500, 500);
TChart tChart1 = new Steema.TeeChart.TChart();
tChart1.Dock = DockStyle.Fill;
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
pie1.MouseEnter += new EventHandler(pie1_MouseEnter);
pie1.MouseLeave += new EventHandler(pie1_MouseLeave);
tChart1.Parent = f;
f.ShowDialog();
}
And I got an exception as soon as the mouse entered the form.
Can you see if you fixed anything between our version and the later ones.?
Here is the version which is written in our license file. We currently cannot risk changing the version since we are in the final QA stages.
Steema.TeeChart.TChart, TeeChart, Version=2.0.2306.26232,
In our application I made a test like your code
void OnTestChart()
{
Form f = new Form();
f.Size = new Size(500, 500);
TChart tChart1 = new Steema.TeeChart.TChart();
tChart1.Dock = DockStyle.Fill;
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
pie1.MouseEnter += new EventHandler(pie1_MouseEnter);
pie1.MouseLeave += new EventHandler(pie1_MouseLeave);
tChart1.Parent = f;
f.ShowDialog();
}
And I got an exception as soon as the mouse entered the form.
Can you see if you fixed anything between our version and the later ones.?
Another issue with empty Pie chart.
I also found that in this case on a pie series with no data if I register to Chart.ClickSeries and click on the chart I get an exception as well
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qcrnd,
You can find v2 release notes here. However, I can't see any issue like yours being mentioned. If you send us a simple project we can run "as-is" to reproduce the problem here we can test it works fine using latest v2 release.
You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
As a workaround you can try unassign events if series has no values:
Thanks in advance.
You can find v2 release notes here. However, I can't see any issue like yours being mentioned. If you send us a simple project we can run "as-is" to reproduce the problem here we can test it works fine using latest v2 release.
You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
As a workaround you can try unassign events if series has no values:
Code: Select all
if (pie1.Count == 0)
{
pie1.MouseEnter -= new EventHandler(pie1_MouseEnter);
pie1.MouseLeave -= new EventHandler(pie1_MouseLeave);
}
else
{
pie1.MouseEnter += new EventHandler(pie1_MouseEnter);
pie1.MouseLeave += new EventHandler(pie1_MouseLeave);
}
Thanks in advance.
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 |
Hi
Yes I have already dont this workaround although I am not so happy with it.
Its funny that it doesnt happen with your v2 .
Are we using the same v2
In anycase I will try later on or maybe next week to create a project and upload becuase the project I am working in is huge.
Thanks.
Its funny that it doesnt happen with your v2 .
Are we using the same v2
In anycase I will try later on or maybe next week to create a project and upload becuase the project I am working in is huge.
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qcrnd,
No, I'm using latest v2 build available which is 2.0.3203.23271/2 published on 8th October 2008. The version you are using is from May 2006. Since May 2007, current TeeChart for .NET version is number 3 and not much development is being done in v2 at the present moment, just sporadic bug fixes. Anyway many bug fixes have been done in v2 during this period (almost 2 years and a half).
No, I'm using latest v2 build available which is 2.0.3203.23271/2 published on 8th October 2008. The version you are using is from May 2006. Since May 2007, current TeeChart for .NET version is number 3 and not much development is being done in v2 at the present moment, just sporadic bug fixes. Anyway many bug fixes have been done in v2 during this period (almost 2 years and a half).
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qcrnd,
Thanks for the example project but I'm not able to reproduce the issue here. Could you please try uninstalling your current v2 version, download and install the last build available at the client area and check if this solves the problem for you?
Thanks in advance.
Thanks for the example project but I'm not able to reproduce the issue here. Could you please try uninstalling your current v2 version, download and install the last build available at the client area and check if this solves the problem for you?
Thanks in advance.
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qcrnd,
In that case please contact our Sales Dept at sales at steema dot com with your customer and license details. They'll provide product keys you may not find.
Thanks in advance.
In that case please contact our Sales Dept at sales at steema dot com with your customer and license details. They'll provide product keys you may not find.
Thanks in advance.
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 |