Determining the series area

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jamsoft
Newbie
Newbie
Posts: 11
Joined: Thu May 29, 2008 12:00 am

Determining the series area

Post by jamsoft » Tue Oct 21, 2008 2:01 pm

Hello,
how can i determine the x,y width and height of the chart?
I use the chart.Axes.Left,Right,Top,Bottom to determine them but it doesn't work.
I want to be able to show a tooltip containing series data only when the
mouse is within the series area:

Code: Select all

        private void OnChartMouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
                return;
            if (tChart1.Series.Count == 0)
                return;

            Axes axes = tChart1.Axes;
            if (e.Location.X < axes.Left.Position
              ||e.Location.X > axes.Right.Position
              ||e.Location.Y < axes.Top.Position
              ||e.Location.Y > axes.Bottom.Position)
            {
                toolTip.Active = false;
                return;
            }

            toolTip.Active = true;
If the window is resized, the position values don't match as i expect them
Thanks in advance,
regards

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 21, 2008 2:15 pm

Hi jamsoft,

You could try using e.X and e.Y arguments instead of e.Location.X and e.Location.Y.

BTW: I guess greater than and smaller than symbols in your code should be inverted like this:

Code: Select all

            if (e.Location.X > axes.Left.Position
              ||e.Location.X < axes.Right.Position
              ||e.Location.Y > axes.Top.Position
              ||e.Location.Y < axes.Bottom.Position)
            {
                toolTip.Active = false;
                return;
            } 
Hope this helps!
Best Regards,
Narcís Calvet / 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

jamsoft
Newbie
Newbie
Posts: 11
Joined: Thu May 29, 2008 12:00 am

Post by jamsoft » Tue Oct 21, 2008 2:28 pm

Hello Narcís,
Same problem with e.X instead of e.Location.X,
for Left, Top and Bottom Axis it seems to be ok, the tooltip disappears if the mouse moved outside the axis. However the position of the right axis is not updated if i resize the chart which is anchored in the window. and the tooltip does not disappear an the edge of the series data, but sometimes too early, sometimes to late.
BTW: I guess greater than and smaller than symbols in your code should be inverted like this
I actually want the tooltip to be shown if within the area and simply switch it off if outside

I use a standard chart with no special settings displaying line series data and having a Legend on the right side of the data with checkboxes enabled.
I use .net tchart version 3.5.3188.18562

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 21, 2008 2:47 pm

Hi jamsoft,

Is right axis associated to any series?

Code: Select all

			tChart1.Series[0].VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;
You can also try use tChart1.Axes.Bottom.IEndPos instead.
Best Regards,
Narcís Calvet / 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

jamsoft
Newbie
Newbie
Posts: 11
Joined: Thu May 29, 2008 12:00 am

Post by jamsoft » Tue Oct 21, 2008 2:56 pm

Hello Narcís
Is right axis associated to any series?
No, i haven't assigned any axis. This probably is the reason
You can also try use tChart1.Axes.Bottom.IEndPos instead.
This works perfectly for me, thanks!

Regards Klaus

Post Reply