As I want more control about panning, and as the default panning provided doesn't work well, I tried to implement panning myself using gestures in FireMonkey. Here is what I got so far for the X axis only:
Code: Select all
procedure TMultiEPGFrame.FrameGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
var
lGlobalWidth: Double;
lLocalWidth: Double;
begin
if EventInfo.GestureID = igiPan then
begin
lGlobalWidth := self.Width;
lLocalWidth := fChart.BottomAxis.Maximum - fChart.BottomAxis.Minimum;
if fLastPosition.X < EventInfo.Location.X then
begin
fChart.BottomAxis.Minimum := fChart.BottomAxis.Minimum -
((EventInfo.Location.X) / lGlobalWidth);
fChart.BottomAxis.Maximum := fChart.BottomAxis.Maximum -
((EventInfo.Location.X) / lGlobalWidth);
end
else
begin
fChart.BottomAxis.Minimum := fChart.BottomAxis.Minimum +
((EventInfo.Location.X) / lGlobalWidth);
fChart.BottomAxis.Maximum := fChart.BottomAxis.Maximum +
((EventInfo.Location.X) / lGlobalWidth);
end;
fLastPosition := EventInfo.Location;
end;
end;
Thanks a lot!
CJ