ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Plotting, movable by the user, vertical and horizontal lines in the "Realtime Chart with Zooming and Scrolling" example
Posted by Thanos on Feb-15-2017 01:15
Attachments:
Hi,

I wanted to create a Realtime chart, like the "Realtime Chart with Zooming and Scrolling" example, in order to implement an oscilloscope using the Qt platform. The oscilloscope must include 2 vertical lines, movable by the user, which are going to be used for detecting the time difference (dt) between two points of the x (time) axis (see the attached picture). The values of these lines must be updated while the chart in moving, zooming and scrolling, exactly like the truck cursor.

I tried to understand how this feature could be implemented based on the "Realtime Chart with Zooming and Scrolling", but unfortunately I didn't find a way to achieve it. Could you give me any helpful advise and/or an identical example please.

Thanks in advance.

Best Regards
Thanos
Oscilloscope Screen.jpg

  Re: Plotting, movable by the user, vertical and horizontal lines in the "Realtime Chart with Zooming and Scrolling" example
Posted by Peter Kwan on Feb-17-2017 05:23
Attachments:
Hi Thanos,

Sorry for the late reply.

I happened to have an example based on "Realtime Chart with Zooming and Scrolling" with 3 vertical track line that can be moved by the user by mouse dragging. However, the exmaple is in C++/MFC.

If you have Visual Studio, you can try the example to see how it works. To try it, simply copy the "realtimezoomscroll" folder inside the zip file to the "ChartDirector/mfcdemo" folder in the ChartDirector download, overwriting the original "Realtime Chart with Zooming and Scrolling" sample code. You can then open the "ChartDirector/mfcdemo/mfcdemo.sln" Visual Studio solution, set the "realtimezoomscroll" as the startup project, then compile and run it.

The followings are how the code works:

(a) In the original sample code, the track line position comes from "mouse move". In the draggable track line sample code, the track line positions are stored in 3 variables. The track line are drawn 3 times, with the 3 variables. So the 3 track lines will be visible no matter where the mouse moves.

(b) When the mouse button is pushed, we checked if the mouse is over one of the track line. If this is the case, we set a flag to indicate that the mouse has "grab" the line. The
flag will be reset when the mouse button is released.

(c) When the mouse moves, if the mouse is grabbing a track line, we update the variable for that track line to position that track line at the mouse position.

If the above still cannot solve the problem, please let me know. I will then ask our developers to port the example to Qt.

Regards
Peter Kwan
realtimezoomscroll_multitrack.zip
realtimezoomscroll_multitrack.zip

44.35 Kb

  Re: Plotting, movable by the user, vertical and horizontal lines in the "Realtime Chart with Zooming and Scrolling" example
Posted by Thanos on Feb-17-2017 15:55
Hi Peter,

many thanks for your quick answer.

I will install the Visual Studio the next few days and I will have a deep look at the example you sent me. If I still have some questions I will ask you again.

Regards
Thanos