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

Message ListMessage List     Post MessagePost Message

  Dynamic selection
Posted by Sergey on Jun-06-2016 22:24
Hi Peter!

Prompt how to use BaseChart.initDynamicLayer() implement dynamic selection area (default selection - press and move the mouse) line chart? It can be a small sample C++ MFC!

  Re: Dynamic selection
Posted by Peter Kwan on Jun-07-2016 05:12
Attachments:
Hi Sergey,

All the "Programmable Track Cursor" sample code in ChartDirector use the dynamic layer to draw things when the mouse moves over the chart. You can modify the code to draw an additional rectangle as the selection rectangle. You just need to keep track of the mouse coordinates and buttons in the drawing code, so that you know when the mouse is down and up.

When the mouse is finally up, if you would like to immediately perform something, you would need to listen to the ON_WM_LBUTTONUP message. In the attached example, I added code to listen to the ON_WM_LBUTTONUP message and forward it as a BN_UNPUSHED message to the parent dialog. In the parent dialog, I then just pop up a message box to display the selected region.

The attached example is based on the "Track Line with Data Labels (MFC)" sample code. To try the attached code, please copy them to replace the files of the same name in the "Track Line with Data Labels (MFC)" sample code in "ChartDirectormfcdemotracklabel", then compile and run the project.

Hope this can help.

Regards
Peter Kwan
trackselection.zip
trackselection.zip

4.56 Kb

  Re: Dynamic selection
Posted by Sergey on Jun-07-2016 17:10
Thanks Peter!

Your example works perfectly!
I think such an example should be added to a collection of examples.