highcharts pie问题!
为什么我让:var dp = "[['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]]";
    chart.series[0].setData(dp);
而此饼状图不能正常显示,请用过highcharts的兄弟们告诉我下

解决方案 »

  1.   

    你的函数调用我不知道对不 但是我重新改写了哈 可以了你可以参考哈
    var chart;
    $(document).ready(function() {
    var dp = [['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]];
    chart = new Highcharts.Chart({

                        chart: {
    renderTo: 'container',
    margin: [50, 200, 60, 170]
    },
    title: {
    text: 'Browser et shares at a specific website, 2010'
    },
    plotArea: {
    shadow: null,
    borderWidth: null,
    backgroundColor: null
    },
    tooltip: {
    formatter: function() {
    return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
    }
    },
    plotOptions: {
    pie: {
    allowPointSelect: true,
    cursor: 'pointer',
    dataLabels: {
    enabled: true,
    formatter: function() {
    if (this.y > 5) return this.point.name;
    },
    color: 'white',
    style: {
    font: '13px Trebuchet MS, Verdana, sans-serif'
    }
    }
    }
    },
    legend: {
    layout: 'vertical',
    style: {
    left: 'auto',
    bottom: 'auto',
    right: '50px',
    top: '100px'
    }
    },
        series: [{
    type: 'pie',
    name: 'Browser share',
    data: dp
    }]
    });
    });
      

  2.   

    问题 是怎么样使用 chart.series[0].setData()方法动态地更改数据!
      

  3.   

    var dp = "[['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]]";
      chart.series[0].setData(dp);
    把字符串类型转变成[['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]]
      

  4.   

    var dp = "[['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]]";改成
    var dp = [['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]];
      

  5.   

    试试这样行不?
    var picchart;
    var options = {
    chart: {
    renderTo: 'pieinfo',
    margin: [100, 0, 0, 0],
    plotBackgroundColor: 'none',
    plotBorderWidth: 0,
    plotShadow: false
    },
    title: {
    text: 'Browser et shares at a specific website'
    },
    plotArea: {
    shadow: null,
    borderWidth: null,
    backgroundColor: null
    },
    tooltip: {
    formatter: function() {
    return '<b>'+ this.series.name +'</b><br/>'+ 
    this.point.name +': '+ this.y +' %';
    }
    },
    legend: {
    enabled: false
    },
        series: [],
    dataLabels: {
    enabled: true,
    formatter: function() {
    if (this.y > 2) return this.point.name;
    },
    color: 'white',
    style: {
    font: '13px Trebuchet MS, Verdana, sans-serif'
    }
    }
    };
    result = [];
    result.push({name: 'Firefox', y: 44.2});
    result.push({name: 'liufang', y: 21});
    result.push({name: 'jet', y: 5});
    result.push({name:'Safari',y:8.5});
    result.push({name:'Opera',y:6.2});
    result.push({name:'Others',y:0.7});
    options.series.push({
         type: 'pie',
    name: '2008',
    size: '100%',
    data: result
    });
    piechart = new Highcharts.Chart(options);
      

  6.   

    我也遇到了这样的问题,var dp = "[['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]]";改成
    var dp = [['河南省',97.42],['山东',1.59],['河南省',0.53],['湖北省',0.23],['湖南省',0.23],['m',0]];
    就可以了,没办法,用了最笨的方法,一个一个赋值的,哎