Skip to main content

Odometer

Namespace: Wisej.Web.Ext.Odometer

Assembly: Wisej.Web.Ext.Odometer (4.1.0.0)

Represents an odometer widget to display smoothly transitioning numbers.

public class Odometer : Widget

Wraps the HubSpot Odometer library: http://github.hubspot.com/odometer/. Changing Value animates the digits from the current value to the new value.

Constructors​

Instance member Odometer()​

Creates a new instance of the Odometer control.

The control is not selectable and doesn't take part in the tab order.

Properties​

Protected member DefaultSize​

Size: The default Size of the control.

Instance member Duration​

Int32: Returns or sets the duration of the animation to the final value, in milliseconds. (Default: 750)

The duration is passed to the odometer library when the widget is created; changing it later doesn't affect the widget already displayed in the browser.

Instance member FontSize​

Int32: Returns or sets the font size of the odometer in pixels. (Default: 13)

The size is applied as an inline CSS font size to the odometer element; a value of 0 leaves the size defined by the skin. The Font property is not used by this control.

Instance member InitScript​

String: Overridden to return the initialization script embedded in this assembly. Setting this property has no effect.

Instance member Options​

Object: Overridden to return the options generated from Skin, Value, Duration and FontSize. Setting this property has no effect.

Instance member Packages​

List<Package>: Overridden to return the odometer script and the CSS files of all the skins embedded in this assembly.

Instance member Skin​

OdometerSkin: Returns or sets the skin used to render the odometer. (Default: Default)

The skin is applied when the widget is created; changing it later doesn't affect the widget already displayed in the browser.

Instance member Value​

Int32: Returns or sets the value to display in the odometer. (Default: 0)

When the value changes after the widget is displayed, the digits roll to the new value in the time set in Duration and the OdometerDone handler is invoked when the animation completes.

Example:

Incrementing a counter and reacting when the animation ends:

public Form1()
{
InitializeComponent();
this.odometer1.OdometerDone += this.odometer1_OdometerDone;
}

private void buttonAdd_Click(object sender, EventArgs e)
{
this.odometer1.Value += 1000;
}

private void odometer1_OdometerDone(object sender, EventArgs e)
{
AlertBox.Show("Total: " + this.odometer1.Value);
}

Methods​

Protected member OnWidgetEvent(e)​

Handles events from the widget.

ParameterTypeDescription
eWidgetEventArgs

Implements​