Working with Scrollbar and Mouse Panning Together

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Luca
Newbie
Newbie
Posts: 4
Joined: Thu Jun 10, 2021 12:00 am

Working with Scrollbar and Mouse Panning Together

Post by Luca » Fri Jun 18, 2021 10:04 am

Hi,
i've a TLineSeries in a TChart and as the title say, i'm trying to work together with a TChartScrollbar and Mouse Panning with right button to scroll. In my case i only need to scroll the chart horizontally. The problem is that when i open the Application if i start using the Scrollbar all goes well, i have no problems. If i start panning the Serie with the right button of Mouse, the scrollbar will not function anymore, the chart remains in the same position if i try dragging the thumb or pressing the scrollbar arrows.
Is it possible to work in this way? with Scrollbar and Mouse Panning Together?
I'm working with C++ Builder 10.4.2, TeeChart Pro v2021.32.210430 VCL 32 bit

Thanks, Luca

Yeray
Site Admin
Site Admin
Posts: 9012
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Working with Scrollbar and Mouse Panning Together

Post by Yeray » Mon Jun 21, 2021 10:13 am

Hello,

This seems to be working fine for me here:

Code: Select all

void __fastcall TForm2::FormCreate(TObject *Sender)
{
  Chart1 = new TChart(this);
  Chart1->Parent = this;

  ChartScrollBar1 = new TChartScrollBar(this);
  ChartScrollBar1->Parent = this;
  Chart1->Align = alClient;
  ChartScrollBar1->Align = alBottom;
  ChartScrollBar1->Chart = Chart1;

  Chart1->Legend->Hide();
  Chart1->View3D = false;

  Chart1->AllowPanning = pmHorizontal;

  TLineSeries *line = new TLineSeries(this);
  Chart1->AddSeries(line);
  line->FillSampleValues();

  Chart1->Axes->Bottom->SetMinMax(10,15);
  ChartScrollBar1->RecalcPosition();
}
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Luca
Newbie
Newbie
Posts: 4
Joined: Thu Jun 10, 2021 12:00 am

Re: Working with Scrollbar and Mouse Panning Together

Post by Luca » Tue Jun 22, 2021 1:50 pm

Hi Yeray,
i tried your code and it works fine. So i came back to my code and i found what was wrong, these options were active:

Chart1->Pages->Autoscale = true; //now is false
Chart1->Pages->MaxPointsPerPage = 100; //now is 0

and prevented the code to work.

Now i have more questions. I work with large file, from 2 MegaByte to 4 MegaByte more or less loaded in a Serie, and want to change some parameters on TChartScrollBar:
- how can i set how much the bar Scrolls?
with these large files it seems like is scrolling 20000 points when i press the left arrow of the scrollbar (keeping the default properties of the scrollbar: smallchange 300, largechange 3000....). I can't understand when the TChartScrollBar needs some code behind.

Thanks,
Luca

Yeray
Site Admin
Site Admin
Posts: 9012
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Working with Scrollbar and Mouse Panning Together

Post by Yeray » Thu Jun 24, 2021 9:48 am

Hello Luca,
Luca wrote:
Tue Jun 22, 2021 1:50 pm
I work with large file, from 2 MegaByte to 4 MegaByte more or less loaded in a Serie [...] with these large files it seems like is scrolling 20000 points when i press the left arrow of the scrollbar
Could you please tell us how many points are you approximately loading in your series do we can do a test here?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply