当我将鼠标悬停在图例中的系列上时,我想显示项目符号的工具提示文本。
我当前的代码隐藏/显示了实际的项目符号,但没有显示工具提示。我尝试了与amCharts不同的方法,但是我可以指出正确的方向。
function createSeries(data) {
var lineSeries = chart.series.push(new am4charts.LineSeries());
lineSeries.data = data;
lineSeries.dataFields.valueY = "value1";
lineSeries.dataFields.valueX = "value2";
// Create bullet
var bullet = lineSeries.bullets.push(new am4charts.CircleBullet());
bullet.tooltipText = "test";
};
// Create Series
chart.data.forEach(function (obj) {
createSeries([obj]);
});
// Add Legend
chart.legend = new am4charts.Legend();
// Legend hover event
chart.legend.itemContainers.template.events.on("over", function (ev) {
var series = ev.target.dataItem.dataContext;
series.bulletsContainer.show();
});
chart.legend.itemContainers.template.events.on("out", function (ev) {
var series = ev.target.dataItem.dataContext;
series.bulletsContainer.hide();
});