yxh
yxh
23 小时以前 8022f7036945b75f82f2dfc43055623f81ed98f6
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
  <div class="">
    <Echart
      :id="id"
      ref="barChart"
      :options="options"
      :height="height"
      :width="width"
    ></Echart>
  </div>
</template>
 
<script>
import Echart from "@/common/echart";
 
export default {
  name: "rankbarchart",
  components: {
    Echart,
  },
  props: {
    id: {
      type: String,
      default: "rankbarchart",
    },
    width: {
      type: String,
      default: "100%",
    },
    height: {
      type: String,
      default: "520px",
    },
    cdata: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      options: {},
    };
  },
  created() {},
  mounted() {},
  methods: {
    resetOption(newData) {
      this.options = {
        title: {
          text: "各地市医院案例数据",
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        grid: {
          top: "5%",
          left: "0",
          right: "3%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "value",
          boundaryGap: [0, 0.01],
          show: false,
        },
        yAxis: {
          type: "category",
          data: [
            "医院0005",
            "医院0001",
            "医院0002",
            "医院0003",
            "医院0004",
            "全部医院",
          ],
          axisLine: {
            show: false,
          },
          axisLabel: {
            textStyle: {
              color: "#566f94", //更改坐标轴文字颜色
              fontSize: 14, //更改坐标轴文字大小
            },
          },
        },
        series: [
          {
            name: "案例数据",
            type: "bar",
            barWidth: 30, //柱图宽度
            data: [110, 80, 110, 30, 50, 500],
          },
        ],
      };
    },
  },
  computed: {},
  watch: {
    cdata: {
      handler(newData) {
        this.resetOption(newData);
      },
      immediate: true,
      deep: true,
    },
  },
};
</script>
 
<style lang="scss" scoped>
</style>