Skip to content

VueUiDashboard - Slot content #208

Closed
@PwrFr

Description

@PwrFr

Describe the bug
I tried to add an button to each chart by using #content from VueUiDashboard But doesn't work

Image

Template

<VueUiDashboard :config="config" :dataset="dataset">
    <template #content="{ item }">
        <Button>Menu</Button>
        <component :is="item.component" v-bind="item.props" />
    </template>
</VueUiDashboard>

Script

const dataset = ref<VueUiDashboardElement[]>([
    {
        id: 'line-0',
        width: 20,
        height: 40,
        left: 1,
        top: 16,
        component: 'VueUiXy',
        props: {
            config: myXyConfig.value,
            dataset: [
                {
                    name: "Series 1",
                    series: [12, 25, 32, 64, 34, 26],
                    type: "bar",
                },
                {
                    name: "Series 2",
                    series: [8, 20, 27, 48, 27, 20],
                    type: "bar",
                },
                {
                    name: "Series 3",
                    series: [18, 52, 51, 74, 12, 94],
                    type: "bar",
                },
            ] as any
        }
    },
    {
        id: 'donut-1',
        width: 20,
        height: 60,
        left: 22,
        top: 16,
        component: 'VueUiDonut',
        props: {
            config: myDonutConfig.value,
            dataset: [{
                name: "Serie 1",
                values: [100],
            },
            {
                name: "Serie 2",
                values: [200]
            },
            {
                name: "Serie 3",
                values: [300, 1],
                comment: "A comment for this specific datapoint"
            }] as any
        }
    },
])

const config = ref({
    locked: false,
    style: {
        board: {
            backgroundColor: "#FFFFFF",
            color: "#2D353C",
            aspectRatio: "16/6.8",
            border: "1px solid #e1e5e8",
        },
        item: {
            backgroundColor: "#FFFFFF",
            // borderColor: "#e1e5e8"
            border: "1px solid #e1e5e8",

        },
        resizeHandles: {
            backgroundColor: "#2D353C",
            border: "none"
        }
    },
    allowPrint: false
})

const myXyConfig = ref<VueUiXyConfig>({
    chart: {
        userOptions: {
            show: false,
        },
        title: {
            show: true,
            text: "Test",
            // color: "#c8c8c8",
            fontSize: 20,
            bold: true,
            textAlign: "center",
            paddingLeft: 0,
            paddingRight: 0,
            subtitle: {
                fontSize: 16,
                // color: "#c8c8c8",
                text: "Heeloo"
            }
        },
    },
    bar: {
        useGradient: false
    },

})

const myDonutConfig = ref({
    userOptions: {
        show: false,
    },
    style: {
        chart: {
            useGradient: false,
            title: {
                text: "Title",
                // color: "#FAFAFA",
                fontSize: 20,
                bold: true,
                textAlign: "center",
                paddingLeft: 0,
                paddingRight: 0,
                subtitle: {
                    // color: "#CCCCCC",
                    text: "Subtitle",
                    fontSize: 16,
                    bold: false
                }
            },

        }
    },

})

Vue Data UI version :
"vue-data-ui": "^2.10.4",

or am i missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions