Skip to content

Commit

Permalink
fix: fix axis component padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Sep 12, 2023
1 parent 93ee908 commit 5eb8877
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/vtable/src/components/axis/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ export class CartesianAxis {
}

getLayoutRect() {
const padding = getQuadProps(this.table.theme.bodyStyle.padding as number);
// const padding = getQuadProps(this.table.theme.bodyStyle.padding as number);
return {
width: this.width - (this.orient === 'top' || this.orient === 'bottom' ? padding[3] + padding[1] : 0),
height: this.height - (this.orient === 'left' || this.orient === 'right' ? padding[0] + padding[2] : 0)
// width: this.width - (this.orient === 'top' || this.orient === 'bottom' ? padding[3] + padding[1] : 0),
// height: this.height - (this.orient === 'left' || this.orient === 'right' ? padding[0] + padding[2] : 0)
width: this.width,
height: this.height
};
}

Expand Down
3 changes: 1 addition & 2 deletions packages/vtable/src/layout/chart-helper/get-chart-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,10 @@ export function getChartAxes(col: number, row: number, layout: PivotLayoutMap):
range.min = Math.min(range.min, 0);
range.max = Math.max(range.max, 0);
}
let tickCount;
if (axisOption?.nice) {
const { ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption);
range.min = ticks[0];
range.max = ticks[ticks.length - 1];
tickCount = ticks.length;
}
if (isNumber(axisOption?.min)) {
(range as any).min = axisOption.min;
Expand All @@ -182,6 +180,7 @@ export function getChartAxes(col: number, row: number, layout: PivotLayoutMap):
orient: index === 0 ? 'left' : 'right',
// visible: true,
label: { visible: false },
// label: { flush: true },
title: { visible: false },
domainLine: { visible: false },
seriesIndex: index,
Expand Down

0 comments on commit 5eb8877

Please sign in to comment.