In many ChartDirector code examples, the track cursor follows the mouse as it moves. In this
example, the track cursor is moved with mouse drag instead. This allows the mouse to control
multiple track cursors. The differences in data values between the track cursors are displayed
and on a semi-transparent overlay on the chart.
This example is based on the
Real-Time Chart with Zooming and Scrolling
sample code in the ChartDirector distribution with the following changes:
- The mouse move event handler is modified to move a track line only if the mouse button
is pressed near the track line before moving.
- The code is modified to include two track lines, with checkboxes to show/hide them.
- Extra code is added to display the differences in data values between the track lines on the
chart.
Download
*** Note *** : If you are new to ChartDirector, it is
recommended you download ChartDirector from the
download page to try it.
It includes complete ChartDirector documentation as well as plenty of sample code designed as tutorials. The
following assumes you already have some basic understanding of ChartDirector.
The sample code in this page is included as part of the "Real-Time Chart Extra Sample Code Pack".
Real-Time Chart Extra Sample Code Pack for C++ (MFC, Qt)
- Remember to unblock the ZIP
file before extracting the contents out
- Includes Visual Studio solution (for C++/MFC), Qt project file (for C++/Qt), and both 32-bit and
64-bit ChartDirector Windows DLL.
- If you are using another operating system edition of ChartDirector, simply copy the sample code folder
inside the qtdemo folder to the qtdemo folder of your ChartDirector distribution, and you can compile and
run the Qt sample code.
Reference
The followings are links to the documentation of the original Real-Time Chart with Zooming and Scrolling sample code.