Gantt Chart JSON Data Format |
Starting FusionWidgets XT, charts/gauges can be rendered using JSON (JavaScript Object Notation) data. 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.
A FusionWidgets XT chart is controlled by a single JSON data source i.e., 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 don't have to define any property for the canvas - the default values will be assumed. Thus, each chart can be generated using minimal properties. |
In this page, we will discuss about how to use JSON data to create a Gantt chart. |
![]() |
A sample JSON data for a Gantt chart looks as under: |
{ |
Brief Explanation |
chart object and its attributes: The chart Object defines all the settings that help to manipulate the chart. You can find the list of all the attributes for this Object in the XML API of Gantt chart. In the most general form, chart attributes represent the following JSON format: Please note that the XML attributes declared in the XML API for Gantt chart are same as the JSON keys in FusionWidgets XT JSON data format. Defining the visual timeline for the chart using the categories array: After the chart Object, comes the categories Array. The categories Array contains one or more Objects each of which refers to a visual timeline. For example, the first timeline can define a particular year, while another can define all the quarters and a third timeline can define the months. Each such Object contains a category Array. Each element of this Array defines the sub-categories or divisions of the particular timeline. FusionWidgets XT Gantt chart allows you to define any number of sub-categories to show dates broken into smaller units as shown below: { You can add innumerable number of categories. However, you need to ensure that each sub-category is within the start and end dates. To add more categories, you need to keep the following considerations in mind:
Defining processes for the chart: Next, we define the list of processes for the chart using the processes Array. You can configure plenty of visual and functional properties for this element, which have been discussed in the XML sheet. All processes are defined within the processes Object. The attributes related to all processes are defined as key-value pairs in the processes Object. It also defines an Array named process. Each Object within the process Array represents a single process on the chart. "processes": { Defining the tasks: "tasks": { When specifying the dates for tasks, you need to make sure that:
Important: To use JSON data format with FusionWidgets XT, you'll 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. |