that is the exact algorithm i was planning on implementing today.
thanks for confirming the approach.
tried to implement the "solution", but haven't seen any lines being drawn, yet. also, tried to find the Tutorials, but was unable.
below is a function that was written to add 2 points to a series, and, then attempt to draw a line between them ... the Line and MoveTo/LineTo are redundant, but wanted to see if either would produce a line.
in another post, it was indicated that the line drawing had to be done in the OnAfterDraw event handler. well, i tried that, as well - still with no luck (copied the last 4 lines to the handler). the problem with doing this in the handler, i'd have to maintain a list of lines that i'd like to have drawn - some points would have multiple lines drawn to/from them. some points wouldn't be processed in order.
------------------DrawLine function-------------------------
void __fastcall TfrmPointPlot::DrawLine ( TChart *chart, TPointSeries *series,
double point1X, double point1Y,
double point2X, double point2Y )
{
// first, plot the 2 sets of points. (this works)
int id1 = series->AddXY ( point1X, point1Y );
int id2 = series->AddXY ( point2X, point2Y );
//********added Draw to force a draw - this results in the point values
//********being available to the functions below
// force a draw of the chart
chart->Draw();
// since there isn't a DrawLine method on the chart, directly, we have to get the
// coordinates of the points (as they are defined on the canvas), and use the canvas
// line function to draw the line
// get the actual canvas coordinates of the points (these are INTs).
coord1X = series->CalcXPos(id1);
coord1Y = series->CalcYPos(id1);
coord2X = series->CalcXPos(id2);
coord2Y = series->CalcYPos(id2);
// also tried...but always returned 0 for all 4 coord values
// coord1X = series->CalcXPosValue(point1X);
// coord1Y = series->CalcYPosValue(point1Y);
// coord2X = series->CalcXPosValue(point2X);
// coord2Y = series->CalcYPosValue(point2Y);
chart->Canvas->Pen->Color = clBlack;
// draw a line between the 2 points.
chart->Canvas->Line(coord1X,coord1Y,coord2X,coord2Y);
// redundant for the single line of code above, but neither worked.
chart->Canvas->MoveTo(coord1X,coord1Y);
chart->Canvas->LineTo(coord2X,coord2Y);
//*********still no lines being drawn on the chart
}