Skip to content

Commit

Permalink
Merge pull request #560 from oceanbase/zhuyue-dev-charts
Browse files Browse the repository at this point in the history
🐞 fix(charts): Remove unreasonable xAxis.tickCount calculate logic for Line, Area, Column and DualAxes
  • Loading branch information
dengfuping authored Apr 12, 2024
2 parents 74cc206 + b40ece1 commit 262d9b6
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
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

0 comments on commit 262d9b6

Please sign in to comment.