FusionCharts XT can also build charts using JSON (JavaScript Object Notation) data format. JSON is a light-weight and simple data format
that is easy to read and understand. Though derived from JavaScript, the data structure is language-independent, with encoders and parsers available for virtually every programming language.
Important: To use JSON data format with FusionCharts XT, you will need to embed the charts using FusionCharts JavaScript class (FusionCharts.js), as the charts internally still use XML. The JavaScript class provides the bridge between JSON and XML.
Here are a few basic things to know about JSON data:
- JSON data is text based data consisting of key and value pairs in format key : value . The values have data associated with them
- You can make up your own key-value pairs like name : "John Doe"
to store data
- Every JSON data is enveloped by curly brace and key:value pairs are comma separated, like { firstName : "John" , lastName: "Doe" }. In JavaScript, this format is called an Object
- A key can be a value within single or double-quotes, for example, { "name" : "John Doe" }
- You can use Objects as values too. For example, { "employee" : { "name" : "John Doe" , "department" : "Project Manager" , "age" : 35 } }
- In JSON, the basic data types are:
- Number (integer or real)
- String (double-quoted Unicode with backslash escaping)
- Boolean (1 or 0 in FusionCharts JSON)
- null
- Array (an ordered sequence of values of Number, String, Boolean, null, Object or Array type, comma-separated and enclosed in square brackets) e.g. [ "employees" : [ "Employees" , { "name" : "John Doe" } , 35 ]
- Object (a collection of key:value pairs, comma-separated and enclosed in curly braces. Value can be of Number, String, Boolean, null, Object or Array type) e.g. { "employee" : { "name" : "John Doe" , "department" : "Project Manager" , "age" : 35 } }
A FusionCharts XT chart is controlled by a single JSON data source, that is, the same source contains data to plot, functional settings and cosmetic properties. There are many properties that you can define for each chart
type. However, it is not necessary to define all the properties for a given
chart. For example, if you do not want to change the default setting of
the canvas (color, alpha, etc.), you do not have to define any property
for the canvas - the default values will be assumed. Thus, each chart
can be generated using minimal properties.
FusionCharts XT has a specific JSON structure for each category of charts. Broadly, we
can classify different JSON structure into following categories:
- Single Series Charts
Single Series Charts are those which depict only one set of data on
the chart.
Single series charts include Column 2D, Column 3D, Bar 2D, Line, Area 2D, Pie 2D, Pie 3D, Doughnut 2D, Doughnut 3D, Pareto 3D and Pareto 3D.
- Multi-Series Charts
Multi-series charts are used to compare two or more datasets like
monthly comparison for two or more years. Under multi-series charts, we
can define the following subcategories:
- Standard Multi-series Charts
The standard multi-series charts, like multi-series column, line,
area etc., are used for straightforward comparison of various datasets
on the chart.
- Stacked Charts
Stacked charts, like stacked column, area etc., are used
to compare cumulative or grouped data. For instance, if we want to show which part of revenue
came from products and which part from services, we can use the
stacked column chart easily to depict the data. Each month will
represent a data column and the column will be divided into two
parts- one representing service and the other product.
- Combination Charts
Combination Charts are a combination of two or more plot types (that is, column, line and area).
There are two sub-types in combination charts:
-
- Single Y-Axis Combination Chart - A single Y-axis (called primary axis) is drawn on the chart, against which all data is plotted
- Dual Y-Axis Combination Chart - The chart assumes two y-axes (primary and secondary). Multiple data series can be plotted against either Y-axis
- Scroll charts
Scroll charts are standard multi-series, combination, and stacked charts with additional scrolling capabilities.
- XY Plot Charts (Multi-series data)
XY Plot Charts are charts where both the axes are numeric, like bubble,
and scatter chart. In bubble chart, a third dimension of data is represented by the size of the bubble.
- Multi-series Stacked Charts
In charts like multi-series stacked column and multi-series stacked
column line combination charts, you can have nested datasets, which allow
you to create multi-series stacked charts (i.e., cluster of stacked columns).
- Zoom Line chart
Zoom Line chart is an advanced chart that allows zooming, scrolling and pinning of data in the same chart. This chart can handle large sets of data up to tens of thousands of points.
|