1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-17 16:18:27 +09:00
cherrypick/packages/frontend/src/components/MkChartTooltip.vue

50 lines
1008 B
Vue
Raw Normal View History

<template>
2023-05-19 13:58:09 +09:00
<MkTooltip ref="tooltip" :showing="showing" :x="x" :y="y" :maxWidth="340" :direction="'top'" :innerMargin="16" @closed="emit('closed')">
2023-01-15 09:14:17 +09:00
<div v-if="title || series">
<div v-if="title" :class="$style.title">{{ title }}</div>
<template v-if="series">
2023-01-15 09:14:17 +09:00
<div v-for="x in series">
<span :class="$style.color" :style="{ background: x.backgroundColor, borderColor: x.borderColor }"></span>
<span>{{ x.text }}</span>
</div>
</template>
</div>
</MkTooltip>
</template>
<script lang="ts" setup>
import { } from 'vue';
import MkTooltip from './MkTooltip.vue';
defineProps<{
showing: boolean;
x: number;
y: number;
2022-06-28 13:06:31 +09:00
title?: string;
series?: {
backgroundColor: string;
borderColor: string;
text: string;
}[];
}>();
const emit = defineEmits<{
(ev: 'closed'): void;
}>();
</script>
2023-01-15 09:14:17 +09:00
<style lang="scss" module>
.title {
margin-bottom: 4px;
}
2023-01-15 09:14:17 +09:00
.color {
display: inline-block;
width: 8px;
height: 8px;
border-width: 1px;
border-style: solid;
margin-right: 8px;
}
</style>