Page 1 of 1
TChartScrollBar scrolling
Posted: Mon Aug 18, 2014 2:01 pm
by 16469977
Hi,
I am trying to add scroll to my chart, but not able to do it.
I added both horizontal and vertical scrollbars to scroll my chart.
But, I don't have any idea about, how to set Page Number, Small change, Large Change etc. (when Rect or animated zoom) in scrollbar OnChange event ?
I understood that number of page numbers setting based on the number of points?
Is it possible to set number of page numbers based on the number of scale units (instead of number of points)?
Thanks in advance,
Re: TChartScrollBar scrolling
Posted: Tue Aug 19, 2014 9:45 am
by yeray
Hello,
skng wrote:I am trying to add scroll to my chart, but not able to do it.
I added both horizontal and vertical scrollbars to scroll my chart.
But, I don't have any idea about, how to set Page Number, Small change, Large Change etc. (when Rect or animated zoom) in scrollbar OnChange event ?
Small Change and Lagre Change are properties of the TScrollBar. Here you have the documentation Embardcadero gives for them:
http://docwiki.embarcadero.com/Librarie ... TScrollBar
http://docwiki.embarcadero.com/Librarie ... mallChange
http://docwiki.embarcadero.com/Librarie ... argeChange
http://docwiki.embarcadero.com/Librarie ... r.OnChange
The paging feature in TeeChart is explained with detail in "Tutorial 3 - Chart Paging". And there are a pair of examples under "All Features\Welcome !\Tools\Page Number" in the features demo.
Both the tutorials and the features demo are shipped with the binary installation.
skng wrote:I understood that number of page numbers setting based on the number of points?
The pages function is designed to be set knowing the number of point per page. Once you've set the number of points to show in a page, you can call
PreviousPage/
NextPage methods to move back/forward in the pages. Or you can jump to a desired page number setting the
Current property.
skng wrote:Is it possible to set number of page numbers based on the number of scale units (instead of number of points)?
If you want to implement a custom navigation, you can just use the bottom axis SetMinMax function.
You just have to calculate the increment you want to set in your TScrollBar OnChange, and set the bottom axis in a similar way as in the example below:
Code: Select all
uses Series;
var incr: Double;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
with Chart1.AddSeries(TBarSeries) do
for i:=0 to 8 do
AddXY(i*i, 50+random*50);
ScrollBar1.Max:=5;
ScrollBar1.Min:=0;
incr:=(Chart1[0].XValues.MaxValue-Chart1[0].XValues.MinValue)/(ScrollBar1.Max-ScrollBar1.Min+1);
Chart1.Axes.Bottom.MinimumOffset:=20;
Chart1.Axes.Bottom.MaximumOffset:=20;
ScrollBar1Change(Self);
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
Chart1.Axes.Bottom.SetMinMax(ScrollBar1.Position*incr,
(ScrollBar1.Position+1)*incr);
end;
Re: TChartScrollBar scrolling
Posted: Tue Aug 19, 2014 2:17 pm
by 16469977
Thanks for your reply Yeray.