|
zoom and scroll finance chart |
Posted by Mahbub on Feb-23-2013 12:34 |
|
Hello, could you please add zoom and scroll feature in your "interactive finance chart" vb.net example?
I have tried several ways, but sometimes it is slow, sometimes zoom doesn't work, now it gets too complicated, not as straight forward as your zoom and scroll example. I believe there are some ideal ways to do that. Please publish one complete project on this. |
Re: zoom and scroll finance chart |
Posted by Peter Kwan on Feb-26-2013 00:55 |
|
Hi Mahbub,
Are you using VB.NET in a Windows Forms application or ASP.NET application?
Regards
Peter Kwan |
Re: zoom and scroll finance chart |
Posted by Mahbub on Feb-26-2013 01:37 |
|
Thanks Peter. I am using vb .net in windows form. |
Re: zoom and scroll finance chart |
Posted by Peter Kwan on Feb-27-2013 01:41 |
|
Hi Mahbub,
I happen to have an existing Scrollable Financial Chart sample code based on the Finance (1) sample code. It uses a scroll bar to control the view port. The draw chart code then draws the chart using data as according to the view port position.
I have just modified the code to add two user selectable indicators (just by copying the indicator code from the "Interactive Financial Chart" sample code). It is as attached.
You may add more indicators and user controls to it to make it similar to the Interactive Financial Charts. For example, instead of hard coding the moving average period, you may modify the code so that the moving average period is obtained from user input.
Hope this can help.
Regards
Peter Kwan
|
Re: zoom and scroll finance chart |
Posted by Mahbub on Feb-27-2013 12:50 |
|
Thanks a lot Peter. I'll try it today and will give you
feedback. |
Re: zoom and scroll finance chart |
Posted by Mahbub on Feb-27-2013 22:12 |
|
Sir, I have made two modifications in your project.
added zoom options and two date controls for start
and end date. Zoom worked well but date controls
are showing error in "update control" sub. I am
uploading the project again. Could you Please
correct the lines. Thanks.
|
Re: zoom and scroll finance chart |
Posted by Peter Kwan on Feb-28-2013 00:49 |
|
Hi Mahbub,
Thie issue is because your code handling the date controls assimes the x-coordinate is "calendar" date/time. In financial charts, the x-coordinates are trading sessions, not "calendar" date/time.
The position of the candlesticks are determined based on trading sessions, not date/time. For example, the distance between Thursday and Friday (1 calendar day) is the same as the distance between Friday and Monday (3 calendar days), because they are both 1 trading session apart. The duration in calendar date is not relevant. (The timeStamps array are just used as names for human reading and do not determine the position of the candlesticks.)
In your updateControls, the x-coordinate you obtain is the trading session number (which is the array index of the timeStamps array). Instead of setting the trading session number directly to the date/time control, your code should look up the calendar date/time from the timeStamps array, and set that into the date/time control.
Similary, when the user selects a date in the date/time control, you would need to determine the corresponding trading session number (and properly handle the cases that the user selects invalid dates, such as non-trading dates), and use that as the x-coordinate in GetViewPortAtValue.
Hope this can help.
Regards
Peter Kwan |
Re: zoom and scroll finance chart |
Posted by Mahbub on Feb-28-2013 17:57 |
|
yahoo!!! The job is done. Thanks sir. I'll upload the
project for others after some modifications. |
|