Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,10 @@ def pd_bar():
|
|
| 7 |
demo=gr.Blocks()
|
| 8 |
with demo:
|
| 9 |
gr.Markdown("# <center>图表渲染测试")
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
<html>
|
| 12 |
<head><style type="text/css">body {margin: 0;}#main2 {height: 100%;}</style></head>
|
| 13 |
<body><div id="main2"></div>
|
|
@@ -15,12 +18,10 @@ with demo:
|
|
| 15 |
<script>var myChart = echarts.init(document.getElementById("main2"));
|
| 16 |
option = {tooltip:{formatter:"{a} <br/>{b} : {c}%"},series:[{name:'业务指标',type:'gauge',detail:{formatter:'{value}%'},axisLine:{lineStyle:{width:20}},splitLine:{length:20},data:[{value:50,name:'完成率'}]}]};
|
| 17 |
myChart.setOption(option);
|
| 18 |
-
|
| 19 |
</script></body>
|
| 20 |
</html>
|
| 21 |
'''
|
| 22 |
-
|
| 23 |
-
with gr.Tabs():
|
| 24 |
with gr.TabItem("pd_bar"):
|
| 25 |
pd_button=gr.Button("pd_bar>>")
|
| 26 |
pd_output=gr.Plot(label="pd_chart1")
|
|
|
|
| 7 |
demo=gr.Blocks()
|
| 8 |
with demo:
|
| 9 |
gr.Markdown("# <center>图表渲染测试")
|
| 10 |
+
|
| 11 |
+
with gr.Tabs():
|
| 12 |
+
with gr.TabItem("echarts"):
|
| 13 |
+
htmls='''
|
| 14 |
<html>
|
| 15 |
<head><style type="text/css">body {margin: 0;}#main2 {height: 100%;}</style></head>
|
| 16 |
<body><div id="main2"></div>
|
|
|
|
| 18 |
<script>var myChart = echarts.init(document.getElementById("main2"));
|
| 19 |
option = {tooltip:{formatter:"{a} <br/>{b} : {c}%"},series:[{name:'业务指标',type:'gauge',detail:{formatter:'{value}%'},axisLine:{lineStyle:{width:20}},splitLine:{length:20},data:[{value:50,name:'完成率'}]}]};
|
| 20 |
myChart.setOption(option);
|
|
|
|
| 21 |
</script></body>
|
| 22 |
</html>
|
| 23 |
'''
|
| 24 |
+
gr.HTML(htmls)
|
|
|
|
| 25 |
with gr.TabItem("pd_bar"):
|
| 26 |
pd_button=gr.Button("pd_bar>>")
|
| 27 |
pd_output=gr.Plot(label="pd_chart1")
|