plotly / plotly/plotly.js

Outlier slows down zooming in scattergl

未关闭
#6,174 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

I have large data sets, which have a fat tail, i.e. looks like having an outlier.
I use scattergl aiming for fast zooming. As shown in https://plotly.com/javascript/webgl-vs-svg
or in the example below, one million points can be done. However, if one point is set as an outlier, then zooming becomes very
slow. I don't understand this, and spent quite some time to pin down the problem.

https://jsfiddle.net/fasmu943

<!DOCTYPE html>
<html>
<div id="plotly-div1"></div>
<div id="plotly-div2"></div>

<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
<script>
function gaussianRand() {
    var rand = 0
    for (var i=0; i < 3; ++i) {
        rand += Math.random()
    }
    return (rand / 3) - 0.5
}

function plot(y, divnum){
   trace1 = {
      type: "scattergl",
      y: y,
   }
   layout = {
      height: 250,
      margin: {l: 40, r: 10, b: 30, t: 10}
   }
   Plotly.plot('plotly-div'+divnum, {
      data: [trace1],
      layout: layout,
   })
}

Y = []
for (var i=0; i < 1000000; i++) {
    Y.push(gaussianRand())
}

plot(Y, 1)

Y[800000] = 100.   // adding an outlier slows down zoom

plot(Y, 2)

delete Y

</script>
</html>

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先运行链接的 JSFiddle 复现,并比较包含和不包含单个异常值时百万点 scattergl 数据的缩放效果。调查示例所涉及的 scattergl 缩放路径和 WebGL 行为。当存在一个异常值时缩放性能不再明显下降,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization, performance
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。