Page 1 of 1

Mouse cursor changing when hovering invisible chart series

Posted: Thu Jul 03, 2014 10:23 am
by 15669377
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

Re: Mouse cursor changing when hovering invisible chart series

Posted: Fri Jul 04, 2014 10:15 am
by Christopher
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;
          }
        }
      }
    }

Re: Mouse cursor changing when hovering invisible chart series

Posted: Fri Jul 04, 2014 10:40 am
by 15669377
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