//chart的数据格式,xChart中所有的图表数据格式都是这样的二维数组, var data= [ ["ie" , 1939], ["chrome" , 865], ["firefox", 2361], ["safari" , 2289], ["其他" , 1886], ["其他1" , 563], ["其他1" , 33], ["其他1" , 60] ]; var options = { tips : { //enabled : false, content : function(info){ return info.data[0]+":"+info.data[1]+"%" } }, //周边tip dataLabel: { enabled: true, format: '{point.name} : {point.percentage}' }, //是否允许扇形选取 allowPointSelect: true, //是否允许动画 animation: true, //内圆半径 innerRadius: 50 //颜色序列,若不设置,会有默认的颜色序列 //colors:['red', 'yellow', 'blue'] }; Chartx.pie("canvasTest" , data , options).then(function( pie ){ pie.on('focused' , function (e) { console.log(e); }); pie.on('unfocused' , function (e) { console.log(e); }); pie.on('complete', function (e) { console.log(e); }); pie.on('click',function(e){ console.log(e); }); });
饼图(pie chart)- 基础饼图
联系人:@自勉