2013-11-14 141 views
0

我的代碼是在這裏Highcharts餅圖

$(function() { 
    $('#container').highcharts({ 
     chart: { 
      plotBackgroundColor: null, 
      plotBorderWidth: null, 
      plotShadow: false 
     }, 
     title: { 
      text: 'Browser market shares at a specific website, 2010' 
     }, 
     tooltip: { 
      pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' 
     }, 
     plotOptions: { 
      pie: { 
       allowPointSelect: true, 
       cursor: 'pointer', 
       dataLabels: { 
        enabled: true, 
        color: '#000000', 
        connectorColor: '#000000', 
        format: '<b>{point.name}</b>: {point.percentage:.1f} %' 
       } 
      } 
     }, 
     series: [{ 
      type: 'pie', 
      name: 'Browser share', 
      data: [ 
       { 
       name: 'Chrome', 
       y: 12.8, 
       sliced: true, 
       selected: true 
      }, 
      { 
       name: 'FireFox', 
       y: 15.8 
           } 
      ] 
     }] 
    }); 
}); 

在工具提示

tooltip: { 
      pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' 
     } 

我想寫

tooltip: { 
      pointFormat: '{series.data.name}: <b>{point.percentage:.1f}%</b>' 
     } 

它不工作,請有人幫我

我我正在關注這個鏈接

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/pie-basic/

+0

你能扔你自己的代碼中的jsfiddle,因爲我不知道你現在出了什麼問題。 –

+0

先生這是我自己的代碼,但名稱不同,只有 –

+0

你想在工具提示上顯示什麼? –

回答

1

試試這個point.name應該幫助

demo

tooltip: { 
     pointFormat: '<b>{point.name}</b>: <b>{point.percentage:.1f}%</b>' 
},