启用滚动高图表,高股票
enable scroll for high chart,high stock
我正试图绘制一张图表,该图表以不规则的间隔显示每月的续期金额。默认情况下,我应该显示18个月的数据,并启用滚动条在18个月后显示。在点悬停时,应该有一个工具提示,其中包含与该点相关的数据,而不是x和y值。在这里,我尝试过使用tooltip
,但加载图失败。这是小提琴。我试过在网上做一些事情,但没有成功。任何解决方案都将大有帮助。
参考:-
高图
HTML:
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
脚本:
$(function () {
$('#container').highcharts({
chart: {
type: 'scatter',zoomType: 'xy',
},
title: {
text: ' '
},
subtitle: {
text: ' '
},
scrollbar: {
enabled: true,
},
xAxis: {
ordinal: false,
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b'
},
title: {
text: 'Date'
}
},
yAxis: {
title: {
text: 'renewal ammount(in Mn)'
},
min: 0
},
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x:%e. %b}: {point.y:.2f} m'
},
plotOptions: {
spline: {
marker: {
enabled: true
}
}
},
series: [{
name: '0-1',
// Define the data points. All series have a dummy year
// of 1970/71 in order to be compared on the same x axis. Note
// that in JavaScript, months start at 0 for January, 1 for February etc.
data: [
],pointInterval: 30*24 * 3600 * 1000
}, {
name: '1-2',
data: [
[Date.UTC(2016,07,16),1.3],[Date.UTC(2018,06,18),1.3,,ww:'mydata'],[Date.UTC(2019,06,19),1.3,ww:'mydata'],[Date.UTC(2016,12,16),1.3,ww:'mydata'],[Date.UTC(2016,06,16),1.3,ww:'mydata'],[Date.UTC(2016,02,16),1.3,ww:'mydata'],
],pointInterval: 30*24 * 3600 * 1000
},{
name: '2-3',
data: [
[Date.UTC(2017,05,17),2.9],[Date.UTC(2016,03,16),2.1],[Date.UTC(2018,06,18),2.1],
],pointInterval: 30*24 * 3600 * 1000
},{
name: '3-4',
data: [
],pointInterval: 30*24 * 3600 * 1000
},{
name: '4-5',
data: [
],pointInterval: 30*24 * 3600 * 1000
},]
});
});
仅供澄清:滚动条适用于高库存。
如何使用它?
<script src="https://code.highcharts.com/stock/highstock.js"></script>
- 添加滚动条
- 在xAxis下添加"min:XX"
检查:http://jsfiddle.net/mushigh/xjearL2z/
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
$(function() {
$('#container').highcharts({
chart: {
type: 'line',
zoomType: 'xy',
},
scrollbar: {
enabled: true,
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
],
min: 8
},
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
}]
});
});
相关文章:
- 如何访问高图表工具提示中的任何特定数据
- 如何从高股票图表中获取导航器选择
- 高股票图表中每个 yAxis 的 X 坐标
- 高股票图表在清除后不显示
- 高图表股票动画
- 三个.json文件'股票图表' - 高图表
- 高股票图表中的相对时间
- 将所有高股票报价中的日期更改为UNIX时间戳
- 启用滚动高图表,高股票
- 使用高图在图表之间切换
- 高股票比较股票如何定义数据
- 高股票没有正确渲染;在放大之前显示空序列
- 高股票与日期时间和多列
- 如何从ajax数据绘制高股票单线系列图
- 高股票与多个系列,工具提示跟随点,即使它被禁用
- 高股票-在同一页面上添加2个图表
- 有没有漏斗图而不是高图的图表库
- 在高股票图表的导航器中显示多个系列
- 带有多个烛台的图表.高股票/高图表
- 高股票:在烛台图表中添加系列