Super imposing Cursors

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Super imposing Cursors

Post by Rajesh Dhiman » Mon Aug 10, 2009 7:18 am

I have created two cursors in following Order in my WPF application. (Please find Attachment)

1. Orange (With Larger height)
2. Green (With Shorter Height)

When Super imposing both on same value.
Green Cursor appears on top. But when I tried to grab the green cursor from green area, Orange cursor is getting grabbed.

I am expecting to grab Green cursor, because it appears on the top.

Is there is any property which i am missing to set for cursor or it is a bug in T chart?

Regards,

Rajesh Dhiman
Attachments
Cursors.PNG
Cursors.PNG (35.63 KiB) Viewed 3132 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Super imposing Cursors

Post by Yeray » Mon Aug 10, 2009 2:15 pm

Hello Rajesh Dhiman,

The problem is that both the drawing process and the tools events handle follow the same order in the tools list. That means that having two cursors, the second will be drawn over the first, but the first will have priority when dragging.

To avoid this, you could use OnChange cursors event to deactivate all the cursors in the same position than the cursor that is actually moving. For example, assigning the following event to both cursors:

Code: Select all

        void cursor_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
        {
            for (int i = tChart1.Tools.Count - 1; i >= 0; i--)
            {
                if (tChart1.Tools[i] is Steema.TeeChart.Tools.CursorTool)
                {
                    if ((tChart1.Tools[i] != sender) && (((Steema.TeeChart.Tools.CursorTool)tChart1.Tools[i]).XValue == e.XValue))
                    {
                        tChart1.Tools[i].Active = false;
                    }
                    else
                    {
                        tChart1.Tools[i].Active = true;
                    }
                }
            }
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Rajesh Dhiman
Newbie
Newbie
Posts: 15
Joined: Mon Sep 15, 2008 12:00 am

Re: Super imposing Cursors

Post by Rajesh Dhiman » Tue Aug 11, 2009 5:40 am

Hi Yerey,

Business req doesnot allow me to deactivate any of the cursor..:(

What to do now?

Rajesh

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Super imposing Cursors

Post by Yeray » Tue Aug 11, 2009 11:55 am

Hi Rajesh,

Another possibility could be changing the color of the series that is drawn over the first series assigning the same color. Then the second cursor will still be shown, but it will have the color of the first, giving the effect that the first cursor is on top.

Code: Select all

        void cursor1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
        {
            for (int i = tChart1.Tools.Count - 1; i >= 0; i--)
            {
                if (tChart1.Tools[i] is Steema.TeeChart.Tools.CursorTool)
                {
                    if ((tChart1.Tools[i] != sender) && (((Steema.TeeChart.Tools.CursorTool)tChart1.Tools[i]).XValue == e.XValue))
                    {
                        ((Steema.TeeChart.Tools.CursorTool)tChart1.Tools[i]).Pen.Color = ((Steema.TeeChart.Tools.CursorTool)sender).Pen.Color;
                    }
                    else
                    {
                        ((Steema.TeeChart.Tools.CursorTool)tChart1.Tools[i]).Pen.Color = cursorColor[i];
                    }
                }
            }
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply