Skip to content

Commit a6581b3

Browse files
committed
Improvement - VueUiXy - Add config option to control x offset of scale values in individualScale mode
1 parent cf812fe commit a6581b3

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

TestingArena/ArenaVueUiXy.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ const model = ref([
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: 0, type: 'number', min: -100, max: 100},
339+
{ key: 'chart.grid.labels.yAxis.scaleLabelOffsetX', def: 36, type: 'number', min: -100, max: 100},
340+
{ key: 'chart.grid.labels.yAxis.scaleValueOffsetX', def: -20, type: 'number', min: -100, max: 100},
340341
341342
{ key: 'chart.grid.labels.xAxis.showBaseline', def: true, type: 'checkbox'},
342343
{ 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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@
455455
:transform="`translate(${el.x - FINAL_CONFIG.chart.grid.labels.yAxis.labelWidth + 5 + xPadding + FINAL_CONFIG.chart.grid.labels.yAxis.scaleLabelOffsetX}, ${mutableConfig.isStacked ? drawingArea.bottom - el.yOffset - (el.individualHeight / 2) : drawingArea.top + drawingArea.height / 2}) rotate(-90)`"
456456
>
457457
{{ el.name }} {{ el.scaleLabel && el.unique && el.scaleLabel !== el.id ? `- ${el.scaleLabel}` : '' }}
458-
459458
</text>
460459
<line
461460
v-for="(yLabel, j) in el.yLabels"
@@ -469,7 +468,7 @@
469468
/>
470469
<text
471470
v-for="(yLabel, j) in el.yLabels"
472-
:x="el.x - 5 + xPadding"
471+
:x="el.x - 5 + xPadding + FINAL_CONFIG.chart.grid.labels.yAxis.scaleValueOffsetX"
473472
:y="forceValidValue(yLabel.y) + fontSizes.dataLabels / 3"
474473
:font-size="fontSizes.dataLabels"
475474
text-anchor="end"

src/useConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ export function useConfig() {
460460
scaleMax: null, // idem
461461
groupColor: null, // force yAxis labels color
462462
scaleLabelOffsetX: 0,
463+
scaleValueOffsetX: 0
463464
},
464465
xAxisLabels: {
465466
color: COLOR_BLACK,

types/vue-data-ui.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,6 +2627,7 @@ declare module "vue-data-ui" {
26272627
scaleMax?: number | null;
26282628
groupColor?: string | null;
26292629
scaleLabelOffsetX?: number;
2630+
scaleValueOffsetX?: number;
26302631
};
26312632
xAxis?: {
26322633
showBaseline?: boolean;

0 commit comments

Comments
 (0)