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.
306 lines
11 KiB
306 lines
11 KiB
11 months ago
|
from pyecharts.charts import Grid, Page
|
||
|
from pyecharts import options as opts
|
||
|
|
||
|
from cky_code01 import cky_code01
|
||
|
from cky_code02 import cky_code02
|
||
|
from cky_code03 import cky_code03
|
||
|
from lyh_code01 import lyh_code01
|
||
|
from lyh_code02 import lyh_code02
|
||
|
from lyh_code03 import lyh_code03
|
||
|
from xja_code01 import xja_code01
|
||
|
from xja_code02 import xja_code02
|
||
|
from xja_code03 import xja_code03
|
||
|
|
||
|
|
||
|
def result_image01():
|
||
|
cky_code01_bar = cky_code01()
|
||
|
cky_code02_bar, cky_code02_pie = cky_code02()
|
||
|
lyh_code01_bar = lyh_code01()
|
||
|
lyh_code02_bar = lyh_code02()
|
||
|
lyh_code03_bar = lyh_code03()
|
||
|
line = xja_code02()
|
||
|
bar = xja_code03()
|
||
|
|
||
|
cky_code01_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西高新区企业数量地区分布图",
|
||
|
pos_left="5%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_left="35%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
cky_code02_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西外资企业引进收入对比图",
|
||
|
pos_left="54%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="5%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
lyh_code01_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市创新能力分析图",
|
||
|
pos_left="5%",
|
||
|
pos_top="500px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_left="35%", # 图例左侧位置
|
||
|
pos_top="500px",
|
||
|
),
|
||
|
)
|
||
|
lyh_code02_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市地域经济活力分析图",
|
||
|
pos_left="54%",
|
||
|
pos_top="500px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="5%", # 图例左侧位置
|
||
|
pos_top="500px",
|
||
|
),
|
||
|
)
|
||
|
lyh_code03_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市投资潜力分析图",
|
||
|
pos_left="5%",
|
||
|
pos_top="1000px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_left="35%", # 图例左侧位置
|
||
|
pos_top="1000px",
|
||
|
),
|
||
|
)
|
||
|
bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市研发总投入对比图",
|
||
|
pos_left="54%",
|
||
|
pos_top="1000px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="5%", # 图例左侧位置
|
||
|
pos_top="1000px",
|
||
|
),
|
||
|
)
|
||
|
line.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市研发投入比分析图",
|
||
|
pos_left="25%",
|
||
|
pos_top="1500px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="25%", # 图例左侧位置
|
||
|
pos_top="1500px",
|
||
|
),
|
||
|
)
|
||
|
cky_code02_pie.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市外企数量分布图",
|
||
|
pos_left="25%",
|
||
|
pos_top="2000px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="35%", # 图例左侧位置
|
||
|
pos_top="2000px",
|
||
|
),
|
||
|
)
|
||
|
|
||
|
# 使用 Grid 将多个图表按网格布局组织在一起
|
||
|
grid = (
|
||
|
Grid(init_opts=opts.InitOpts(width="100%",height="2600px",bg_color="rgb(255, 255, 240)")) # 设置整个 Grid 区域的初始宽度和高度
|
||
|
.add(cky_code01_bar, grid_opts=opts.GridOpts(pos_left="5%", pos_right="55%", pos_top="50px", pos_bottom="2150px"))
|
||
|
.add(cky_code02_bar, grid_opts=opts.GridOpts(pos_left="55%", pos_right="5%", pos_top="50px", pos_bottom="2150px"))
|
||
|
.add(lyh_code01_bar, grid_opts=opts.GridOpts(pos_left="5%", pos_right="55%", pos_top="550px", pos_bottom="1650px"))
|
||
|
.add(lyh_code02_bar, grid_opts=opts.GridOpts(pos_left="55%", pos_right="5%", pos_top="550px", pos_bottom="1650px"))
|
||
|
.add(lyh_code03_bar, grid_opts=opts.GridOpts(pos_left="5%", pos_right="55%", pos_top="1050px", pos_bottom="1150px"))
|
||
|
.add(bar, grid_opts=opts.GridOpts(pos_left="55%", pos_right="5%", pos_top="1050px", pos_bottom="1150px"))
|
||
|
.add(line, grid_opts=opts.GridOpts(pos_left="25%", pos_right="25%", pos_top="1550px", pos_bottom="650px"))
|
||
|
.add(cky_code02_pie, grid_opts=opts.GridOpts(pos_left="25%", pos_right="25%", pos_top="2050px", pos_bottom="450px"))
|
||
|
)
|
||
|
|
||
|
# 生成 HTML 文件
|
||
|
grid.render('result_image01.html')
|
||
|
|
||
|
def result_image02():
|
||
|
|
||
|
cky_code03_map = cky_code03()
|
||
|
xja_code01_map = xja_code01()
|
||
|
|
||
|
# 将图表添加到 Page 中
|
||
|
page = Page(layout=Page.SimplePageLayout)
|
||
|
page.add(cky_code03_map)
|
||
|
page.add(xja_code01_map)
|
||
|
|
||
|
# 生成 HTML 文件
|
||
|
page.render('result_image02.html')
|
||
|
|
||
|
# 广西企业产业类型分布
|
||
|
def industry_type():
|
||
|
cky_code03().render('industry_type.html')
|
||
|
|
||
|
# 广西各地市整体经济发展
|
||
|
def whole_development():
|
||
|
lyh_code01_bar = lyh_code01()
|
||
|
lyh_code02_bar = lyh_code02()
|
||
|
lyh_code03_bar = lyh_code03()
|
||
|
|
||
|
lyh_code01_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市创新能力分析图",
|
||
|
pos_left="5%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_left="35%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
lyh_code02_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市地域经济活力分析图",
|
||
|
pos_left="54%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="5%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
lyh_code03_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市投资潜力分析图",
|
||
|
pos_left="30%",
|
||
|
pos_top="500px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="30%", # 图例左侧位置
|
||
|
pos_top="500px",
|
||
|
),
|
||
|
)
|
||
|
|
||
|
grid = (
|
||
|
Grid(init_opts=opts.InitOpts(width="100%", height="1000px")) # 设置整个 Grid 区域的初始宽度和高度
|
||
|
.add(lyh_code01_bar,grid_opts=opts.GridOpts(pos_left="5%", pos_right="55%", pos_top="50px", pos_bottom="550px"))
|
||
|
.add(lyh_code02_bar,grid_opts=opts.GridOpts(pos_left="55%", pos_right="5%", pos_top="50px", pos_bottom="550px"))
|
||
|
.add(lyh_code03_bar,grid_opts=opts.GridOpts(pos_left="30%", pos_right="30%", pos_top="550px", pos_bottom="50px"))
|
||
|
)
|
||
|
|
||
|
# 生成 HTML 文件
|
||
|
grid.render('whole_development.html')
|
||
|
|
||
|
# 广西外资企业发展情况
|
||
|
def foreign_capital_development():
|
||
|
cky_code02_bar1, cky_code02_bar2, cky_code02_pie = cky_code02()
|
||
|
|
||
|
cky_code02_bar1.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西外资企业引进总营业收入图",
|
||
|
pos_left="5%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_left="35%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
cky_code02_bar2.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西外资企业引进总净利润图",
|
||
|
pos_left="54%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="5%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
cky_code02_pie.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市外企数量分布图",
|
||
|
pos_left="25%",
|
||
|
pos_top="550px",
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="50%", # 图例左侧位置
|
||
|
pos_top="550px",
|
||
|
),
|
||
|
)
|
||
|
|
||
|
grid = (
|
||
|
Grid(init_opts=opts.InitOpts(width="100%", height="1100px")) # 设置整个 Grid 区域的初始宽度和高度
|
||
|
.add(cky_code02_bar1,grid_opts=opts.GridOpts(pos_left="5%", pos_right="55%", pos_top="50px", pos_bottom="650px"))
|
||
|
.add(cky_code02_bar2,grid_opts=opts.GridOpts(pos_left="55%", pos_right="5%", pos_top="50px", pos_bottom="650px"))
|
||
|
.add(cky_code02_pie,grid_opts=opts.GridOpts(pos_left="25%", pos_right="25%", pos_top="550px", pos_bottom="50px"))
|
||
|
)
|
||
|
|
||
|
# 生成 HTML 文件
|
||
|
grid.render('foreign_capital_development.html')
|
||
|
|
||
|
# 广西各地高新区企业情况
|
||
|
def Hi_tech_Zone():
|
||
|
cky_code01_bar = cky_code01()
|
||
|
cky_code01_bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西高新区企业数量地区分布图",
|
||
|
pos_left="30%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="30%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
|
||
|
grid = (
|
||
|
Grid(init_opts=opts.InitOpts(width="100%")) # 设置整个 Grid 区域的初始宽度和高度
|
||
|
.add(cky_code01_bar,grid_opts=opts.GridOpts(pos_left="30%", pos_right="30%", pos_top="50px", pos_bottom="50px"))
|
||
|
)
|
||
|
|
||
|
# 生成 HTML 文件
|
||
|
grid.render('Hi_tech_Zone.html')
|
||
|
|
||
|
# 广西各市潜力发展情况
|
||
|
def potential_development():
|
||
|
xja_code01().render('potential_development.html')
|
||
|
|
||
|
# 广西各市研发投入情况
|
||
|
def R_D_investment():
|
||
|
line = xja_code02()
|
||
|
bar = xja_code03()
|
||
|
|
||
|
bar.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市研发总投入对比图",
|
||
|
pos_left="5%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_left="35%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
line.set_global_opts(
|
||
|
title_opts=opts.TitleOpts(
|
||
|
title="2018年广西各地市研发投入比分析图",
|
||
|
pos_left="54%"
|
||
|
),
|
||
|
legend_opts=opts.LegendOpts(
|
||
|
orient="horizontal", # 图例方向,可以设置为 "horizontal" 或 "vertical"
|
||
|
pos_right="5%", # 图例左侧位置
|
||
|
),
|
||
|
)
|
||
|
|
||
|
grid = (
|
||
|
Grid(init_opts=opts.InitOpts(width="100%")) # 设置整个 Grid 区域的初始宽度和高度
|
||
|
.add(bar,grid_opts=opts.GridOpts(pos_left="5%", pos_right="55%", pos_top="50px", pos_bottom="50px"))
|
||
|
.add(line,grid_opts=opts.GridOpts(pos_left="55%", pos_right="5%", pos_top="50px", pos_bottom="50px"))
|
||
|
)
|
||
|
|
||
|
grid.render('R_D_investment.html')
|
||
|
|
||
|
industry_type()
|