0 0

highcharts饼图后台加载data 显示不了5

{"type":"pie","name":"销售占比","data":[{"常州店":15},{"南京龙蟠路店":41},{"沈阳店":27},{"无锡店":17}]}

 以上是后台返回的JSON,前台解析json的代码如下:

        success:function(iJson){  
            	var results = eval(iJson);
            	options.series[0].data=results.data;
            	options.series[0].type=results.type;
            	options.series[0].name=results.name;
       			new Highcharts.Chart(options);
			},  

 options的初始定义如下

          
    		  chart: {
                  renderTo: this.mainContainerId,
                  plotBackgroundColor: null,
                  plotBorderWidth: null,
                  plotShadow: false
              },
              title: {
                  text: '年度各分支机构销售收入占比情况'
              },
              tooltip: {
                  pointFormat: '{series.name}: <b>{point.percentage}%</b>',
                  percentageDecimals: 1
              },
              plotOptions: {
                  pie: {
                      allowPointSelect: true,
                      cursor: 'pointer',
                      dataLabels: {
                          enabled: true,
                          color: '#000000',
                          connectorColor: '#000000',
                          formatter: function() {
                              return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
                          }
                      }
                  }
              },
              series: [{
                  type: 'pie',
                  name: '销售占比',
                  data:[]
              }]
          

 显示出来的根本不是饼状图,是个树状一样的线条簇,slice:0%。。。。效果见图:

2012年9月14日 18:36
  • 大小: 5.9 KB
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics