summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkChartTooltip.vue
blob: 0ad10162a8c6794626c71d20e50842ab2a8d60b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
<MkTooltip ref="tooltip" :showing="showing" :x="x" :y="y" :max-width="340" :direction="'top'" :inner-margin="16" @closed="emit('closed')">
	<div v-if="title || series" class="qpcyisrl">
		<div v-if="title" class="title">{{ title }}</div>
		<template v-if="series">
			<div v-for="x in series" class="series">
				<span class="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;
	title?: string;
	series?: {
		backgroundColor: string;
		borderColor: string;
		text: string;
	}[];
}>();

const emit = defineEmits<{
	(ev: 'closed'): void;
}>();
</script>

<style lang="scss">
.qpcyisrl {
	> .title {
		margin-bottom: 4px;
	}

	> .series {
		> .color {
			display: inline-block;
			width: 8px;
			height: 8px;
			border-width: 1px;
			border-style: solid;
			margin-right: 8px;
		}
	}
}
</style>