Page 1 of 1

Working with Scrollbar and Mouse Panning Together

Posted: Fri Jun 18, 2021 10:04 am
by 16591355
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

Re: Working with Scrollbar and Mouse Panning Together

Posted: Mon Jun 21, 2021 10:13 am
by yeray
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.

Re: Working with Scrollbar and Mouse Panning Together

Posted: Tue Jun 22, 2021 1:50 pm
by 16591355
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

Re: Working with Scrollbar and Mouse Panning Together

Posted: Thu Jun 24, 2021 9:48 am
by yeray
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?