Page 1 of 1

Horizontal Zooming - Drawing issue

Posted: Sun May 04, 2014 5:14 pm
by 15658695
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 16531 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 16532 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

Re: Horizontal Zooming - Drawing issue

Posted: Mon May 05, 2014 9:44 am
by 15658695
Oh I forgot this:

IDE : VS 2012
Language : C#

Dominik

Re: Horizontal Zooming - Drawing issue

Posted: Mon May 05, 2014 1:19 pm
by Christopher
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.

Re: Horizontal Zooming - Drawing issue

Posted: Mon May 05, 2014 1:25 pm
by 15658695
Hi Christopher,

ok I think I can wait for the next release.

Thx for your help !

Dominik

Re: Horizontal Zooming - Drawing issue

Posted: Mon May 05, 2014 1:37 pm
by Christopher
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 :)

Re: Horizontal Zooming - Drawing issue

Posted: Tue May 06, 2014 5:26 am
by 15658695
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 16509 times
Vertical Error.png
Vertical Error
Vertical Error.png (48.5 KiB) Viewed 16502 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.

Re: Horizontal Zooming - Drawing issue

Posted: Tue May 06, 2014 5:31 am
by 15658695
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 16524 times
But I think this is not a big deal ... :wink:

Re: Horizontal Zooming - Drawing issue

Posted: Tue May 06, 2014 11:15 am
by Christopher
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.

Re: Horizontal Zooming - Drawing issue

Posted: Tue May 06, 2014 11:17 am
by Christopher
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.

Re: Horizontal Zooming - Drawing issue

Posted: Wed May 07, 2014 7:34 am
by 15658695
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:

Re: Horizontal Zooming - Drawing issue

Posted: Wed May 07, 2014 7:38 am
by Christopher
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 :)