Share: Bookmark with delicious tweet this site Post to Facebook

RGraph: HTML5 canvas graph library - Vertical Progress bar documentation

The example file is here.

<script>
    window.onload = function ()
    {
        var myProgress = new RGraph.VProgess('myProgress', 78, 100);    
        myProgress.Set('chart.colors', ['red']);
        myProgress.Draw();
    }
</script>

Properties

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

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

Chart configuration

chart.labels.count
This controls how many labels there are.
Default: 10

chart.tickmarks
Whether the tickmarks are drawn.
Default: true

chart.tickmarks.color
The color used for tickmarks.
Default: black

chart.tickmarks.inner
This controls whether the bar has inner tickmarks
Default: false

chart.tickmarks.zerostart
If true, labels and tickmarks will start at and show zero.
Default: false

chart.value
The indicated value. You don't need to set this because it's one of the arguments to the constructor.
Default: none (An argument to the constructor)

chart.min
The minimum value. Setting a minimum value allows to show a more detailed progress bar.
Default: 0

chart.max
The maximum value. You don't need to set this because it's one of the arguments to the constructor.

chart.numticks
How many tick marks there are.
Default: 10

chart.numticks.inner
How many inner tick marks there are.
Default: 50

chart.arrows
This stipulates that two indicator arrows are drawn. It works best if you have tickmarks off, and no title.
Default: false

chart.width
This controls the width of the graph. You can set this to (for example) 600 and have your canvas 650px wide giving an extra 50px for labels.
Default: null (By default the canvas width is used)

chart.height
This controls the height of the graph. You can set this to (for example) 250 and have your canvas 300px heigh giving an extra 50px for labels.
Default: null (By default the canvas height is used)

Margins

chart.gutter
The size of the gutter.
Default: 25

Chart configuration

Colors

chart.color
The color of the bar. This can be a solid color, or a gradient that you create.
Default: #0c0

chart.background.color
The background color.
Default: #eee

Shadow

chart.shadow
Whether the progress bar has a shadow. This uses the canvas shadow API and therefore is only supported on Chrome 2, Safari 3.1 and Firefox 3.1 (and above).
Default: false

chart.shadow.offsetx
The X offset of the progress bar shadow.
Default: 3

chart.shadow.offsety
The Y offset of the progress bar shadow.
Default: 3

chart.shadow.color
The color of the shadow.
Default: rgba(0,0,0,0.5)

chart.shadow.blur
The blurring effect that is applied to the shadow.
Default: 3

Labels and text

chart.text.font
The font used to render the text.
Default: Verdana

chart.text.color
The color of the labels.
Default: black

chart.text.size
The size of the text (in points).
Default: 10

chart.labels
Labels that are applied to the graph.
Default: An empty array

chart.labels.position
Can be left or right and controls which side the labels are positioned on.
Default: right

Scale

chart.units.pre
The units that the Y scale is measured in (these are preppend to the number).
Default: none

chart.units.post
The units that the Y scale is measured in (these are appended to the number).
Default: none

chart.scale.decimals
This stipulates how many decimal places there are.
Default: 0

Titles

chart.title
The title of the progress bar.
Default: An empty string

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: null

chart.title.vpos
This allows you to completely override the vertical positioning of the title. It should be a number between 0 and 1, and is multiplied with the gutter and then used as the vertical position. It can be useful if you need to have a large gutter.
Default: null

chart.title.color
The color of the title.
Default: black

Interactive features

chart.tooltips
An array, albeit one element only. This is shown when the progress bar is clicked on. Tooltips can contain HTML.
Default: An empty array

chart.tooltips.effect
The animated effect used for showing the tooltip. Can be either fade or expand.
Default: fade

chart.tooltips.css.class
This is the name of the CSS class the graph uses.
Default: RGraph_tooltip

chart.tooltips.override
If you wish to handle showing tooltips yourself, this should be a function object which does just that. There's more information on the tooltips documentation page
Default: null

chart.tooltips.coords.adjust
If you translate to gain space, then you can use this to tell RGraph that you have, so that the coordinates for the tooltip(s) are accurate.
Default: [0, 0]

chart.contextmenu
An array of context menu items. More information on context menus is here.
Default: [] (An empty array)

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

chart.resizable
Defaulting to false, this determines whether your graph 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.resize.handle.adjust
If you're right aligning your chart then you may need this to adjust the position of the resize handle.
Default: [0,0]

chart.resize.handle.background
With this you can specify the background color for the resize handle. If you're adjusting the position of the handle then you may need this to make the handle stand out more.
Default: null

chart.adjustable
Defaulting to false, this determines whether your progress bar will be adjustable (click the bar and drag it).
Default: false

Zoom

chart.zoom.factor
This is the factor that the graph 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.background
Defaulting to true, this determines whether the zoom has a dark, semi-opaque background that covers the entire web page.
Default: true

Key

chart.key
An array of key information.
Default: [] (An empty array)

chart.key.background
The color of the key background. Typically white, you could set this to something like rgba(255,255,255,0.7) to allow people to see things behind it.
Default: white

chart.key.halign
Instead of specifying the exact x/y coordinates, you can use this property to simply specify whether the key hould be aligned left or right.
Default: right

chart.key.position
Determines the position of the key.Either graph (default), or gutter.
Default: graph

chart.key.position.x
This allows you to specify a specific X coordinate for the key.
Default: null

chart.key.position.y
This allows you to specify a specific Y coordinate for the key.
Default: null

chart.key.position.gutter.boxed
If you have the key in gutter mode (ie horizontal), this allows you to give a background color.
Default: true

chart.key.shadow
Whether a small drop shadow is applied to the key.
Default: false

chart.key.shadow.color
The color of the shadow.
Default: #666

chart.key.shadow.blur
The extent of the blurring effect used on the shadow.
Default: 3

chart.key.shadow.offsetx
The X offset of the shadow.
Default: 2

chart.key.shadow.offsety
The Y offset of the shadow.
Default: 2

chart.key.rounded
This controls whether the corners of the key (in graph mode) are curved. If the key is gutter mode, this has no effect.
Default: true

chart.key.color.shape
This can be square, circle or line and controls how the color indicators in the key appear.
Default: square

chart.key.linewidth
The line width of the surrounding border on the key.
Default: 1

Miscellaneous

chart.highlight.stroke
If you use tooltips, this controls the colour of the highlight stroke.
Default: black

chart.highlight.fill
If you use tooltips, this controls the colour of the highlight fill.
Default: rgba(255,255,255,0.5)