FusionCharts - Forced decimals on y-axis values

Created using FusionCharts Suite XT - www.fusioncharts.com

by André Albson

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>
<!-- 
If the number of divisional lines is manually provided, to control the decimal places for y-axis values only, and not chart values, use these attribute:
    # forceYAxisValueDecimals - Set to 1 if you wish to force decimals on y-axis values
    # yAxisValueDecimals - Number of decimal places
    # adjustDiv - 0, for manual configyration of number of divisional lines

In this example, by manually fixing the chart lower limit and number of divisional lines, we instruct FusionCharts to ignore automatic adjustment of divisional lines. Thereafter, we set forceYAxisValueDecimals to 1, to force decimal plaes on y-axis, and provide the decimal places as 2 using yAxisValueDecimals

Deviation from theme:
    # placeValuesInside - Set to 0
    # rotateValues - Set to 0
    # valueFontColor - Set to #000000
 -->
<div id="chart-container">FusionCharts will render here</div>

JavaScript

FusionCharts.ready(function () {
    var revenueChart = new FusionCharts({
        type: 'column2d',
        renderAt: 'chart-container',
        width: '400',
        height: '300',
        dataFormat: 'json',
        dataSource: {
            "chart": {
                "caption": "Average value of online refunds",
                "subcaption": "Last year",
                "xaxisname": "Quarter",
                "yaxisname": "Amount (In 000 USD)",
                "placeValuesInside" :"0",
                "rotateValues": "0",
                "valueFontColor": "#000000",
                //Setting flag to manually specify div lines                
                "adjustDiv": "0",
                //Setting 3 dvisional lines on y-axis
                "numdivlines": "3",
                //Manually setting y-axis lower limit
                "yAxisMinValue": "60",     
                //Setting number of decimals on y-axis to 2
                "yAxisValueDecimals":"2",
                "forceYAxisValueDecimals": "1", 
                //Theme 
                "theme" : "fint"
                
            },
            "data": [
                {
                    "label": "Q1",
                    "value": "125"
                }, 
                {
                    "label": "Q2",
                    "value": "257"
                }, 
                {
                    "label": "Q3",
                    "value": "173"
                }, 
                {
                    "label": "Q4",
                    "value": "0"
                }
            ]
        }
    });
    
    revenueChart.render();
});