plotly / plotly/plotly.js

Colored and Styled Error Bars described incorrectly in docs

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

还没有人认领这个 Issue。

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

描述

This error was reported by Martin Shell, the VP customer success at Taipy.

The error is located in Colored and Styled Error Bars.
In the example, the js code begins as follow:

function linspace(a,b,n) {
  return d3.range(n).map(function(i){return a+i*(b-a)/(n-1);});
}
x_theo = linspace(-4, 4, 100)
sincx = Math.sin(x_theo) / x_theo

(looks like someone translated this FROM python -- ironic as I am translating it TO python).
In any case, in the last line, x_theo is a js array and I think the coder was trying to get an array out, but this code results in sincx being set to NaN. Plotly js basically ignores sincx and the resulting chart is clearly not what is intended. You need to do something like:

sincx = x._theo.map(x=>Math.sin(x)/x)

贡献指南

打开贡献指南

从这里开始

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

调研方向

打开标题为“Colored and Styled Error Bars”的 JavaScript 文档部分,并检查以 linspace 开头、以 sincx 计算结尾的示例。修正数组计算,使示例生成预期的误差条图,然后验证渲染后的示例不再包含 NaN 值。

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

评估

技术栈
d3, javascript
领域
data-visualization, documentation
Issue 类型
文档
难度
1/5
预计耗时
1 小时以内
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

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