Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,150 +1,164 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from streamlit.components.v1 import html
|
3 |
+
|
4 |
+
st.header('嵌入网页及图表')
|
5 |
+
|
6 |
+
html('''
|
7 |
+
<iframe src="https://web.powerva.microsoft.com/environments/Default-51a58d6c-4fcf-4b75-8608-d00bf7f244d5/bots/new_bot_830e155fc862429e89683426b31c9bd5/webchat" height="500" frameborder="1" style="width:100%"></iframe>
|
8 |
+
''',height=520)
|
9 |
+
|
10 |
+
html('''
|
11 |
+
<iframe src="https://d.pbihub.cn/" height="600" frameborder="1" style="width:100%"></iframe>
|
12 |
+
''',height=620)
|
13 |
+
|
14 |
+
|
15 |
+
html('''
|
16 |
+
<head><meta charset="utf-8"><title>测试</title></head>
|
17 |
+
<body>
|
18 |
+
<div id="main" style="width: 600px;height:400px;"></div>
|
19 |
+
<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
|
20 |
+
<script>
|
21 |
+
require.config({paths: {echarts: 'http://echarts.baidu.com/build/dist'}});
|
22 |
+
require(
|
23 |
+
['echarts','echarts/chart/bar'],
|
24 |
+
function (ec) {
|
25 |
+
var myChart = ec.init(document.getElementById('main'));
|
26 |
+
var option = {
|
27 |
+
|
28 |
+
title : {
|
29 |
+
|
30 |
+
text: '某地区蒸发量和降水量',
|
31 |
+
|
32 |
+
subtext: '纯属虚构'
|
33 |
+
|
34 |
+
},
|
35 |
+
|
36 |
+
tooltip : {
|
37 |
+
|
38 |
+
trigger: 'axis'
|
39 |
+
|
40 |
+
},
|
41 |
+
|
42 |
+
legend: {
|
43 |
+
|
44 |
+
data:['蒸发量','降水量']
|
45 |
+
|
46 |
+
},
|
47 |
+
|
48 |
+
toolbox: {
|
49 |
+
|
50 |
+
show : true,
|
51 |
+
|
52 |
+
feature : {
|
53 |
+
|
54 |
+
dataView : {show: true, readOnly: false},
|
55 |
+
|
56 |
+
magicType : {show: true, type: ['line', 'bar']},
|
57 |
+
|
58 |
+
restore : {show: true},
|
59 |
+
|
60 |
+
saveAsImage : {show: true}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
},
|
65 |
+
|
66 |
+
calculable : true,
|
67 |
+
|
68 |
+
xAxis : [
|
69 |
+
|
70 |
+
{
|
71 |
+
|
72 |
+
type : 'category',
|
73 |
+
|
74 |
+
data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
],
|
79 |
+
|
80 |
+
yAxis : [
|
81 |
+
|
82 |
+
{
|
83 |
+
|
84 |
+
type : 'value'
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
],
|
89 |
+
|
90 |
+
series : [
|
91 |
+
|
92 |
+
{
|
93 |
+
|
94 |
+
name:'蒸发量',
|
95 |
+
|
96 |
+
type:'bar',
|
97 |
+
|
98 |
+
data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
|
99 |
+
|
100 |
+
markPoint : {
|
101 |
+
|
102 |
+
data : [
|
103 |
+
|
104 |
+
{type : 'max', name: '最大值'},
|
105 |
+
|
106 |
+
{type : 'min', name: '最小值'}
|
107 |
+
|
108 |
+
]
|
109 |
+
|
110 |
+
},
|
111 |
+
|
112 |
+
markLine : {
|
113 |
+
|
114 |
+
data : [
|
115 |
+
|
116 |
+
{type : 'average', name: '平均值'}
|
117 |
+
|
118 |
+
]
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
},
|
123 |
+
|
124 |
+
{
|
125 |
+
|
126 |
+
name:'降水量',
|
127 |
+
|
128 |
+
type:'bar',
|
129 |
+
|
130 |
+
data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],
|
131 |
+
|
132 |
+
markPoint : {
|
133 |
+
|
134 |
+
data : [
|
135 |
+
|
136 |
+
{name : '年最高', value : 182.2, xAxis: 7, yAxis: 183},
|
137 |
+
|
138 |
+
{name : '年最低', value : 2.3, xAxis: 11, yAxis: 3}
|
139 |
+
|
140 |
+
]
|
141 |
+
|
142 |
+
},
|
143 |
+
|
144 |
+
markLine : {
|
145 |
+
|
146 |
+
data : [
|
147 |
+
|
148 |
+
{type : 'average', name : '平均值'}
|
149 |
+
|
150 |
+
]
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
}
|
155 |
+
|
156 |
+
]
|
157 |
+
};
|
158 |
+
|
159 |
+
myChart.setOption(option);
|
160 |
+
}
|
161 |
+
);
|
162 |
+
</script>
|
163 |
+
</body>
|
164 |
+
''',height=600)
|