Demos

Beginner's Guide

Charts / Gauges / Maps Guide

Customizing Charts

API

Integrating With Your Stack

Help

version static member

Specifies the framework version of FusionCharts. In the format [major, minor, revision, nature, build]

items static member

The reference to every new instance of FusionCharts is maintained in this object with the chart ID as the key. Upon dispose of the instance, the key is removed from this. One can iterate through all instances of FusionCharts using this object.

A short-hand approach to accessing a single chart by its id is to use FusionCharts function itself but without the new operator and by passing the chart id as the first parameter.

Example

// Assuming a page has many instances of {% linkTo FusionCharts %}, but
// none of them are rendered, we are going to iterate through all and
// render them.
for (var item in FusionCharts.items) {
    FusionCharts.items[item].render();
}
// Alternate method to access the charts using FusionCharts function to retrieve the chart from its id.
for (var item in FusionCharts.items) {
    FusionCharts(item).render();
}

dataFormats

The list of data formats that can be passed over to setChartData or setChartDataUrl or during creating a new instance of FusionCharts. The parameters that accept data format should have one of the values from this enumeration:

Value Description
json This denotes that the data being passed on to the chart or returned by the chart is in standard JSON format. The JSON format can be a string containg JSON data or it can also be a JavaScript object.
jsonurl Specifying the data format as jsonurl indicates that the data is not JSON data by itself but rather the data being passed is a URL pointing to a file that contains JSON data.
csv FusionCharts supports data in comma separated value format. However, this is presently supported to retrieve data set in one of the other formats and data cannot be passed on to chart in CSV format.
xml Specifies that the data passed on to the chart is in XML format. As such the data is expected to be a string containing XML data.
xmlurl The xml data format is transportable by nature. This means that specifying the data as an URL to a file that contains XML is a valid option.

annotations

Annotations are a set of customisable shapes (squares, circles, texts, images) that can be created and positioned anywhere on charts. Whenever a new FusionCharts object is created, one instance of the class annotations is created. Whenever annotation definitions are added via data, this object is updated with the same.

ref

Every instance of FusionCharts, when rendered within a container element (provided by the renderAt parameter,) creates a <span> element within which a chart is rendered. As such, the user-provided container element is not polluted by the DOM elements created by a chart.

Example

// Iterate on all charts rendered on a page and move them to a common location
var sidebar = document.getElementById('sidebar-html-div'), // assuming that your common container is this
    chart;

for (chart in FusionCharts.items) {
    chart = FusionCharts.items[chart];
    chart.ref && sidebar.appendChild(chart.ref.parentNode);
}

DOMInsertModes

When a chart is rendered within a DOM element on a page, the chart by default clears its contents and replaces them with the chart. However, this behavior can be changed by specifying the insertMode of the chart during construction of a chart or while calling render.

FusionCharts.options static member

FusionCharts.options consists of many attributes that can be used to configure advanced options of the FusionCharts library.

Attributes

preventTrackResize

: boolean

[+]

FusionCharts checks for its parent container resize on a time interval of every 300 milliseconds and if the container size has changed the chart will automatically resize if the chart’s height and width are in percentage. Set its value to true to stop this behaviour.

Default:

‘False’

resizeTrackingInterval

: number

[+]

Set the time interval for checking parent container’s size if preventTrackResize is set to false.

Default:

‘300’

scriptBaseUri

: string

[+]

Can be used to define the path of the source js files. For example, if map definition file has to be kept in different folder than fusioncharts.js, the path can be set using this attribute.

SVGDefinitionURL

: string

[+]

Set to absolute to use absolute URLs for SVG definitions, otherwise URLs are assumed to be relative.

Default:

‘relative’

  • version static
  • items static
  • dataFormats
  • annotations
  • ref
  • DOMInsertModes
  • FusionCharts.options
Top