# Thermometer charts documentation

- Example
- Properties
- Methods

## Example

    <script>
        window.onload = function ()
        {
            // Create the Thermometer chart. The arguments are: the canvas ID, the minimum,
            // the maximum and the indicated value.
            var thermometer = new OfficeExcel.Thermometer('myCanvas', 0,100,14);

            // Configure the thermometer chart to look as you want.
            thermometer.Set('chart.gutter.left', 45);
            thermometer.Set('chart.gutter.right', 45);
            thermometer.Set('chart.colors', ['rgba(255,0,0,1)']);

            // Now call the .Draw() method to draw the chart.
            thermometer.Draw();
        }
    </script>

The example file is here.

## Properties

You can use these properties to control how the chart apears. You can set them by using the Set() method. Eg:

myBar.Set('name', 'value');

- Margins
- Colors
- Titles
- Labels and text
- Shadow
- Scale
- Interactive features
- Zoom
- Events

### Margins

chart.gutter.left
The left gutter of the chart, (the gutter is where the labels and title are)).
Default: 15
chart.gutter.right
The right gutter of the chart, (the gutter is where the labels and title are).
Default: 15
chart.gutter.top
The top gutter of the chart, (the gutter is where the labels and title are).
Default: 15
chart.gutter.bottom
The bottom gutter of the chart, (the gutter is where the labels and title are).
Default: 15

### Colors

chart.colors
An array of the colors of the actual bars.
Default: An array - ['rgb(0,0,255)', '#0f0', '#00f', '#ff0', '#0ff', '#0f0']

### Titles

chart.title.side
This is the text that is used as the side title on the left hand side of the thermometer.
Default: '' (An empty string)
chart.title.font
The font that the title is rendered in. If not specified the chart.text.font setting is used (usually Verdana)
Default: null
chart.title.size
The size of the title. If not specified the size is usually 2pt bigger than the chart.text.size setting.
Default: null
chart.title.bold
Whather the title is bold or not.
Default: true
chart.title.hpos
This allows you to completely override the horizontal positioning of the title. It should be a number between 0 and 1, and is multiplied with the whole width of the canvas and then used as the horizontal position.
Default: 0.5

### Labels and text

chart.value.label
This controls whether the Thermometers value is shown in text.
Default: true
chart.ylabels.count
A value that controls how many Y labels there are. Keep in mind that if you use this it may result in decimals, and to see the full number you may need to use chart.scale.decimals.
Default: 10

### Shadow

chart.shadow
Whether a drop shadow is applied.
Default: true
chart.shadow.color
The color of the shadow.
Default: gray
chart.shadow.offsetx
The X offset of the shadow.
Default: 0
chart.shadow.offsety
The Y offset of the shadow.
Default: 0
chart.shadow.blur
The severity of the shadow blurring effect.
Default: 15

### Scale

chart.scale.visible
Defaulting to false, this controls whether the scale is visible.
Default: false
chart.scale.decimals
This allows you to control the amount of decimals that the labels have.
Default: 0
chart.scale.point
The character used as the decimal point.
Default: .
chart.scale.thousand
The character used as the thousand separator
Default: ,

### Interactive features

chart.adjustable
Defaulting to false, this determines whether your bar chart will be adjustable.
Default: false
chart.contextmenu
An array of context menu items. More information on context menus is here.
Default: [] (An empty array)
chart.resizable
Defaulting to false, this determines whether your chart will be resizable. Because of the numerous event handlers this has to install code on, This feature is unlikely to work with other dynamic features (the context menu is fine however).
Default: false
chart.annotatable
Whether annotations are enabled for the chart (ie you can draw on the chart interactively.
Default: false
chart.annotate.color
If you do not allow the use of the palette, then this will be the only colour allowed for annotations.
Default: black

### Zoom

chart.zoom.mode
Can be used to control whether the zoom is in thumbnail or canvas mode. Possible values are: thumbnail and canvas.
Default: canvas
chart.zoom.factor
This is the factor that the chart will be zoomed by (bigger values means more zoom)
Default: 1.5
chart.zoom.fade.in
Whether the zoomed canvas fades in or not. This also can be used to control the fade in for the zoom in thumbnail mode.
Default: true
chart.zoom.fade.out
Whether the zoomed canvas fades out or not. This also can be used to control the fade in for the zoom in thumbnail mode.
Default: true
chart.zoom.hdir
The horizontal direction of the zoom. Possible values are: left, center, right
Default: right
chart.zoom.vdir
The vertical direction of the zoom. Possible values are: up, center, down
Default: down
chart.zoom.delay
The delay (in milliseconds) between frames.
Default: 50
chart.zoom.frames
The number of frames in the zoom animation.
Default: 10
chart.zoom.shadow
Whether or not the zoomed canvas has a shadow or not.
Default: true
chart.zoom.thumbnail.width
When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.
Default: 75
chart.zoom.thumbnail.height
When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.
Default: 75
chart.zoom.thumbnail.fixed
When the zoom is in thumbnail mode, you can use this property to fix the zoom in the top left corner instead of it following the cursor around.
Default: false
chart.zoom.background
Defaulting to true, this determines whether the zoom has a dark, semi-opaque background that covers the entire web page.
Default: true

### Events

chart.events.click
If you want to add your own onclick function you can do so by assigning it to this property. See here for details.
Default: null
chart.events.mousemove
If you want to add your own onmousemove function you can do so by assigning it to this property. See here for details.
Default: null

## Methods

obj.getBar(event)

This methods returns details on the focused bar (there's only one). It returns an array consisting of:

[obj, left, top, width, height]
- The chart object
- The X coordinate
- The Y coordinate
- The width
- The height

obj.getShape(event)

This method is an alternate name for the above method but has a generic name that is the same acoss the various libraries.

obj.getValue(mixed)

This method can be used to get the value at a particular point or at the mouse coordinates, based on the scale that is in use. Not simply the coordinates of the mouse. The argument can either be an event object (for use in event listener functions) OR a two element array consisting of the X and Y coordinates (ie when you're not necessarily in an event listener). It returns null if the mouse or coordinates are in the gutter areas. An example:

    myChart.canvas.onclick = function (e)
    {
        var obj   = e.target.__object__;
        var value = obj.getValue(e);

        // ...
    }