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
| <template>
| <div class="mini-chart">
| <div class="chart-content">
| <ve-line
| :height="chartHeight"
| :data="chartData"
| :settings="chartSettings"
| :extend="extendSettings"
| :legend-visible="false"></ve-line>
| </div>
| </div>
| </template>
|
| <style scoped lang="less">
| @import "./../index.less";
| </style>
|
| <script lang="ts">
| import { Component, Prop, Vue } from 'vue-property-decorator';
| import {format} from 'date-fns';
|
| @Component({
| components: {
| },
| })
| export default class MiniArea extends Vue {
|
| @Prop({ type: Number, default: 64})
| private height!: number;
|
| @Prop({ type: String, default: '#cceafe'})
| private color!: string;
|
| @Prop({ type: String, default: '#1089ff'})
| private borderColor!: string;
|
| @Prop({ type: Boolean, default: false})
| private line!: boolean;
|
| @Prop({type: Array, default: () => []})
| private data!: any[];
|
| get chartHeight() {
| return `${this.height}px`;
| }
|
| private chartSettings = {
| height: this.height,
| area: true,
| scale: [true, true],
| };
|
| get extendSettings() {
| const hasLine = this.line;
| const chartColor = this.color;
| const borderColor = this.borderColor;
| return {
| xAxis: {
| show: false,
| boundaryGap: false,
| axisLine: {
| show: false,
| },
| },
| yAxis: {
| show: false,
| axisLine: {
| show: false,
| },
| },
| series(v: any) {
| v.forEach((i: any ) => {
| i.symbol = false;
| i.showSymbol = false;
| i.showAllSymbol = false;
|
| i.lineStyle = {
| opacity: hasLine ? 1 : 0,
| color: borderColor,
| };
|
| i.itemStyle = {
| color: chartColor,
| };
|
| i.areaStyle = {
| opacity: 1,
| };
| });
| return v;
| },
| };
| }
|
| get chartData() {
| return {
| columns: ['x', 'y'],
| rows: this.data,
| };
| }
| /*
| private chartData= {
| columns: ['x', 'y'],
| rows: data
| };
| */
| }
| </script>
|
|