Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Fusion图表将百分比显示为圆环图中的中心标签_Jquery_Fusioncharts - Fatal编程技术网

Jquery Fusion图表将百分比显示为圆环图中的中心标签

Jquery Fusion图表将百分比显示为圆环图中的中心标签,jquery,fusioncharts,Jquery,Fusioncharts,使用Fusion Charts脚本,我可以轻松地将图表标签显示为百分比。但是,我需要在标签上显示值,并在甜甜圈图表的中心显示百分比 Fusion Charts API似乎没有涵盖此选项。似乎$value和$label是唯一可用的变量 有可能这样做吗 如果我似乎遗漏了一些明显的东西,下面是一些jquery的设置: $.each(jsonDataPoints, function (index, obj) { var hoverText = obj.label + " (" + obj

使用Fusion Charts脚本,我可以轻松地将图表标签显示为百分比。但是,我需要在标签上显示值,并在甜甜圈图表的中心显示百分比

Fusion Charts API似乎没有涵盖此选项。似乎$value和$label是唯一可用的变量

有可能这样做吗

如果我似乎遗漏了一些明显的东西,下面是一些jquery的设置:

$.each(jsonDataPoints, function (index, obj) {
        var hoverText = obj.label + " (" + obj.value + ")";
        //obj.toolText = hoverText; //This sets the text to display when a pie chart is hovered.
        //obj.displayValue = hoverText; //This sets the chart labels.
        obj.displayValue = obj.value; //This sets the chart labels.
        obj.centerLabel = obj.percentValue;//percentValue is not an object. Just a guess
    });

    var doughnutChart = new FusionCharts({
        type: 'doughnut2D',
        renderAt: containerId,
        registerWithJS: '1',
        dataFormat: 'json',
        "width": "100%",
        "height": "100%",
        dataSource: {
            "chart": {
                "paletteColors": "#0075c2,#1aaf5d,#f2c500,#f45b00,#8e0000",
                "bgColor": "#ffffff",
                "showBorder": "0",
                "use3DLighting": "0",
                "showShadow": "0",
                "enableSmartLabels": "0",
                "startingAngle": "310",
                "showLabels": "0",
                "showPercentValues": "1",
                "showLegend": "1",
                "legendShadow": "0",
                "legendBorderAlpha": "0",
                "defaultCenterLabel": "...",
                "centerLabel": "$value",
                "centerLabelBold": "1",
                "showTooltip": "1",
                "decimals": "0",
                "captionFontSize": "14",
                "subcaptionFontSize": "14",
                "subcaptionFontBold": "0",
                "useDataPlotColorForLabels": "1",
                "labelDistance": "-20",
                "baseFontSize": "13",
            },
            "data": jsonDataPoints
        }
    });

    doughnutChart.render();

通过浏览fusioncharts.js源代码,我偶然发现了这个问题的答案。该值为$percentValue

只需设置“centerLabel”:“$percentValue”

"centerLabel" : "$percentValue
该值在fusioncharts.js中的“_parseValues”函数中设置