Skip to content

Commit 72715d2

Browse files
committed
Fix - VueUiXy - In individualScale mode fix yAxis scale width inconsistent when segregating series
1 parent 8d03e67 commit 72715d2

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

TestingArena/ArenaVueUiXy.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ const model = ref([
331331
{ key: 'chart.grid.labels.yAxis.useIndividualScale', def: true, type: "checkbox" },
332332
{ key: 'chart.grid.labels.yAxis.stacked', def: false, type: 'checkbox' },
333333
{ key: 'chart.grid.labels.yAxis.gap', def: 12, min: 0, max: 200, type: 'number' },
334-
{ key: 'chart.grid.labels.yAxis.labelWidth', def: 20, min: 0, max: 100, type: 'number' },
334+
{ key: 'chart.grid.labels.yAxis.labelWidth', def: 48, min: 0, max: 100, type: 'number' },
335335
{ key: 'chart.grid.labels.yAxis.showBaseline', def: true, type: 'checkbox'},
336336
{ key: 'chart.grid.labels.yAxis.scaleMin', def: -90, type: 'number', min: -1000, max: 1000 },
337337
{ key: 'chart.grid.labels.yAxis.scaleMax', def: 90, type: 'number', min: -1000, max: 1000 },
338338
{ key: 'chart.grid.labels.yAxis.groupColor', def: '#1A1A1A', type: 'color'},
339-
{ key: 'chart.grid.labels.yAxis.scaleLabelOffsetX', def: -16, type: 'number', min: -100, max: 100},
339+
{ key: 'chart.grid.labels.yAxis.scaleLabelOffsetX', def: 0, type: 'number', min: -100, max: 100},
340340
341341
{ key: 'chart.grid.labels.xAxis.showBaseline', def: true, type: 'checkbox'},
342342
{ key: 'chart.grid.labels.zeroLine.show', def: true, type: 'checkbox'},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@
107107
"vitest": "^3.1.1",
108108
"vue": "^3.5.13"
109109
}
110-
}
110+
}

src/components/vue-ui-xy.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,18 @@ export default {
21582158
})
21592159
},
21602160
drawingArea() {
2161-
const individualScalesPadding = this.mutableConfig.useIndividualScale && this.FINAL_CONFIG.chart.grid.labels.show ? this.absoluteDataset.filter(s => !this.segregatedSeries.includes(s.id)).length * (this.mutableConfig.isStacked ? 0 : this.FINAL_CONFIG.chart.grid.labels.yAxis.labelWidth) : 0;
2161+
function getUniqueScaleLabelsCount(dataset) {
2162+
const uniqueLabels = new Set();
2163+
dataset.forEach(item => {
2164+
const label = item.scaleLabel || '__noScaleLabel__';
2165+
uniqueLabels.add(label);
2166+
});
2167+
return uniqueLabels.size;
2168+
}
2169+
2170+
const len = getUniqueScaleLabelsCount(this.absoluteDataset.filter(s => !this.segregatedSeries.includes(s.id)));
2171+
2172+
const individualScalesPadding = this.mutableConfig.useIndividualScale && this.FINAL_CONFIG.chart.grid.labels.show ? len * (this.mutableConfig.isStacked ? 0 : this.FINAL_CONFIG.chart.grid.labels.yAxis.labelWidth) : 0;
21622173
return {
21632174
top: this.FINAL_CONFIG.chart.padding.top,
21642175
right: this.width - this.FINAL_CONFIG.chart.padding.right,

0 commit comments

Comments
 (0)