问题
I have a Highcharts scatter plot that I've managed to integrate into my react.js page, and it's happily showing ~15,000 points. On the tooltip, I wish to show an image based on the 'name' property of the point (each point has a unique name). This is what I'm doing:
tooltip: {
useHTML: true,
formatter: function() {
return "<img src='https://image.deckbrew.com/mtg/multiverseid/'" + cardsRaw[point.name].multiverseids[cardsRaw[point.name].multiverseids.length - 1].multiverseid + "'.jpg' height='150'/>";
},
followPointer: false
}
where cardsRaw
is an array of objects keyed on the name, and points.name
is the name of the point. Currently when I hover over any point it just gives me the series name and x and y coordinates, which I believe is the default behaviour. Based on other questions on this site, I can't see what I'm doing wrong? I even tried a static img src, but that didn't work either.
来源:https://stackoverflow.com/questions/34983462/showing-image-with-variable-src-in-tooltip-of-highcharts-scatter-plot