|
Can get XYChart from FinaceChart in ChartDirector 7.0 (ASP/COM/VB Edition) for VB ? |
Posted by C.H. Gim on Sep-12-2022 04:52 |
|
How to get XYChart class from FinaceChart class in ChartDirector 7.0 (ASP/COM/VB Edition) for VB ?
Or, how can FinaceChart class typecast to multiChart class ? |
Re: Can get XYChart from FinaceChart in ChartDirector 7.0 (ASP/COM/VB Edition) for VB ? |
Posted by Peter Kwan on Sep-12-2022 21:27 |
|
Hi C.H. Gim,
The FinanceChart can contain a main price chart, and also a number of indicator charts. When you add those charts, the function will return the XYChart object. For example:
Dim c As FinanceChart
Set c = cd.FinanceChart(640)
............
' Add the main chart with 240 pixels in height
Dim mainChart As XYChart
Set mainChart = c.addMainChart(240)
............
Dim rsiChart As XYChart
Set rsiChart = c.addRSI(75, 14, &H800080, 20, &Hff0000, &H0000ff)
............
In the above, the mainChart and rsiChart are XYChart objects for the main price chart and the RSI indicator chart.
Best Regards
Peter Kwan |
Re: Can get XYChart from FinaceChart in ChartDirector 7.0 (ASP/COM/VB Edition) for VB ? |
Posted by C.H. Gim on Sep-13-2022 10:48 |
|
Thank you!
And then, How to update drawings each DrawArea of the xyChart? |
Re: Can get XYChart from FinaceChart in ChartDirector 7.0 (ASP/COM/VB Edition) for VB ? |
Posted by Peter Kwan on Sep-14-2022 17:05 |
|
Hi C.H. Gim,
To use the DrawArea on the XYChart, you can just use the DrawArea API to draw things on it before the chart is displayed. When you finally display the chart, it will contain the things that have been drawn.
Note that in ChartDirector, with the exception of the dynamic layer, the chart cannot be changed once it is displayed. The dynamic layer is intended for drawing simple things like straight lines, text and small circles. We use it to draw the programming track cursors.
Are you designing a system to allow the users to interactively "add" objects to the chart? Normally, it also means it needs to delete the objects. (For example, in the track cursor code, we do not just draw the track cursor. We have to delete the previous track cursor that has already been drawn.)
To implement the above, your code needs to maintain a list of objects you have added to the chart. The chart drawing code draws the chart as usual and also draws the objects in the list, before finally displays the chart.
To add/delete/move/change the objects on the chart, simply update the list, and redraw the chart again.
It is similar to how the Interactive Finance Chart is implemented:
https://www.advsofteng.com/doc/cdcom.htm#financedemo.htm
In the above example, the controls on the left side is the list of objects to be added to the chart. Whenever it is changed, the chart is redrawn.
Best Regards
Peter Kwan |
Re: Can get XYChart from FinaceChart in ChartDirector 7.0 (ASP/COM/VB Edition) for VB ? |
Posted by C.H. Gim on Sep-15-2022 15:38 |
|
Thanks Peter Kwan!
Finally, success drawing track cursor in the financeChart.
Creates XYCharts in the financeChart, and add to MultiChart at last line,
then, can access each layer and XYChart in the dynamic drawing,
so, it likes other language codes.
Have a good days!! |
|