Skip to content
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

🐞 fix(charts): Remove unreasonable xAxis.tickCount calculate logic for Line, Area, Column and DualAxes #560

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ export default defineConfig({
title: 'Histogram 直方图',
link: '/charts/histogram',
},
{
title: 'Pie 饼图&环图',
link: '/charts/pie',
},
{
title: 'DualAxes 双轴图',
link: '/charts/dual-axes',
},
{
title: 'Pie 饼图&环图',
link: '/charts/pie',
},
{
title: 'Gauge 仪表盘',
link: '/charts/gauge',
Expand Down
3 changes: 3 additions & 0 deletions packages/charts/src/Area/demo/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default () => {
data,
xField: 'timePeriod',
yField: 'value',
xAxis: {
tickCount: 7,
},
};
return <Area {...config} />;
};
3 changes: 3 additions & 0 deletions packages/charts/src/Area/demo/stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default () => {
xField: 'date',
yField: 'value',
seriesField: 'country',
xAxis: {
tickCount: 7,
},
};
return <Area {...config} />;
};
3 changes: 3 additions & 0 deletions packages/charts/src/Area/demo/tooltip-scrollable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default () => {
xField: 'date',
yField: 'value',
seriesField: 'country',
xAxis: {
tickCount: 7,
},
tooltip: {
scrollable: true,
},
Expand Down
2 changes: 0 additions & 2 deletions packages/charts/src/Area/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ const Area = forwardRef<unknown, AreaConfig>(
// type 为 time 时需要关闭自动美化,否则 X 轴两侧会留白
// issue: https://github.com/antvis/G2Plot/issues/1951
nice: xAxis?.type === 'time' ? false : undefined,
// 点数 >= 14 时,x 方向展示 7 个刻度线和网格
tickCount: data?.length >= 14 ? 7 : undefined,
...xAxis,
// x 方向增加虚线网格
grid:
Expand Down
2 changes: 0 additions & 2 deletions packages/charts/src/Column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ const Column = forwardRef<unknown, ColumnConfig>(
// type 为 time 时需要关闭自动美化,否则 X 轴两侧会留白
// issue: https://github.com/antvis/G2Plot/issues/1951
nice: xAxis?.type === 'time' ? false : undefined,
// 点数 >= 14 时,x 方向展示 7 个刻度线和网格
tickCount: data?.length >= 14 ? 7 : undefined,
...xAxis,
// x 方向增加虚线网格
grid:
Expand Down
2 changes: 0 additions & 2 deletions packages/charts/src/DualAxes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ const DualAxes = forwardRef<unknown, DualAxesConfig>(
// type 为 time 时需要关闭自动美化,否则 X 轴两侧会留白
// issue: https://github.com/antvis/G2Plot/issues/1951
nice: xAxis?.type === 'time' ? false : undefined,
// 点数 >= 14,x 方向展示 7 个刻度线和网格
tickCount: data?.length >= 14 ? 7 : undefined,
...xAxis,
// x 方向增加虚线网格
grid:
Expand Down
3 changes: 3 additions & 0 deletions packages/charts/src/Line/demo/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default () => {
data,
xField: 'Date',
yField: 'scales',
xAxis: {
type: 'timeCat',
},
};
return <Line {...config} />;
};
2 changes: 0 additions & 2 deletions packages/charts/src/Line/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const Line = forwardRef<unknown, LineConfig>(
// type 为 time 时需要关闭自动美化,否则 X 轴两侧会留白
// issue: https://github.com/antvis/G2Plot/issues/1951
nice: xAxis?.type === 'time' ? false : undefined,
// 非阶梯折线图,并且点数 >= 14,x 方向展示 7 个刻度线和网格
tickCount: !stepType && data?.length >= 14 ? 7 : undefined,
...xAxis,
// x 方向增加虚线网格
grid:
Expand Down
Loading