Skip to content
vjt edited this page Sep 13, 2010 · 1 revision

The speedometer currently has a very simple API, composed of few functions.

new Speedometer (element, options = {})

Description: constructor
Purpose: create a new speedometer instance
Parameters:

  • String element: the DOM id of the speedometer container
  • Object options: an hash of options for configuration, as documented in doc/configuration.textile
    Returns: Object – a new speedometer instance

draw ()

Description: main drawing function
Purpose: draw all the gauge components – background, meter, gloss, display, hand
Parameters: none
Returns: nothing

update (value)

Description: update the speedometer instance to a new value, clipping to the configured maximum and minimum
Purpose: set the current value, move the hand, update the display
Parameters:

  • Integer value: the new value to set
    Returns: Integer – the value set

value ()

Description: getter
Parameters: none
Returns: Integer – the current value of the speedometer instance

min ()

Description: getter
Parameters: none
Returns: Integer – the minimum value of the speedometer instance

max ()

Description: getter
Parameters: none
Returns: Integer – the maximum value of the speedometer instance

Clone this wiki locally