|
how to click on the FinanceChart to highligh the special user drawn object? |
Posted by tyr2000 on Jan-24-2013 19:56 |
|
hi,
I want to let the user draw some user defined object, such as triangle,arrow... to indicate
the proper price to buy or sell on the FinanceChart. After user drawn, how can i the the
object to be selected highlight ,when they want to delete.Just like the attached pic,the
rectangle is now in selected mode,if user want to delete , the program knows the
destination of the delete operation.
pls help
|
Re: how to click on the FinanceChart to highligh the special user drawn object? |
Posted by tyr2000 on Jan-24-2013 19:58 |
|
I am using chartdirector5.1 + mfc |
Re: how to click on the FinanceChart to highligh the special user drawn object? |
Posted by Peter Kwan on Jan-25-2013 01:31 |
|
Hi tyr2000,
Your code would need to keep track of the positions of all deletable objects that the user has added. When the user selects a region, your code may search the deletable objects list to determine which object is selected, then redraw the chart with the selected object in another color (or enclosed with a circle or some other means of highlighting).
In performing the above, you may need to translate between mouse coordinates and data values. The ChartDirector API XYChart.getXCoor, XYChart.getYCoor, XYChart.getXValue, XYChart.getYValue, BaseChart.getAbsOffsetX and BaseChart.getAbsOffsetY may be useful for this purposes.
Regards
Peter Kwan |
Re: how to click on the FinanceChart to highligh the special user drawn object? |
Posted by tyr2000 on Jan-25-2013 13:52 |
|
if the selected object is the embeded index line such as macd,ma ... ,and i want to make
them selected not exactly on the line ,but near them ,is there any simple short cut to make
this kind of object selected? |
Re: how to click on the FinanceChart to highligh the special user drawn object? |
Posted by Peter Kwan on Jan-26-2013 00:57 |
|
Hi tyr2000,
If the purpose of letting the user selecting the objects is to allow them to edit or delete the objects that they have drawn interactively, then your code should have keep track of all the objects that the user has drawn. In this case, when the user selects a region, your code can determine which objects to select from your list. Because your list should not include objects drawn by ChartDirector automatically (such as the MACD line), so the MACD line should not be selectable at all.
In brief, the ChartDirector API can help you to determine the selected region. Your own code can then determine which specific objects are selected. Your code can consider only the objects that are drawn interactively by the user. In this case, objects drawn by ChartDirector should not be selectable.
Regards
Peter Kwan |
|