如何使用JSXGraph向扇形图添加扇形角?

时间:2019-06-29 15:24:45

标签: javascript jsxgraph

我正在使用JSXgraph绘制饼图,并且需要在中心标记每个扇区的角度大小,如下所示:

example pie chart with angles at center

以下代码取自https://jsxgraph.uni-bayreuth.de/wiki/index.php/Pie_chart,但我在文档中找不到有关如何向图表添加角度的任何信息。这可能吗?

var dataArr = [30,16,14,10,10,8,6,6];
var board = JXG.JSXGraph.initBoard('jxgbox', {showNavigation:false, showCopyright:true, boundingbox: [-2.4, 8, 13.6, -4]});
board.containerObj.style.backgroundColor = 'black';
board.options.label.strokeColor = 'yellow';
board.suspendUpdate();

var a = board.createElement('chart', dataArr, 
    {chartStyle:'pie',  
     colors:['#0F408D','#6F1B75','#CA147A','#DA2228','#E8801B','#FCF302','#8DC922','#15993C','#87CCEE','#0092CE'],
     fillOpacity:0.8, center:[5,2], strokeColor:'black', highlightStrokeColor:'black', strokeWidth:4,
     labels:['War games','Sport games', 'Old games','Strategy games', '3D games', 'Puzzle games','Board games', 'I do not play games'],
     highlightColors:['#E46F6A','#F9DF82','#F7FA7B','#B0D990','#69BF8E','#BDDDE4','#92C2DF','#637CB0','#AB91BC','#EB8EBF'],
     highlightOnSector:true, 
     highlightBySize:true,
     gradient:'linear'
    }
);
board.unsuspendUpdate();

0 个答案:

没有答案