Controlling Annotations Dynamically
Prerequisites:
FusionCharts Suite XT lets you control annotations dynamically using the FusionCharts API. These methods let you create, update, set the visibility of, and delete annotation groups and items at run-time.
Dynamic control of annotations is specifically helpful when you want to augment your charts with context sensitive information. For instance, you can show, hide, or update the color for an annotation group or item using the respective methods.
This article describes the API methods that let you create, manipulate, and delete annotations dynamically.
A spline chart that demonstrates how annotations can be controlled dynamically is shown below:
The API methods to control annotations dynamically are:
Method Name | Method Description | Parameter Description |
---|---|---|
|
Adds a group that can hold multiple annotation items within it. |
|
|
Adds an annotation item to the specified group. If the groupId is not specified, a new group is created and the annotation item is added to it. |
|
|
Shows the specified annotation group or item on the chart. |
|
|
Hides the specified annotation group or item from the chart. |
|
|
Updates the properties of the specified annotation group or an individual item in the specified group. |
|
|
Removes the group or an annotation item based on the id specified. |
|
|
Removes all the annotation groups and items within the groups. |
The complete data structure for the spline chart is given below:
{
"chart": {
"caption": "Total footfall in Bakersfield Central",
"subCaption": "Last week",
"xAxisName": "Day",
"yAxisName": "No. of Visitors",
"showValues": "1",
"theme": "fint"
},
"annotations": {
"origw": "400",
"origh": "300",
"autoscale": "1"
},
"data": [
{
"label": "Mon",
"value": "15123"
},
{
"label": "Tue",
"value": "14233"
},
{
"label": "Wed",
"value": "25507"
},
{
"label": "Thu",
"value": "9110"
},
{
"label": "Fri",
"value": "15529"
},
{
"label": "Sat",
"value": "20803"
},
{
"label": "Sun",
"value": "19202"
}
]
}