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

Message ListMessage List     Post MessagePost Message

  How can I draw double headed arrow
Posted by Tony on Nov-17-2017 19:43
Attachments:
Hi,


How can I draw double headed arrow on XYchart.
please refer to the attachment.
Thanks.



My sample code:

double Measx[2] = {x1 , x2};
double Measy[2] = {y1 , y2};

LineLayer *layer = c->addLineLayer(DoubleArray(Measy, 2), 0);
layer->setXData(DoubleArray(Measx, 2));
layer->setLineWidth(2);


version:  6.0
programming language :  MFC C++
operating system:Win7
vector.jpg

  Re: How can I draw double headed arrow
Posted by Peter Kwan on Nov-18-2017 00:37
Hi Tony,

You can use vector layers (XYChart.addVectorLayer) to add arrows to the chart. You can use two such layers for arrows pointing in opposite directions. For example:

// The starting and ending points of the arrows
double startX[] = {x1};
double endX[] = {x2};
double startY[] = {y1};
double endY[] = {y2};

VectorLayer *layer1 = c->addVectorLayer(DoubleArray(startX, 1), DoubleArray(startY, 1), DoubleArray(endX, 1), DoubleArray(endY, 1), Chart::EndPoints, 0x000000);
layer1->setLineWidth(1);

VectorLayer layer2 = c->addVectorLayer(DoubleArray(endX, 1), DoubleArray(endY, 1), DoubleArray(startX, 1), DoubleArray(startY, 1), Chart::EndPoints, 0x000000);

// Set arrow head size . If not set, will use default size.
layer1->setArrowHead(15);
layer2->setArrowHead(15);

Hope this can help.

Regards
Peter Kwan