Showing image with variable src in tooltip of Highcharts scatter plot

别说谁变了你拦得住时间么 提交于 2019-12-12 03:16:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!