mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Revert "center labels: removed condition"
This reverts commit a83fab28e16cb2e681dc183b10a577dede92ecb5.
This commit is contained in:
parent
a83fab28e1
commit
5c39e99e32
@ -283,14 +283,14 @@ export class QuadrantBuilder {
|
|||||||
quadrantTop,
|
quadrantTop,
|
||||||
quadrantWidth,
|
quadrantWidth,
|
||||||
} = quadrantSpace;
|
} = quadrantSpace;
|
||||||
|
const drawAxisLabelInMiddle = this.data.points.length === 0;
|
||||||
const axisLabels: QuadrantTextType[] = [];
|
const axisLabels: QuadrantTextType[] = [];
|
||||||
|
|
||||||
if (this.data.xAxisLeftText && showXAxis) {
|
if (this.data.xAxisLeftText && showXAxis) {
|
||||||
axisLabels.push({
|
axisLabels.push({
|
||||||
text: this.data.xAxisLeftText,
|
text: this.data.xAxisLeftText,
|
||||||
fill: this.themeConfig.quadrantXAxisTextFill,
|
fill: this.themeConfig.quadrantXAxisTextFill,
|
||||||
x: quadrantLeft + quadrantHalfWidth / 2,
|
x: quadrantLeft + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0),
|
||||||
y:
|
y:
|
||||||
xAxisPosition === 'top'
|
xAxisPosition === 'top'
|
||||||
? this.config.xAxisLabelPadding + titleSpace.top
|
? this.config.xAxisLabelPadding + titleSpace.top
|
||||||
@ -299,7 +299,7 @@ export class QuadrantBuilder {
|
|||||||
quadrantHeight +
|
quadrantHeight +
|
||||||
this.config.quadrantPadding,
|
this.config.quadrantPadding,
|
||||||
fontSize: this.config.xAxisLabelFontSize,
|
fontSize: this.config.xAxisLabelFontSize,
|
||||||
verticalPos: 'center',
|
verticalPos: drawAxisLabelInMiddle ? 'center' : 'left',
|
||||||
horizontalPos: 'top',
|
horizontalPos: 'top',
|
||||||
rotation: 0,
|
rotation: 0,
|
||||||
});
|
});
|
||||||
@ -308,7 +308,7 @@ export class QuadrantBuilder {
|
|||||||
axisLabels.push({
|
axisLabels.push({
|
||||||
text: this.data.xAxisRightText,
|
text: this.data.xAxisRightText,
|
||||||
fill: this.themeConfig.quadrantXAxisTextFill,
|
fill: this.themeConfig.quadrantXAxisTextFill,
|
||||||
x: quadrantLeft + quadrantHalfWidth + quadrantHalfWidth / 2,
|
x: quadrantLeft + quadrantHalfWidth + (drawAxisLabelInMiddle ? quadrantHalfWidth / 2 : 0),
|
||||||
y:
|
y:
|
||||||
xAxisPosition === 'top'
|
xAxisPosition === 'top'
|
||||||
? this.config.xAxisLabelPadding + titleSpace.top
|
? this.config.xAxisLabelPadding + titleSpace.top
|
||||||
@ -317,7 +317,7 @@ export class QuadrantBuilder {
|
|||||||
quadrantHeight +
|
quadrantHeight +
|
||||||
this.config.quadrantPadding,
|
this.config.quadrantPadding,
|
||||||
fontSize: this.config.xAxisLabelFontSize,
|
fontSize: this.config.xAxisLabelFontSize,
|
||||||
verticalPos: 'center',
|
verticalPos: drawAxisLabelInMiddle ? 'center' : 'left',
|
||||||
horizontalPos: 'top',
|
horizontalPos: 'top',
|
||||||
rotation: 0,
|
rotation: 0,
|
||||||
});
|
});
|
||||||
@ -334,9 +334,9 @@ export class QuadrantBuilder {
|
|||||||
quadrantLeft +
|
quadrantLeft +
|
||||||
quadrantWidth +
|
quadrantWidth +
|
||||||
this.config.quadrantPadding,
|
this.config.quadrantPadding,
|
||||||
y: quadrantTop + quadrantHeight - quadrantHalfHeight / 2,
|
y: quadrantTop + quadrantHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0),
|
||||||
fontSize: this.config.yAxisLabelFontSize,
|
fontSize: this.config.yAxisLabelFontSize,
|
||||||
verticalPos: 'center',
|
verticalPos: drawAxisLabelInMiddle ? 'center' : 'left',
|
||||||
horizontalPos: 'top',
|
horizontalPos: 'top',
|
||||||
rotation: -90,
|
rotation: -90,
|
||||||
});
|
});
|
||||||
@ -352,9 +352,9 @@ export class QuadrantBuilder {
|
|||||||
quadrantLeft +
|
quadrantLeft +
|
||||||
quadrantWidth +
|
quadrantWidth +
|
||||||
this.config.quadrantPadding,
|
this.config.quadrantPadding,
|
||||||
y: quadrantTop + quadrantHalfHeight - quadrantHalfHeight / 2,
|
y: quadrantTop + quadrantHalfHeight - (drawAxisLabelInMiddle ? quadrantHalfHeight / 2 : 0),
|
||||||
fontSize: this.config.yAxisLabelFontSize,
|
fontSize: this.config.yAxisLabelFontSize,
|
||||||
verticalPos: 'center',
|
verticalPos: drawAxisLabelInMiddle ? 'center' : 'left',
|
||||||
horizontalPos: 'top',
|
horizontalPos: 'top',
|
||||||
rotation: -90,
|
rotation: -90,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user