Some issues regardind TCHartNavScrollBar lazarus / 55-TAChart ---------------------------------------------------------------------- CM630 · 2013-09-29 09:31 I put a horizontal TCHartNavScrollBar and linked it to the chart. 1. When I scroll right, it shows after the end of the series. I don't know if this is a bug or it's made on purpose? 2. I put this code, in order to scale the scrollbar according the portion of the zoomed area, related to the total range. Code: [Select]procedure TForm1.Chart1ExtentChanged(ASender: TChart); var     SpanX, RangeX: extended; begin    SpanX:=abs(chart1.LogicalExtent.coords[3]- chart1.LogicalExtent.coords[1]);    RangeX:=abs(chart1.GetFullExtent.coords[3]- chart1.GetFullExtent.coords[1]);   ChartNavScrollBar1.PageSize:=max(1,round(100*SpanX/RangeX));  //max prevents the value from becoming zero end;Then a problem occurred: when the .PageSize is set to 100, still the scrollbar (slider piece) does not fill the whole area, do it can be dragged left-right. So I added a line to disable the TCHartNavScrollBar... when, I debugged...the code is run, but it does not get disabled. I tried to disable the TCHartNavScrollBar from a Button- it does work? Is it me doing something wrong?  Code: [Select] procedure TForm1.Chart1ExtentChanged(ASender: TChart); var     SpanX, RangeX: extended; begin      SpanX:=abs(chart1.LogicalExtent.coords[3]- chart1.LogicalExtent.coords[1]);      RangeX:=abs(chart1.GetFullExtent.coords[3]- chart1.GetFullExtent.coords[1]);   //   ChartNavScrollBar1.Enabled:=not (SpanX>=RangeX); //This is not working      if SpanX>=RangeX then ChartNavScrollBar1.Enabled:=False else ChartNavScrollBar1.Enabled:=True;  //This is not working neither      ChartNavScrollBar1.PageSize:=max(1,round(100*SpanX/RangeX));  //max prevents the value from becoming zero end;     I have attached a sample project. Edit: I set CHartNavScrollBar1.Max:=99 and this way there is no necessity to disable it. ---------------------------------------------------------------------- wp · 2013-09-29 13:18 The ChartNavScrollbar behaves fairly decent if you enable its "AutoPageSize"; your handling of ChartExtentChanged is not necessary to avoid scrolling beyond the axis range. One thing which I find annoying is that the scrolled viewport shifts a bit when the mouse button is released. Disabling the scrollbar does not seem to work when the chart is zoomed. But why would you want to disable it? If you don't need it I think it would be better to hide it altogether. For the docs of the ChartNavScrollbar, see http://wiki.lazarus.freepascal.org/TAChart_documentation#Scroll_bars. ---------------------------------------------------------------------- CM630 · 2013-10-01 10:08 There occurred to be some more more signifficant problems. If I set  AutoPageSize:=True and I do Code: [Select]uses ... TAChartUtils... procedure TForm1.Button3Click(Sender: TObject); var extents:TDoubleRect; begin extents.coords[1] :=2; extents.coords[3]:=2.01; extents.coords[2]:=-10; extents.coords[4]:=10; chart1.Extent.FixTo (extents) ; end;  the slider files the whole area, so it cannot be used. But that is not the worst thing. In the sample project, that I have attached if you zoom so that SpanX becomes about 0,2, and you click the right arrow of the scrollbar the Xscale will shift in such a way, that it will skip a part of the curve. To explain it the other way: If the leftmost value on the axis is for example 5  (logicalextent[1]) , and the rightmost is 5,2   (logicalextent[3]) , when the right arrow is pressed, the new leftmost value should not be greater that 5,2. Well, in the example attached it is greater (say 5.3), i.e. parts of the curve are skipped. Quote from: wp on September 29, 2013, 03:18:23 pmBut why would you want to disable it? If you don't need it I think it would be better to hide it altogether. Well, it has to take spece on the screen, an the user should know, that it exists and can be used. Maybe is't a question of taste. ---------------------------------------------------------------------- wp · 2013-10-01 11:57 Quoteand you click the right arrow of the scrollbar the Xscale will shift in such a way, that it will skip a part of the curve.The resolution of scrolling is determined by the range defined by Scrollbar.Min and .Max. The manual (http://wiki.lazarus.freepascal.org/TAChart_documentation#Scroll_bars) recommends to increase the Max value to a large integer to achieve finer scrolling. Using Max = 1000 or Max= 10000 produced a nice scrolling behavior with my tests, at least as I can tell. Quotechart1.Extent.FixTo (extents) ; the slider files the whole area, so it cannot be used.That's the way it is intended. The Chart.Extent defines the non-zoomed rectangle, i.e. that what is returned by the function Chart.GetFullExtent. Normally this extent is defined by the range of the data, but you can override it by modifiying the Chart.Extent subproperties. FixTo freezes all values. Since the chart extent defines the limits of the scrollbar range there's nothing to scroll any more after calling Extent.FixTo.