我正在使用Highstocks动态图表,其时间滑块类似于 here
Highcharts.setOptions({
global: {
useUTC: false
}
});
// Create the chart
Highcharts.stockChart('container', {
chart: {
events: {
load: function () {
// set up the updating of the chart each second
var series = this.series[0];
setInterval(function () {
var x = (new Date()).getTime(), // current time
y = Math.round(Math.random() * 100);
series.addPoint([x, y], true, true);
}, 1000);
}
}
},
rangeSelector: {
buttons: [{
count: 1,
type: 'minute',
text: '1M'
}, {
count: 5,
type: 'minute',
text: '5M'
}, {
type: 'all',
text: 'All'
}],
inputEnabled: false,
selected: 0
},
title: {
text: 'Live random data'
},
exporting: {
enabled: false
},
series: [{
name: 'Random data',
data: (function () {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;
for (i = -999; i <= 0; i += 1) {
data.push([
time + i * 1000,
Math.round(Math.random() * 100)
]);
}
return data;
}())
}]
});
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>
我唯一的区别是我可以在图表中有1到n个行,这些行将在特定时间段后继续更新。现在我的问题是
提前致谢!
答案 0 :(得分:0)
我试图创建问题
对于上述问题1和2,将由navigator
解决plotOptions: {
series: {
showInNavigator: true
}
},
使用showInNavigator: true
Highcharts.setOptions({
global: {
useUTC: false
}
});
// Create the chart
Highcharts.stockChart('container', {
chart: {
events: {
load: function() {
// set up the updating of the chart each second
var series = this.series[0];
var series1 = this.series[1];
setInterval(function() {
var x = (new Date()).getTime(), // current time
y1 = Math.round(Math.random() * 10),
y2 = Math.round(Math.random() * 100);
series.addPoint([x, y1], true, true);
series1.addPoint([x, y2], true, true);
}, 1000);
}
}
},
rangeSelector: {
buttons: [{
count: 1,
type: 'minute',
text: '1M'
}, {
count: 5,
type: 'minute',
text: '5M'
}, {
type: 'all',
text: 'All'
}],
inputEnabled: false,
selected: 0
},
title: {
text: 'Live random data'
},
exporting: {
enabled: false
},
plotOptions: {
series: {
showInNavigator: true
}
},
series: [{
name: 'Random data',
data: (function() {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;
for (i = -999; i <= 0; i += 1) {
data.push([
time + i * 1000,
Math.round(Math.random() * 10)
]);
}
return data;
}())
}, {
name: 'Random data1',
data: (function() {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;
for (i = -999; i <= 0; i += 1) {
data.push([
time + i * 1000,
Math.round(Math.random() * 100)
]);
}
return data;
}())
}]
});
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>
对于我看不到底部图形的模式类似于我的任何顶部图形模式,是的它几乎相同,因为导航器中实际图形的小尺寸
答案 1 :(得分:0)
您可以在每个系列中设置showInNavigator
属性。
在Highstock中,除非您使用navigator.series.dataGrouping.enabled
禁用dataGrouping,否则将在导航器系列中启用dataGrouping。此外,导航器显示整个范围,因此当它显示全范围时,将其与主系列进行比较。
示例:
http://jsfiddle.net/pgr1st89/ - 使用showInNavigator
http://jsfiddle.net/vomu0xug/ - 禁用数据分组并显示整个范围