Mouse cursor changing when hovering invisible chart series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
OM Partners
Newbie
Newbie
Posts: 8
Joined: Mon Jun 02, 2014 12:00 am

Mouse cursor changing when hovering invisible chart series

Post by OM Partners » Thu Jul 03, 2014 10:23 am

Dear,

In our application, we want to change the mouse cursor when the user hovers over some chart series.
However, when null-points are added to the series, these are not visible to the user,
so we do not want to see the mouse cursor changing when hovering over invisible parts of the chart series.

To illustrate the issue, I created following code sample. The resulting chart image is attached.

Code: Select all

Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line.Add(0);
line.Add(1);
line.Add(2);
line.Add(3);
line.Add(4);
line.SetNull(2);
line.Cursor = System.Windows.Forms.Cursors.Cross;
In this chart, we added a simple line going from (0,0) to (4,4) and made the point at (2,2) a null-point.
We make the mouse cursor change to a cross when going over the line.
Between (1,1) and (3,3), although the line is not visible, the mouse cursor still changes.

Is there a way to not change the mouse cursor when hovering over invisible parts of this line?

Regards,
Steven
Attachments
chart_changing_cursor.JPG
changed cursor on chart
chart_changing_cursor.JPG (12.83 KiB) Viewed 5404 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Mouse cursor changing when hovering invisible chart series

Post by Christopher » Fri Jul 04, 2014 10:15 am

Hello Steven,
OM Partners wrote: Is there a way to not change the mouse cursor when hovering over invisible parts of this line?
This is unfortunately a defect which I have added to our bug tracking software with id=827.

As a workaround, you could try something like the following:

Code: Select all

    private void InitializeChart()
    {
      tChart1.MouseMove += tChart1_MouseMove;
      Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line.Add(0);
      line.Add(1);
      line.Add(2);
      line.Add(3);
      line.Add(4);
      line.SetNull(2);
      //line.Cursor = System.Windows.Forms.Cursors.Cross;
    }

    void tChart1_MouseMove(object sender, MouseEventArgs e)
    {
      for (int i = 0; i < tChart1.Series.Count; i++)
      {
        int index = tChart1.Series[i].Clicked(e.Location);
        if (index > -1)
        {
          if (tChart1.Series[i].IsNull(index) || tChart1.Series[i].IsNull(index + 1))
          {
            base.Cursor = Cursors.Arrow;
          }
          else
          {
            base.Cursor = Cursors.Cross;
          }
        }
      }
    }
Best Regards,
Christopher Ireland / 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

OM Partners
Newbie
Newbie
Posts: 8
Joined: Mon Jun 02, 2014 12:00 am

Re: Mouse cursor changing when hovering invisible chart series

Post by OM Partners » Fri Jul 04, 2014 10:40 am

Hello Christopher,

Thank you very much for adding this issue to the defects list and providing a workaround.
I will try the suggested workaround and keep you updated if anything goes wrong with it.

Best regards,
Steven

Post Reply