带有 xasis 时间的流程图
我正在尝试带有数据的流程图
[[1645570986, 0.4624863055203449], [1645570987, 0.4624863055203449], [1645570988, 0.468952235505014],…]
因此 [timespamp, value],但是时间不会出现在 x 轴上。 任何人都可以给我一些建议。
function CF_real_CPU(){
'use strict';
var cpu = $.plot('#flotRealtime1', [real[0].data], {
colors: ['#ff5e5e'],
series: {
lines: {
show: true,
lineWidth: 1
},
shadowSize: 0 // Drawing is faster without shadows
},
grid: {
borderColor: 'transparent',
borderWidth: 1,
labelMargin: 5
},
xaxis: {
mode: "time",
tickSize: [10, "second"],
tickLength: 10,
axisLabelUseCanvas: true,
axisLabelPadding: 10,
color: "transparent",
font: {
size: 10,
color: "#fff"
}
},
yaxis: {
color: 'transparent',
font: {
size: 10,
color: '#fff'
}
}
});
}
谢谢
阿尔比696
I am trying a flot charts with data
[[1645570986, 0.4624863055203449], [1645570987, 0.4624863055203449], [1645570988, 0.468952235505014],…]
therefore [timespamp, value], however, the time does not appear in the x axis.
Anyone can give me some advice.
function CF_real_CPU(){
'use strict';
var cpu = $.plot('#flotRealtime1', [real[0].data], {
colors: ['#ff5e5e'],
series: {
lines: {
show: true,
lineWidth: 1
},
shadowSize: 0 // Drawing is faster without shadows
},
grid: {
borderColor: 'transparent',
borderWidth: 1,
labelMargin: 5
},
xaxis: {
mode: "time",
tickSize: [10, "second"],
tickLength: 10,
axisLabelUseCanvas: true,
axisLabelPadding: 10,
color: "transparent",
font: {
size: 10,
color: "#fff"
}
},
yaxis: {
color: 'transparent',
font: {
size: 10,
color: '#fff'
}
}
});
}
Thank you
alby696
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的时间戳以秒为单位。当使用 Flot(以及一般的 JavaScript)时,它们需要以毫秒为单位。
1645570987
需要是1645570987000
等等。使用现在的时间戳,所有数据的跨度都不到一秒,因此轴上的时间位于可见区域之外。
Your timestamp are in seconds. When using Flot (and JavaScript in general) they need to be in milliseconds.
1645570987
needs to be1645570987000
and so on.With the timestamps as they are now, all your data spans less than one second, so the time on the axis is outside the vissible area.