0
퓨전 차트 스크립트를 사용하면 차트 레이블을 백분율로 쉽게 표시 할 수 있습니다. 그러나 레이블에 값을 표시하고 도넛 형 차트 가운데에 백분율을 표시해야합니다.퓨전 차트 도너츠 차트의 centerLabel로 백분율 표시
Fusion Charts API는이 옵션을 다루지 않습니다. 사용할 수있는 변수는 $ value와 $ label뿐입니다.
가능합니까?
$.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();