FusionCharts - Using macros to embed series name, axis name, data value and label in dynamic tooltips
Created using FusionCharts Suite XT - www.fusioncharts.com
HTML
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!--
Using macros to embed series name, axis name, data value and label in dynamic tooltips
Attribute:
# plottooltext
Macros:
# $seriesName - Series Name
# $yAxisName
# $xAxisName
# $label
# $dataValue - Formatted data value
Deviation from theme:
# subCaptionFontBold - Set to 0
-->
<div id="chart-container">FusionCharts will render here</div>
JavaScript
FusionCharts.ready(function () {
var revenueChart = new FusionCharts({
type: 'mscolumn2d',
renderAt: 'chart-container',
width: '300',
height: '200',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Comparison of Quarterly Revenue",
"subCaption": "(Roll over columns to view tooltip using macros)",
"subCaptionFontBold": "0",
"xAxisname": "Quarter",
"yAxisName": "Amount (In USD)",
"numberPrefix": "$",
//Dynamic tool-text using a combination of HTML and macros
"plottooltext":'<div id="nameDiv" style="font-size: 14px; border-bottom: 1px dashed #666666; font-weight:bold; padding-bottom: 3px; margin-bottom: 5px; display: inline-block;">$label :</div>{br}State: <b>$seriesName</b>{br}Sales : <b>$dataValue</b>{br}Market share in State : <b>some percent value</b>{br}Overall market share of $label',
//Theme
"theme" : "fint"
},
"categories": [
{
"category": [
{ "label": "Quarter 1" },
{ "label": "Quarter 2" },
{ "label": "Quarter 3" },
{ "label": "Quarter 4" }
]
}
],
"dataset": [
{
"seriesname": "Previous Year",
"data": [
{ "value": "10000" },
{ "value": "11500" },
{ "value": "12500" },
{ "value": "15000" }
]
},
{
"seriesname": "This Year",
"data": [
{ "value": "25400" },
{ "value": "29800" },
{ "value": "21800" },
...