strange jumps when zooming on real time chart
未关闭
还没有人认领这个 Issue。
bug
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
Hi,
is there a way to fix this?
not sure if it's related to react-plotly or plotly.js
The chart jumps back and forth in a confusing way while scrolling forward.
The faster I scroll the more extreme it jumps back.
When using the toolbar, it behaves normal.
useEffect(() => {
setInterval(()=>{
$_state(($:any) => {
console.log($)
const _x = $.data[0].x
const _y = $.data[0].y
const _ymin = _y[_y.length-1] - gaussianRand()/100
const _ypls = _y[_y.length-1] + gaussianRand()/100
return {...$, data: [
{
...$.data[0],
x: [..._x, _x[_x.length-1]+0.1],
y: [..._y, ~~(Math.random()*2) ? _ymin : _ypls],
}
]}
})
}, 100)
},[])
return (
<Plot
className={jss.root}
data={_state.data}
layout={_state.layout}
config={_state.config}
onInitialized={figure => $_state(figure)}
onUpdate={figure => $_state(figure)}
/>
);
const [_state, $_state] = useState({
data:[
{
type: 'scattergl',
mode: 'markers',
marker: {
color : 'rgba(255, 255, 255, 0)',
line: {
width: 1,
color: ['rgba(255, 255, 255, 0.5)', 'rgba(255, 255, 0, 1)']
}
},
x: [0],
y: [0],
}]
, layout: {
title: '-',
font: {
family:'IBM Plex Mono',
size:10,
},
margin: {
l: 50,
r: 50,
b: 50,
t: 50,
pad: 4
},
plot_bgcolor: 'rgba(255,255,255,0)',
paper_bgcolor: 'rgba(255,255,255,0)',
yaxis: {
tickcolor: 'rgba(255,255,255,0.1)',
tickwidth: 1,
gridcolor: 'rgba(255,255,255,0.1)',
gridwidth: 1,
zerolinecolor: 'rgba(255,255,255,0.1)',
zerolinewidth: 1,
},
xaxis: {
tickcolor: 'rgba(255,255,255,0.1)',
tickwidth: 1,
zerolinecolor: 'rgba(255,255,255,0.1)',
zerolinewidth: 1,
gridcolor: 'rgba(255,255,255,0.1)',
gridwidth: 1,
},
}, frames: [], config: {
scrollZoom:true,
}})
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 React 示例开始,该示例使用 Plotly 的 scattergl 图表、快速追加的 x/y 数据,并启用 scrollZoom。将基于滚轮的滚动与工具栏行为进行比较,并使用链接的录屏来复现向后跳动;当追加实时数据时向前滚动仍保持稳定,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- data-visualization, frontend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100