Tooltip Macros-Additional Examples
Prerequisites:
FusionCharts Suite XT includes about a 100 macros that can be used for tooltip customization—the text as well as the formatting.
This article showcases a few more examples, in addition to the example covered in the Introduction to Tooltip Macros article.
Example 1: Tooltip Macros for Trend-lines
By default, trend-lines don’t have a tooltip text configured for them. The tooltip macros can be used to set a custom tooltip text.
The column 2D chart shown below uses the trendlineToolText
attribute for setting a custom tooltip text. Hover the mouse pointer over the trend-lines to see the tooltip text.
Sales (YTD): $dataValue
$displayValue", "trendlineToolText": "$displayValue: $startDataValue", "theme": "fint" }, "data": [ { "label": "Bakersfield Central", "value": "750000", "displayValue": "Store manager: Victoria" }, { "label": "Garden Groove Harbour", "value": "700000", "displayValue": "Store manager: Teresa" }, { "label": "Los Angeles Topanga", "value": "690000", "displayValue": "Store manager: Elvis" }, { "label": "Compton-Rancho Dom", "value": "650000", "displayValue": "Store manager: Pete" }, { "label": "Daly City Serramonte", "value": "620000", "displayValue": "Store manager: Reesa" } ], "trendlines": [ { "line": [ { "startvalue": "680000", "color": "#800000", "displayValue": "Target Sales (This Year)", "valueOnRight": "1", "thickness": "2", "showOnTop": "1" }, { "startvalue": "500000", "color": "#800000", "displayValue": "Target Sales (Last Year)", "valueOnRight": "1", "thickness": "2", "showOnTop": "1" }, { "startvalue": "530000", "color": "#006600", "displayValue": "Max Sales (Last Year)", "valueOnRight": "1", "thickness": "2", "showOnTop": "1" }, { "startvalue": "390000", "color": "#006600", "displayValue": "Min Sales (Last Year)", "valueOnRight": "1", "thickness": "2", "showOnTop": "1" }, { "startvalue": "460000", "color": "#006600", "displayValue": "Average Sales (Last Year)", "valueOnRight": "1", "thickness": "2", "showOnTop": "1" } ] } ] }
{
"chart": {
"caption": "Harry's SuperMart: Sales Analysis for Top Five Store Locations",
"subCaption": "YTD",
"yAxisName": "Sales (In USD)",
"numberPrefix": "$",
"showValues": "1",
"plotToolText": "Store location: $label <br> Sales (YTD): $dataValue <br> $displayValue",
"trendlineToolText": "$displayValue: $startDataValue",
"theme": "fint"
},
"data": [
{
"label": "Bakersfield Central",
"value": "750000",
"displayValue": "Store manager: Victoria"
},
{
"label": "Garden Groove Harbour",
"value": "700000",
"displayValue": "Store manager: Teresa"
},
{
"label": "Los Angeles Topanga",
"value": "690000",
"displayValue": "Store manager: Elvis"
},
{
"label": "Compton-Rancho Dom",
"value": "650000",
"displayValue": "Store manager: Pete"
},
{
"label": "Daly City Serramonte",
"value": "620000",
"displayValue": "Store manager: Reesa"
}
],
"trendlines": [
{
"line": [
{
"startvalue": "680000",
"color": "#800000",
"displayValue": "Target Sales (This Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
},
{
"startvalue": "500000",
"color": "#800000",
"displayValue": "Target Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
},
{
"startvalue": "530000",
"color": "#006600",
"displayValue": "Max Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
},
{
"startvalue": "390000",
"color": "#006600",
"displayValue": "Min Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
},
{
"startvalue": "460000",
"color": "#006600",
"displayValue": "Average Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
}
]
}
]
}
<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js?cacheBust=56"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var fusioncharts = new FusionCharts({
type: 'column2d',
renderAt: 'chart-container',
id: "myChart",
width: '600',
height: '400',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Harry's SuperMart: Sales Analysis for Top Five Store Locations",
"subCaption": "YTD",
"yAxisName": "Sales (In USD)",
"numberPrefix": "$",
"showValues": "1",
"plotToolText": "Store location: $label <br> Sales (YTD): $dataValue <br> $displayValue",
"trendlineToolText": "$displayValue: $startDataValue",
"theme": "fint"
},
"data": [{
"label": "Bakersfield Central",
"value": "750000",
"displayValue": "Store manager: Victoria"
}, {
"label": "Garden Groove Harbour",
"value": "700000",
"displayValue": "Store manager: Teresa"
}, {
"label": "Los Angeles Topanga",
"value": "690000",
"displayValue": "Store manager: Elvis"
}, {
"label": "Compton-Rancho Dom",
"value": "650000",
"displayValue": "Store manager: Pete"
}, {
"label": "Daly City Serramonte",
"value": "620000",
"displayValue": "Store manager: Reesa"
}],
"trendlines": [{
"line": [{
"startvalue": "680000",
"color": "#800000",
"displayValue": "Target Sales (This Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
}, {
"startvalue": "500000",
"color": "#800000",
"displayValue": "Target Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
}, {
"startvalue": "530000",
"color": "#006600",
"displayValue": "Max Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
}, {
"startvalue": "390000",
"color": "#006600",
"displayValue": "Min Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
}, {
"startvalue": "460000",
"color": "#006600",
"displayValue": "Average Sales (Last Year)",
"valueOnRight": "1",
"thickness": "2",
"showOnTop": "1"
}]
}]
}
}
);
fusioncharts.render();
});
</script>
</head>
<body>
<div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>
The tooltip is customized using the code snippet given below:
Given below is a brief description of the attribute and macros used in this example:
Attribute/Macro Name | Description |
---|---|
|
This attribute accepts macros, along with plain text and HTML tags, for customizing tooltip text for trend-lines. |
|
In context of the above example, this macro represents the text rendered with the trend-line, set using the displayValue attribute. |
|
This macro represents the starting value, formatted, of a trend-line/trend-zone. |
Click here for the complete list of tooltip macros supported by FusionCharts Suite XT. |
Example 2: Tooltip Macros for Map Connectors
Tooltip macros can be used to set a tooltip text for connectors in maps.
In the map below, showing the average shipping volume for a distribution network, the connectorToolText
attribute has been used to configure a tooltip that includes:
- Connector source
- Connector destination
- Average no. of shipments shipped every day for the last quarter, from the source to the destination
To: $toLabel
Daily shipments (avg): $label Units" }, "markers": { "shapes": [ { "id": "myCustomShape", "type": "circle", "fillcolor": "#f8bd19", "showborder": "0" } ], "items": [ { "shapeid": "myCustomShape", "id": "WA", "x": "54.5", "y": "44.8", "label": "Washington", "radius": "1" }, { "shapeid": "myCustomShape", "id": "OR", "x": "58.3", "y": "101.7", "radius": "1", "label": "Oregon" }, { "shapeid": "myCustomShape", "id": "ID", "x": "132.8", "y": "110.7", "radius": "1", "label": "Idaho" }, { "shapeid": "myCustomShape", "id": "MT", "x": "188.8", "y": "45.1", "radius": "1", "label": "Montana" }, { "shapeid": "myCustomShape", "id": "WY", "x": "220", "y": "121", "radius": "1", "label": "Wyoming" }, { "shapeid": "myCustomShape", "id": "AZ", "x": "165", "y": "261", "radius": "1", "label": "Arizona" }, { "shapeid": "myCustomShape", "id": "UT", "x": "170", "y": "178", "radius": "1", "label": "Utah" }, { "shapeid": "myCustomShape", "id": "NV", "x": "101", "y": "193", "radius": "1", "label": "Nevada" }, { "shapeid": "myCustomShape", "id": "LA", "x": "406", "y": "300", "radius": "1", "label": "Louisiana" }, { "shapeid": "myCustomShape", "id": "OK", "x": "347", "y": "245", "radius": "1", "label": "Oklahoma" }, { "shapeid": "myCustomShape", "id": "NM", "x": "238", "y": "263", "radius": "1", "label": "New Mexico" }, { "shapeid": "myCustomShape", "id": "CO", "x": "246.72", "y": "179.01", "radius": "1", "label": "Colorado" }, { "shapeid": "myCustomShape", "id": "KS", "x": "335", "y": "195", "radius": "1", "label": "Kansas" }, { "shapeid": "myCustomShape", "id": "MO", "x": "408", "y": "197", "radius": "1", "label": "Missouri" }, { "shapeid": "myCustomShape", "id": "AR", "x": "413", "y": "253", "radius": "1", "label": "Arkansas" }, { "shapeid": "myCustomShape", "id": "MS", "x": "442", "y": "277", "radius": "1", "label": "Mississippi" }, { "shapeid": "myCustomShape", "id": "NE", "x": "318", "y": "146", "radius": "1", "label": "Nebraska" }, { "shapeid": "myCustomShape", "id": "SD", "x": "311", "y": "99", "radius": "1", "label": "South Dakota" }, { "shapeid": "myCustomShape", "id": "ND", "x": "310", "y": "42", "radius": "1", "label": "North Dakota" }, { "shapeid": "myCustomShape", "id": "MN", "x": "382", "y": "61", "radius": "1", "label": "Minnesota" }, { "shapeid": "myCustomShape", "id": "WI", "x": "439", "y": "91", "radius": "1", "label": "Wisconsin" }, { "shapeid": "myCustomShape", "id": "IA", "x": "396", "y": "139", "radius": "1", "label": "Iowa" }, { "shapeid": "myCustomShape", "id": "IL", "x": "445", "y": "174", "radius": "1", "label": "Illinois" }, { "shapeid": "myCustomShape", "id": "MI", "x": "502", "y": "114", "radius": "1", "label": "Michigan" }, { "shapeid": "myCustomShape", "id": "IN", "x": "483", "y": "174", "radius": "1", "label": "Indiana" }, { "shapeid": "myCustomShape", "id": "OH", "x": "530", "y": "168", "radius": "1", "label": "Ohio" }, { "shapeid": "myCustomShape", "id": "KY", "x": "501", "y": "210", "radius": "1", "label": "Kentucky" }, { "shapeid": "myCustomShape", "id": "WV", "x": "544", "y": "199", "radius": "1", "label": "West Virginia" }, { "shapeid": "myCustomShape", "id": "PA", "x": "593", "y": "155", "radius": "1", "label": "Pennsylvania" }, { "shapeid": "myCustomShape", "id": "VA", "x": "580", "y": "210", "radius": "1", "label": "Virginia" }, { "shapeid": "myCustomShape", "id": "NY", "x": "620", "y": "120", "radius": "1", "label": "New York" }, { "shapeid": "myCustomShape", "id": "VT", "x": "654", "y": "95", "radius": "1", "label": "Vermont" }, { "shapeid": "myCustomShape", "id": "ME", "x": "700", "y": "82", "radius": "1", "label": "Maine" }, { "shapeid": "myCustomShape", "id": "NH", "x": "666", "y": "114", "radius": "1", "label": "New Hampshire" }, { "shapeid": "myCustomShape", "id": "MA", "x": "655", "y": "132", "radius": "1", "label": "Massachusetts" }, { "shapeid": "myCustomShape", "id": "CT", "x": "654", "y": "146", "radius": "1", "label": "Connecticut" }, { "shapeid": "myCustomShape", "id": "TN", "x": "490", "y": "237", "radius": "1", "label": "Tennessee" }, { "shapeid": "myCustomShape", "id": "GA", "x": "522", "y": "283", "radius": "1", "label": "Georgia" }, { "shapeid": "myCustomShape", "id": "AL", "x": "489", "y": "279", "radius": "1", "label": "Alabama" }, { "shapeid": "myCustomShape", "id": "FL", "x": "539", "y": "350", "radius": "1", "label": "Florida" }, { "shapeid": "myCustomShape", "id": "TX", "x": "333", "y": "304", "label": "Texas", "radius": "10" }, { "shapeid": "myCustomShape", "id": "NC", "x": "576", "y": "240", "label": "North Carolina", "radius": "10" }, { "shapeid": "myCustomShape", "id": "CA", "x": "68", "y": "225", "label": "California", "radius": "10" } ], "connectors": [ { "from": "CA", "to": "WA", "label": "20,540" }, { "from": "CA", "to": "ID", "label": "17,400" }, { "from": "CA", "to": "MT", "label": "15,600" }, { "from": "CA", "to": "WY", "label": "18,400" }, { "from": "CA", "to": "NV", "label": "19,300" }, { "from": "CA", "to": "UT", "label": "16,500" }, { "from": "CA", "to": "AZ", "label": "18,400" }, { "from": "TX", "to": "NM", "label": "21,300" }, { "from": "TX", "to": "LA", "label": "15,440" }, { "from": "TX", "to": "OK", "label": "16,800" }, { "from": "TX", "to": "CO", "label": "17,200" }, { "from": "TX", "to": "KS", "label": "13,670" }, { "from": "TX", "to": "MO", "label": "12,560" }, { "from": "TX", "to": "AR", "label": "19,200" }, { "from": "TX", "to": "MS", "label": "18,760" }, { "from": "TX", "to": "NE", "label": "16870" }, { "from": "TX", "to": "SD", "label": "17300" }, { "from": "TX", "to": "ND", "label": "19,900" }, { "from": "TX", "to": "MN", "label": "16,100" }, { "from": "TX", "to": "WI", "label": "14,890" }, { "from": "TX", "to": "IA", "label": "15,600" }, { "from": "TX", "to": "IL", "label": "17,650" }, { "from": "NC", "to": "IN", "label": "14,700" }, { "from": "NC", "to": "MI", "label": "18,200" }, { "from": "NC", "to": "OH", "label": "16,540" }, { "from": "NC", "to": "KY", "label": "15,850" }, { "from": "NC", "to": "WV", "label": "16,430" }, { "from": "NC", "to": "PA", "label": "15,600" }, { "from": "NC", "to": "VT", "label": "18,400" }, { "from": "NC", "to": "NH", "label": "16,900" }, { "from": "NC", "to": "MA", "label": "16,590" }, { "from": "NC", "to": "CT", "label": "18,340" }, { "from": "NC", "to": "ME", "label": "14,680" }, { "from": "NC", "to": "NY", "label": "23,600" }, { "from": "NC", "to": "TN", "label": "19,800" }, { "from": "NC", "to": "AL", "label": "13,400" }, { "from": "NC", "to": "VA", "label": "17,260" }, { "from": "NC", "to": "GA", "label": "17,400" }, { "from": "NC", "to": "SC", "label": "16,230" }, { "from": "NC", "to": "FL", "label": "21,200" } ] } }
{
"chart": {
"caption": "Harry's SuperMart Distribution Network",
"subcaption": "Average shipping volume (last quarter)",
"captionFontSize": "14",
"subCaptionFontSize": "14",
"theme": "fint",
"showLabels": "1",
"showMarkerLabels": "0",
"connectorColor": "#90e501",
"connectorThickness": "2",
"formatNumber": "1",
"connectorToolText": "<b>From</b>: $fromLabel <br> <b>To</b>: $toLabel <br> <b>Daily shipments (avg)</b>: $label Units"
},
"markers": {
"shapes": [
{
"id": "myCustomShape",
"type": "circle",
"fillcolor": "#f8bd19",
"showborder": "0"
}
],
"items": [
{
"shapeid": "myCustomShape",
"id": "WA",
"x": "54.5",
"y": "44.8",
"label": "Washington",
"radius": "1"
},
{
"shapeid": "myCustomShape",
"id": "OR",
"x": "58.3",
"y": "101.7",
"radius": "1",
"label": "Oregon"
},
{
"shapeid": "myCustomShape",
"id": "ID",
"x": "132.8",
"y": "110.7",
"radius": "1",
"label": "Idaho"
},
{
"shapeid": "myCustomShape",
"id": "MT",
"x": "188.8",
"y": "45.1",
"radius": "1",
"label": "Montana"
},
{
"shapeid": "myCustomShape",
"id": "WY",
"x": "220",
"y": "121",
"radius": "1",
"label": "Wyoming"
},
{
"shapeid": "myCustomShape",
"id": "AZ",
"x": "165",
"y": "261",
"radius": "1",
"label": "Arizona"
},
{
"shapeid": "myCustomShape",
"id": "UT",
"x": "170",
"y": "178",
"radius": "1",
"label": "Utah"
},
{
"shapeid": "myCustomShape",
"id": "NV",
"x": "101",
"y": "193",
"radius": "1",
"label": "Nevada"
},
{
"shapeid": "myCustomShape",
"id": "LA",
"x": "406",
"y": "300",
"radius": "1",
"label": "Louisiana"
},
{
"shapeid": "myCustomShape",
"id": "OK",
"x": "347",
"y": "245",
"radius": "1",
"label": "Oklahoma"
},
{
"shapeid": "myCustomShape",
"id": "NM",
"x": "238",
"y": "263",
"radius": "1",
"label": "New Mexico"
},
{
"shapeid": "myCustomShape",
"id": "CO",
"x": "246.72",
"y": "179.01",
"radius": "1",
"label": "Colorado"
},
{
"shapeid": "myCustomShape",
"id": "KS",
"x": "335",
"y": "195",
"radius": "1",
"label": "Kansas"
},
{
"shapeid": "myCustomShape",
"id": "MO",
"x": "408",
"y": "197",
"radius": "1",
"label": "Missouri"
},
{
"shapeid": "myCustomShape",
"id": "AR",
"x": "413",
"y": "253",
"radius": "1",
"label": "Arkansas"
},
{
"shapeid": "myCustomShape",
"id": "MS",
"x": "442",
"y": "277",
"radius": "1",
"label": "Mississippi"
},
{
"shapeid": "myCustomShape",
"id": "NE",
"x": "318",
"y": "146",
"radius": "1",
"label": "Nebraska"
},
{
"shapeid": "myCustomShape",
"id": "SD",
"x": "311",
"y": "99",
"radius": "1",
"label": "South Dakota"
},
{
"shapeid": "myCustomShape",
"id": "ND",
"x": "310",
"y": "42",
"radius": "1",
"label": "North Dakota"
},
{
"shapeid": "myCustomShape",
"id": "MN",
"x": "382",
"y": "61",
"radius": "1",
"label": "Minnesota"
},
{
"shapeid": "myCustomShape",
"id": "WI",
"x": "439",
"y": "91",
"radius": "1",
"label": "Wisconsin"
},
{
"shapeid": "myCustomShape",
"id": "IA",
"x": "396",
"y": "139",
"radius": "1",
"label": "Iowa"
},
{
"shapeid": "myCustomShape",
"id": "IL",
"x": "445",
"y": "174",
"radius": "1",
"label": "Illinois"
},
{
"shapeid": "myCustomShape",
"id": "MI",
"x": "502",
"y": "114",
"radius": "1",
"label": "Michigan"
},
{
"shapeid": "myCustomShape",
"id": "IN",
"x": "483",
"y": "174",
"radius": "1",
"label": "Indiana"
},
{
"shapeid": "myCustomShape",
"id": "OH",
"x": "530",
"y": "168",
"radius": "1",
"label": "Ohio"
},
{
"shapeid": "myCustomShape",
"id": "KY",
"x": "501",
"y": "210",
"radius": "1",
"label": "Kentucky"
},
{
"shapeid": "myCustomShape",
"id": "WV",
"x": "544",
"y": "199",
"radius": "1",
"label": "West Virginia"
},
{
"shapeid": "myCustomShape",
"id": "PA",
"x": "593",
"y": "155",
"radius": "1",
"label": "Pennsylvania"
},
{
"shapeid": "myCustomShape",
"id": "VA",
"x": "580",
"y": "210",
"radius": "1",
"label": "Virginia"
},
{
"shapeid": "myCustomShape",
"id": "NY",
"x": "620",
"y": "120",
"radius": "1",
"label": "New York"
},
{
"shapeid": "myCustomShape",
"id": "VT",
"x": "654",
"y": "95",
"radius": "1",
"label": "Vermont"
},
{
"shapeid": "myCustomShape",
"id": "ME",
"x": "700",
"y": "82",
"radius": "1",
"label": "Maine"
},
{
"shapeid": "myCustomShape",
"id": "NH",
"x": "666",
"y": "114",
"radius": "1",
"label": "New Hampshire"
},
{
"shapeid": "myCustomShape",
"id": "MA",
"x": "655",
"y": "132",
"radius": "1",
"label": "Massachusetts"
},
{
"shapeid": "myCustomShape",
"id": "CT",
"x": "654",
"y": "146",
"radius": "1",
"label": "Connecticut"
},
{
"shapeid": "myCustomShape",
"id": "TN",
"x": "490",
"y": "237",
"radius": "1",
"label": "Tennessee"
},
{
"shapeid": "myCustomShape",
"id": "GA",
"x": "522",
"y": "283",
"radius": "1",
"label": "Georgia"
},
{
"shapeid": "myCustomShape",
"id": "AL",
"x": "489",
"y": "279",
"radius": "1",
"label": "Alabama"
},
{
"shapeid": "myCustomShape",
"id": "FL",
"x": "539",
"y": "350",
"radius": "1",
"label": "Florida"
},
{
"shapeid": "myCustomShape",
"id": "TX",
"x": "333",
"y": "304",
"label": "Texas",
"radius": "10"
},
{
"shapeid": "myCustomShape",
"id": "NC",
"x": "576",
"y": "240",
"label": "North Carolina",
"radius": "10"
},
{
"shapeid": "myCustomShape",
"id": "CA",
"x": "68",
"y": "225",
"label": "California",
"radius": "10"
}
],
"connectors": [
{
"from": "CA",
"to": "WA",
"label": "20,540"
},
{
"from": "CA",
"to": "ID",
"label": "17,400"
},
{
"from": "CA",
"to": "MT",
"label": "15,600"
},
{
"from": "CA",
"to": "WY",
"label": "18,400"
},
{
"from": "CA",
"to": "NV",
"label": "19,300"
},
{
"from": "CA",
"to": "UT",
"label": "16,500"
},
{
"from": "CA",
"to": "AZ",
"label": "18,400"
},
{
"from": "TX",
"to": "NM",
"label": "21,300"
},
{
"from": "TX",
"to": "LA",
"label": "15,440"
},
{
"from": "TX",
"to": "OK",
"label": "16,800"
},
{
"from": "TX",
"to": "CO",
"label": "17,200"
},
{
"from": "TX",
"to": "KS",
"label": "13,670"
},
{
"from": "TX",
"to": "MO",
"label": "12,560"
},
{
"from": "TX",
"to": "AR",
"label": "19,200"
},
{
"from": "TX",
"to": "MS",
"label": "18,760"
},
{
"from": "TX",
"to": "NE",
"label": "16870"
},
{
"from": "TX",
"to": "SD",
"label": "17300"
},
{
"from": "TX",
"to": "ND",
"label": "19,900"
},
{
"from": "TX",
"to": "MN",
"label": "16,100"
},
{
"from": "TX",
"to": "WI",
"label": "14,890"
},
{
"from": "TX",
"to": "IA",
"label": "15,600"
},
{
"from": "TX",
"to": "IL",
"label": "17,650"
},
{
"from": "NC",
"to": "IN",
"label": "14,700"
},
{
"from": "NC",
"to": "MI",
"label": "18,200"
},
{
"from": "NC",
"to": "OH",
"label": "16,540"
},
{
"from": "NC",
"to": "KY",
"label": "15,850"
},
{
"from": "NC",
"to": "WV",
"label": "16,430"
},
{
"from": "NC",
"to": "PA",
"label": "15,600"
},
{
"from": "NC",
"to": "VT",
"label": "18,400"
},
{
"from": "NC",
"to": "NH",
"label": "16,900"
},
{
"from": "NC",
"to": "MA",
"label": "16,590"
},
{
"from": "NC",
"to": "CT",
"label": "18,340"
},
{
"from": "NC",
"to": "ME",
"label": "14,680"
},
{
"from": "NC",
"to": "NY",
"label": "23,600"
},
{
"from": "NC",
"to": "TN",
"label": "19,800"
},
{
"from": "NC",
"to": "AL",
"label": "13,400"
},
{
"from": "NC",
"to": "VA",
"label": "17,260"
},
{
"from": "NC",
"to": "GA",
"label": "17,400"
},
{
"from": "NC",
"to": "SC",
"label": "16,230"
},
{
"from": "NC",
"to": "FL",
"label": "21,200"
}
]
}
}
<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js?cacheBust=56"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var fusioncharts = new FusionCharts({
type: 'maps/usa',
renderAt: 'chart-container',
width: '600',
height: '400',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Harry's SuperMart Distribution Network",
"subcaption": "Average shipping volume (last quarter)",
"captionFontSize": "14",
"subCaptionFontSize": "14",
"theme": "fint",
"showLabels": "1",
"showMarkerLabels": "0",
"connectorColor": "#90e501",
"connectorThickness": "2",
"formatNumber": "1",
"connectorToolText": "<b>From</b>: $fromLabel <br> <b>To</b>: $toLabel <br> <b>Daily shipments (avg)</b>: $label Units"
},
"markers": {
"shapes": [{
"id": "myCustomShape",
"type": "circle",
"fillcolor": "#f8bd19",
"showborder": "0",
}],
"items": [{
"shapeid": "myCustomShape",
"id": "WA",
"x": "54.5",
"y": "44.8",
"label": "Washington",
"radius": "1"
}, {
"shapeid": "myCustomShape",
"id": "OR",
"x": "58.3",
"y": "101.7",
"radius": "1",
"label": "Oregon"
}, {
"shapeid": "myCustomShape",
"id": "ID",
"x": "132.8",
"y": "110.7",
"radius": "1",
"label": "Idaho"
}, {
"shapeid": "myCustomShape",
"id": "MT",
"x": "188.8",
"y": "45.1",
"radius": "1",
"label": "Montana"
}, {
"shapeid": "myCustomShape",
"id": "WY",
"x": "220",
"y": "121",
"radius": "1",
"label": "Wyoming"
}, {
"shapeid": "myCustomShape",
"id": "AZ",
"x": "165",
"y": "261",
"radius": "1",
"label": "Arizona"
}, {
"shapeid": "myCustomShape",
"id": "UT",
"x": "170",
"y": "178",
"radius": "1",
"label": "Utah"
}, {
"shapeid": "myCustomShape",
"id": "NV",
"x": "101",
"y": "193",
"radius": "1",
"label": "Nevada"
}, {
"shapeid": "myCustomShape",
"id": "LA",
"x": "406",
"y": "300",
"radius": "1",
"label": "Louisiana"
}, {
"shapeid": "myCustomShape",
"id": "OK",
"x": "347",
"y": "245",
"radius": "1",
"label": "Oklahoma"
}, {
"shapeid": "myCustomShape",
"id": "NM",
"x": "238",
"y": "263",
"radius": "1",
"label": "New Mexico"
}, {
"shapeid": "myCustomShape",
"id": "CO",
"x": "246.72",
"y": "179.01",
"radius": "1",
"label": "Colorado"
}, {
"shapeid": "myCustomShape",
"id": "KS",
"x": "335",
"y": "195",
"radius": "1",
"label": "Kansas"
}, {
"shapeid": "myCustomShape",
"id": "MO",
"x": "408",
"y": "197",
"radius": "1",
"label": "Missouri"
}, {
"shapeid": "myCustomShape",
"id": "AR",
"x": "413",
"y": "253",
"radius": "1",
"label": "Arkansas"
}, {
"shapeid": "myCustomShape",
"id": "MS",
"x": "442",
"y": "277",
"radius": "1",
"label": "Mississippi"
}, {
"shapeid": "myCustomShape",
"id": "NE",
"x": "318",
"y": "146",
"radius": "1",
"label": "Nebraska"
}, {
"shapeid": "myCustomShape",
"id": "SD",
"x": "311",
"y": "99",
"radius": "1",
"label": "South Dakota"
}, {
"shapeid": "myCustomShape",
"id": "ND",
"x": "310",
"y": "42",
"radius": "1",
"label": "North Dakota"
}, {
"shapeid": "myCustomShape",
"id": "MN",
"x": "382",
"y": "61",
"radius": "1",
"label": "Minnesota"
}, {
"shapeid": "myCustomShape",
"id": "WI",
"x": "439",
"y": "91",
"radius": "1",
"label": "Wisconsin"
}, {
"shapeid": "myCustomShape",
"id": "IA",
"x": "396",
"y": "139",
"radius": "1",
"label": "Iowa"
}, {
"shapeid": "myCustomShape",
"id": "IL",
"x": "445",
"y": "174",
"radius": "1",
"label": "Illinois"
}, {
"shapeid": "myCustomShape",
"id": "MI",
"x": "502",
"y": "114",
"radius": "1",
"label": "Michigan"
}, {
"shapeid": "myCustomShape",
"id": "IN",
"x": "483",
"y": "174",
"radius": "1",
"label": "Indiana"
}, {
"shapeid": "myCustomShape",
"id": "OH",
"x": "530",
"y": "168",
"radius": "1",
"label": "Ohio"
}, {
"shapeid": "myCustomShape",
"id": "KY",
"x": "501",
"y": "210",
"radius": "1",
"label": "Kentucky"
}, {
"shapeid": "myCustomShape",
"id": "WV",
"x": "544",
"y": "199",
"radius": "1",
"label": "West Virginia"
}, {
"shapeid": "myCustomShape",
"id": "PA",
"x": "593",
"y": "155",
"radius": "1",
"label": "Pennsylvania"
}, {
"shapeid": "myCustomShape",
"id": "VA",
"x": "580",
"y": "210",
"radius": "1",
"label": "Virginia"
}, {
"shapeid": "myCustomShape",
"id": "NY",
"x": "620",
"y": "120",
"radius": "1",
"label": "New York"
}, {
"shapeid": "myCustomShape",
"id": "VT",
"x": "654",
"y": "95",
"radius": "1",
"label": "Vermont"
}, {
"shapeid": "myCustomShape",
"id": "ME",
"x": "700",
"y": "82",
"radius": "1",
"label": "Maine"
}, {
"shapeid": "myCustomShape",
"id": "NH",
"x": "666",
"y": "114",
"radius": "1",
"label": "New Hampshire"
}, {
"shapeid": "myCustomShape",
"id": "MA",
"x": "655",
"y": "132",
"radius": "1",
"label": "Massachusetts"
}, {
"shapeid": "myCustomShape",
"id": "CT",
"x": "654",
"y": "146",
"radius": "1",
"label": "Connecticut"
}, {
"shapeid": "myCustomShape",
"id": "TN",
"x": "490",
"y": "237",
"radius": "1",
"label": "Tennessee"
}, {
"shapeid": "myCustomShape",
"id": "GA",
"x": "522",
"y": "283",
"radius": "1",
"label": "Georgia"
}, {
"shapeid": "myCustomShape",
"id": "AL",
"x": "489",
"y": "279",
"radius": "1",
"label": "Alabama"
}, {
"shapeid": "myCustomShape",
"id": "FL",
"x": "539",
"y": "350",
"radius": "1",
"label": "Florida"
}, {
"shapeid": "myCustomShape",
"id": "TX",
"x": "333",
"y": "304",
"label": "Texas",
"radius": "10"
}, {
"shapeid": "myCustomShape",
"id": "NC",
"x": "576",
"y": "240",
"label": "North Carolina",
"radius": "10"
}, {
"shapeid": "myCustomShape",
"id": "CA",
"x": "68",
"y": "225",
"label": "California",
"radius": "10"
}],
"connectors": [{
"from": "CA",
"to": "WA",
"label": "20,540"
}, {
"from": "CA",
"to": "ID",
"label": "17,400"
}, {
"from": "CA",
"to": "MT",
"label": "15,600"
}, {
"from": "CA",
"to": "WY",
"label": "18,400"
}, {
"from": "CA",
"to": "NV",
"label": "19,300"
}, {
"from": "CA",
"to": "UT",
"label": "16,500"
}, {
"from": "CA",
"to": "AZ",
"label": "18,400"
}, {
"from": "TX",
"to": "NM",
"label": "21,300"
}, {
"from": "TX",
"to": "LA",
"label": "15,440"
}, {
"from": "TX",
"to": "OK",
"label": "16,800"
}, {
"from": "TX",
"to": "CO",
"label": "17,200"
}, {
"from": "TX",
"to": "KS",
"label": "13,670"
}, {
"from": "TX",
"to": "MO",
"label": "12,560"
}, {
"from": "TX",
"to": "AR",
"label": "19,200"
}, {
"from": "TX",
"to": "MS",
"label": "18,760"
}, {
"from": "TX",
"to": "NE",
"label": "16870"
}, {
"from": "TX",
"to": "SD",
"label": "17300"
}, {
"from": "TX",
"to": "ND",
"label": "19,900"
}, {
"from": "TX",
"to": "MN",
"label": "16,100"
}, {
"from": "TX",
"to": "WI",
"label": "14,890"
}, {
"from": "TX",
"to": "IA",
"label": "15,600"
}, {
"from": "TX",
"to": "IL",
"label": "17,650"
}, {
"from": "NC",
"to": "IN",
"label": "14,700"
}, {
"from": "NC",
"to": "MI",
"label": "18,200"
}, {
"from": "NC",
"to": "OH",
"label": "16,540"
}, {
"from": "NC",
"to": "KY",
"label": "15,850"
}, {
"from": "NC",
"to": "WV",
"label": "16,430"
}, {
"from": "NC",
"to": "PA",
"label": "15,600"
}, {
"from": "NC",
"to": "VT",
"label": "18,400"
}, {
"from": "NC",
"to": "NH",
"label": "16,900"
}, {
"from": "NC",
"to": "MA",
"label": "16,590"
}, {
"from": "NC",
"to": "CT",
"label": "18,340"
}, {
"from": "NC",
"to": "ME",
"label": "14,680"
}, {
"from": "NC",
"to": "NY",
"label": "23,600"
}, {
"from": "NC",
"to": "TN",
"label": "19,800"
}, {
"from": "NC",
"to": "AL",
"label": "13,400"
}, {
"from": "NC",
"to": "VA",
"label": "17,260"
}, {
"from": "NC",
"to": "GA",
"label": "17,400"
}, {
"from": "NC",
"to": "SC",
"label": "16,230"
}, {
"from": "NC",
"to": "FL",
"label": "21,200"
}]
}
}
}
);
fusioncharts.render();
});
</script>
</head>
<body>
<div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>
The tooltip text is set using the following code snippet:
"connectorToolText": "<b>From</b>: $fromLabel <br> <b>To</b>: $toLabel <br> <b>Daily shipments (avg)</b>: $label Units"
The table below describes the attribute and the macros used in the above example:
Attribute/Macro Name | Description |
---|---|
|
This attribute accepts macros, plain text and HTML tags, as strings, for customizing tooltip text for the connectors in maps and the drag-node chart. |
|
This macro represents the label of the source marker (for maps)/node (for the drag-node chart). |
|
This macro represents the label of the destination marker (for maps)/node (for the drag-node chart). |
|
This macro represents the data plot, category, connector, and marker labels. In this example, it is used to render the connector label in the tooltip text. |
Click here for the complete list of tooltip macros supported by FusionCharts Suite XT. |
Example 3: Tooltip Macros for the Box and Whisker Chart
By default, the tooltip text for the data plots in a box and whisker chart includes the following values:
- Minimum value
- Maximum value
- Upper and lower quartile values
- Median
In the chart shown below, tooltip marcos for the box and whisker chart have been used to add the mean, quartile deviation, standard deviation, and mean deviation values to the tooltip text.
Max value: $maxDataValue
Min value: $minDataValue
Q3: $Q3
Median: $median
Q1: $Q1
Mean: $mean
Standard deviation: $SD
Quartile Deviation: $QD
Mean Deviation: $MD", "plotSpacePercent": "50" }, "categories": [ { "category": [ { "label": "Elementary School", "showLabel": "1" }, { "label": "Middle School", "showLabel": "1" }, { "label": "High School", "showLabel": "1" } ] } ], "dataset": [ { "seriesname": "Male", "lowerBoxColor": "#008ee4", "upperBoxColor": "#6baa01", "data": [ { "value": "30000, 32450, 32580, 40500, 41800, 40500, 42500, 44700, 44050, 47880, 50000, 51000,52300, 53200, 54200, 56560, 60580, 61550, 62800, 63700, 65000, 66000" }, { "value": "31000, 33250, 35000, 34000, 35100, 37500, 39583, 43500, 42800, 39000, 45541, 48000, 51300, 54000, 57000, 61000, 66500" }, { "value": "31400, 34000, 39000, 42000, 48000, 54000, 49000, 63000, 66000, 72000" } ] }, { "seriesname": "Female", "lowerBoxColor": "#e44a00", "upperBoxColor": "#f8bd19", "data": [ { "value": "29400, 32000, 33500, 35000, 39000, 44000, 40000, 49000, 54000, 58000, 62000, 65000" }, { "value": "30500, 35000, 39500, 43000, 48000, 51000, 56000, 59800, 63700, 66500" }, { "value": "31400, 35000, 40000, 46000, 52600, 58000, 64000, 69500, 71600" } ] } ] }
{
"chart": {
"caption": "Annual income of teachers (K-12)",
"subcaption": "Gender-wise distribution (Last year)",
"xAxisName": "Pay Grades",
"yAxisName": "Salaries (In USD)",
"numberPrefix": "$",
"theme": "fint",
"showValues": "0",
"plotToolText": "$seriesName Teachers-$label <br> <br> Max value: $maxDataValue <br> Min value: $minDataValue <br> <br> Q3: $Q3 <br> Median: $median <br> Q1: $Q1 <br> <br> Mean: $mean <br> <br> Standard deviation: $SD <br> Quartile Deviation: $QD <br> Mean Deviation: $MD",
"plotSpacePercent": "50"
},
"categories": [
{
"category": [
{
"label": "Elementary School",
"showLabel": "1"
},
{
"label": "Middle School",
"showLabel": "1"
},
{
"label": "High School",
"showLabel": "1"
}
]
}
],
"dataset": [
{
"seriesname": "Male",
"lowerBoxColor": "#008ee4",
"upperBoxColor": "#6baa01",
"data": [
{
"value": "30000, 32450, 32580, 40500, 41800, 40500, 42500, 44700, 44050, 47880, 50000, 51000,52300, 53200, 54200, 56560, 60580, 61550, 62800, 63700, 65000, 66000"
},
{
"value": "31000, 33250, 35000, 34000, 35100, 37500, 39583, 43500, 42800, 39000, 45541, 48000, 51300, 54000, 57000, 61000, 66500"
},
{
"value": "31400, 34000, 39000, 42000, 48000, 54000, 49000, 63000, 66000, 72000"
}
]
},
{
"seriesname": "Female",
"lowerBoxColor": "#e44a00",
"upperBoxColor": "#f8bd19",
"data": [
{
"value": "29400, 32000, 33500, 35000, 39000, 44000, 40000, 49000, 54000, 58000, 62000, 65000"
},
{
"value": "30500, 35000, 39500, 43000, 48000, 51000, 56000, 59800, 63700, 66500"
},
{
"value": "31400, 35000, 40000, 46000, 52600, 58000, 64000, 69500, 71600"
}
]
}
]
}
<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script type="text/javascript" src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js?cacheBust=56"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var fusioncharts = new FusionCharts({
type: 'boxandwhisker2d',
renderAt: 'chart-container',
width: '600',
height: '400',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Annual income of teachers (K-12)",
"subcaption": "Gender-wise distribution (Last year)",
"xAxisName": "Pay Grades",
"yAxisName": "Salaries (In USD)",
"numberPrefix": "$",
"theme": "fint",
"showValues": "0",
"plotToolText": "$seriesName Teachers-$label <br> <br> Max value: $maxDataValue <br> Min value: $minDataValue <br> <br> Q3: $Q3 <br> Median: $median <br> Q1: $Q1 <br> <br> Mean: $mean <br> <br> Standard deviation: $SD <br> Quartile Deviation: $QD <br> Mean Deviation: $MD",
"plotSpacePercent": "50"
},
"categories": [{
"category": [{
"label": "Elementary School",
"showLabel": "1"
},
{
"label": "Middle School",
"showLabel": "1"
},
{
"label": "High School",
"showLabel": "1"
}]
}],
"dataset": [{
"seriesname": "Male",
"lowerBoxColor": "#008ee4",
"upperBoxColor": "#6baa01",
"data": [{
"value": "30000, 32450, 32580, 40500, 41800, 40500, 42500, 44700, 44050, 47880, 50000, 51000,52300, 53200, 54200, 56560, 60580, 61550, 62800, 63700, 65000, 66000"
}, {
"value": "31000, 33250, 35000, 34000, 35100, 37500, 39583, 43500, 42800, 39000, 45541, 48000, 51300, 54000, 57000, 61000, 66500"
}, {
"value": "31400, 34000, 39000, 42000, 48000, 54000, 49000, 63000, 66000, 72000"
}]
}, {
"seriesname": "Female",
"lowerBoxColor": "#e44a00",
"upperBoxColor": "#f8bd19",
"data": [{
"value": "29400, 32000, 33500, 35000, 39000, 44000, 40000, 49000, 54000, 58000, 62000, 65000"
}, {
"value": "30500, 35000, 39500, 43000, 48000, 51000, 56000, 59800, 63700, 66500"
}, {
"value": "31400, 35000, 40000, 46000, 52600, 58000, 64000, 69500, 71600"
}]
}]
}
}
);
fusioncharts.render();
});
</script>
</head>
<body>
<div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>
The tooltip text is set using the following code snippet:
"plotToolText": "$seriesName Teachers-$label <br> <br> Max value: $maxDataValue <br> Min value: $minDataValue <br> <br> Q3: $Q3 <br> Median: $median <br> Q1: $Q1 <br> <br> Mean: $mean <br> <br> Standard deviation: $SD <br> Quartile Deviation: $QD <br> Mean Deviation: $MD"
The table below describes the attribute and the macros used in the above example:
Attribute/Macro Name | Description |
---|---|
|
This attribute accepts macros, plain text, and HTML tags, as strings, to create and format the custom tooltip text for data plots. |
|
This macro represents the data plot, category, connector, and marker labels. In this example, it represents the data plot label. |
|
This macro represents the maximum value, formatted, of the data plot. |
|
This macro represents the minimum value, formatted, of the data plot. |
|
This macro represents the formatted value of the upper quartile of the data plot. |
|
This macro represents the formatted value of the lower quartile of the data plot. |
|
This macro represents the formatted median value of the data plot. |
|
This macro represents the mean value of the data plot. |
|
This macro represents the standard deviation value of the data plot. |
|
This macro represents the quartile deviation value of the data plot. |
|
This macro represents the mean deviation value of the data plot. |
Click here for the complete list of tooltip macros supported by FusionCharts Suite XT. |