You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
3.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from pyecharts.charts import Grid
from pyecharts.globals import ThemeType
from pyecharts import options as opts
from 大数据.ZJS.各地市研发总投入 import create_bar as get_Bar1
from 大数据.ZJS.各地市研发投入比 import create_line as get_Line1
from 大数据.ZJS.各市企业工业总产值和人员分布 import create_line_bar as get_line_bar
from 大数据.PXX.各市企业平均净利润 import create_bar as get_Bar3
from 大数据.PXX.各市企业平均技术转让收入 import create_bar as get_Bar4
from 大数据.YY.各市企业注册总资金 import create_bar as get_Bar5
from 大数据.YX.广西省企业出口榜 import create_line as get_line3
# 获取可视化对象
bar1 = get_Bar1()
line1 = get_Line1()
line2, bar2 = get_line_bar()
bar3 = get_Bar3()
bar4 = get_Bar4()
bar5 = get_Bar5()
line3 = get_line3()
# 设置标题和图例的位置
bar1.set_global_opts(
title_opts=opts.TitleOpts(title="各市研发总投入额", pos_left="1%", pos_top="0px"),
legend_opts=opts.LegendOpts(pos_left="39.3%", pos_top="0px")
)
line1.set_global_opts(
title_opts=opts.TitleOpts(title="各市研发投入比(%)", pos_right="35%", pos_top="0px"),
legend_opts=opts.LegendOpts(pos_right="2%", pos_top="0px")
)
bar2.set_global_opts(
title_opts=opts.TitleOpts(title="各市企业的学历人员分布数量", pos_left="1%", pos_top="400px"),
legend_opts=opts.LegendOpts(pos_left="33.1%", pos_top="400px")
)
line2.set_global_opts(
title_opts=opts.TitleOpts(title="各市企业的工业总产值", pos_right="34%", pos_top="400px"),
legend_opts=opts.LegendOpts(pos_right="2%", pos_top="400px")
)
bar3.set_global_opts(
title_opts=opts.TitleOpts(title="各市企业平均净利润", pos_left="1%", pos_top="800px"),
legend_opts=opts.LegendOpts(pos_left="40.3%", pos_top="800px")
)
bar5.set_global_opts(
title_opts=opts.TitleOpts(title="各市企业注册总资金", pos_right="35%", pos_top="800px"),
legend_opts=opts.LegendOpts(pos_right="2%", pos_top="800px")
)
bar4.set_global_opts(
title_opts=opts.TitleOpts(title="各市企业平均技术转让收入", pos_left="1%", pos_top="1200px"),
legend_opts=opts.LegendOpts(pos_left="37.9%", pos_top="1200px")
)
line3.set_global_opts(
title_opts=opts.TitleOpts(title="广西省各市企业出口榜", pos_right="34%", pos_top="1200px"),
legend_opts=opts.LegendOpts(pos_right="2%", pos_top="1200px")
)
# 创建一个Grid对象
grid = Grid(init_opts=opts.InitOpts(theme=ThemeType.DARK, width='100%', height='1600px'))
# 将图表添加到Grid对象中分成两列
grid.add(bar1, grid_opts=opts.GridOpts(pos_left="5%", pos_right="50%", pos_top="50px", height='300px'))
grid.add(line1, grid_opts=opts.GridOpts(pos_left="55%", pos_right="2%", 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="55%", pos_right="2%", pos_top="450px", height='300px'))
grid.add(bar3, grid_opts=opts.GridOpts(pos_left="5%", pos_right="50%", pos_top="850px", height='300px'))
grid.add(bar5, grid_opts=opts.GridOpts(pos_left="55%", pos_right="2%", pos_top="850px", height='300px'))
grid.add(bar4, grid_opts=opts.GridOpts(pos_left="5%", pos_right="50%", pos_top="1250px", height='300px'))
grid.add(line3, grid_opts=opts.GridOpts(pos_left="55%", pos_right="2%", pos_top="1250px", height='300px'))
# 渲染所有图表到一个HTML文件中
grid.render("./Output/图表1.html")