Page 1 of 1

Zooming: At a loss

Posted: Wed Aug 23, 2006 7:29 pm
by 9233315
I'm completely stumped, and I'm looking for troubleshooting advice.

I'm using Delphi 5, and TeeChart Pro 7.06. I have two charts defined. I'm using TFastLine series to display RSSI and CINR information gathered from my company's wireless equipment.

I have a quick procedure that I run which initializes the zooming functionality of my charts:

Code: Select all

procedure TFChart.initialize;
begin
  RSSIChart.Zoom.Allow := true;
  SINADRChart.Zoom.Allow := true;
  RSSIChart.Zoom.MouseButton := mbMiddle;
  SINADRChart.Zoom.MouseButton := mbMiddle;
  RSSIChart.Axes.FastCalc := true;
  SINADRChart.Axes.FastCalc := true;
end;
The problem I'm having is that the SINADR chart zooms properly. The RSSI chart does not zoom at all -- the white zoom drag box does not appear. I've done a search through all my source files for the word "zoom", and found only the 4 lines included above, so it's not like I'm accidentally changing the setting somewhere else in the code. I was reading through the forum, and found an issue someone was having where the chart.clickseries event would be called instead of zoom, but I don't think that's my issue because a: I'm clicking on the chart background, and b: I've completely removed my clickseries event to see if that helped and it had no effect.

I guess my question is: what other parameters can affect the operation of zoom? Are there any events aside from chart.clickseries which prevent zoom functionality? I am currently using the following events on BOTH charts:

OnAfterDraw
OnAllowScroll
OnClickBackground
OnClickSeries
OnDblClick
OnMouseDown
OnMouseMove
OnMouseUp

There was a bug I encountered a while ago where dragging a chart to the left would cause the chart to move at a rate greater than that of the mouse (still present in your Tee7New.exe example file!), so my OnAllowScroll event always returns false, and I handle scrolling myself using if Button = mbRight then SetCaptureControl(TControl(Sender)); in the OnMouseDown event, and if mouseCaptured then chart.bottomaxis.scroll(value); in the OnMouseMove event. Could this be causing the problem?

Any help would be greatly appreciated.

Andrew

Posted: Thu Aug 24, 2006 9:39 am
by narcis
Hi Andrew,

This is very strange as if one chart zooms the other should behave the same. Have you checked that both charts have the same setting in the chart editor at design-time?

If the problem persists could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Posted: Thu Aug 24, 2006 1:38 pm
by 9233315
Yes, I'm sure the charts are configured exactly the same. I've opened up the unit's .dfm file and compared the declaration of each object line by line.

I haven't been able to reproduce the problem in anything but my application itself. I'm hesitant to post the source-code to a corporate application on a public news server. I'll continue to try to reproduce the problem in a sample project.

Have you got any hints though? Does enabling/disabling panning have any effect whatsoever on zoom? When does the zoom process get started? I've verified that clicking the middle button on my chart calls the OnMouseDown event with Button = mbMiddle, yet the zoom process never initiates. In what order do the events trigger when one clicks the zoom button on a graph?

Andrew

Posted: Thu Aug 24, 2006 1:46 pm
by narcis
Hi Andrew,

Ok, if you wanted you could privately send us the source code instead of posting it at the public newsgroups.

My hints would be trying to setup the most simple project as possible and start slowly adding property settings, events, etc. To see if you find what makes the difference.

Posted: Thu Aug 31, 2006 8:37 pm
by 9233315
I've traced the problem to the OnClickBackground event. Here's how to reproduce:

-Create a new project.
-Add a chart with one series (in my case, TFastline)
-Run project and verify zoom with mbLeft is functioning
-Add Chart1ClickBackground procedure, with contents of:

Code: Select all

procedure TForm1.Chart1ClickBackground(Sender: TCustomChart;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
//
end;
-Run project and verify zoom with mbLeft is now broken.

Are you able to reproduce this? The strange thing is that both of my charts have OnClickBackground events. Why does one work, and one not? Maybe it's because I'm manually re-drawing the labels on my chart that works, and it's causing a chart repaint...

Comments?

Andrew

Posted: Fri Sep 01, 2006 9:12 am
by narcis
Hi Andrew,

Thanks for the information. I could reproduce the problem here and added it (TV52011734) to our defect list to be fixed for future releases. It's most likely a problem with the order when the events are fired.

As a workaround you could try imitate similar behaviour to the working chart.

Posted: Tue Mar 06, 2007 9:08 pm
by 9233315
NarcĂ­s,

Any news on the resolution of this bug? Failing that, do you have any suggestions as to how I might work around it? I've upgraded to 7.07 Pro, and I'm still experiencing the issue.

Thanks in advance,

Andrew

Posted: Wed Mar 07, 2007 8:15 am
by narcis
Hi Andrew,

Yes, we have reviewed the issue here and we think this is not a bug. The user must notify the chart that TeeChart should continue processing mouse clicks and events, like this:

Code: Select all

procedure TForm1.Chart1ClickBackground(Sender: TCustomChart;
 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
   Chart1.CancelMouse:=False;  // keep processing this mouse click
end;

Posted: Wed Mar 07, 2007 5:10 pm
by 9233315
Actually, I placed that statement at the end of my OnClickBackground event, and it solved my problem. Thank you!!

Andrew