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

Message ListMessage List     Post MessagePost Message

  drawing vertical line in the FinanceChart
Posted by Paul King on Nov-16-2006 01:34
Can someone help me if there is a simple way to draw vertical lines in the FinanceChart in Java?

I am trying to draw a vertical line between two specific dates, ie vertical line between Nov 7 and Nov 8.

Thank you in advance
Paul

  Re: drawing vertical line in the FinanceChart
Posted by Peter Kwan on Nov-16-2006 07:11
Hi Paul,

For financial charts, the unit on the x-axis are trading sessions. (For example, 20 days moving average means 20 trading days, not 20 "real" days.) The date labels are for human reading only.

In FinanceChart, the x-coordinate for Nov 7 is the visible trading day count of Nov 7. For example, if Nov 7 is the 10th trading day in the chart, then its x-coordinate is 9 (the first trading day is 0). The Nov 8 must be the 11th trading day with x-coordinate 10. So the mark line should be put at 9.5 (in between x = 9 and x = 10). The code is (in C#/Java):

//add main chart as usual
XYChart mainChart = c.addMainChart(....);

//add a mark line at x = tradingDayCount
main_chart.xAxis().addMark(tradingDayCount, 0x995500, "");

In practice, the tradingDayCount of any date is just the index position of the date in your timeStamps array, minus the "extraDays" (lead dates that are not visible).

Hope this can help.

Regards
Peter Kwan

  Re: drawing vertical line in the FinanceChart
Posted by Paul King on Nov-16-2006 23:32
It works beautifully. Great product.
Thank you
Paul