代码之家  ›  专栏  ›  技术社区  ›  Travis Su

是否可以设置数据标签以显示Xaxis数据而不是HighCharts中的Yaxis数据?

  •  0
  • Travis Su  · 技术社区  · 6 年前

    =

    2 回复  |  直到 6 年前
        1
  •  1
  •   Paweł Fus    6 年前

    您可以用两种方式在海图中设置标签格式:

    1. dataLabels.formatter 你可以去哪里 this

      formatter: function () {
        return this.x;
      }
      

      http://jsfiddle.net/BlackLabel/t2cek68m/1/

    2. 使用 dataLabels.format

      format: "{x}"
      

      http://jsfiddle.net/BlackLabel/t2cek68m/

    注:

    format formatter 可用于:

     format: '{point.customValue}'
    

     formatter: function () {
       return this.point.customValue;
     }
    

    series: [{
      data: [{
        x: 10,
        y: 15,
        customValue: '10x10'
      }]
    }]
    

    演示: http://jsfiddle.net/BlackLabel/t2cek68m/3/

        2
  •  1
  •   Core972    6 年前

    dataLabels: {
      enabled: true,
      formatter: function() {
        return this.x;
      }
    },
    

    Fiddle