Class Index | File Index

Classes


Class links.Graph.StepNumber

StepNumber The class StepNumber is an iterator for numbers. You provide a start and end value, and a best step size. StepNumber itself rounds to fixed values and a finds the step that best fits the provided step. If prettyStep is true, the step size is chosen as close as possible to the provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... Example usage: var step = new links.Graph.StepNumber(0, 10, 2.5, true); step.start(); while (!step.end()) { alert(step.getCurrent()); step.next(); } Version: 1.0
Defined in: graph.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
links.Graph.StepNumber(start, end, step, prettyStep)
Method Summary
Method Attributes Method Name and Description
 
end()
Returns true whether the end is reached
 
returns the current value of the step
 
returns the current step size
 
next()
Do a step, add the step size to the current value
 
setStep(step, prettyStep)
Set a new step size
 
Set the current value to the largest value smaller than start, which is a multiple of the step size
Class Detail
links.Graph.StepNumber(start, end, step, prettyStep)
Parameters:
{number} start
The start value
{number} end
The end value
{number} step
Optional. Step size. Must be a positive value.
{boolean} prettyStep
Optional. If true, the step size is rounded To a pretty step size (like 1, 2, 5, 10, 20, 50, ...)
Method Detail
{boolean} end()
Returns true whether the end is reached
Returns:
{boolean} True if the current value has passed the end value.

{number} getCurrent()
returns the current value of the step
Returns:
{number} current value

{number} getStep()
returns the current step size
Returns:
{number} current step size

next()
Do a step, add the step size to the current value

setStep(step, prettyStep)
Set a new step size
Parameters:
{number} step
New step size. Must be a positive value
{boolean} prettyStep
Optional. If true, the provided step is rounded to a pretty step size (like 1, 2, 5, 10, 20, 50, ...)

start()
Set the current value to the largest value smaller than start, which is a multiple of the step size

Documentation generated by JsDoc Toolkit 2.3.2 on Tue Aug 20 2013 14:42:14 GMT+0200 (CEST)