Is there a way to obtain the Chart X and Y coordinates from a screen X, Y (mouse coordinates).
Thanks
Bernard
Screen Point to Chart Coordinates
Re: Screen Point to Chart Coordinates
Hello,
You can use the Axis' CalcPosPoint to transform screen pixels to axis values. Ie:
Note you can also transform Axis values to screen pixels with CalcPosValue function. Ie:
Another pair useful functions is the Series' CalcXPos/CalcYPos, returning the pixel position for a given ValueIndex. Ie:
You can use the Axis' CalcPosPoint to transform screen pixels to axis values. Ie:
Code: Select all
var XPixel: Integer;
XValue: Double;
//...
XValue:=Chart1.Axes.Bottom.CalcPosPoint(XPixel);
Code: Select all
var XPixel: Integer;
XValue: Double;
//...
XPixel:=Chart1.Axes.Bottom.CalcPosValue(XValue);
Code: Select all
var XPixel, YPixel, ValueIndex: Integer;
Series1: TPointSeries;
//...
XPixel:=Series1.CalcXPos(ValueIndex);
YPixel:=Series1.CalcYPos(ValueIndex);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Screen Point to Chart Coordinates
Thanks for your response.
Where can I find the function 'CalcPosPixel' I have searched all of the directories under Steema TeeChart Pro VCL FMX 2017.22 but have not found it.
Bernard
Where can I find the function 'CalcPosPixel' I have searched all of the directories under Steema TeeChart Pro VCL FMX 2017.22 but have not found it.
Bernard
Re: Screen Point to Chart Coordinates
Never mind, I found it, in C++ Builder it's Chart1->Series->CalcXPosValue(.....
Thanks
Bernard
Thanks
Bernard