gpt4 book ai didi

jquery - 用flot绘制时间序列数据并忽略大的时间 block

转载 作者:行者123 更新时间:2023-12-01 00:19:01 26 4
gpt4 key购买 nike

我正在使用 Flot 绘制股票数据图表。如果我绘制一天的图表,效果很好。如果我在同一张图表中绘制 2 天或更多天,则第一天结束和第二天开始之间有一条很长的线。

正确的是,Flot 看不到任何数据(市场休市),因此只是画一条线到新一天的开始。

如何让 Flot 忽略市场收盘​​(美国东部时间下午 4 点)和市场开盘(美国东部时间上午 9:30)之间的时间?

附图:Flot graph

我的绘图数据是:

$(function () {
$.plot($("#placeholder"),
[ { data: [[1355131782000000, "2.95"], [1355132082000000, "2.99"], [1355132382000000, "2.97"], [1355132682000000, "2.9699"], [1355132982000000, "2.955"], [1355133282000000, "2.92"], [1355133582000000, "2.91"], [1355133882000000, "2.95"], [1355134182000000, "2.94"], [1355134482000000, "2.935"], [1355134782000000, "2.92"], [1355135082000000, "2.92"], [1355135382000000, "2.91"], [1355135682000000, "2.9"], [1355135982000000, "2.8901"], [1355136282000000, "2.865"], [1355136582000000, "2.92"], [1355136882000000, "2.945"], [1355137182000000, "2.95"], [1355137482000000, "2.925"], [1355137782000000, "2.92"], [1355138082000000, "2.925"], [1355138382000000, "2.92"], [1355138682000000, "2.92"], [1355138982000000, "2.93"], [1355139282000000, "2.9201"], [1355139582000000, "2.93"], [1355139882000000, "2.925"], [1355140182000000, "2.9115"], [1355140482000000, "2.92"], [1355140782000000, "2.91"], [1355141082000000, "2.92"], [1355141382000000, "2.91"], [1355141682000000, "2.91"], [1355141982000000, "2.915"], [1355142282000000, "2.915"], [1355142582000000, "2.91"], [1355142882000000, "2.905"], [1355143182000000, "2.9"], [1355143482000000, "2.9"], [1355143782000000, "2.89"], [1355144382000000, "2.885"], [1355144682000000, "2.88"], [1355144982000000, "2.89"], [1355145282000000, "2.89"], [1355145582000000, "2.89"], [1355145882000000, "2.89"], [1355146182000000, "2.88"], [1355146482000000, "2.885"], [1355146782000000, "2.89"], [1355147082000000, "2.89"], [1355147382000000, "2.88"], [1355147682000000, "2.88"], [1355147982000000, "2.89"], [1355148282000000, "2.89"], [1355148582000000, "2.88"], [1355148882000000, "2.88"], [1355149182000000, "2.9"], [1355149482000000, "2.9"], [1355149782000000, "2.89"], [1355150382000000, "2.9"], [1355150682000000, "2.91"], [1355150982000000, "2.9"], [1355151282000000, "2.91"], [1355151582000000, "2.9001"], [1355151882000000, "2.905"], [1355152182000000, "2.9015"], [1355152482000000, "2.9"], [1355152782000000, "2.96"], [1355153082000000, "3.0"], [1355153382000000, "3.01"], [1355153682000000, "3.005"], [1355153982000000, "3.005"], [1355154282000000, "3.01"], [1355154582000000, "3.01"], [1355154882000000, "3.02"], [1355155182000000, "3.02"]] } ],
{ xaxes: [ { mode: 'time',
twelveHourClock: true,
timeformat: "%H:%M%p"} ],
yaxes: [ ] })
});

更新(每个答案)新图表: enter image description here

这不是我想要的。我想基本上折叠市场收盘和开盘之间的图表。我不想看到这么大的差距......

最佳答案

添加 x 轴值落在间隙内且 y 轴值为 null 的假数据点以创建不连续性。

请参阅Data Format有关详细信息,请参阅 API 文档部分。

编辑:要实际折叠轴以仅显示可用数据,请勿使用时间模式。如果值不是单调增加,那么您并没有真正显示时间,而应该根据可用数据手动指定 x 轴刻度数组。

关于jquery - 用flot绘制时间序列数据并忽略大的时间 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13888970/

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