3
0

Adjust default chart offset

This commit is contained in:
Jože Fortun
2022-11-25 13:53:50 +01:00
parent bc2280bdd1
commit 7f260b7135
3 changed files with 10 additions and 12 deletions

View File

@@ -434,7 +434,6 @@ export default {
deep: true,
handler (value, oldValue) {
if (value && oldValue) {
console.log(value, oldValue)
this.onConfigUpdate()
}
},

View File

@@ -289,10 +289,10 @@ export class BaseChart {
},
},
offset: {
top: '0',
right: '0',
bottom: '0',
left: '0',
top: '50',
right: '30',
bottom: '20',
left: '30',
isDefault: true,
},
})

View File

@@ -133,7 +133,7 @@ export default class Chart extends BaseChart {
name: yLabel,
type: yType === 'linear' ? 'value' : 'log',
position,
nameGap: labelPosition === 'center' ? 25 : 7,
nameGap: labelPosition === 'center' ? 30 : 7,
nameLocation: labelPosition,
min: beginAtZero ? 0 : min || undefined,
max: max || undefined,
@@ -149,7 +149,7 @@ export default class Chart extends BaseChart {
},
nameTextStyle: {
align: labelPosition === 'center' ? 'center' : position,
padding: labelPosition !== 'center' ? (position === 'left' ? [0, 0, 2, -20] : [0, -20, 2, 0]) : undefined,
padding: labelPosition !== 'center' ? (position === 'left' ? [0, 0, 2, -3] : [0, -3, 2, 0]) : undefined,
},
}
@@ -190,7 +190,6 @@ export default class Chart extends BaseChart {
}
}
return {
z: index,
name: label,
@@ -243,10 +242,10 @@ export default class Chart extends BaseChart {
}
options.grid = {
top: offset?.isDefault ? 45 : offset?.top,
right: offset?.isDefault ? 25 : offset?.right,
bottom: offset?.isDefault ? 25 : offset?.bottom,
left: offset?.isDefault ? 25 : offset?.left,
top: offset?.isDefault ? 50 : offset?.top,
right: offset?.isDefault ? 30 : offset?.right,
bottom: offset?.isDefault ? 20 : offset?.bottom,
left: offset?.isDefault ? 30 : offset?.left,
containLabel: true,
}