Horizontal Zooming - Drawing issue

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
moelski.net
Newbie
Newbie
Posts: 19
Joined: Mon Mar 07, 2011 12:00 am

Horizontal Zooming - Drawing issue

Post by moelski.net » Sun May 04, 2014 5:14 pm

TChart Version : 4.1.2014.2242

Hi !

I think there is a problem in the Zooming functions ... Just use the attached sample projekt and run it. Open the Editor and go to the General/Zoom tab.
Set the Direction to Horizontal and press close to end the editor.

Now just zoom within the chart. I got this rectangles on different computers:
TestOnXP.jpg
Problem on Windows XP 32 Bit
TestOnXP.jpg (56.4 KiB) Viewed 16416 times
This is on windows XP (32 Bit)
2014-05-04_19-04-40.png
Problem on Win7 64 Bit
2014-05-04_19-04-40.png (62.46 KiB) Viewed 16417 times
This is on my developement system with Win7 64Bit.

And I asked one of our users to test it, too. He has the same behaviour on a XP 32Bit system.

Can you confirm this issue and tell me a quick workaround or a new Tchart.dll with a fix?
We want to bring out our new software, soon. But this issue is a real blocking point for us. :?

Best regards
Dominik
Attachments
CursorTest.zip
Testapp for reproducing the problem
(12.05 KiB) Downloaded 662 times

moelski.net
Newbie
Newbie
Posts: 19
Joined: Mon Mar 07, 2011 12:00 am

Re: Horizontal Zooming - Drawing issue

Post by moelski.net » Mon May 05, 2014 9:44 am

Oh I forgot this:

IDE : VS 2012
Language : C#

Dominik

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

Re: Horizontal Zooming - Drawing issue

Post by Christopher » Mon May 05, 2014 1:19 pm

Hello Dominik,
moelski.net wrote:Oh I forgot this:

IDE : VS 2012
Language : C#
Yes, I've been able to reproduce this issue here and have added it to our bug database with ID=760. As you can read there, there is a temporary workaround to this issue:

Code: Select all

        private void button1_Click(object sender, EventArgs e)
        {
          this.editor1.CloseEditor += editor1_CloseEditor;
          this.editor1.ShowModal();
        }

        void editor1_CloseEditor(object sender, EventArgs e)
        {
          tChart1.Zoom.Pen.Visible = false;
        }
You will also be able to see that this issue is now fixed and will be available in the next maintenance release, due out within the next two working days.
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

moelski.net
Newbie
Newbie
Posts: 19
Joined: Mon Mar 07, 2011 12:00 am

Re: Horizontal Zooming - Drawing issue

Post by moelski.net » Mon May 05, 2014 1:25 pm

Hi Christopher,

ok I think I can wait for the next release.

Thx for your help !

Dominik

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

Re: Horizontal Zooming - Drawing issue

Post by Christopher » Mon May 05, 2014 1:37 pm

Hello Dominik,
moelski.net wrote: ok I think I can wait for the next release.

Thx for your help !
That's good.

You're very welcome :)
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

moelski.net
Newbie
Newbie
Posts: 19
Joined: Mon Mar 07, 2011 12:00 am

Re: Horizontal Zooming - Drawing issue

Post by moelski.net » Tue May 06, 2014 5:26 am

Hi Christopher,

I think there is another issue on this zoom topic. I use this code to detect STRG and SHIFT key to set vertical or horizontal zooming:

Code: Select all

        private void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            var strgPressed = ModifierKeys == Keys.Control;
            var shiftPressed = ModifierKeys == Keys.Shift;
            var bothPressed = ModifierKeys == (Keys.Shift | Keys.Control);

            if (e.Button == MouseButtons.Left)
            {
                if (!strgPressed & !shiftPressed) { this.tChart1.Zoom.Direction = ZoomDirections.Both; }
                if (strgPressed) { this.tChart1.Zoom.Direction = ZoomDirections.Horizontal; }
                if (shiftPressed) { this.tChart1.Zoom.Direction = ZoomDirections.Vertical; }
            }
        }
But if I run this code the zoom rectangle is not drawn at the correct position:
Horizontal Error.png
Horizontal Error
Horizontal Error.png (52.97 KiB) Viewed 16394 times
Vertical Error.png
Vertical Error
Vertical Error.png (48.5 KiB) Viewed 16387 times
I have placed some red marks. That would be what I would expect from the rectangle to be drawn.

You can test this with my sample application above.

Hope this can be fixed, too.

moelski.net
Newbie
Newbie
Posts: 19
Joined: Mon Mar 07, 2011 12:00 am

Re: Horizontal Zooming - Drawing issue

Post by moelski.net » Tue May 06, 2014 5:31 am

Oh and one additional thing if missing (which is important for zooming, too). The MouseWheel event is not visible in the IDE:
MouseWheel.png
MouseWheel.png (5.27 KiB) Viewed 16409 times
But I think this is not a big deal ... :wink:

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

Re: Horizontal Zooming - Drawing issue

Post by Christopher » Tue May 06, 2014 11:15 am

Hello,
moelski.net wrote:Hope this can be fixed, too.
Not so much fixed, but a technique that can be deployed:

Code: Select all

    private void tChart1_MouseDown(object sender, MouseEventArgs e)
    {
      var strgPressed = ModifierKeys == Keys.Control;
      var shiftPressed = ModifierKeys == Keys.Shift;
      var bothPressed = ModifierKeys == (Keys.Shift | Keys.Control);

      int x = e.X;
      int y = e.Y;

      Rectangle rect = tChart1.Chart.ChartRect;

      if (e.Button == MouseButtons.Left)
      {
        if (!strgPressed & !shiftPressed)
        {
          this.tChart1.Zoom.Direction = ZoomDirections.Both;
        }
        if (strgPressed)
        {
          this.tChart1.Zoom.Direction = ZoomDirections.Horizontal;
          y = rect.Top;
          tChart1.Zoom.Activate(x, y);
        }
        if (shiftPressed)
        {
          this.tChart1.Zoom.Direction = ZoomDirections.Vertical;
          x = rect.Left;
          tChart1.Zoom.Activate(x, y);
        }
      }
    }
This is happening because the TeeChart code in the OnMouseDown event is being called before your code in this tChart1_MouseDown event. This is inevitable. To correct for this we can copy a little of the necessary functionality, which includes the call to Zoom.Activate.
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

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

Re: Horizontal Zooming - Drawing issue

Post by Christopher » Tue May 06, 2014 11:17 am

Hello,
moelski.net wrote:But I think this is not a big deal ... :wink:
This is strange, but as you can see from the documentation for the System.Windows.Forms.Control MouseWheel event, the BrowsableAttribute is set to false. I'm not sure why.
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

moelski.net
Newbie
Newbie
Posts: 19
Joined: Mon Mar 07, 2011 12:00 am

Re: Horizontal Zooming - Drawing issue

Post by moelski.net » Wed May 07, 2014 7:34 am

Hi !
the BrowsableAttribute is set to false
Can´t you change it so that it is visible for tchart?
will be available in the next maintenance release, due out within the next two working days
Hope to see a new version today :roll:

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

Re: Horizontal Zooming - Drawing issue

Post by Christopher » Wed May 07, 2014 7:38 am

moelski.net wrote:Can´t you change it so that it is visible for tchart?
No, I cannot.
moelski.net wrote: Hope to see a new version today :roll:
That will depend on how many questions I am asked today :)
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

Post Reply