Page 1 of 1

Scrolling/Panning in iOS

Posted: Fri Jun 27, 2014 8:14 pm
by 17568804
Hi all,

I am just doing my first tests with TeeChart in Appmethod 1.14 on the iOS platform. I have the TeeChart source code in my project group and everything compiles just fine.

My idea is to use TGanttSeries to represent an electronic program guide (tv guide) visually - my first tests are quite conclusive but panning/scrolling doesn't quite work correctly.

This is how I configured my TChart:

Code: Select all

 fChart.LeftAxis.Automatic := false;
  fChart.LeftAxis.Minimum := -0.5;
  fChart.LeftAxis.Maximum := 5;

  fChart.BottomAxis.Automatic := false;
  fChart.BottomAxis.Minimum := 0;
  fChart.BottomAxis.Maximum := 50;

  fChart.AllowZoom := false;
  fChart.Panning.Active := True;
  fChart.AllowPanning := TPanningMode.pmBoth;
Panning works only once when the app is started and doesn't follow the finger but has an offset. A second attempt doesn't work anymore and the app needs to be restarted for the panning to work again.

Any ideas?

I am using the latest TeeChart 2014 source code for FireMonkey.

Thanks a lot!
CJ

Re: Scrolling/Panning in iOS

Posted: Fri Jun 27, 2014 8:20 pm
by 17568804
For completeness - here is the entire test file with my first steps (only mockup code):

https://github.com/darktab/simpleEPG/bl ... GFrame.pas

Thanks,
CJ

Re: Scrolling/Panning in iOS

Posted: Tue Jul 01, 2014 10:42 am
by Pep
Hello,

in order to make work the pan/scroll over the chart you have to add the following line of code to your code :

Code: Select all

 fChart.ScrollMouseButton := TMouseButton.mbLeft;

Re: Scrolling/Panning in iOS

Posted: Tue Jul 01, 2014 5:56 pm
by 17568804
Thanks!

This is the solution!

One more question though - what's the recommended way to pan/scroll only inside some arbitrary bounds?

Regards,
Christian

Re: Scrolling/Panning in iOS

Posted: Tue Jul 01, 2014 8:56 pm
by 17568804
A way I succeeded in doing so, was implementing the onScroll event with this:

Code: Select all

if (fChart.BottomAxis.Minimum < 0) then
  begin
    fChart.BottomAxis.Minimum := 0;
    fChart.BottomAxis.Maximum := fChart.BottomAxis.Minimum + 50;
  end;
  if (fChart.BottomAxis.Maximum > 70) then
  begin
    fChart.BottomAxis.Minimum := 20;
    fChart.BottomAxis.Maximum := 70;
  end;
which then blocks scrolling on the bottom axis to a boundary between 0 and 70.

Re: Scrolling/Panning in iOS

Posted: Wed Jul 02, 2014 10:49 am
by yeray
Hello,
cjacoby78 wrote:A way I succeeded in doing so, was implementing the onScroll event with this:

Code: Select all

if (fChart.BottomAxis.Minimum < 0) then
  begin
    fChart.BottomAxis.Minimum := 0;
    fChart.BottomAxis.Maximum := fChart.BottomAxis.Minimum + 50;
  end;
  if (fChart.BottomAxis.Maximum > 70) then
  begin
    fChart.BottomAxis.Minimum := 20;
    fChart.BottomAxis.Maximum := 70;
  end;
which then blocks scrolling on the bottom axis to a boundary between 0 and 70.
Yes, onScroll event is the way to limit the scroll to a known area.

Re: Scrolling/Panning in iOS

Posted: Wed Jul 02, 2014 11:35 am
by 17568804
Thanks a lot!