Top
You are looking at an outdated 7.1.0 version of this document. Switch to the 8.0.1 version to see the up to date information.

class anychart.ui.ScrollBar Improve this Doc

Extends: anychart.VisualBaseWithBounds

Scroll bar implementation. TODO (A.Kudryavtsev): Add features list and common functionality.

Methods Overview

Miscellaneous
backgroundFill()Gets/sets a background fill.
backgroundStroke()Gets/sets a background stroke.
buttonsVisible()Adds/removes scroll buttons from scroll bar.
contentBounds()Gets/sets a content bounds.
draw()Draws scroll bar.
endRatio()Gets/sets an end ratio.
layout()Getter/setter for layout.
scroll()Performs the ratio step scroll.
scrollEndTo()Tries to set new value of end ratio.
scrollPixel()Performs the pixel step scroll.
scrollPixelEndTo()Tries to set new value of end pixel of visible bounds.
scrollPixelStartTo()Tries to set new value of start pixel of visible bounds.
scrollStartTo()Tries to set new value of start ratio.
setRatio()Sets startRatio and endRatio.
sliderFill()Gets/sets a slider fill.
sliderStroke()Gets/sets a slider stroke.
startRatio()Gets/sets a start ratio.
visibleBounds()Gets/sets a visible bounds.

Methods Description

backgroundFill

Gets/sets a background fill.

Params:

Name Type Description
fillOrColorOrKeys anychart.graphics.vector.Fill | !Array.<(anychart.graphics.vector.GradientKey|string)> | null .
opacityOrAngleOrCx number .
modeOrCy number | boolean | anychart.graphics.math.Rect | Object .
opacityOrMode number | anychart.graphics.math.Rect | Object | null .
opacity number .
fx number .
fy number .

Returns:

anychart.graphics.vector.Fill anychart.ui.ScrollBar string - - Current value or itself for chaining.

backgroundStroke

Gets/sets a background stroke.

Params:

Name Type Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null .
thickness number .
dashpattern string .
lineJoin anychart.graphics.vector.StrokeLineJoin .
lineCap anychart.graphics.vector.StrokeLineCap .

Returns:

anychart.graphics.vector.Stroke anychart.ui.ScrollBar string - - Current value or itself for chaining.

buttonsVisible

Adds/removes scroll buttons from scroll bar.

Params:

Name Type Description
value boolean Whether show or hide the scroll buttons.

Returns:

boolean anychart.ui.ScrollBar - - Current value or itself for chaining.

contentBounds

Gets/sets a content bounds. Content bounds in this case is a reflection of some real bounds that express a real content's sizes.

Params:

Name Type Description
value anychart.graphics.math.Rect Value to be set.
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar anychart.graphics.math.Rect - - Current value or itself for chaining.

draw

Draws scroll bar.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

endRatio

Gets/sets an end ratio. To set startRatio and endRatio both in a same moment, use setRatio instead. NOTE: Start ratio value can't exceed an end ratio value. That's why the following behavior is implemented (please be careful here): 1) endRatio can't be set to 0. If you try to set endRatio(0) then new value will not be set. 2) If you try to set endRatio < startRatio, the minimal value becomes startRatio, the maximal one becomes endRatio. For example: startRatio = 0.3; endRatio = 0.5; Call endRatio(0.2) : startRatio = 0.2; //Newly set value. endRatio = 0.3; //Swapped with startRatio. 3) If you try to set endRatio equal to current startRatio, then startRatio becomes 0. It is so because the difference between startRatio and endRatio as actually a visible range in some real bounds. This range can't be 0 (dividing by 0 means that content bounds are infinity). At the same time, user must have a possibility to set endRatio to current startRatio value excepting endRatio = 0. So, be careful here. For example: startRatio = 0.3; endRatio = 0.5; Call endRatio(0.3) : startRatio = 0; //Force 0. endRatio = 0.3; //Newly set value. Usage: Initial startRatio = 0.3; Initial endRatio = 0.5; scrollBar .endRatio(0.3) //Here startRatio becomes 0 , endRatio becomes 0.3. .startRatio(0.1); //startRatio becomes 0.1, endRatio is still 0.3 - everything is fine.

Params:

Name Type Description
value number Value to be set.
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

number anychart.ui.ScrollBar - - Current value or itself for chaining.

layout

Getter/setter for layout. NOTE: Doesn't modify actual bounds.

Params:

Name Type Description
value anychart.enums.Layout | string Value to be set.

Returns:

anychart.enums.Layout anychart.ui.ScrollBar - - Current layout or itself for chaining.

scroll

Performs the ratio step scroll. NOTE: Negative step-parameter value is backward, positive one is forward.

Params:

Name Type Description
step number Ratio scroll step value.
eventSource string Event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

scrollEndTo

Tries to set new value of end ratio. This method keeps a difference between end ratio and start ratio constant, that's why this method can't be used as direct value setter.

Params:

Name Type Description
value number New value, where method tries to scroll end ratio to. //TODO Bad english :'( .
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

scrollPixel

Performs the pixel step scroll. NOTE: Negative step-parameter value is backward, positive one is forward. NOTE 2: If the visible bounds are not set, nothing will be done.

Params:

