用户:穿山甲汤查看:0 回复:4 评论:0 创建时间:2021-12-10T22:05:10
【作品展示】

【作品介绍】
可以生成图表(折线,柱状)
【作品源代码】
from pyecharts import *
import webbrowser,turtle
import os
import json
print("記得保存")
print("欢迎使用图表生成器")
print("请选择模式")
z=int(input("柱状图摁1,折线图摁2"))
def zhu():
num = input("请输入名称")
bar=Bar(num)
s = turtle.Screen()
y=int(s.textinput("选择打开方式","(1是json,2是普通文档"))
if y==1:
with open(s.textinput("输入", "输入json名称"), "r") as f:
p=json.load(f)
if y==2:
with open(s.textinput("输入", "输入文档名称"), "r", encoding="utf-8") as f:
p = f.read()
shu=list(p.keys())
ju=list(p.values())
bar.add("",shu,ju)
bar.render()
webbrowser.open("file://"+os.path.realpath("render.html"))
def zhe():
num = input("请输入名称")
l = Line(num)
s = turtle.Screen()
y = int(s.textinput("选择打开方式", "(1是json,2是普通文档"))
if y == 1:
with open(s.textinput("输入", "输入json名称"), "r") as f:
p = json.load(f)
if y == 2:
with open(s.textinput("输入", "输入文档名称(必须是字典格式,懂得都懂)"), "r", encoding="utf-8") as f:
p = f.read()
shu = list(p.keys())
ju = list(p.values())
l.add("", shu, ju)
l.render()
webbrowser.open("file://"+os.path.realpath("render.html"))
if z==1:
zhu()
elif z==2:
zhe()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn