饼图与钻取不工作

时间:2014-07-22 10:15:40

标签: angularjs highcharts highcharts-ng


这是一个吸烟者:
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

感谢您的帮助

1 个答案:

答案 0 :(得分:10)

我终于解决了(抱歉我必须回答我自己的问题),感谢Pawel Fus的启发性评论:) 首先,我添加了向下钻取模块:

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

接下来,我按照这个答案添加了一些代码到highcharts-ng lib:
Highcharts-ng with drilldown

最后,我将drilldown属性放在选项属性下,如下所述:
https://github.com/pablojim/highcharts-ng/pull/145

这是最后的woorking plunker:
http://plnkr.co/edit/S1B9Q9e1yen0QgmKt2ri