linear axis: "reverse" breaks tick align 'inner'
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 77/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- chart.js, javascript
调研方向
从 scale.js 中的 computeLabelItem 开始,检查 inner 刻度对齐如何计算第一个和最后一个刻度的标签位置。使用提供的配置,将现有行为与反向线性轴进行比较。更新对齐方式,使这些刻度保持在轴内,然后运行相关的 scale 和刻度对齐测试;反向轴能够将两端的刻度都朝内渲染时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Expected behavior
When the axis is drawn and "align": "inner" is set for ticks, the first and last tick shall be painted inwards the axis line.
Current behavior
When the axis is drawn in standard direction, "align": "inner" works for ticks
But when "reverse": "true", the first and last tick are explicitly rendred out of the axis!
Reproducible sample
don't have one. Use the codepen and replace the cfg with the one below
Optional extra steps/info to reproduce
Cfg for the codepen. Clearly shows the problem
var myChart = new Chart(ctx, {
type: "line",
data: {
//labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [
{
label: "# of Votes",
indexAxis: "x",
data: [
{ x: 200, y: 12 },
{ x: 451, y: 14 },
{ x: 999, y: 14 }
]
}
]
},
options: {
scales: {
x: {
axis: "x",
type: "linear",
min: 200,
max: 1000,
reverse: true,
ticks: {
align: "inner"
}
},
y: {
axis: "y",
min: 0,
max: 20
}
}
}
});
Possible solution
scale.js computeLabelItem
Consider reversed axis setting here
case 'inner':
if (i === ilen - 1) {
left -= width;
} else if (i > 0) {
left -= width / 2;
}
break;
Context
No response
chart.js version
v4.5.1
Browser name and version
Chrome 152
Link to your project
No response
- 主要语言
- JavaScript
- 星标
- 67.8k
- 派生
- 12k
- 平均合并
- 6 小时 15 分钟
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
chartjs/Chart.js 的其他 Issue
-
Numeric tick formatter gives repeated labels in scientific notation and with bounds: 'data'可能已有人在做 @RClaudiuM 于 4 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
fill: 'stack': a dataset's whole fill disappears when its x differs from the line below by ≤ 1e-6 px (happens in animations)可能已有人在做 @ump45nose 于 41 天前认领。 未关闭type: bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
Legend pointStyle: 'line' does not apply dataset borderDash pattern可能已有人在做 @HuzaifaChaudary 于 73 天前认领。 未关闭type: bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
`skipNull` is a configuration option, not a dataset field可能已有人在做 @puneetdixit200 于 160 天前认领。 未关闭type: documentation
难度 2/5 1-3 小时 新手友好度 72/100
chartjs/Chart.js#12235 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
needs verification
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 7 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
awesome-dsh-plugin/awesome-dsh-plugin#14322 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
swc-project/swc-ai-issues#414 ·
-
[workshop-sim] Repair: Make Copilot access and billing path decision self-contained in Steps 07/07d未关闭feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 72/100
githubnext/gh-aw-workshop#5597 ·
维护者通常 1 天内回复
-
[Bug]: v0.1.61 fails to initialize preload script due to system memory information error on Linux未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/desktop#167 ·