$(function() {
    "use strict";
    BWA.ChartOptions = BWA.ChartOptions || {};
    var A = BWA.ChartOptions.MainDashBoard = BWA.ChartOptions.MainDashBoard || {};

    A.getUsageRatioByEnergyChartOptions = function() {
        return {
            palette: "Default",
            legend: {
                horizontalAlignment: "center",
                verticalAlignment: "bottom",
                margin: 10,
                border: {
                    visible: true
                }
            },
            tooltip: {
                enabled: true,
                format: 'fixedPoint',
                precision: 2,
                customizeTooltip: function(point) {
                    return {
                        text: [this.argumentText, ': ', this.valueText].join('')
                    };
                }
            },
            pointClick: function(point) {
                point.select();
            },
            series: [
                {
                    type: "doughnut",  // if not, pie.
                    argumentField: "energy",
                    valueField: "value",
                    hoverStyle: {
                        color: "#ffd700"
                    },
                    label: {
                        format: 'fixedPoint',
                        precision: 2,
                        visible: true,
                        connector: {
                            visible: true
                        },
                        customizeText: function(pointInfo) {
                            //return pointInfo.argumentText;
                            return pointInfo.percentText; // 
                        }
                    }
                }
            ]
        };
    };
});