plotly / plotly/react-plotly.js

[TypeScript] Missing property in `Partial<PlotData>`

未关闭
#308 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
1.1k
派生
138
平均合并
3 天 2 小时
30 天内合并 PR
4

描述

Hi, thanks very much for this handy component!

I tried to look at all examples and API docs available but can't figure out how to make use of connector among other properties (e.g. measure) for a Waterfall chart. I wonder whether there is a generic way to pass those parameters or it's just not possible at the moment?

This is the code I have:

<Plot
  data={[
    {
      type: 'waterfall', 
      x: ['Name 1', 'Name 2'], 
      y: [15, 20],
      connector: {line: {color: 'red'}} // Cause error: Object literal may only specify known properties, and 'connector' does not exist in type 'Partial<PlotData>'
    },
  ]}
  layout={{
    width: 300 
    height: 150
  }}
/>

The root of the problem seems that only limited number of properties are implemented on Partial<PlotData> - including for instance (as shown in example) the marker: {color: 'red'} property - which is NOT relevant to a waterfall chart at all.

Actually, due to my limited knowledge with React/TypeScript, I don't even know how to look at the definition of PlotData (it looks not available on this repo?) in order to inspect what properties are actually implemented there - would be helpful if anyone can provide some pointers.

This might be related to this: https://github.com/plotly/react-plotly.js/issues/247

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

调研方向

首先定位 Plot 组件以及其 data prop 使用的 Partial 定义;该 issue 没有指定仓库文件或测试。将已声明的 waterfall 属性与 Plotly 示例和 API 文档中描述的 connector 和 measure 属性进行比较。当使用这些属性的有效 waterfall 数据能够通过类型检查且不再出现报告的错误时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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