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

Message ListMessage List     Post MessagePost Message

  adding lines on the XYChart
Posted by Steven Wonly on Jul-22-2022 04:17
Hello ASE,

I'm using XY-chart with zoom control to display position of incoming data. I'm using addScatterLayer(). It is working well.

By the way, I have a question.
I want to add a couple of lines between data on the XY-chart. I tried to use addLine() but I can't see any lines on the chart.

For example, let assume I got three data A1 (10, 20), A2 (15, 30), A3 (4,13). I can display these three data on the chart by using addScatterLayer(10, 20, "A1",...) and so on. After this, I want to add a line between A1 & A2 and A1 & A3 with distance values on the chart.
I attached a image file that I captured screen. It will give you better understand I think.

Is it possible? If so, would you please help me how to do it?

Thank you.
Best regards,
Steven Wonly

  Re: adding lines on the XYChart
Posted by Peter Kwan on Jul-22-2022 12:35
Hi Steven,

The addLine API uses pixel coordinates, not data coordinates. To add a line segment using data values, you may use XYChart.addLineLayer. See:

For example:

double xData[] = {10, 15};
double yData[] = {20, 30};

LineLayer *layer = c->addLineLayer(DoubleArray(yData, 2), 0xff0000);
layer->setXData(DoubleArray(xData, 2));

Best Regards
Peter Kwan