2014-07-22 39 views
2


这里有一个plunker:
http://plnkr.co/edit/S1B9Q9e1yen0QgmKt2ri饼图与钻不工作

var chartConfig = { 
    title: { 
    text: 'Number of offers by trend' 
    }, 
    subtitle: { 
    text: 'My company' 
    }, 
    plotOptions: { 
    series: { 
     dataLabels: { 
     enabled: true, 
     format: '{point.name}: {point.y:.1f}%' 
     } 
    } 
    }, 

    tooltip: { 
    headerFormat: '<span style="font-size:11px">{series.name}</span><br>', 
    pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>' 
    }, 
    options: { 
    chart: { 
     type: 'pie' 
    }, 
    legend: { 
     align: 'right', 
     x: -70, 
     verticalAlign: 'top', 
     y: 20, 
     floating: true, 
     backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', 
     borderColor: '#CCC', 
     borderWidth: 1, 
     shadow: false 
    }, 
    tooltip: { 
     headerFormat: '<span style="font-size:11px">{series.name}</span><br>', 
     pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>' 
    }, 
    plotOptions: { 
     column: { 
     stacking: 'normal', 
     dataLabels: { 
      enabled: true, 
      color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', 
      style: { 
      textShadow: '0 0 3px black, 0 0 3px black' 
      } 
     } 
     } 
    } 
    }, 
    series: [{ 
    name: 'Trends', 
    colorByPoint: true, 
    data: TREND_LIST 
    }], 
    drilldown: { 
    series: NUMBER_OF_OFFERS_BY_TREND 
    } 
}; 

馅饼是淹死不错,但我不能单击以获得向下钻取馅饼

这是原创小提琴从highcharts.com,我改变了一下,所以它可以与highcharts-ng一起使用:
bit.ly/1kOPi7L

Th帮助

+0

是否highcharts-ng的支持drilldown.js插件? (顺便说一句,包括drilldown.js文件 - 它缺少) - 我可以看到你已经创建了它的github [ticket](https://github.com/pablojim/highcharts-ng/issues/159)。 –

+0

我做了,它支持,您的评论帮助了很多, 谢谢 – Fourat

+0

哦,对了,我完全忘记了这个问题:http://stackoverflow.com/questions/22195266/highcharts-ng-with-drilldown –

回答

10

anks我终于解决了它(抱歉,我不得不回答我的问题),这要归功于帕维尔毕淑敏的启发评论:)
首先,我添加了钻取模块:

<script src="http://code.highcharts.com/modules/drilldown.js"></script> 

下一页我遵循这个答案,并添加一些代码到highcharts-NG lib目录下:
Highcharts-ng with drilldown

最后我把钻取属性选项属性下这里提到:
https://github.com/pablojim/highcharts-ng/pull/145

下面是最终woorking plunker:
http://plnkr.co/edit/S1B9Q9e1yen0QgmKt2ri

+0

不要忘记接受你的答案 - 这是点左边的绿色标记。恭喜! –

+0

您不应该需要对插件进行任何编辑:http://plnkr.co/edit/CsvZGI3rEAjGHg9TdhqM?p=preview – Pablojim