Blame view

ant-design-vue-jeecg/src/components/chart/Liquid.vue 1.36 KB
肖超群 authored
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
<template>
  <div>
    <v-chart
      :forceFit="true"
      :height="height"
      :width="width"
      :data="data"
      :scale="scale"
      :padding="0">
      <v-tooltip/>
      <v-interval
        :shape="['liquid-fill-gauge']"
        position="transfer*value"
        color=""
        :v-style="{
          lineWidth: 8,
          opacity: 0.75
        }"
        :tooltip="[
          'transfer*value',
          (transfer, value) => {
            return {
              name: transfer,
              value,
            };
          },
        ]"
      ></v-interval>
      <v-guide
        v-for="(row, index) in data"
        :key="index"
        type="text"
        :top="true"
        :position="{
          gender: row.transfer,
          value: 45
        }"
        :content="row.value + '%'"
        :v-style="{
          fontSize: 100,
          textAlign: 'center',
          opacity: 0.75,
        }"
      />
    </v-chart>
  </div>
</template>

<script>
肖超群 authored
51
52
53
54
55
const sourceDataConst = [
  {transfer: '一月', value: 813},
  {transfer: '二月', value: 233},
  {transfer: '三月', value: 561}
]
肖超群 authored
56
肖超群 authored
57
58
59
60
61
62
export default {
  name: 'Liquid',
  props: {
    height: {
      type: Number,
      default: 0
肖超群 authored
63
    },
肖超群 authored
64
65
66
67
68
69
70
71
72
    width: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      data: sourceDataConst,
      scale: []
肖超群 authored
73
74
    }
  }
肖超群 authored
75
}
肖超群 authored
76
77
78
79
80
</script>

<style scoped>

</style>