删除相同父类别的空间|分组类别Highcharts

时间:2016-02-22 07:46:51

标签: highcharts

我有一个图表使用分组类别highcharts,我已经成功制作图表但我有点问题。

示例图表:Fiddle here

可以删除空间/或更改具有相同父级的列之间的空间,因此它们会彼此靠近吗?

在那个例子中:

   apple, banana, orange   = group as fruit

   carrot, potato, tomato  = group as vegetable

   cod, salmon, tuna       = group as fish

我想:

 between apple, banana, orange the column is near 
 and between orange - carrot is still have space.

我试图改变风格,但我仍然无法弄明白。

感谢

2 个答案:

答案 0 :(得分:2)

您可以在plotOptions inside和verticalAlign下使用这些选项在底部显示标签。

plotOptions: {
  series: {
    dataLabels: {
      enabled: true,
      inside: true,
      verticalAlign: 'bottom',
      formatter: function() {
        return this.point.name;
      }
    },
  }
},

我不得不改变系列的结构,以便于显示:

    series: [{name:'Fruits',
      data: [{y:4, name:'Apple'}, {y:14, name:'Banana'},{y:18, name:'Orange'}]
    }, {name:'Vegetable',
      data: [{y:5, name:'Carrot'}, {y:6, name:'Potato'}, {y:5, name:'Tomato'}]
    }, {name:'Fish',
      data: [{y:14, name:'Cod'}, {y:15, name:'Salmon'} ,{y:18, name:'Tuna'}]
    }]
  });

示例jsfiddle

答案 1 :(得分:1)

我也用不同的风格[jsfiddle] [1]

搞清楚了
           [1]: http://jsfiddle.net/rikad/gptrz8Lh/