&l_echart百分比">
赞
踩
前端代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.1.2/echarts.common.js"></script> </head> <body> <div id="chart" style="width: 500px;height: 360px"></div> <script type="text/javascript"> var myChart = echarts.init(document.getElementById('chart')); option = { tooltip: { trigger: 'item', formatter: '{b} : {c} ({d}%)' }, legend: { orient: 'vertical', left: 'left', }, series: [ { name: '销量', type: 'pie', radius: '55%', center: ['50%', '60%'], data: [ {value: 23, name: '衣服'}, {value: 636, name: '裤子'}, {value: 2, name: '鞋子'} ], itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' }, // 这里做改变 normal: { label: { show: true, formatter: '{b} : {c} ({d}%)' }, labelLine: { show: true } } } } ] }; myChart.setOption(option); </script> </body> </html>
后端代码
from flask import Flask,render_template
app = Flask(__name__)
@app.route('/')
def index(): # put application's code here
return render_template('index.html')
if __name__ == '__main__':
app.run()
效果
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。