Recent

Author Topic: OnMouseUp event of the Chart component does not seem to be called  (Read 8703 times)

ironphil

  • Jr. Member
  • **
  • Posts: 58
I only need to zoom in X with my charts so I do not use the rectangle zoom feature of the chart. Instead, onmousedown I create two vertical lines (constantline), on mousemove I move the second line and onmouseup and change the chart extents in X from line 1 to line 2. It used to work in 0.9.28.2 but is does not anymore in the latest SVN. I put some debug code and it seem the onmouseup event of the chart is not being called. Can anybody confirm this?

If there is a more elegant way of zooming only in X let me know.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: OnMouseUp event of the Chart component does not seem to be called
« Reply #1 on: January 10, 2011, 04:32:07 pm »
If there is a more elegant way of zooming only in X let me know.
OnMouseUp is called only if you have no tools assigned to the chart
(by default, built-in toolset with zoom tool is assigned).
Maybe I should enable it always, but it can cause awkward interactions
with some tools. Maybe OnBeforeMouseUp/OnAfterMouseUp pair is the right answer...
I shall think about it.

create two vertical lines (constantline), on mousemove I move the second line and onmouseup and change the chart extents in X from line 1 to line 2.
How do you zoom out with this method?
To do this, user will wave to drag the line outside the current chart extent?
Anyway, dragging is better done with TDataPointDragTool, as seen
in "dragdrop" and "line" demos.

If there is a more elegant way of zooming only in X let me know.
If you are content with single-click zooming, you can use TZoomClickTool
and set ZoomRatio = 1/ZoomFactor.

ironphil

  • Jr. Member
  • **
  • Posts: 58
Re: OnMouseUp event of the Chart component does not seem to be called
« Reply #2 on: January 10, 2011, 07:28:13 pm »
I remember I had to disable the default zoom of the chart to achieve my way of zooming in X. It would zoom in if line2 > line1 and would reset the zoom if line2 < line1. I will carefully check the code of the tools demo and other demos. I think it is preferable to use the provided tools to avoid awkward interactions but it is not easy to understand how they work at first.

But thank you, you answered my question: OnMouseUp was not called because some tools were still assigned to the chart. Since I plan to use some of the tools, I will try some of your suggestions like the single click zooming.

ironphil

  • Jr. Member
  • **
  • Posts: 58
Re: OnMouseUp event of the Chart component does not seem to be called
« Reply #3 on: January 31, 2011, 06:59:53 pm »
I managed to use the built-in tools for zooming and dragging but I still need to interact with the chart. Which events of the chart are still operational when you use the chart tools? I need to click on the chart to identify some peaks.

The extent method seems to be disabled as well when the tools are used, it ignores any value given to any extent (xmin, xmax etc.). Is that right?

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: OnMouseUp event of the Chart component does not seem to be called
« Reply #4 on: February 03, 2011, 06:58:06 pm »
Sorry, I did not notice you post earlier.
(In the future, you can either use mailing list or PM me if TAChart-related post is
not responded to in 2-3 days).

Which events of the chart are still operational when you use the chart tools? I need to click on the chart to identify some peaks.

The idea is that you should use tools exclusively to interact with the chart.
The provide a better control over the tool priority and multi-tool interaction.
OnClick, OnMouseXXX etc. methods of TChart are left mostly for backwards compatibility.

Since r29353, dragdropdemo contains an example of using tool to identify the point
user clicked on -- is that what you want to achieve?

The extent method seems to be disabled as well when the tools are used, it ignores any value given to any extent (xmin, xmax etc.). Is that right?

I am not sure what are you talking about -- extent is a property, not a method,
and it should work identically with or without tools (see extentdemo for an example usage).
If it does not work, it is a bug.

ironphil

  • Jr. Member
  • **
  • Posts: 58
Re: OnMouseUp event of the Chart component does not seem to be called
« Reply #5 on: February 22, 2011, 11:01:17 pm »
I added the pandrag tool to the extentdemo and changing the extent values does not seem to work anymore. However, calling the zoomfull procedure works. I know the pandrag tool also modifies the extents so maybe there is a conflict but under some circumstances using both ways to change the extents may be useful.

Also, is there a way to set limits to the pandrag tool? For example, when xmin reaches 0, the drag stops. Or allowing to drag only within the extents found by the zoomfull procedure (outside of that there is nothing anyway).

Finally, allowing to zoom only in X, Y or both like the pandrag tool does with dragging would be cool.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: OnMouseUp event of the Chart component does not seem to be called
« Reply #6 on: February 27, 2011, 04:10:25 am »
Sigh, I have yet again failed to notice your post.
This is why I prefer mailing list for discussions.

I added the pandrag tool to the extentdemo and changing the extent values does not seem to work anymore. However, calling the zoomfull procedure works. I know the pandrag tool also modifies the extents so maybe there is a conflict but under some circumstances using both ways to change the extents may be useful.

Yes, there is a conceptual conflict here. Since r29674 ZoomFull is performed automatically
upon the change to Extent. I hope it will be less confusing.

Also, is there a way to set limits to the pandrag tool? For example, when xmin reaches 0, the drag stops. Or allowing to drag only within the extents found by the zoomfull procedure (outside of that there is nothing anyway).

Added LimitToExtent property to the panning tools in r29673,
see extent demo since r29675.

Finally, allowing to zoom only in X, Y or both like the pandrag tool does with dragging would be cool.

Replaced Proportional property with the more general RatioLimit in r29676.
For an example see line demo since r29677.

 

TinyPortal © 2005-2018