SVG Radar charts API reference

Share RGraph:   Share or Like RGraph on Facebook!

Summary
Documentation about the SVG Radar chart including information on all the options and methods that are available to you.

 

Example

The code below produces a chart like this:

<script>
    // Some data that is to be shown on the Pie chart. For multiple
    // lines it can also be an array of arrays
    var data = [
        [50,58,54,59,56,51,52,53,51,50,48,56,48,55,49],
        [90,84,86,98,86,84,85,79,81,82,86,89,87,81,80]
    ];

    new RGraph.SVG.Radar({
        id: 'chart-container',
        data: data,
        options: {
            colors: ['black', 'red'],
            tickmarks: 'filledcircle',
            tickmarksSize: 5,
            linewidth: 2
        }
    }).draw();
</script>

 

Properties

You can use these properties to control how the chart apears. You can set them by including them in the options section of the configuration as above.

Layout style:     
  

Chart configuration

PropertyDescriptionDefault
centerxIf required, you can position the Radar chart using this instead of the gutters.null
centeryIf required, you can position the Radar chart using this instead of the gutters.null
radiusIf required, you can size the Radar chart using this instead of the gutters.null

Margins

PropertyDescriptionDefault
gutterLeftThe left gutter of the chart, (the gutter is where the labels and title are)).35
gutterRightThe right gutter of the chart, (the gutter is where the labels and title are).35
gutterTopThe top gutter of the chart, (the gutter is where the labels and title are).35
gutterBottomThe bottom gutter of the chart, (the gutter is where the labels and title are).35

Background

PropertyDescriptionDefault
backgroundGridWhether the background "grid" is displayed or not.true
backgroundGridColorThe color of the background grid.#ddd
backgroundGridRadialsCountThe number of lines eminating from the center of the Radar chart outwards.null (linked to how many data points that you have)
backgroundGridConcentricsCountThe number of lines that go around the center of the radar chart.5
backgroundGridLinewidthThe linewidth that is used to draw the background grid.1
backgroundGridPolyWhether the background grid uses polygon concentrics or circular based ones.true

Colors

PropertyDescriptionDefault
colorsColors to be used for the pie segments.['red', 'black', 'orange', 'green', '#6ff', '#ccc', 'pink', 'orange', 'cyan', 'maroon', 'olive', 'teal']
filledWhether the Radar chart is filed or not.false
filledOpacityThe opacity of the fill in Radar charts0.25
filledAccumulativeIf true that datasets will be stacked on top of each other.true

Labels and text

PropertyDescriptionDefault
textSizeThe size of the text.12
textFontThe font used to render the text.sans-serif
textColorThe color of the labels.black
textItalicWhether the labels are italic or not.false
textBoldWhether the labels are bold or not.false
labelsAn array of labels for the chart.[]

Shadow

PropertyDescriptionDefault
shadowWhether or not the chart has a shadow or not.false
shadowOffsetxThe X offset of the shadow.2
shadowOffsetyThe Y offset of the shadow.2
shadowBlurThe blurring of the shadow.2
shadowOpacityThe opacity of the shadow colour.0.25

Title

PropertyDescriptionDefault
titleThe title of the chart.(An empty string)
titleXThe specific X coordinate of the title. This can also be a string that looks like this: "+10" or "-10" in which case it's added to the calculated position.null
titleYThe specific Y coordinate of the title. This can also be a string that looks like this: "+10" or "-10" in which case it's added to the calculated position.null
titleHalignThe horizontal alignment of the title.center
titleValignThe vertical alignment of the title.bottom
titleColorThe color of the title. It defaults to be the same as the textColor property.null
titleFontThe font used to render the title.null
titleSizeThe size of the font used to render the title. It defaults to be a little larger than the textSize propertynull
titleBoldWhether the title is bold or not.false
titleItalicWhether the title is italic or not.false
titleSubtitleThe subtitle of the chart. If a subtitle is specified the title is moved up to accommodate it. As such you might need to give a larger gutterTop value.(An empty string)
titleSubtitleXThe specific X coordinate of the subtitle. This can also be a string that looks like this: "+10" or "-10" in which case it's added to the calculated position.null
titleSubtitleYThe specific Y coordinate of the subtitle. This can also be a string that looks like this: "+10" or "-10" in which case it's added to the calculated position.null
titleSubtitleHalignThe horizontal alignment of the subtitle.center
titleSubtitleValignThe vertical alignment of the subtitle.top
titleSubtitleColorThe color of the subtitle.#aaa
titleSubtitleFontThe font used to render the subtitle.null
titleSubtitleSizeThe size of the font used to render the subtitle. It defaults to be the same as the textSize setting.null
titleBoldWhether the subtitle is bold or not.false
titleSubtitleItalicWhether the subtitle is italic or not.false

