javascript highchart照片幻灯片
我正在使用javascript库highchart创建一个可视化图表。我用一些假数据制作了我的图表。我想知道如何使用图表数据触发图像幻灯片。因此,如果我将鼠标悬停在图表中某个点上的数据上,相应的图像将水平滑动到页面中心。以下是我目前为止的一些javascript代码javascript highchart照片幻灯片,javascript,jquery,html,css,highcharts,Javascript,Jquery,Html,Css,Highcharts,我正在使用javascript库highchart创建一个可视化图表。我用一些假数据制作了我的图表。我想知道如何使用图表数据触发图像幻灯片。因此,如果我将鼠标悬停在图表中某个点上的数据上,相应的图像将水平滑动到页面中心。以下是我目前为止的一些javascript代码 <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="width:100%; height:400px;"></div>
<script type="text/javascript">
$(function () {
$('#container').highcharts({
title: {
text: 'Dive Log',
x: -20 //center
},
subtitle: {
text: 'example',
x: -20
},
xAxis: {
title: {
text: 'Time',
categories: ['5', '10', '15', '20', '25', '30',
'35', '40', '45', '50', '55', '1 hr']
}
},
yAxis: {
title: {
text: 'Depth in Meters'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [ {
data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
}],
});
});
</script>
$(函数(){
$(“#容器”)。高图({
标题:{
文本:“潜水日志”,
x:-20/中心
},
副标题:{
文本:“示例”,
x:-20
},
xAxis:{
标题:{
文本:“时间”,
类别:['5','10','15','20','25','30',',
‘35’、‘40’、‘45’、‘50’、‘55’、‘1小时’]
}
},
亚克斯:{
标题:{
文字:“以米为单位的深度”
},
绘图线:[{
值:0,
宽度:1,
颜色:'#808080'
}]
},
工具提示:{
valueSuffix:“°C”
},
图例:{
布局:“垂直”,
对齐:“右”,
垂直排列:'中间',
边框宽度:0
},
系列:[{
数据:[-0.2,0.8,5.7,11.3,17.0,22.0,24.8,24.1,20.1,14.1,8.6,2.5]
}],
});
});
您可以在序列点上使用events.mouseOver和events.MouseOut来执行此操作:
在其回调函数中,您可以触发图像的“幻灯片”:
events: {
mouseOver: function () {
$(".img1").trigger("slideIn");
},
mouseOut: function () {
$(".img1").trigger("slideOut");
},
}
在jQuery中,您可以查看触发器选项,例如:
$('.img1').on("slideIn", function () {
$(this).animate({
opacity: 1,
left: 155
});
});
$('.img1').on("slideOut", function () {
$(this).animate({
opacity: 0,
left: -550
});
});
例如:
您可以在序列点上使用events.mouseOver和events.MouseOut来执行此操作: 在其回调函数中,您可以触发图像的“幻灯片”:
events: {
mouseOver: function () {
$(".img1").trigger("slideIn");
},
mouseOut: function () {
$(".img1").trigger("slideOut");
},
}
在jQuery中,您可以查看触发器选项,例如:
$('.img1').on("slideIn", function () {
$(this).animate({
opacity: 1,
left: 155
});
});
$('.img1').on("slideOut", function () {
$(this).animate({
opacity: 0,
left: -550
});
});
例如:
非常感谢,真是太棒了!如果我想向y轴添加参数以触发单独的文件照片幻灯片,我会在事件之前添加它吗?我对你有点陌生javascript@jsandrails你能解释一下你的意思吗?现在y轴的参数与照片幻灯片的触发无关。你想添加更多图像并允许更多/所有点触发滑动吗?是的,就是这样,添加更多图像并触发滑动。我知道怎么做,但它不工作,我知道它与我的括号的东西。非常感谢,这是惊人的!如果我想向y轴添加参数以触发单独的文件照片幻灯片,我会在事件之前添加它吗?我对你有点陌生javascript@jsandrails你能解释一下你的意思吗?现在y轴的参数与照片幻灯片的触发无关。你想添加更多图像并允许更多/所有点触发滑动吗?是的,就是这样,添加更多图像并触发滑动。我知道怎么做,但它不起作用,我知道它与我的括号的东西。