Name Type Description
step number Ratio scroll step value.
eventSource string Event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

scrollPixelEndTo

Tries to set new value of end pixel of visible bounds. This method keeps a difference between end value of visible bounds and its start value constant, that's why this method can't be used as direct value setter. NOTE: In this case end value for horizontal layout is 'left + width' of visible bounds and 'top + height' for vertical layout.

Params:

Name Type Description
value number New value, where method tries to scroll end value of visible bounds to. //TODO Bad english :'( .
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

scrollPixelStartTo

Tries to set new value of start pixel of visible bounds. This method keeps a difference between end value of visible bounds and its start value constant, that's why this method can't be used as direct value setter. NOTE: In this case start value for horizontal layout is 'left' coordinate of visible bounds and 'top' for vertical layout.

Params:

Name Type Description
value number New value, where method tries to scroll start value of visible bounds to. //TODO Bad english :'( .
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

scrollStartTo

Tries to set new value of start ratio. This method keeps a difference between end ratio and start ratio constant, that's why this method can't be used as direct value setter.

Params:

Name Type Description
value number New value, where method tries to scroll start ratio to. //TODO Bad english :'( .
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

setRatio

Sets startRatio and endRatio. If you try to set startRatio < endRatio, the minimal value becomes startRatio, the maximal one becomes endRatio. If you try to set startRatio == endRatio, new values will not be set. NOTE: This method is created to simplify usage of a scroll bar. Example: startRatio = 0; endRatio = 0.4; Than we call: scrollBar.startRatio(0.6).endRatio(1); By the first look, we're expecting that the values will be startRatio = 0.6; endRatio = 1; but it is not correct in this case: Calling the first scrollBar.startRatio(0.6) gives the following values: startRatio = 0.4; //Swapped with current endRatio value. See startRatio description. endRatio = 0.6; //Newly set value. Then call .endRatio(1) and values become: startRatio = 0.4; //Not changes after the previous operation. endRatio = 1; //Newly set value. Using this method allows to avoid such a strange situations.

Params:

Name Type Description
startRatio number New value for start ratio. Must be in [0 .. endRatio) range.
endRatio number New value for end ratio. Must be in (startRatio .. 1] range.
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar - - Itself for chaining.

sliderFill

Gets/sets a slider fill.

Params:

Name Type Description
fillOrColorOrKeys anychart.graphics.vector.Fill | !Array.<(anychart.graphics.vector.GradientKey|string)> | null .
opacityOrAngleOrCx number .
modeOrCy number | boolean | anychart.graphics.math.Rect | Object .
opacityOrMode number | anychart.graphics.math.Rect | Object | null .
opacity number .
fx number .
fy number .

Returns:

anychart.graphics.vector.Fill anychart.ui.ScrollBar string - - Current value or itself for chaining.

sliderStroke

Gets/sets a slider stroke.

Params:

Name Type Description
strokeOrFill anychart.graphics.vector.Stroke | anychart.graphics.vector.ColoredFill | string | null .
thickness number .
dashpattern string .
lineJoin anychart.graphics.vector.StrokeLineJoin .
lineCap anychart.graphics.vector.StrokeLineCap .

Returns:

anychart.graphics.vector.Stroke anychart.ui.ScrollBar string - - Current value or itself for chaining.

startRatio

Gets/sets a start ratio. To set startRatio and endRatio both in a same moment, use setRatio instead. NOTE: Start ratio value can't exceed an end ratio value. That's why the following behavior is implemented (please be careful here): 1) startRatio can't be set to 1. If you try to set startRatio(1) then new value will not be set. 2) If you try to set startRatio > endRatio, the minimal value becomes startRatio, the maximal one becomes endRatio. For example: startRatio = 0.3; endRatio = 0.5; Call startRatio(0.6) : startRatio = 0.5; //Swapped with endRatio. endRatio = 0.6; //Newly set value. 3) If you try to set startRatio equal to current endRatio, then endRatio becomes 1. It is so because the difference between startRatio and endRatio as actually a visible range in some real bounds. This range can't be 0 (dividing by 0 means that content bounds are infinity). At the same time, user must have a possibility to set startRatio to current endRatio value excepting startRatio = 1. So, be careful here. For example: startRatio = 0.3; endRatio = 0.5; Call startRatio(0.5) : startRatio = 0.5; //Newly set value. endRatio = 1; //Force 1. Usage: Initial startRatio = 0.3; Initial endRatio = 0.5; scrollBar .startRatio(0.5) //Here startRatio = 0.5 , endRatio becomes 1. .endRatio(0.9); //startRatio is still 0.5, endRatio becomes 0.9 - everything is fine.

Params:

Name Type Description
value number Value to be set.
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

number anychart.ui.ScrollBar - - Current value or itself for chaining.

visibleBounds

Gets/sets a visible bounds. Visible bounds in this case is a reflection of some real bounds visible in a real content's bounds.

Params:

Name Type Description
value anychart.graphics.math.Rect Value to be set.
eventSource string Scroll event source. Additional information to be attached to event object. Used for advanced events manipulations.

Returns:

anychart.ui.ScrollBar anychart.graphics.math.Rect - - Current value or itself for chaining.