gpt4 book ai didi

javascript - Highcharts 工具提示图片

转载 作者:行者123 更新时间:2023-11-30 08:12:24 25 4
gpt4 key购买 nike

我有一个问题。

我在我的项目中使用 highchars,我想知道是否可以在工具提示上显示图像(在本例中我想显示谷歌地图静态图像)?

提前致谢

最佳答案

您可以使用 HTML 代替 SVG 来呈现工具提示的内容。使用 HTML 允许高级格式设置,例如工具提示中的表格和图像。

查看工具提示中的“格式化程序”选项:

$(function () {
var chart = new Highcharts.Chart({

chart: {
renderTo: 'container'
},

xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},

tooltip: {
useHTML: true,
headerFormat: '<small>{point.key}</small><table>',
pointFormat: '<tr><td style="color: {series.color}">{series.name}: </td>' +
'<td style="text-align: right"><b>{point.y} EUR</b></td></tr>',
footerFormat: '</table>',
formatter: function() {
return '<img src="http://static.adzerk.net/Advertisers/bd294ce7ff4c43b6aad4aa4169fb819b.jpg" title="" alt="" border="0" height="250" width="220">';
},
valueDecimals: 2
},

series: [{
name: 'Short',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}, {
name: 'Long named series',
data: [129.9, 171.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 195.6, 154.4].reverse()
}]

});
});​

您可以只插入您正在谈论的静态 Google map 图像的代码。

希望对您有所帮助。

关于javascript - Highcharts 工具提示图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8474375/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com