FusionCharts - Using macros to embed data label, x-value, y-value and z-value in dynamic tooltips for bubble chart
Created using FusionCharts Suite XT - www.fusioncharts.com
by Ashok Kumaresan
HTML
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.powercharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!--
Using macros to embed data label, x-value, y-value and z-value in dynamic tooltips for bubble chart
Attribute:
# plotTooltext
Macros:
# $name
# $xDataValue
# $yDataValue
# $zvalue
-->
<div id="chart-container">FusionCharts will render here</div>
CSS
#nameDiv{
font-size: 14px;
border-bottom: 1px dashed #666666;
font-weight:bold;
padding-bottom: 3px;
margin-bottom: 3px;
display: inline-block;
}
JavaScript
FusionCharts.ready(function () {
var analysisChart = new FusionCharts({
type: 'bubble',
renderAt: 'chart-container',
width: '600',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Sales Analysis of Shoe Brands",
"subcaption": "Last Quarter",
"xAxisMinValue": "0",
"xAxisMaxValue": "100",
"yAxisMinValue": "0",
"yAxisMaxValue": "30000",
"plotFillAlpha": "70",
"plotFillHoverColor": "#6baa01",
"showPlotBorder": "0",
"xAxisName": "Average Price",
"yAxisName": "Units Sold",
"numDivlines": "2",
"showValues":"1",
"showTrendlineLabels": "0",
//Dynamic tool-tips with HTML and macro variables
"plotTooltext": "<div id='nameDiv'></div>",
"theme": "fint"
},
"categories": [
{
"category": [
{
"label": "0",
"x": "0"
},
{
"label": "$20",
"x": "20",
"showverticalline": "1"
},
{
"label": "$40",
"x": "40",
"showverticalline": "1"
},
{
"label": "$60",
"x": "60",
"showverticalline": "1"
},
{
"label": "$80",
"x": "80",
"showverticalline": "1"
},
...