highcharts highchart Sankey图表节点流与图像形成见解

xam8gpfp  于 2022-11-10  发布在  Highcharts
关注(0)|答案(1)|浏览(157)

highchart Sankey图表节点流与图像形成见解
enter image description here

xkrw2x1b

xkrw2x1b1#

nodes.dataLabels.format中,将图像添加到example上的节点。

nodes: [{
  id: 'Oil',
  colorIndex: 0
}, {
  id: 'Natural Gas',
  colorIndex: 1,
  dataLabels: {
    enabled: true,
    useHTML: true,
    align: 'center',
    varticalAlign: 'middle',
    format: '{point.id} <img src="https://www.highcharts.com/samples/graphics/sun.png"></img>'
  }
}, {
  id: 'Coal',
  colorIndex: 2
}, {
  id: 'Renewable',
  colorIndex: 3
}, {
  id: 'Nuclear',
  colorIndex: 4
}, {
  id: 'R&C',
  name: 'Residential & Commercial'
}],

或者,可以使用chart.events.render渲染图像。

chart: {
    styledMode: true,
    events: {
      render: function() {
        this.renderer.image('https://www.highcharts.com/samples/graphics/sun.png', 60, 180, 30, 30)
          .add();
      }
    }
  },

相关问题