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

Message ListMessage List     Post MessagePost Message

  Line drawing question in FinanceChart.
Posted by eaglescv on Aug-03-2020 01:00
I am trying to draw a line in FinanceChart and I want to draw based on the high or low data of the candle.

FinanceChart m(width);
m.addLine( highdata[200].pixel.x, highdata[200].pixel.y, highdata[200].pixel.x + 100, highdata[200].pixel.y);

I want to get the pixel position of the candle's(array random access index) high or low data.
What should I do? help me plz..

  Re: Line drawing question in FinanceChart.
Posted by Peter Kwan on Aug-03-2020 20:28
Hi eaglescv,

The BaseChart.addLine uses pixel coordinates. Instead of using BaseChart.addLine, you may consider to use Axis.addMark with xZoneColor, which uses data values instead of pixel coordinates. It is like (in C++):

FinanceChart m(width);


// Add the main price chart
XYChart *c = m.addMainChart(.....);


// Blue color between index = 200 to 210, transparent outside this range.
// (extraPoints is the same extraPoints parameter used in FinanceChart.setData)
int lineColor = c->xZoneColor(200 - extraPoints, Chart::Transparent, c->xZoneColor(210 - extraPoints, 0x0000ff, Chart::Transparent));

// Add the line
c->yAxis()->addMark(highData[200], lineColor)->setLineWidth(2);

Hope this can help.

Peter Kwan