Skip to content

Commit ccdcf60

Browse files
committed
Modification - Legends - Harmonize legend marker sizes
1 parent 0532bc5 commit ccdcf60

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/atoms/Legend.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ function handleClick(legend, i) {
4242
>
4343
<slot name="legendTitle" :titleSet="legendSet"></slot>
4444
<div v-for="(legend, i) in legendSet" :key="`legend_${i}`" :class="{ 'vue-data-ui-legend-item': true, 'active': clickable }">
45-
<svg @click="handleClick(legend, i)" v-if="legend.shape" :height="config.fontSize" :width="config.fontSize" viewBox="-8 -8 76 76" :style="`overflow: visible;opacity:${legend.opacity}`">
45+
<svg @click="handleClick(legend, i)" v-if="legend.shape" :height="config.fontSize" :width="config.fontSize" :viewBox="legend.shape && legend.shape === 'star' ? '-10 -10 80 80' : '0 0 60 60'" :style="`overflow: visible;opacity:${legend.opacity}`">
4646
<Shape
4747
:shape="legend.shape"
4848
:radius="30"
4949
stroke="none"
50-
:plot="{ x: 30, y: 30 }"
50+
:plot="{ x: 30, y: legend.shape === 'triangle' ? 36 : 30 }"
5151
:fill="legend.color"
5252
/>
5353
<slot name="legend-pattern" v-bind="{ legend, index: isValidUserValue(legend.absoluteIndex) ? legend.absoluteIndex : i}"/>

src/components/vue-ui-xy.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,11 +4169,26 @@ defineExpose({
41694169
:stroke="FINAL_CONFIG.chart.backgroundColor" :strokeWidth="0.5" />
41704170
</svg>
41714171
<svg v-else-if="icons[legendItem.type] === 'bar'" viewBox="0 0 40 40" height="14" width="14">
4172-
<rect v-if="icons[legendItem.type] === 'bar' && $slots.pattern" x="0" y="0" rx="1" height="40"
4173-
width="40" stroke="none" :fill="legendItem.color" />
4174-
<rect v-if="icons[legendItem.type] === 'bar'" x="0" y="0" rx="1" height="40" width="40"
4172+
<rect
4173+
v-if="icons[legendItem.type] === 'bar' && $slots.pattern"
4174+
x="4"
4175+
y="4"
4176+
rx="1"
4177+
height="32"
4178+
width="32"
4179+
stroke="none"
4180+
:fill="legendItem.color"
4181+
/>
4182+
<rect
4183+
v-if="icons[legendItem.type] === 'bar'"
4184+
x="4"
4185+
y="4"
4186+
rx="1"
4187+
height="32"
4188+
width="32"
41754189
stroke="none"
4176-
:fill="$slots.pattern ? `url(#pattern_${uniqueId}_${legendItem.slotAbsoluteIndex})` : legendItem.color" />
4190+
:fill="$slots.pattern ? `url(#pattern_${uniqueId}_${legendItem.slotAbsoluteIndex})` : legendItem.color"
4191+
/>
41774192
</svg>
41784193
<svg v-else viewBox="0 0 12 12" height="14" width="14">
41794194
<Shape :plot="{ x: 6, y: 6 }" :radius="5" :color="legendItem.color"

0 commit comments

Comments
 (0)