commit 491086cbbd907c8b651bebbd860643f394af763d
parent bca1e057e48856bfc862bc6454fae3ce6a011f34
Author: finwo <finwo@pm.me>
Date: Fri, 2 Oct 2026 01:15:38 +0200
Add configurable legend position (bottom/right/left)
Diffstat:
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/index.ts b/src/index.ts
@@ -170,6 +170,34 @@ export default definePanel({
},
},
{
+ field: 'legendPosition',
+ type: 'string',
+ name: 'Legend Position',
+ meta: {
+ interface: 'select-dropdown',
+ options: {
+ choices: [
+ {
+ value: 'bottom',
+ text: 'Bottom',
+ },
+ {
+ value: 'right',
+ text: 'Right',
+ },
+ {
+ value: 'left',
+ text: 'Left',
+ },
+ ],
+ },
+ width: 'half',
+ },
+ schema: {
+ default_value: 'bottom',
+ },
+ },
+ {
field: 'showDataLabel',
name: '$t:show_data_label',
type: 'boolean',
diff --git a/src/panel.vue b/src/panel.vue
@@ -67,6 +67,10 @@ export default defineComponent({
type: Boolean,
default: true,
},
+ legendPosition: {
+ type: String,
+ default: 'bottom',
+ },
showDataLabel: {
type: Boolean,
default: true,
@@ -104,6 +108,7 @@ export default defineComponent({
() => props.labelGrouping,
() => props.sortDirection,
() => props.showLegend,
+ () => props.legendPosition,
() => props.showDataLabel,
],
() => {
@@ -230,7 +235,7 @@ export default defineComponent({
},
legend: {
show: props.showLegend,
- position: 'bottom',
+ position: props.legendPosition,
markers: {
shape: 'circle',
},