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

Message ListMessage List     Post MessagePost Message

  Vertical line to PHP finance chart
Posted by pisikesipelgas on Apr-24-2024 17:56
Hello,

I have date like let's say '2024-02-05'. I can extract YYYY, MM, and DD from it and construct Chardirectory internally used timestamp, something like that:

$my_time=chartTime(2024,02,05);

And then use this to add a vertical line to main graph (in lib/FinanceChart.php) like that:

$xmark1 = $c->xAxis->addMark($my_time, 0x000000 ,"my line");

at the same time horizontal line appears as expected:
$ymark1 = $c->yAxis->addMark(2, 0x000000 ,"my line");

Problem is that the vertical line does not appear. What i'm missing?

Regards,

  Re: Vertical line to PHP finance chart
Posted by Peter Kwan on Apr-25-2024 16:48
Hi Pisikesipelgas,

The x-coordinates in a financial chart is not date/time. It is the trading session number. It is because financial chart only plot trading days. Trading days can be affected by may factors including unpredictable events like typhoons or hurricanes. (In my location, each year around 2 trading days are lost due to typhoons.) So the date/time are just treated as "names" for human reading.

If you want to add a mark at '2024-02-05', please search the timeStamps array to find its array index. The mark is then:

$xmark1 = $c->xAxis->addMark($array_index - $extraDays, 0x000000 ,"my line");

The $extraDays is the extraDays parameter in FinanceChart.setData. It represents the leading part of the array that is not plotted.

Best Regards
Peter Kwan

  Re: Vertical line to PHP finance chart
Posted by pisikesipelgas on Apr-25-2024 20:07
Thank You for the answer! I'll try!
Regards,