Skip to content

Commit 1907287

Browse files
committed
Improvement - VueUiXy - Added optional period gap for bar types
1 parent 36a4611 commit 1907287

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

TestingArena/ArenaVueUiXy.vue

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ import convertArrayToObject from "./convertModel";
88
const dataset = ref([
99
{
1010
name: "S0",
11-
series: [10, 20, 12, 13],
11+
series: [10, 20, 12, 13, 10, 20, 30, 20, 12, 16, 32, 64],
1212
type: "bar",
1313
smooth: false,
1414
useArea: true,
1515
dataLabels: true,
1616
scaleSteps: 2,
1717
},
18-
{
19-
name: "S1",
20-
series: [8, 4, 8, 16],
21-
type: "bar",
22-
smooth: false,
23-
useArea: true,
24-
scaleSteps: 2,
25-
},
26-
{
27-
name: "S2",
28-
series: [10,12,10,12],
29-
type: "bar",
30-
smooth: false,
31-
useArea: true,
32-
scaleSteps: 2
33-
},
18+
// {
19+
// name: "S1",
20+
// series: [8, 4, 8, 16, 12, 13, 16, 25, 12, 3, 7, 12, 6],
21+
// type: "bar",
22+
// smooth: false,
23+
// useArea: true,
24+
// scaleSteps: 2,
25+
// },
26+
// {
27+
// name: "S2",
28+
// series: [10,12,10,12, 25, 12, 4, 4, 3, 7, 8, 9, 12],
29+
// type: "bar",
30+
// smooth: false,
31+
// useArea: true,
32+
// scaleSteps: 2
33+
// },
3434
// {
3535
// name: "S3",
3636
// series: [23.12, 23.12, 23.05, 23.07, null, 23.69, 23.72, 23.25, 23.36, 23.41, 23.65],
@@ -146,7 +146,7 @@ const model = ref([
146146
{ key: 'bar.serieName.abbreviationSize', def: 3, type: 'number', min: 0, max: 12, label: ['serieName', 'abbreviation', 'is', 'size'], category: 'bar' },
147147
{ key: 'bar.serieName.useSerieColor', def: true, type: 'checkbox', label: ['serieName', 'textColor', 'is', 'series'], category: 'bar' },
148148
{ key: 'bar.serieName.color', def: '#1A1A1A', type: 'color', label: ['serieName', 'is', 'textColor'], category: 'bar' },
149-
{ key: 'bar.periodGap', def: 0.125, type: 'number', min: 0, max: 24},
149+
{ key: 'bar.periodGap', def: 0.1, type: 'number', min: 0, max: 24},
150150
151151
{ key: 'line.radius', def: 6, type: 'number', min: 0, max: 20, label: 'radius', category: 'line' },
152152
{ key: 'line.useGradient', def: true, type: 'checkbox', label: 'useGradient', category: 'line' },

src/components/vue-ui-xy.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
:x="calcRectX(plot)"
183183
:y="chartConfig.chart.grid.labels.yAxis.useIndividualScale ? calcIndividualRectY(plot) : calcRectY(plot)"
184184
:height="chartConfig.chart.grid.labels.yAxis.useIndividualScale ? calcIndividualHeight(plot) : calcRectHeight(plot)"
185-
:width="calcRectWidth() - barPeriodGap"
185+
:width="calcRectWidth() - (chartConfig.chart.grid.labels.yAxis.useIndividualScale && chartConfig.chart.grid.labels.yAxis.stacked ? 0 : barPeriodGap)"
186186
:rx="chartConfig.bar.borderRadius"
187187
:fill="chartConfig.bar.useGradient ? plot.value >= 0 ? `url(#rectGradient_pos_${i}_${uniqueId})`: `url(#rectGradient_neg_${i}_${uniqueId})` : serie.color"
188188
/>
@@ -409,7 +409,7 @@
409409
<text
410410
:data-cy="`xy-bar-label-x-${i}-${j}`"
411411
v-if="plot && (!Object.hasOwn(serie, 'dataLabels') || serie.dataLabels === true) && chartConfig.bar.labels.show"
412-
:x="chartConfig.chart.grid.labels.yAxis.useIndividualScale && chartConfig.chart.grid.labels.yAxis.stacked ? plot.x + slot.line / 2 : calcRectX(plot) + barPeriodGap"
412+
:x="chartConfig.chart.grid.labels.yAxis.useIndividualScale && chartConfig.chart.grid.labels.yAxis.stacked ? plot.x + slot.line / 2 : calcRectX(plot) + calcRectWidth() / 2 - barPeriodGap / 2"
413413
:y="plot.y + (plot.value > 0 ? chartConfig.bar.labels.offsetY : - chartConfig.bar.labels.offsetY * 3)"
414414
text-anchor="middle"
415415
:font-size="chartConfig.chart.labels.fontSize"

src/default_configs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@
305305
"bar": {
306306
"borderRadius": 2,
307307
"useGradient": true,
308-
"periodGap": 0,
308+
"periodGap": 0.1,
309309
"labels": {
310310
"show": false,
311311
"offsetY": -6,

types/vue-data-ui.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,6 +2465,7 @@ declare module 'vue-data-ui' {
24652465
bar?: {
24662466
borderRadius?: number;
24672467
useGradient?: boolean;
2468+
periodGap?: number;
24682469
labels?: {
24692470
show?: boolean;
24702471
offsetY?: number;

0 commit comments

Comments
 (0)