-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
折线图按Y轴降序排序 #6544
Comments
复现代码如下:原因应该是 sortX 当 x 通道是 ordinal 数据的时候,只对 x scale 的 domain 进行了排序,而不是对数据整体进行排序。 ![]() import { Chart } from "@antv/g2";
const chart = new Chart({
container: "container",
});
// Apply academy theme.
chart.theme({ type: "academy" });
chart
.line()
.data({
type: "fetch",
value:
"https://gw.alipayobjects.com/os/bmw-prod/f129b517-158d-41a9-83a3-3294d639b39e.csv",
format: "csv",
})
.transform({ type: "groupX", reducer: "sum" })
.encode("x", "state")
.encode("y", "population")
.encode("series", () => "b")
.transform({ type: "sortX", by: "y" });
chart.render(); 但是如下设置也不行 ![]() |
BQXBQX
added a commit
to BQXBQX/G2
that referenced
this issue
Mar 1, 2025
This commit fixes issue antvis#6544 by: - Implementing proper domain-based sorting in the sortQuantitative transform - Adding support for slicing sorted domains - Creating a test case that demonstrates the fix - Enhancing the sort transform to handle sorting by a different channel than the one being displayed
2 tasks
hustcc
pushed a commit
that referenced
this issue
Mar 6, 2025
* fix(chart): resolve issue #6544 with line chart sorting This commit fixes issue #6544 by: - Implementing proper domain-based sorting in the sortQuantitative transform - Adding support for slicing sorted domains - Creating a test case that demonstrates the fix - Enhancing the sort transform to handle sorting by a different channel than the one being displayed * refactor(transform): unify sorting logic * refactor(transform): simplify Sort implementation by inlining unifiedSort logic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
使用
transform({ type: 'sortX', by: 'y', reverse: true})
对折线图排序,会导致线条错乱重现链接
https://codesandbox.io/p/sandbox/nervous-joliot-hg59ty
重现步骤
No response
预期行为
期望能够实现折线图按Y轴降序排序
平台
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: