Skip to content

Commit eb86a28

Browse files
committed
feat(dashboard): reduce xAxis’ nameGap when xAxisData is empty
cartesian chart & scatter chart
1 parent d477093 commit eb86a28

File tree

2 files changed

+4
-0
lines changed
  • dashboard/src/components/plugins/viz-components

2 files changed

+4
-0
lines changed

dashboard/src/components/plugins/viz-components/cartesian/option/x-axis.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { ICartesianChartConf } from '../type';
55
export function getXAxes(conf: ICartesianChartConf, xAxisData: $TSFixMe[]) {
66
const { overflow, ...axisLabel } = conf.x_axis.axisLabel;
77
const overflowOption = getLabelOverflowOptionOnAxis(overflow.on_axis);
8+
const xDataEmpty = xAxisData.length === 0;
89
return [
910
{
1011
data: xAxisData,
1112
name: conf.x_axis_name ?? '',
13+
nameGap: xDataEmpty ? 5 : undefined,
1214
id: 'main-x-axis',
1315
axisTick: {
1416
show: true,

dashboard/src/components/plugins/viz-components/scatter-chart/option/x-axis.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import { IScatterChartConf } from '../type';
44
export function getXAxes(conf: IScatterChartConf, xAxisData: $TSFixMe[]) {
55
const allNumbers = xAxisData.every((d) => !Number.isNaN(Number(d)));
66
const { axisLabel } = conf.x_axis;
7+
const xDataEmpty = xAxisData.length === 0;
78
return [
89
{
910
data: xAxisData,
1011
name: conf.x_axis.name ?? '',
12+
nameGap: xDataEmpty ? 5 : undefined,
1113
id: 'main-x-axis',
1214
axisTick: {
1315
show: true,

0 commit comments

Comments
 (0)