代码之家  ›  专栏  ›  技术社区  ›  p0tta

带超链接的X轴时间和Y轴值图表

  •  -2
  • p0tta  · 技术社区  · 7 年前

    1 回复  |  直到 7 年前
        1
  •  1
  •   daniel_s    7 年前

    你可以设置一个 subtitle 并在其中定义到数据源的链接,在 tooltip.pointFormat 定义。代码如下:

    subtitle: {
        useHTML: true,
        text: 'Data source: <a href="google.com">somewhereinthenet.com</a>'
    },
    tooltip: {
        useHTML: true,
        style: {
            pointerEvents: 'auto'
        },
        pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/><span style="font-size: 10px">Data source: <a href="google.com" class="tooltip-link">somewhereinthenet.com</a>'
    }
    

    实例: https://jsfiddle.net/3tkx75uq/

    https://api.highcharts.com/highcharts/subtitle

    https://api.highcharts.com/highcharts/tooltip.pointFormat

    推荐文章