Radar charts documentation

This chart used to be called the Tradar chart (T standing for "Traditional" - there used to be two Radar charts in OfficeExcel), however now (July 2011), it has been renamed to the "Radar" chart to make it easier for people to identify. If you use it you will need to update your code accordingly. Keep in mind that if you use the .type property - this has been updated too (to radar).

 

Example

<script>
    window.onload = function ()
    {
        // The data to be represented on the Radar chart.
        var data = [3, 3, 41, 37, 16];

        // Create the Radar chart. The arguments are the canvas ID and the data to be shown on the chart.
        var radar = new OfficeExcel.Radar('myRadar', data);
        
        // If you want to show multiple data sets, then you give them like this:
        // var radar = new OfficeExcel.Radar('myRadar', [3,5,6,8], [4,5,2,6]);

        // Configure the Radar chart to look as you wish.
        radar.Set('chart.background.circles', true);
        radar.Set('chart.color', 'rgba(255,0,0,0.5)');
        radar.Set('chart.circle', 20);
        radar.Set('chart.circle.fill', 'rgba(200,255,200,0.5)');
        radar.Set('chart.labels', ['Safari (3%)', 'Other (3%)', 'MSIE 7 (41%)', 'MSIE 6 (37%)', 'Firefox (16%)']);
        radar.Set('chart.key', ['Market share', 'A made up figure']);
        
        // Now call the .Draw() method to draw the chart.
        radar.Draw();
    }
</script>

The example file is here.

 

Properties

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

myRadar.Set('color', 'rgba(255,0,0,0.5)');

Margins

chart.gutter.left
The left gutter of the chart, (the gutter is where the labels and title are)).
Default: 25

chart.gutter.right
The right gutter of the chart, (the gutter is where the labels and title are).
Default: 25

chart.gutter.top
The top gutter of the chart, (the gutter is where the labels and title are).
Default: 25

chart.gutter.bottom
The bottom gutter of the chart, (the gutter is where the labels and title are).
Default: 25

Colors

chart.colors
The colors of the radar chart(s).
Default: red

chart.colors.alpha
If set (a number between 0 nd 1), this will be used as the alpha value of the colors of the chart.
Default: null

Title

chart.title
The title, if any, of the chart.
Default: Not set

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.color
The color of the title.
Default: black

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.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

Labels and text

chart.labels
The labels to use for the chart.
Default: An empty array

chart.labels.axes
This controls the axes that show the scale labels. Each letter stands for the appropriate axis (North, South, East and West)
Default: nsew

chart.labels.offsetx
The X pixel offset for the labels.
Default: 10

chart.labels.offsety
The Y pixel offset for the labels.
Default: 10

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

Scale

chart.ymax
The optional maximum Y scale value. If not specified then it will be calculated.
Default: null (It's calculated)

chart.scale.round
Whether to round the maximum scale value up or not. This will produce slightly better scales in some instances.
Default: null

chart.scale.point
The character used as the decimal point.
Default: .

chart.scale.thousand
The character used as the thousand separator
Default: ,

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

Miscellaneous

chart.radius
This allows you to override the default calculated radius and set your own.
Default: null (it's calculated from the canvas width/height)

chart.highlight.stroke
If you use tooltips, this controls the color of the highlight stroke.
Default: gray

chart.highlight.fill
If you use tooltips, this controls the colour of the highlight fill.
Default: white

chart.background.circles
Whether to draw the grey background circles.
Default: true

chart.linewidth
The width of the outline.
Default: 1

chart.circle
What value to draw a circle at. Defaults to zero (off). You could use this to represent a threshold of some sort.
Default: 0

chart.circle.fill
What color to fill the circle with.
Default: red

chart.circle.stroke
What color to stroke (ie The outline) the circle with.
Default: black

chart.accumulative
If set to true this will produce a "stacked" Radar chart. Obviously you must have two or more data sets, and also the data sets must have the same number of data points.
Default: false

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

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

Interactive features

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.tooltips
A numerically indexed array of tooltips that are shown when a hotspot is hovered over. These can contain HTML.
Default: An empty array

chart.tooltips.effect
The visual effect used when showing tooltips. Can be either fade or expand.
Default: fade

chart.tooltips.css.class
This is the name of the CSS class the chart uses.
Default: OfficeExcel_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.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.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

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.getPoint(event)

This function returns the details of any focused point on the chart. It returns:

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.