Odometer
Namespace: Wisej.Web.Ext.Odometer
Assembly: Wisej.Web.Ext.Odometer (4.1.0.0)
Represents an odometer widget to display smoothly transitioning numbers.
- C#
- VB.NET
public class Odometer : Widget
Public Class Odometer
Inherits 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
Odometer()
Creates a new instance of the Odometer control.
The control is not selectable and doesn't take part in the tab order.
Properties
DefaultSize
Size: The default Size of the control.
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.
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.
InitScript
String: Overridden to return the initialization script embedded in this assembly. Setting this property has no effect.
Options
Object: Overridden to return the options generated from Skin, Value, Duration and FontSize. Setting this property has no effect.
Packages
List<Package>: Overridden to return the odometer script and the CSS files of all the skins embedded in this assembly.
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.
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
OnWidgetEvent(e)
Handles events from the widget.
| Parameter | Type | Description |
|---|---|---|
| e | WidgetEventArgs |