zj
2024-06-03 89d48809779ae41f8712539584798d5900b64b78
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
116
117
118
119
120
121
122
123
124
125
<template>
  <div class="wrapper">
    <div ref="myEchart" style="height:60px;"></div>
  </div>
</template>
 
<script>
  import * as api from '../../../axios/api'
  import echarts from 'echarts'
 
  export default {
    components: {},
    props: {
      code: {
        type: String,
        default () {
 
        }
      }
    },
    data () {
      return {
        ChartsTime: []
      }
    },
    watch: {},
    computed: {},
    created () {},
    mounted () {
      this.getDate()
      this.getChrtsTime()
    },
    methods: {
      getChrtsTime () {
        // 获取时间
        // 9:30 ~ 11:30  13:00~15:00
        for (var i = 9; i < 15; i++) {
          let item = ''
          if (i === 12) {
 
          } else {
            for (let j = 0; j < 60; j++) {
              if (i === 11 && j > 30) {
 
              } else if (i === 9 && j < 30) {
 
              } else {
                let min = i
                let sec = j
                if (sec < 10) {
                  sec = '0' + j
                }
                if (min < 10) {
                  min = '0' + i
                }
                item = min + ':' + sec
                this.ChartsTime.push(item)
              }
            }
          }
        }
      },
      async getDate () {
        let opts = {
          stockCode: this.code,
          code: this.code,
          time: 5,
          ma: 5,
          size: 50
        }
 
        let data = await api.getMinuteLine(opts)
        if (data.status === 0) {
          this.initEchartMap(data.data)
        } else {
          this.$message.success(data.msg)
        }
      },
      initEchartMap (data) {
        let myChart = echarts.init(this.$refs.myEchart)
        let this_ = this
        window.onresize = myChart.resize
        let option = {
          xAxis: {
            type: 'category',
            axisLabel: { show: false },
            axisLine: { show: false },
            axisTick: { show: false },
            splitLine: { show: false },
            data: this_.ChartsTime
          },
          yAxis: {
            type: 'value',
            axisLabel: { show: false },
            axisLine: { show: false },
            axisTick: { show: false },
            splitLine: { show: false },
            min: 'dataMin',
            max: 'dataMax'
          },
          series: [{
            data: data.price,
            type: 'line',
            symbol: 'none',
            itemStyle: {
              color: 'rgb(237, 186, 83)'
            },
            areaStyle: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                offset: 0,
                color: 'rgba(237, 186, 83,0.1)'
              }, {
                offset: 1,
                color: 'rgba(237, 186, 83,0)'
              }])
            }
          }]
        }
        myChart.setOption(option)
      }
    }
  }
</script>
<style lang="less" scoped>
</style>