Highcharts学习笔记-饼状图(内存使用监视)
来源:互联网 发布:sql数据库远程连接 编辑:程序博客网 时间:2024/05/29 11:04
function show(arr) { //alert(arr); var chart = new Highcharts.Chart({ chart: { renderTo: 'container', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Browser market shares at a specific website, 2010' }, tooltip: { formatter: function() { return '<b>' + this.point.name + '</b>: ' + this.y + ' MB'; } }, plotOptions: { pie: { allowPointSelect: false, cursor: 'pointer', dataLabels: { enabled: true, color: '#000000', connectorColor: '#000000', formatter: function() { return '<b>' + this.point.name + '</b>: ' + this.y + ' %'; } } } }, series: [ { type: 'pie', name: 'Browser share', data: arr } ] }); }
2、post请求数据
$.post("${createLink(controller:'main',action:'pie')}", {type:'json'}, function(data) { var arr = new Array(); for (var i = 0; i < data.length; i++) { var tmp = new Array(); tmp[0] = data[i].name; tmp[1] = data[i].memSize/1024; arr[i] = tmp; } show(arr); });
3、显示结果: