FusionCharts - Dynamic tooltips using Macros in Bubble chart_242770

Created using FusionCharts Suite XT - www.fusioncharts.com

by Vishalika

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>
<!-- 
    Building dynamic tooltips using Macros for bubble chart.

    A Multi Series Bubble Chart showing Sales Analysis of shoes of different brands for Male and Female in Harry's Supermart for different campaigns.

    Attribute:
        #plotTooltext
    Macros:
        $name 
        $xDataValue
        $yDataValue
        $zvalue
-->
<div id="chart-container">FusionCharts will render here</div>

JavaScript

FusionCharts.ready(function () {
    var conversionChart = 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",
                "xAxisName": "Average Price",
                "yAxisName": "Units Sold",
                "numDivlines": "2",
                "showValues":"1",
                "showTrendlineLabels": "0",
                //Dynamic tooltip built using 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;'>$name :</div>{br}Units Sold : <b>$yDataValue</b>{br}Average Price: <b>$$xDataValue</b>{br}Profit Share : <b>$zvalue%</b>",
                "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"
                  ...