amCharts - 标签中的多个超链接

amCharts - Multiple hyper links in a label

是否可以在同一个标​​签中有多个链接?我希望能够点击“数据一”或“数据二”并被定向到不同的网址。

var sourceLabel = chart.createChild(am4core.Label);
sourceLabel.text = "Source: Date one & Data Two";
sourceLabel.align = "right";
sourceLabel.interactionsEnabled = true;
sourceLabel.url = "https://data-one.html";

如果您使用 html 而不是 text,您可以在同一个标​​签中有两个链接:

sourceLabel.html = '<a href="path/to/data-one.html">Data One</a> &amp; <a href="path/to/data-two.html">Data Two</a>'

如果您不想使用 html,那么您唯一的选择就是创建两个单独的标签。

var chart = am4core.create("chartdiv", am4charts.XYChart);
var sourceLabel = chart.createChild(am4core.Label);
sourceLabel.html = '<a href="path/to/data-one.html">Data One</a> &amp; <a href="path/to/data-two.html">Data Two </a>'

chart.data = [{
  "category": "Research",
  "value": 450
}, {
  "category": "Marketing",
  "value": 1200
}, {
  "category": "Distribution",
  "value": 1850
}];

// Create axes
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
categoryAxis.renderer.grid.template.location = 0;

var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());

// Create series
var series = chart.series.push(new am4charts.ColumnSeries());
series.dataFields.valueY = "value";
series.dataFields.categoryX = "category";
<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<div id="chartdiv" style="width: 100%; height: 300px;"></div>