Still have questions?
Contact support



Sometimes when there is too much data that it cannot be displayed simultaneously keeping it comfortable for understanding. In this case we can enable the scroller.

Use enabled() method to switch the scroller on and off. Passing "true" to the xScroller() method is a shortcut to enable scroller:

// turn on X Scroller
var chart = anychart.column();

// disable scroller

JsFiddle Playground

Zoom Settings

Limits by ratio

The simplest way of limiting the show area is using the ratio. Do this with the setTo() method for that. Use two values with this method: the start ratio value (e.g. 0) and the end one (e.g. 0.3):

// set zoom ratio
chart.xZoom().setTo(0, 0.3);

JsFiddle Playground

Limits by values

Another option is to define the particular values which exist on the scale. In this case you have to set the scale as the third parameter, the default xScale is used when no scale is specified. If you like to zoom the chart to the area from "Part 1" to "Part 4" on the heatmap we should use the setToValues() method:

Note: only Heat maps support scroll or zoom by Y in this version.

// set zoom limits by values
chart.yZoom().setToValues("Part 1", "Part 4");

JsFiddle Playground

Limits by the number of points

The third way of setting the limits is to set the number of points from the beginning or end of the scale. We set the number of points, the second boolean parameter defines if the points should be counted from the end of the scale and the third parameter is the scale. The point will be counted from start by default, if you need them to be counted from end, set "true" as the second value.

// set limits using a number of points
chart.xZoom()setToPointsCount(10, true);

JsFiddle Playground

Get the limits ratio

To get the limiting points ratio using getStartRatio() and getEndRatio() methods.

// set the xZoom
var xZoom = chart.xZoom();

// Zooms series by defined points count

// get the limits ratio
chart.title("The chart shows the part from " + xZoom.getStartRatio() + " and ends at " + xZoom.getEndRatio());

JsFiddle Playground

Allow range change

To limit the amount of items displayed you can use the allowRangeChange() method.

// forbid scroller range change

JsFiddle Playground

Scroll bar

The scroll bar is flexible in its look and behavior, you can change colors, size, position, etc.


With the orientation() method you can set the orientation of the scroller.

// change the scroller orientation

JsFiddle Playground


Scroller can be displayed in "afterAxes" or "beforeAxes" positions. The "afterAxes" position is set by default.

// change the scroller orientation

JsFiddle Playground


Colors of the scroll bar can be easily changed with simple methods fill(), selectedFill() and outlineStroke():

// set the fill color

// set the selected fill color

// set the stroke of the bar
chart.xScroller().outlineStroke("#33CC33", 2);

JsFiddle Playground


To adjust scroll bar height (width) use the height() method. There are also maxHeight() and minHeight() methods which are useful when your charts are being resized.

// set the bar height

// set the bar height

JsFiddle Playground


The scroll bar thumbs can be adjusted too. You change their look, dimensions or enable/disable them.

// adjusting the thumbs behavior and look

JsFiddle Playground

Live update

By default, the chart is changing while being scrolled. To redraw a chart only when the mouse button is released use the continuous() method. This may improve user experience when you show very large data sets.

// prevent the scrolling while the button is not released yet

JsFiddle Playground

Auto hide

You can prevent the scroller from showing if there is no need in it. Use the autoHide() method in such cases:

// autoHide the scroller

In this sample a dataSet has 20 points, zoom settings allow to show only 15. You can remove points simply by clicking them, and when 15 or less are left - scroll bar will disappear.

JsFiddle Playground


Basic information about event listeners can be found in the Event Listeners tutorial.

There are three events which scroller can dispatch:

  • scrollerchange
  • scrollerchangestart
  • scrollerchangefinish.

These events are dispatched when we drag the scroll bar, click on it or change it's size. All events provide information about the source of changes (thumbDrag, selectedRangeDrag or backgroundClick), the startRatio and endRatio values.

Here is the sample of scrollerchangefinish event listener:

// add a listener
chart.xScroller().listen("scrollerchangefinish", function(e){
    var startRatio = e.startRatio;
    var endRatio = e.endRatio;
    // change the chart title
    chart.title("The chart shows the part from " + startRatio + " and ends " + endRatio);

JsFiddle Playground