|
|
|
|
from pyecharts.charts import Grid
|
|
|
|
|
from pyecharts.globals import ThemeType
|
|
|
|
|
from pyecharts import options as opts
|
|
|
|
|
from 大数据.YY.各市企业营业收入 import create_bar as get_Bar1
|
|
|
|
|
from 大数据.ZJS.企业主要外资来源国别或地区代码分布 import create_pie as get_pie1
|
|
|
|
|
from 大数据.YX.广西省企业税收榜 import create_bar as get_Bar2
|
|
|
|
|
from 大数据.YX.广西省企业就业榜 import create_pie as get_pie2
|
|
|
|
|
from 大数据.YY.截止2018年各市企业注册数量 import create_line as get_line2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 获取可视化对象
|
|
|
|
|
bar1 = get_Bar1()
|
|
|
|
|
pie1 = get_pie1()
|
|
|
|
|
bar2 = get_Bar2()
|
|
|
|
|
pie2 = get_pie2()
|
|
|
|
|
line2 = get_line2()
|
|
|
|
|
|
|
|
|
|
# 设置标题和图例的位置
|
|
|
|
|
bar1.set_global_opts(
|
|
|
|
|
title_opts=opts.TitleOpts(title="各市企业营业收入总资金", pos_left="1%", pos_top="0px"),
|
|
|
|
|
legend_opts=opts.LegendOpts(pos_left="42.6%", pos_top="0px")
|
|
|
|
|
)
|
|
|
|
|
pie1.set_global_opts(
|
|
|
|
|
title_opts=opts.TitleOpts(title="主要外资来源国别或地区代码分布", pos_right="29%", pos_top="0px"),
|
|
|
|
|
# legend_opts=opts.LegendOpts(pos_right="2%", pos_top="25px")
|
|
|
|
|
legend_opts=opts.LegendOpts(
|
|
|
|
|
orient="vertical", # 设置图例的布局为垂直布局
|
|
|
|
|
pos_right="2%",
|
|
|
|
|
pos_top="25px"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
bar2.set_global_opts(
|
|
|
|
|
title_opts=opts.TitleOpts(title="广西省各市企业税收榜", pos_left="1%", pos_top="400px"),
|
|
|
|
|
legend_opts=opts.LegendOpts(pos_left="39.7%", pos_top="400px")
|
|
|
|
|
)
|
|
|
|
|
pie2.set_global_opts(
|
|
|
|
|
title_opts=opts.TitleOpts(title="广西省各市企业就业人数分布", pos_right="31%", pos_top="400px"),
|
|
|
|
|
legend_opts=opts.LegendOpts(
|
|
|
|
|
orient="vertical", # 设置图例的布局为垂直布局
|
|
|
|
|
pos_right="2%",
|
|
|
|
|
pos_top="430px"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
line2.set_global_opts(
|
|
|
|
|
title_opts=opts.TitleOpts(title="2008-2018年各市企业注册数量", pos_left="5%", pos_top="800px"),
|
|
|
|
|
legend_opts=opts.LegendOpts(pos_right="2%", pos_top="800px")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 创建一个Grid对象
|
|
|
|
|
grid = Grid(init_opts=opts.InitOpts(theme=ThemeType.DARK, width='100%', height='1400px'))
|
|
|
|
|
|
|
|
|
|
# 将图表添加到Grid对象中,分成两列
|
|
|
|
|
grid.add(bar1, grid_opts=opts.GridOpts(pos_left="5%", pos_right="50%", pos_top="50px", height='300px'))
|
|
|
|
|
grid.add(bar2, grid_opts=opts.GridOpts(pos_left="5%", pos_right="50%", pos_top="450px", height='300px'))
|
|
|
|
|
grid.add(line2, grid_opts=opts.GridOpts(pos_left="5%", pos_right="2%", pos_top="850px", height='500px'))
|
|
|
|
|
# 渲染pie
|
|
|
|
|
grid.add(pie1, grid_opts=opts.GridOpts(height='300px'))
|
|
|
|
|
grid.add(pie2, grid_opts=opts.GridOpts(pos_bottom="300px"))
|
|
|
|
|
|
|
|
|
|
# 渲染所有图表到一个HTML文件中
|
|
|
|
|
grid.render("./Output/图表2.html")
|
|
|
|
|
|