添加标题到highcharts

问题描述 投票:0回答:1

我想知道是否可以像下图中红色方块所示的那样添加标题。任何演示将被感激

高购物车与标题

highcharts
1个回答
1
投票

我想通过下面的配置,用虚数列来渲染第二个y轴,应该可以达到你想要的效果。

Highcharts.chart('container', {

  chart: {
    type: 'bar'
  },

  xAxis: [{
    title: {
      align: 'high',
      rotation: 0,
      y: -20,
      x: 45,
      text: 'test',
      style: {
        "color": "#333333",
        "fontSize": "18px"
      }
    }
  }, {
    offset: 150,
    tickLength: 0,
    lineWidth: 0,
    categories: ['26-35', '16-25', '36-45', '46-55', '56-65', '66-75', '75+'],
    title: {
      align: 'high',
      rotation: 0,
      y: -20,
      x: 45,
      text: 'test',
      style: {
        "color": "#333333",
        "fontSize": "18px"
      }
    },
  }],

  series: [{
    // dummy series
    type: 'column',
    data: [43934, 52503, 57177, 69658, 97031, 119931, 137133],
    xAxis: 1,
    showInLegend: false,
    color: 'transparent',
    enableMouseTracking: false
  }, {
    data: [43934, 52503, 57177, 69658, 97031, 119931, 137133],
    name: 'main series'
  }]
});

演示: https:/jsfiddle.netBlackLabel3qu4Lv19

API使用的功能。

© www.soinside.com 2019 - 2024. All rights reserved.