Highcharts Line Chart, display series name at the end of line series

前端 未结 2 1594
故里飘歌
故里飘歌 2021-01-28 01:04

We have requirement for line chart as below. We are using highcharts. Our requirement is that chart should display series name at the end of line as displayed in below images. <

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-28 02:04

    As an alternative to the renderer(), I find it convenient to use the dataLabels for this purpose.

    The idea being to disable dataLabels in the plotOptions, but define the position and format anyway.

    Then enable the dataLabels for the last point in each series' data array.

    Example:

    plotOptions: {
      series: {
        dataLabels: {
          enabled: false,
          crop: false,
          overflow: 'none',
          align: 'left',
          verticalAlign: 'middle',
          formatter: function() {
            return ''+this.series.name+'';
          }
        }
      }
    }
    

    Fiddle:

    • http://jsfiddle.net/jlbriggs/pgo7pedn/

    Output example:

提交回复
热议问题