Series.GetXImgValue(Index)

Series.GetYImgValue(Index)

These are just wrappers for Chart.XImageToGraph and Chart.YImageToGraph. Use whatever is convenient.

Is there a function that converts from mouse position to series values?

EDIT: Probably ImageToGraph?

Certainly. I think you used that in the other projects we discussed here.

Please note however, that this is not the most general case. If you use transformations you have to consider these as well. The "graph" coordinates are relative to the unique x/y coordinates spanning some kind of invisible axes behind the chart. When you use a transformation the values stored in the series ("axis coordinates") are mapped to this axis. Create a simple project with a logarithmic axis, and you'll see the difference: if your data points range between 1 and 1 million ("axis" coordinates), the "graph" coordinates range between 0 (= log(1)) and 6 (= log (1 million)).

The transformations class does all the conversions. It has methods AxisToGraph and GraphToAxis. The axis, moreover, provides the method GetTransform to determine the selected transformation chain (there can be several transformations per axis) (or 1:1 identity if transformations are not used). The most general way therefore is

`var`

x,y: Integer; // Mouse coordinates, in pixels (or "image coordinates")

P: TDoublePoint;

begin

P.x := Chart.XImageToGraph(x); // P is in "graph" coordinates

P.y := Chart.YImageToGraph(y);

// Now convert "graph" to "axis" coordinates

P.x := Chart.BottomAxis.GetTransform.GraphToAxis(P.X); // P is in "axis" coordinates now

P.y := Chart.LeftAxis.GetTransform.GraphToAxis(P.Y);

{ or, in a single line:

P.x := Chart.BottomAxis.GetTransform.GraphToAxis(Chart.XImageToGraph(x));

P.y := Chart.LeftAxis.GetTransform.GraphToAxis(Chart.YImageToGraph(y));}

end;