gpt4 book ai didi

javascript - 在 Highcharts 中添加图像

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:45:31 24 4
gpt4 key购买 nike

我试图在 Highcharts 中添加图像,但我看不到图像。请看下面的代码:

var currentECGOptions = {
chart: {
renderTo: 'currentECGContainer',
events: {
load: function () {
alert("load this function");
this.renderer.image('/Content/Images/logo.png', 100, 100, 30, 30)
.on('click' , function(){location.href='http://www.highcharts.com'})
.css({cursor:'Pointer'})

.add();
}
}
},

navigator: {
enabled: true,
maskFill: 'rgba(255, 255, 255, 0.45)',
series: {
type: 'areaspline',
color: 'rgba(255, 255, 255, 0.00)',
fillOpacity: 0.8,
dataGrouping: {
smoothed: true
},
lineWidth: 1,
lineColor: 'blue',
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [[0, '#FF8000'], [1, '#FFFF00']]
},
marker: {
enabled: false
},
shadow: false
},
yAxis: {
reversed: false
}
},
series: [{
showInLegend: false,
data: [null, null]
}]
};

currentECGOptions = jQuery.extend(true, {}, options, currentECGOptions);

var currentECG = new Highcharts.Chart(currentECGOptions);

currentECG.setTitle({ text: "CURRENT ECG" });
currentECG.showLoading();

最佳答案

尝试在创建图表后添加 Logo ,而不是在 events 选项中添加。它可能看起来像这样:

/* create the chart */
var currentECG = new Highcharts.Chart(currentECGOptions);

/* add the image to the new chart, after it's been created */
currentECG.renderer.image('/Content/Images/logo.png', 100, 100, 30, 30).on('click' , function(){location.href='http://www.highcharts.com'}).css({cursor:'Pointer'}).add();

希望对您有所帮助!

关于javascript - 在 Highcharts 中添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17100517/

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