Duplicate Keys on X-Axis with Date Format and formatTick
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
When plotting a chart using Plotly with a small dataset and specifying the x-axis type as date, along with a custom formatTick function, the x-axis displays duplicate keys. This issue creates a confusing and cluttered appearance, as shown in the example provided below.
Steps to Reproduce:
Create a chart with the x-axis type set to date.
Use a small dataset with date values.
Specify a custom formatTick function for the x-axis.
Example:
You can see the issue in the following CodePen example:
CodePen Example
Expected Behavior:
The x-axis should display unique date values without any duplicates, even for small datasets, ensuring a clean and accurate representation of the data.
Actual Behavior:
The x-axis shows duplicate date values, leading to a misleading visualization.
Environment:
Plotly.js version: plotly.js-dist-min@2.32.0
Browser: chrome
Operating System: windows
This issue significantly impacts the readability of charts, especially when dealing with smaller datasets where clear and distinct x-axis labels are crucial.
Additional information:
by specifying type as category or explicitly specilfying tickvals and ticktext doesn't suit well for large dataset.
Screenshot
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 Plotly.js 2.32.0 运行链接的 CodePen 示例,并比较使用和不使用自定义 formatTick 函数时 date-axis 的标签。跟踪导致标签重复的 date-axis 刻度生成和格式化行为。完成标准是:小型日期数据集能够在不需要 category axes 或显式 tickvals 和 ticktext 的情况下,渲染出唯一且易读的 x-axis 标签。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100