Key

PropertyDescriptionDefault
keyAn array of the labels that appear on the key.null
keyColorsAn array of colors to be shown on the key. If not specified then the colors option will be used instead.null
keyTextBoldWhether the key text is bold or not.false
keyTextFontThe font to use for the key text. If not specified it defaults to the textFont setting.null
keyTextSizeThe size to use for the key text. If not specified then the textSize is used.null
ketTextItalicWhether the key text is italic or not.false
keyTextOffsetxThe horizontal pixel offset of the key text (just the text).0
keyTextOffsetyThe vertical pixel offset of the key text (just the text).-1
keyOffsetxThe horizontal pixel offset of the entire key.0
keyOffsetyThe horizontal pixel offset of the entire key.0
keyColorShapeThis controls which shape should be displayed on the key. It can be a string or an array of strings. The possible options are: rect, circle, triangle, line, dotrect

Tooltips

PropertyDescriptionDefault
tooltipsAn array of tooltips for the chart. This array should NOT be multidimensional - even for stacked or grouped charts.null
tooltipsOverrideIf required, this can be a function that totally handles the tooltip showing instead of the default RGraph tooltips. It should look like this:
tooltipsOverride: function (obj, opt)
{
    // Show tooltip
}
The opt is an argument that contains these items:
  • object The chart object.
  • index The index of the element (that triggered the tooltip).
  • sequentialIndex The sequential index of the element that was clicked.
  • text The text to be used as the tooltip. Remember that this may contain HTML (or whatever else you may have specified).
  • event The event object (either a click or mousemove event).
null
tooltipsCssClassThe CSS class thats applied to the tooltip DIV.RGraph_tooltip
tooltipsEventThe event used for tooltips (either click or mousemove.click

Highlight

PropertyDescriptionDefault
highlightStrokeThe color of the stroke of the highlight.rgba(0,0,0,0)
highlightFillThe color of the fill of the highlight.rgba(255,255,255,0.7)
highlightLinewidthThe linewidth of the stroke of the highlight.1

Scale

PropertyDescriptionDefault
scaleVisibleWhether the scale is displayed or not.true
scaleUnitsPreThe units which are PREPENDED to the numbers.(an empty string)
scaleUnitsPostThe units which are APPENDED to the numbers.(an empty string)
scaleMinThe minimum scale value.0
scaleMaxThe maximum scale valuenull
scalePointThe character to use as the decimal point..
scaleThousandThe character to use as the thousand seperator.,
scaleRoundWhether to round the maximum scale value up.false
scaleDecimalsThe number of decimal places to display.0
scaleFormatterA function that handles all of the formatting of the value. The function should look like this:
function (obj, num)
{
}
null
scaleBoldWhether the scale values are bold or not. This falls back to the textBold setting if left as null.null
scaleItalicWhether the scale values are italic or not. This falls back to the textItalic setting if left as null.null
scaleColorThe color of the scale labels. This falls back to the textColor setting if left as null.null
scaleSizeThe size of the scale labels. This falls back to the textSize setting if left as null.null
scaleFontThe font of the scale labels. This falls back to the textFont setting if left as null.null
scaleLabelsCountThe number of scale labels.5

Tickmarks

PropertyDescriptionDefault
tickmarksThe style of tickmarks that are used. You set this to false to disable tickmarks. This can be either a string or an array of tickmark styles:
  • circle
  • filledcircle
  • rect
  • filledrect
circle
tickmarksLinewidthThe linewidth used for the tickmarks.1
tickmarksSizeThe overall size of the tickmarks.6
tickmarksFillThe fill color used for tickmarks (when in circle mode or rect mode.).white

Other

PropertyDescriptionDefault
linewidthThe linewidth of the seperating lines.1

Methods

 

obj.set(name, value)

This can be used to set properties if necessary. It's normally used after the chart is drawn if you need to set additional parameters or change them.

 

obj.on(event, handler)

This function adds an event listener (such as onbeforedraw or ondraw) to the chart object.

 

obj.exec(func)

This function simply executes the function that you give it (there and then - not on any particular event)