(Fib)
点击查看该示例的代码
<template>
<div class="pr dsfsdfd">
<span class="ye sfdgrtrt">(Fib)</span>
<div class="h100 dsfsr" ref="chartsBox"></div>
</div>
</template>
<script>
import { dataer, yf, initTime } from "./data.js";
export default {
data() {
return {
legendData: [
"Base Tx Fee",
"Overestimation Fee",
"Penalty Fee",
"Batch Fee",
"Miner Tip",
"Protocol Revenue",
],
};
},
components: {},
methods: {
zhuanhuan(data) {
return parseFloat(data)
.toFixed(2)
.replace(/[^\d\.-]/g, ",");
},
fmoney(
s,
n //s:传入的float数字 ,n:希望返回小数点几位
) {
n = n > 0 && n <= 20 ? n : 2;
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
var l = s.split(".")[0].split("").reverse(),
r = s.split(".")[1],
t = "";
for (let i = 0; i < l.length; i++) {
t += l[i] + ((i + 1) % 3 == 0 && i + 1 != l.length ? "," : "");
}
return t.split("").reverse().join("") + "." + r;
},
},
mounted() {
const jhbasda = [];
const jhbasdb = [];
const jhbasdc = [];
const jhbasdd = [];
const jhbasde = [];
const jhbasdf = [];
const xAxisdata = [];
dataer.map((a) => {
const jhbjer = a.base_fee_burn,
kjserb = a.overestimation_fee,
kjserc = a.penalty_fee,
kjserd = a.prove_commit_batch_fee,
kjsere = a.miner_tip,
kjserf = a.protocol_revenue;
jhbasda.push(jhbjer);
jhbasdb.push(kjserb);
jhbasdc.push(kjserc);
jhbasdd.push(kjserd);
jhbasde.push(kjsere);
jhbasdf.push(kjserf);
const data = new Date(a.stat_date);
let iuner = data.getDate();
if (iuner < 10) {
iuner = "0" + iuner;
}
xAxisdata.push(
yf[data.getMonth()] + " " + iuner + "," + data.getFullYear()
);
});
const jjne = this.$refs.chartsBox;
const myChart = echarts.init(jjne);
const option = {
grid: {
left: "0%",
right: "0%",
bottom: "20%",
top: "25%",
containLabel: true,
},
dataZoom: [
{
type: "inside",
},
{
type: "slider",
},
],
title: {
text: "Protocol Revenue",
},
toolbox: {
show: true,
feature: {
saveAsImage: {},
},
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
},
formatter: (data) => {
let hgse = "";
data.map((a) => {
hgse += `
<div class='jjnnjderr display-flex' style="width:220px">
<span class='kjjsertwe' style="background:${a.color}"></span>
<span class='ml5'>
${a.seriesName}
</span> <span class="flex-1 tr">${this.fmoney(a.value)}</span>
</div>
`;
});
return hgse;
},
},
legend: {
right: 30,
top: 5,
data: this.legendData,
},
xAxis: {
data: xAxisdata,
},
yAxis: {
type: "value",
},
series: [
{
name: this.legendData[0],
data: jhbasda,
type: "bar",
stack: "Ad",
},
{
name: this.legendData[1],
data: jhbasdb,
type: "bar",
stack: "Ad",
},
{
name: this.legendData[2],
data: jhbasdc,
type: "bar",
stack: "Ad",
},
{
name: this.legendData[3],
data: jhbasdd,
type: "bar",
stack: "Ad",
},
{
name: this.legendData[4],
data: jhbasde,
type: "bar",
stack: "Ad",
},
{
name: this.legendData[5],
data: jhbasdf,
type: "line",
},
],
};
myChart.setOption(option);
},
};
</script>
<style scoped>
.dsfsdfd {
height: 400px;
}
</style>
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182