Page 1 of 1

MouseEnter event question

Posted: Tue Oct 16, 2012 6:22 pm
by 15663492
Hello,
I've read a few threads on similar questions, but I'm still confused. I'm having trouble using the MouseEnter events when I have multiple series that overlap. Specifically, if I have an Area series and Points series and they have a common data point, when I mouse over that point the MouseEnter event is only triggered for the series that was added first, and which is plotted behind the other series.

For example if I add the Area series first, then add the Points series, the Points will be plotted on top, but only the Area MouseEnter event is triggered.

In another thread, it was suggested that every series at that point would trigger its MouseEnter event, but in my case with the Area and Points series, this doesn't seem to be true. The top series event does not fire at all. (I think the person in the other thread was using multiple line series).

In a different thread, I also saw a suggestion to use the chart MouseMove event together with Series.Clicked. I looks like I could make this would work if necessary, but it would be more convenient if I could handle it with the series events. I will be dynamically plotting and removing many series, and each will have it's own specific mouse behavior so I'd rather not have to use Chart events.

In summary, I would like to have the Points series plotted on top of the Area series then use the Points MouseEnter event. Anything I can do?

I'm using TeeChart .NET 4.1.2011.10190

Thanks,
Gregg

Re: MouseEnter event question

Posted: Wed Oct 17, 2012 12:19 pm
by 10050769
Hello greggL,

I can reproduce your problem using last version of TeeChartFor.Net and same data with Area and Point Series and in your case, I suggest you use MouseMove in a dynamic way, e.g: using last series you have added in chart to use clicked method in mouse move. Please see next code:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.Area area1;
        Steema.TeeChart.Styles.Points point1;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            area1 = new Steema.TeeChart.Styles.Area(tChart1.Chart);
            point1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);

            area1.FillSampleValues();
            point1.DataSource = area1;
            point1.RefreshSeries();
            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
        }

        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if (tChart1[tChart1.Series.Count - 1].Clicked(e.X, e.Y) != -1)
            {
                tChart1.Header.Text = "Mouse Point Series Enter";
            }
            else
            {
                tChart1.Header.Text = "TeeChart";
            }
           
        }
Could you tell us if previous code works in your end? If it doesn't like you, please try to arrange a simple project because we can work with it to find a good solution for you.

I hope will helps.

Thanks,

Re: MouseEnter event question

Posted: Wed Oct 17, 2012 9:51 pm
by 15663492
Hi Sandra,
Thanks for the reply. That's the same suggestion I saw in the other thread. I think that I can make it work.
Can you explain what is happening with the MouseEnter event here? I'd like to better understand the behavior of the series events so that I can use them effectively in the future.
Thanks again,
Gregg

Re: MouseEnter event question

Posted: Thu Oct 18, 2012 12:03 pm
by 10050769
Hello greggL,

The description of MouseEnter tell this event is called when the mouse cursor "enters" into any point of the series. So, we consider, after doing many test,the MouseEnger have a bug that we have already fixed. Therefore, in next maintenance release of TeeChartFor.Net the problem is fixed and the MouseEnter triggered for each series.

Thanks,