Python-数据分析可视化实例图

Python-数据分析可视化实例图

一:3D纹理图

运行效果图:

在这里插入图片描述

Python代码:

import math
from typing import Unionimport pyecharts.options as opts
from pyecharts.charts import Surface3Ddef float_range(start: int, end: int, step: Union[int, float], round_number: int = 2):"""浮点数 range:param start: 起始值:param end: 结束值:param step: 步长:param round_number: 精度:return: 返回一个 list"""temp = []while True:if start < end:temp.append(round(start, round_number))start += stepelse:breakreturn tempdef surface3d_data():for t0 in float_range(-3, 3, 0.05):y = t0for t1 in float_range(-3, 3, 0.05):x = t1z = math.sin(x ** 2 + y ** 2) * x / 3.14yield [x, y, z](Surface3D(init_opts=opts.InitOpts(width="1600px", height="800px")).add(series_name="",shading="color",data=list(surface3d_data()),xaxis3d_opts=opts.Axis3DOpts(type_="value"),yaxis3d_opts=opts.Axis3DOpts(type_="value"),grid3d_opts=opts.Grid3DOpts(width=100, height=40, depth=100),).set_global_opts(visualmap_opts=opts.VisualMapOpts(dimension=2,max_=1,min_=-1,range_color=["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026",],)).render("surface_wave.html")
)
二:3D散点图

运行效果图:

在这里插入图片描述

Python代码:

import asyncio
from aiohttp import TCPConnector, ClientSessionimport pyecharts.options as opts
from pyecharts.charts import Scatter3Dasync def get_json_data(url: str) -> dict:async with ClientSession(connector=TCPConnector(ssl=False)) as session:async with session.get(url=url) as response:return await response.json()# 获取官方的数据
data = asyncio.run(get_json_data(url="https://echarts.apache.org/examples/data/asset/data/nutrients.json")
)# 列名映射
field_indices = {"calcium": 3,"calories": 12,"carbohydrate": 8,"fat": 10,"fiber": 5,"group": 1,"id": 16,"monounsat": 14,"name": 0,"polyunsat": 15,"potassium": 7,"protein": 2,"saturated": 13,"sodium": 4,"sugars": 9,"vitaminc": 6,"water": 11,
}# 配置 config
config_xAxis3D = "protein"
config_yAxis3D = "fiber"
config_zAxis3D = "sodium"
config_color = "fiber"
config_symbolSize = "vitaminc"# 构造数据
data = [[item[field_indices[config_xAxis3D]],item[field_indices[config_yAxis3D]],item[field_indices[config_zAxis3D]],item[field_indices[config_color]],item[field_indices[config_symbolSize]],index,]for index, item in enumerate(data)
](Scatter3D(init_opts=opts.InitOpts(width="1440px", height="720px"))  # bg_color="black".add(series_name="",data=data,xaxis3d_opts=opts.Axis3DOpts(name=config_xAxis3D,type_="value",# textstyle_opts=opts.TextStyleOpts(color="#fff"),),yaxis3d_opts=opts.Axis3DOpts(name=config_yAxis3D,type_="value",# textstyle_opts=opts.TextStyleOpts(color="#fff"),),zaxis3d_opts=opts.Axis3DOpts(name=config_zAxis3D,type_="value",# textstyle_opts=opts.TextStyleOpts(color="#fff"),),grid3d_opts=opts.Grid3DOpts(width=100, height=100, depth=100),).set_global_opts(visualmap_opts=[opts.VisualMapOpts(type_="color",is_calculable=True,dimension=3,pos_top="10",max_=79 / 2,range_color=["#1710c0","#0b9df0","#00fea8","#00ff0d","#f5f811","#f09a09","#fe0300",],),opts.VisualMapOpts(type_="size",is_calculable=True,dimension=4,pos_bottom="10",max_=2.4 / 2,range_size=[10, 40],),]).render("scatter3d.html")
)
三:3D折线图

运行效果图:

在这里插入图片描述

Python代码:

import mathimport pyecharts.options as opts
from pyecharts.charts import Line3Dweek_en = "Saturday Friday Thursday Wednesday Tuesday Monday Sunday".split()
clock = ("12a 1a 2a 3a 4a 5a 6a 7a 8a 9a 10a 11a 12p ""1p 2p 3p 4p 5p 6p 7p 8p 9p 10p 11p".split()
)data = []
for t in range(0, 25000):_t = t / 1000x = (1 + 0.25 * math.cos(75 * _t)) * math.cos(_t)y = (1 + 0.25 * math.cos(75 * _t)) * math.sin(_t)z = _t + 2.0 * math.sin(75 * _t)data.append([x, y, z])(Line3D().add("",data,xaxis3d_opts=opts.Axis3DOpts(data=clock, type_="value"),yaxis3d_opts=opts.Axis3DOpts(data=week_en, type_="value"),grid3d_opts=opts.Grid3DOpts(width=100, height=100, depth=100),).set_global_opts(visualmap_opts=opts.VisualMapOpts(dimension=2,max_=30,min_=0,range_color=["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026",],)).render("line3d_rectangular_projection.html")
)
四:3D柱状图

(一)运行效果图:

在这里插入图片描述

Python代码:

import randomfrom pyecharts import options as opts
from pyecharts.charts import Bar3D
from pyecharts.faker import Fakerdata = [(i, j, random.randint(0, 12)) for i in range(6) for j in range(24)]
c = (Bar3D().add("",[[d[1], d[0], d[2]] for d in data],xaxis3d_opts=opts.Axis3DOpts(Faker.clock, type_="category"),yaxis3d_opts=opts.Axis3DOpts(Faker.week_en, type_="category"),zaxis3d_opts=opts.Axis3DOpts(type_="value"),).set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=20),title_opts=opts.TitleOpts(title="3D-基本示例"),).render("bar3d_base.html")
)

(二)运行效果图:

在这里插入图片描述

Python代码:

import pyecharts.options as opts
from pyecharts.charts import Bar3Dhours = ["12a","1a","2a","3a","4a","5a","6a","7a","8a","9a","10a","11a","12p","1p","2p","3p","4p","5p","6p","7p","8p","9p","10p","11p",
]
days = ["Saturday", "Friday", "Thursday", "Wednesday", "Tuesday", "Monday", "Sunday"]data = [[0, 0, 5],[0, 1, 1],[0, 2, 0],[0, 3, 0],[0, 4, 0],[0, 5, 0],[0, 6, 0],[0, 7, 0],[0, 8, 0],[0, 9, 0],[0, 10, 0],[0, 11, 2],[0, 12, 4],[0, 13, 1],[0, 14, 1],[0, 15, 3],[0, 16, 4],[0, 17, 6],[0, 18, 4],[0, 19, 4],[0, 20, 3],[0, 21, 3],[0, 22, 2],[0, 23, 5],[1, 0, 7],[1, 1, 0],[1, 2, 0],[1, 3, 0],[1, 4, 0],[1, 5, 0],[1, 6, 0],[1, 7, 0],[1, 8, 0],[1, 9, 0],[1, 10, 5],[1, 11, 2],[1, 12, 2],[1, 13, 6],[1, 14, 9],[1, 15, 11],[1, 16, 6],[1, 17, 7],[1, 18, 8],[1, 19, 12],[1, 20, 5],[1, 21, 5],[1, 22, 7],[1, 23, 2],[2, 0, 1],[2, 1, 1],[2, 2, 0],[2, 3, 0],[2, 4, 0],[2, 5, 0],[2, 6, 0],[2, 7, 0],[2, 8, 0],[2, 9, 0],[2, 10, 3],[2, 11, 2],[2, 12, 1],[2, 13, 9],[2, 14, 8],[2, 15, 10],[2, 16, 6],[2, 17, 5],[2, 18, 5],[2, 19, 5],[2, 20, 7],[2, 21, 4],[2, 22, 2],[2, 23, 4],[3, 0, 7],[3, 1, 3],[3, 2, 0],[3, 3, 0],[3, 4, 0],[3, 5, 0],[3, 6, 0],[3, 7, 0],[3, 8, 1],[3, 9, 0],[3, 10, 5],[3, 11, 4],[3, 12, 7],[3, 13, 14],[3, 14, 13],[3, 15, 12],[3, 16, 9],[3, 17, 5],[3, 18, 5],[3, 19, 10],[3, 20, 6],[3, 21, 4],[3, 22, 4],[3, 23, 1],[4, 0, 1],[4, 1, 3],[4, 2, 0],[4, 3, 0],[4, 4, 0],[4, 5, 1],[4, 6, 0],[4, 7, 0],[4, 8, 0],[4, 9, 2],[4, 10, 4],[4, 11, 4],[4, 12, 2],[4, 13, 4],[4, 14, 4],[4, 15, 14],[4, 16, 12],[4, 17, 1],[4, 18, 8],[4, 19, 5],[4, 20, 3],[4, 21, 7],[4, 22, 3],[4, 23, 0],[5, 0, 2],[5, 1, 1],[5, 2, 0],[5, 3, 3],[5, 4, 0],[5, 5, 0],[5, 6, 0],[5, 7, 0],[5, 8, 2],[5, 9, 0],[5, 10, 4],[5, 11, 1],[5, 12, 5],[5, 13, 10],[5, 14, 5],[5, 15, 7],[5, 16, 11],[5, 17, 6],[5, 18, 0],[5, 19, 5],[5, 20, 3],[5, 21, 4],[5, 22, 2],[5, 23, 0],[6, 0, 1],[6, 1, 0],[6, 2, 0],[6, 3, 0],[6, 4, 0],[6, 5, 0],[6, 6, 0],[6, 7, 0],[6, 8, 0],[6, 9, 0],[6, 10, 1],[6, 11, 0],[6, 12, 2],[6, 13, 1],[6, 14, 3],[6, 15, 4],[6, 16, 0],[6, 17, 0],[6, 18, 0],[6, 19, 0],[6, 20, 1],[6, 21, 2],[6, 22, 2],[6, 23, 6],
]
data = [[d[1], d[0], d[2]] for d in data](Bar3D(init_opts=opts.InitOpts(width="1600px", height="800px")).add(series_name="",data=data,xaxis3d_opts=opts.Axis3DOpts(type_="category", data=hours),yaxis3d_opts=opts.Axis3DOpts(type_="category", data=days),zaxis3d_opts=opts.Axis3DOpts(type_="value"),).set_global_opts(visualmap_opts=opts.VisualMapOpts(max_=20,range_color=["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026",],)).render("bar3d_punch_card.html")
)

(三)运行效果图:

在这里插入图片描述

Python代码:

import randomfrom pyecharts import options as opts
from pyecharts.charts import Bar3Dx_data = y_data = list(range(10))def generate_data():data = []for j in range(10):for k in range(10):value = random.randint(0, 9)data.append([j, k, value * 2 + 4])return databar3d = Bar3D()
for _ in range(10):bar3d.add("",generate_data(),shading="lambert",xaxis3d_opts=opts.Axis3DOpts(data=x_data, type_="value"),yaxis3d_opts=opts.Axis3DOpts(data=y_data, type_="value"),zaxis3d_opts=opts.Axis3DOpts(type_="value"),)
bar3d.set_global_opts(title_opts=opts.TitleOpts("3D-堆叠柱状图示例"))
bar3d.set_series_opts(**{"stack": "stack"})
bar3d.render("bar3d_stack.html")
五:饼状图

(一)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Fakerv = Faker.choose()
c = (Pie().add("",[list(z) for z in zip(v, Faker.values())],radius=["30%", "75%"],center=["25%", "50%"],rosetype="radius",label_opts=opts.LabelOpts(is_show=False),).add("",[list(z) for z in zip(v, Faker.values())],radius=["30%", "75%"],center=["75%", "50%"],rosetype="area",).set_global_opts(title_opts=opts.TitleOpts(title="Pie-玫瑰图示例")).render("pie_rosetype.html")
)

(二)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Fakerc = (Pie().add("",[list(z) for z in zip(Faker.choose(), Faker.values())],radius=["40%", "55%"],label_opts=opts.LabelOpts(position="outside",formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c}  {per|{d}%}  ",background_color="#eee",border_color="#aaa",border_width=1,border_radius=4,rich={"a": {"color": "#999", "lineHeight": 22, "align": "center"},"abg": {"backgroundColor": "#e3e3e3","width": "100%","align": "right","height": 22,"borderRadius": [4, 4, 0, 0],},"hr": {"borderColor": "#aaa","width": "100%","borderWidth": 0.5,"height": 0,},"b": {"fontSize": 16, "lineHeight": 33},"per": {"color": "#eee","backgroundColor": "#334455","padding": [2, 4],"borderRadius": 2,},},),).set_global_opts(title_opts=opts.TitleOpts(title="Pie-富文本示例")).render("pie_rich_label.html")
)

(三)运行效果图:

在这里插入图片描述

Python代码:

import pyecharts.options as opts
from pyecharts.charts import Pieinner_x_data = ["直达", "营销广告", "搜索引擎"]
inner_y_data = [335, 679, 1548]
inner_data_pair = [list(z) for z in zip(inner_x_data, inner_y_data)]outer_x_data = ["直达", "营销广告", "搜索引擎", "邮件营销", "联盟广告", "视频广告", "百度", "谷歌", "必应", "其他"]
outer_y_data = [335, 310, 234, 135, 1048, 251, 147, 102]
outer_data_pair = [list(z) for z in zip(outer_x_data, outer_y_data)](Pie(init_opts=opts.InitOpts(width="1600px", height="800px")).add(series_name="访问来源",data_pair=inner_data_pair,radius=[0, "30%"],label_opts=opts.LabelOpts(position="inner"),).add(series_name="访问来源",radius=["40%", "55%"],data_pair=outer_data_pair,label_opts=opts.LabelOpts(position="outside",formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c}  {per|{d}%}  ",background_color="#eee",border_color="#aaa",border_width=1,border_radius=4,rich={"a": {"color": "#999", "lineHeight": 22, "align": "center"},"abg": {"backgroundColor": "#e3e3e3","width": "100%","align": "right","height": 22,"borderRadius": [4, 4, 0, 0],},"hr": {"borderColor": "#aaa","width": "100%","borderWidth": 0.5,"height": 0,},"b": {"fontSize": 16, "lineHeight": 33},"per": {"color": "#eee","backgroundColor": "#334455","padding": [2, 4],"borderRadius": 2,},},),).set_global_opts(legend_opts=opts.LegendOpts(pos_left="left", orient="vertical")).set_series_opts(tooltip_opts=opts.TooltipOpts(trigger="item", formatter="{a} <br/>{b}: {c} ({d}%)")).render("nested_pies.html")
)

(四)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.commons.utils import JsCodefn = """function(params) {if(params.name == '其他')return '\\n\\n\\n' + params.name + ' : ' + params.value + '%';return params.name + ' : ' + params.value + '%';}"""def new_label_opts():return opts.LabelOpts(formatter=JsCode(fn), position="center")c = (Pie().add("",[list(z) for z in zip(["剧情", "其他"], [25, 75])],center=["20%", "30%"],radius=[60, 80],label_opts=new_label_opts(),).add("",[list(z) for z in zip(["奇幻", "其他"], [24, 76])],center=["55%", "30%"],radius=[60, 80],label_opts=new_label_opts(),).add("",[list(z) for z in zip(["爱情", "其他"], [14, 86])],center=["20%", "70%"],radius=[60, 80],label_opts=new_label_opts(),).add("",[list(z) for z in zip(["惊悚", "其他"], [11, 89])],center=["55%", "70%"],radius=[60, 80],label_opts=new_label_opts(),).set_global_opts(title_opts=opts.TitleOpts(title="Pie-多饼图基本示例"),legend_opts=opts.LegendOpts(type_="scroll", pos_top="20%", pos_left="80%", orient="vertical"),).render("mutiple_pie.html")
)

(5)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Fakerc = (Pie().add("",[list(z) for z in zip(Faker.choose(), Faker.values())],radius=["40%", "75%"],).set_global_opts(title_opts=opts.TitleOpts(title="Pie-Radius"),legend_opts=opts.LegendOpts(orient="vertical", pos_top="15%", pos_left="2%"),).set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}")).render("pie_radius.html")
)
六:词云图

(一)运行效果图:

在这里插入图片描述

Python代码:

import pyecharts.options as opts
from pyecharts.charts import WordClouddata = [("生活资源", "999"),("供热管理", "888"),("供气质量", "777"),("生活用水管理", "688"),("一次供水问题", "588"),("交通运输", "516"),("城市交通", "515"),("环境保护", "483"),("房地产管理", "462"),("城乡建设", "449"),("社会保障与福利", "429"),("社会保障", "407"),("文体与教育管理", "406"),("公共安全", "406"),("公交运输管理", "386"),("出租车运营管理", "385"),("供热管理", "375"),("市容环卫", "355"),("自然资源管理", "355"),("粉尘污染", "335"),("噪声污染", "324"),("土地资源管理", "304"),("物业服务与管理", "304"),("医疗卫生", "284"),("粉煤灰污染", "284"),("占道", "284"),("供热发展", "254"),("农村土地规划管理", "254"),("生活噪音", "253"),("供热单位影响", "253"),("城市供电", "223"),("房屋质量与安全", "223"),("大气污染", "223"),("房屋安全", "223"),("文化活动", "223"),("拆迁管理", "223"),("公共设施", "223"),("供气质量", "223"),("供电管理", "223"),("燃气管理", "152"),("教育管理", "152"),("医疗纠纷", "152"),("执法监督", "152"),("设备安全", "152"),("政务建设", "152"),("县区、开发区", "152"),("宏观经济", "152"),("教育管理", "112"),("社会保障", "112"),("生活用水管理", "112"),("物业服务与管理", "112"),("分类列表", "112"),("农业生产", "112"),("二次供水问题", "112"),("城市公共设施", "92"),("拆迁政策咨询", "92"),("物业服务", "92"),("物业管理", "92"),("社会保障保险管理", "92"),("低保管理", "92"),("文娱市场管理", "72"),("城市交通秩序管理", "72"),("执法争议", "72"),("商业烟尘污染", "72"),("占道堆放", "71"),("地上设施", "71"),("水质", "71"),("无水", "71"),("供热单位影响", "71"),("人行道管理", "71"),("主网原因", "71"),("集中供热", "71"),("客运管理", "71"),("国有公交(大巴)管理", "71"),("工业粉尘污染", "71"),("治安案件", "71"),("压力容器安全", "71"),("身份证管理", "71"),("群众健身", "41"),("工业排放污染", "41"),("破坏森林资源", "41"),("市场收费", "41"),("生产资金", "41"),("生产噪声", "41"),("农村低保", "41"),("劳动争议", "41"),("劳动合同争议", "41"),("劳动报酬与福利", "41"),("医疗事故", "21"),("停供", "21"),("基础教育", "21"),("职业教育", "21"),("物业资质管理", "21"),("拆迁补偿", "21"),("设施维护", "21"),("市场外溢", "11"),("占道经营", "11"),("树木管理", "11"),("农村基础设施", "11"),("无水", "11"),("供气质量", "11"),("停气", "11"),("市政府工作部门(含部门管理机构、直属单位)", "11"),("燃气管理", "11"),("市容环卫", "11"),("新闻传媒", "11"),("人才招聘", "11"),("市场环境", "11"),("行政事业收费", "11"),("食品安全与卫生", "11"),("城市交通", "11"),("房地产开发", "11"),("房屋配套问题", "11"),("物业服务", "11"),("物业管理", "11"),("占道", "11"),("园林绿化", "11"),("户籍管理及身份证", "11"),("公交运输管理", "11"),("公路(水路)交通", "11"),("房屋与图纸不符", "11"),("有线电视", "11"),("社会治安", "11"),("林业资源", "11"),("其他行政事业收费", "11"),("经营性收费", "11"),("食品安全与卫生", "11"),("体育活动", "11"),("有线电视安装及调试维护", "11"),("低保管理", "11"),("劳动争议", "11"),("社会福利及事务", "11"),("一次供水问题", "11"),
](WordCloud().add(series_name="热点分析", data_pair=data, word_size_range=[6, 66]).set_global_opts(title_opts=opts.TitleOpts(title="热点分析", title_textstyle_opts=opts.TextStyleOpts(font_size=23)),tooltip_opts=opts.TooltipOpts(is_show=True),).render("basic_wordcloud.html")
)

(二)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import WordCloudwords = [("花鸟市场", 1446),("汽车", 928),("视频", 906),("电视", 825),("Lover Boy 88", 514),("动漫", 486),("音乐", 53),("直播", 163),("广播电台", 86),("戏曲曲艺", 17),("演出票务", 6),("给陌生的你听", 1),("资讯", 1437),("商业财经", 422),("娱乐八卦", 353),("军事", 331),("科技资讯", 313),("社会时政", 307),("时尚", 43),("网络奇闻", 15),("旅游出行", 438),("景点类型", 957),("国内游", 927),("远途出行方式", 908),("酒店", 693),("关注景点", 611),("旅游网站偏好", 512),("出国游", 382),("交通票务", 312),("旅游方式", 187),("旅游主题", 163),("港澳台", 104),("本地周边游", 3),("小卖家", 1331),("全日制学校", 941),("基础教育科目", 585),("考试培训", 473),("语言学习", 358),("留学", 246),("K12课程培训", 207),("艺术培训", 194),("技能培训", 104),("IT培训", 87),("高等教育专业", 63),("家教", 48),("体育培训", 23),("职场培训", 5),("金融财经", 1328),("银行", 765),("股票", 452),("保险", 415),("贷款", 253),("基金", 211),("信用卡", 180),("外汇", 138),("P2P", 116),("贵金属", 98),("债券", 93),("网络理财", 92),("信托", 90),("征信", 76),("期货", 76),("公积金", 40),("银行理财", 36),("银行业务", 30),("典当", 7),("海外置业", 1),("汽车", 1309),("汽车档次", 965),("汽车品牌", 900),("汽车车型", 727),("购车阶段", 461),("二手车", 309),("汽车美容", 260),("新能源汽车", 173),("汽车维修", 155),("租车服务", 136),("车展", 121),("违章查询", 76),("汽车改装", 62),("汽车用品", 37),("路况查询", 32),("汽车保险", 28),("陪驾代驾", 4),("网络购物", 1275),("做我的猫", 1088),("只想要你知道", 907),("团购", 837),("比价", 201),("海淘", 195),("移动APP购物", 179),("支付方式", 119),("代购", 43),("体育健身", 1234),("体育赛事项目", 802),("运动项目", 405),("体育类赛事", 337),("健身项目", 199),("健身房健身", 78),("运动健身", 77),("家庭健身", 36),("健身器械", 29),("办公室健身", 3),("商务服务", 1201),("法律咨询", 508),("化工材料", 147),("广告服务", 125),("会计审计", 115),("人员招聘", 101),("印刷打印", 66),("知识产权", 32),("翻译", 22),("安全安保", 9),("公关服务", 8),("商旅服务", 2),("展会服务", 2),("特许经营", 1),("休闲爱好", 1169),("收藏", 412),("摄影", 393),("温泉", 230),("博彩彩票", 211),("美术", 207),("书法", 139),("DIY手工", 75),("舞蹈", 23),("钓鱼", 21),("棋牌桌游", 17),("KTV", 6),("密室", 5),("采摘", 4),("电玩", 1),("真人CS", 1),("轰趴", 1),("家电数码", 1111),("手机", 885),("电脑", 543),("大家电", 321),("家电关注品牌", 253),("网络设备", 162),("摄影器材", 149),("影音设备", 133),("办公数码设备", 113),("生活电器", 67),("厨房电器", 54),("智能设备", 45),("个人护理电器", 22),("服饰鞋包", 1047),("服装", 566),("饰品", 289),("鞋", 184),("箱包", 168),("奢侈品", 137),("母婴亲子", 1041),("孕婴保健", 505),("母婴社区", 299),("早教", 103),("奶粉辅食", 66),("童车童床", 41),("关注品牌", 271),("宝宝玩乐", 30),("母婴护理服务", 25),("纸尿裤湿巾", 16),("妈妈用品", 15),("宝宝起名", 12),("童装童鞋", 9),("胎教", 8),("宝宝安全", 1),("宝宝洗护用品", 1),("软件应用", 1018),("系统工具", 896),("理财购物", 440),("生活实用", 365),("影音图像", 256),("社交通讯", 214),("手机美化", 39),("办公学习", 28),("应用市场", 23),("母婴育儿", 14),("游戏", 946),("手机游戏", 565),("PC游戏", 353),("网页游戏", 254),("游戏机", 188),("模拟辅助", 166),("个护美容", 942),("护肤品", 177),("彩妆", 133),("美发", 80),("香水", 50),("个人护理", 46),("美甲", 26),("SPA美体", 21),("花鸟萌宠", 914),("绿植花卉", 311),("狗", 257),("其他宠物", 131),("水族", 125),("猫", 122),("动物", 81),("鸟", 67),("宠物用品", 41),("宠物服务", 26),("书籍阅读", 913),("网络小说", 483),("关注书籍", 128),("文学", 105),("报刊杂志", 77),("人文社科", 22),("建材家居", 907),("装修建材", 644),("家具", 273),("家居风格", 187),("家居家装关注品牌", 140),("家纺", 107),("厨具", 47),("灯具", 43),("家居饰品", 29),("家居日常用品", 10),("生活服务", 883),("物流配送", 536),("家政服务", 108),("摄影服务", 49),("搬家服务", 38),("物业维修", 37),("婚庆服务", 24),("二手回收", 24),("鲜花配送", 3),("维修服务", 3),("殡葬服务", 1),("求职创业", 874),("创业", 363),("目标职位", 162),("目标行业", 50),("兼职", 21),("期望年薪", 20),("实习", 16),("雇主类型", 10),("星座运势", 789),("星座", 316),("算命", 303),("解梦", 196),("风水", 93),("面相分析", 47),("手相", 32),("公益", 90),
]c = (WordCloud().add("",words,word_size_range=[20, 100],textstyle_opts=opts.TextStyleOpts(font_family="cursive"),).set_global_opts(title_opts=opts.TitleOpts(title="自定义文字样式")).render("wordcloud_custom_font_style.html")
)

(三)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import WordCloud
from pyecharts.globals import SymbolTypewords = [("Sam S Club", 10000),("Macys", 6181),("Amy Schumer", 4386),("Jurassic World", 4055),("Charter Communications", 2467),("Chick Fil A", 2244),("Planet Fitness", 1868),("Pitch Perfect", 1484),("Express", 1112),("Home", 865),("Johnny Depp", 847),("Lena Dunham", 582),("Lewis Hamilton", 555),("KXAN", 550),("Mary Ellen Mark", 462),("Farrah Abraham", 366),("Rita Ora", 360),("Serena Williams", 282),("NCAA baseball tournament", 273),("Point Break", 265),
]
c = (WordCloud().add("", words, word_size_range=[20, 100], shape=SymbolType.DIAMOND).set_global_opts(title_opts=opts.TitleOpts(title="WordCloud-shape-diamond")).render("wordcloud_diamond.html")
)
七:雷达图

(一)运行效果图:

在这里插入图片描述

Python代码:

import pyecharts.options as opts
from pyecharts.charts import Radarv1 = [[4300, 10000, 28000, 35000, 50000, 19000]]
v2 = [[5000, 14000, 28000, 31000, 42000, 21000]](Radar(init_opts=opts.InitOpts(width="1280px", height="720px", bg_color="#CCCCCC")).add_schema(schema=[opts.RadarIndicatorItem(name="销售(sales)", max_=6500),opts.RadarIndicatorItem(name="管理(Administration)", max_=16000),opts.RadarIndicatorItem(name="信息技术(Information Technology)", max_=30000),opts.RadarIndicatorItem(name="客服(Customer Support)", max_=38000),opts.RadarIndicatorItem(name="研发(Development)", max_=52000),opts.RadarIndicatorItem(name="市场(Marketing)", max_=25000),],splitarea_opt=opts.SplitAreaOpts(is_show=True, areastyle_opts=opts.AreaStyleOpts(opacity=1)),textstyle_opts=opts.TextStyleOpts(color="#fff"),).add(series_name="预算分配(Allocated Budget)",data=v1,linestyle_opts=opts.LineStyleOpts(color="#CD0000"),).add(series_name="实际开销(Actual Spending)",data=v2,linestyle_opts=opts.LineStyleOpts(color="#5CACEE"),).set_series_opts(label_opts=opts.LabelOpts(is_show=False)).set_global_opts(title_opts=opts.TitleOpts(title="基础雷达图"), legend_opts=opts.LegendOpts()).render("basic_radar_chart.html")
)

(二)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Radardata = [{"value": [4, -4, 2, 3, 0, 1], "name": "预算分配"}]
c_schema = [{"name": "销售", "max": 4, "min": -4},{"name": "管理", "max": 4, "min": -4},{"name": "技术", "max": 4, "min": -4},{"name": "客服", "max": 4, "min": -4},{"name": "研发", "max": 4, "min": -4},{"name": "市场", "max": 4, "min": -4},
]
c = (Radar().set_colors(["#4587E7"]).add_schema(schema=c_schema,shape="circle",center=["50%", "50%"],radius="80%",angleaxis_opts=opts.AngleAxisOpts(min_=0,max_=360,is_clockwise=False,interval=5,axistick_opts=opts.AxisTickOpts(is_show=False),axislabel_opts=opts.LabelOpts(is_show=False),axisline_opts=opts.AxisLineOpts(is_show=False),splitline_opts=opts.SplitLineOpts(is_show=False),),radiusaxis_opts=opts.RadiusAxisOpts(min_=-4,max_=4,interval=2,splitarea_opts=opts.SplitAreaOpts(is_show=True, areastyle_opts=opts.AreaStyleOpts(opacity=1)),),polar_opts=opts.PolarOpts(),splitarea_opt=opts.SplitAreaOpts(is_show=False),splitline_opt=opts.SplitLineOpts(is_show=False),).add(series_name="预算",data=data,areastyle_opts=opts.AreaStyleOpts(opacity=0.1),linestyle_opts=opts.LineStyleOpts(width=1),).render("radar_angle_radius_axis.html")
)
八:漏斗图

(一)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Funnel
from pyecharts.faker import Fakerc = (Funnel().add("漏斗图",[list(z) for z in zip(Faker.choose(), Faker.values())],label_opts=opts.LabelOpts(position="inside"),).set_global_opts(title_opts=opts.TitleOpts(title="Funnel-Label(inside)")).render("funnel_label_inside.html")
)

(一)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Funnel
from pyecharts.faker import Fakerc = (Funnel().add("漏斗图",[list(z) for z in zip(Faker.choose(), Faker.values())],sort_="ascending",label_opts=opts.LabelOpts(position="inside"),).set_global_opts(title_opts=opts.TitleOpts(title="Funnel-Sort(ascending)")).render("funnel_sort_ascending.html")
)
九:地理坐标图

(一)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Geo
from pyecharts.globals import ChartType, SymbolTypec = (Geo().add_schema(maptype="china",itemstyle_opts=opts.ItemStyleOpts(color="#323c48", border_color="#111"),).add("",[("广州", 55), ("北京", 66), ("杭州", 77), ("重庆", 88)],type_=ChartType.EFFECT_SCATTER,color="white",).add("geo",[("广州", "上海"), ("广州", "北京"), ("广州", "杭州"), ("广州", "重庆")],type_=ChartType.LINES,effect_opts=opts.EffectOpts(symbol=SymbolType.ARROW, symbol_size=6, color="blue"),linestyle_opts=opts.LineStyleOpts(curve=0.2),).set_series_opts(label_opts=opts.LabelOpts(is_show=False)).set_global_opts(title_opts=opts.TitleOpts(title="")).render("地理坐标图(4).html")
)

(二)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.faker import Fakerc = (Map().add("世界地图", [list(z) for z in zip(Faker.country, Faker.values())], "world").set_series_opts(label_opts=opts.LabelOpts(is_show=False)).set_global_opts(title_opts=opts.TitleOpts(title="世界地图(平面)"),visualmap_opts=opts.VisualMapOpts(max_=200),).render("世界地图(平面).html")
)
十:K线图烛台

(一)运行效果图:

在这里插入图片描述

Python代码:

from pyecharts import options as opts
from pyecharts.charts import Klinedata = [[2320.26, 2320.26, 2287.3, 2362.94],[2300, 2291.3, 2288.26, 2308.38],[2295.35, 2346.5, 2295.35, 2345.92],[2347.22, 2358.98, 2337.35, 2363.8],[2360.75, 2382.48, 2347.89, 2383.76],[2383.43, 2385.42, 2371.23, 2391.82],[2377.41, 2419.02, 2369.57, 2421.15],[2425.92, 2428.15, 2417.58, 2440.38],[2411, 2433.13, 2403.3, 2437.42],[2432.68, 2334.48, 2427.7, 2441.73],[2430.69, 2418.53, 2394.22, 2433.89],[2416.62, 2432.4, 2414.4, 2443.03],[2441.91, 2421.56, 2418.43, 2444.8],[2420.26, 2382.91, 2373.53, 2427.07],[2383.49, 2397.18, 2370.61, 2397.94],[2378.82, 2325.95, 2309.17, 2378.82],[2322.94, 2314.16, 2308.76, 2330.88],[2320.62, 2325.82, 2315.01, 2338.78],[2313.74, 2293.34, 2289.89, 2340.71],[2297.77, 2313.22, 2292.03, 2324.63],[2322.32, 2365.59, 2308.92, 2366.16],[2364.54, 2359.51, 2330.86, 2369.65],[2332.08, 2273.4, 2259.25, 2333.54],[2274.81, 2326.31, 2270.1, 2328.14],[2333.61, 2347.18, 2321.6, 2351.44],[2340.44, 2324.29, 2304.27, 2352.02],[2326.42, 2318.61, 2314.59, 2333.67],[2314.68, 2310.59, 2296.58, 2320.96],[2309.16, 2286.6, 2264.83, 2333.29],[2282.17, 2263.97, 2253.25, 2286.33],[2255.77, 2270.28, 2253.31, 2276.22],
]c = (Kline().add_xaxis(["2017/7/{}".format(i + 1) for i in range(31)]).add_yaxis("kline",data,markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_="max", value_dim="close")]),).set_global_opts(xaxis_opts=opts.AxisOpts(is_scale=True),yaxis_opts=opts.AxisOpts(is_scale=True,splitarea_opts=opts.SplitAreaOpts(is_show=True, areastyle_opts=opts.AreaStyleOpts(opacity=1)),),title_opts=opts.TitleOpts(title=""),).render("K线图烛台(7).html")
)

(二)运行效果图:

在这里插入图片描述

Python代码:

from typing import List, Sequence, Union
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
from pyecharts.charts import Kline, Line, Bar, Grid# 数据
echarts_data = [["2015-10-16", 18.4, 18.58, 18.33, 18.79, 67.00, 1, 0.04, 0.11, 0.09],["2015-10-19", 18.56, 18.25, 18.19, 18.56, 55.00, 0, -0.00, 0.08, 0.09],["2015-10-20", 18.3, 18.22, 18.05, 18.41, 37.00, 0, 0.01, 0.09, 0.09],["2015-10-21", 18.18, 18.69, 18.02, 18.98, 89.00, 0, 0.03, 0.10, 0.08],["2015-10-22", 18.42, 18.29, 18.22, 18.48, 43.00, 0, -0.06, 0.05, 0.08],["2015-10-23", 18.26, 18.19, 18.08, 18.36, 46.00, 0, -0.10, 0.03, 0.09],["2015-10-26", 18.33, 18.07, 17.98, 18.35, 65.00, 0, -0.15, 0.03, 0.10],["2015-10-27", 18.08, 18.04, 17.88, 18.13, 37.00, 0, -0.19, 0.03, 0.12],["2015-10-28", 17.96, 17.86, 17.82, 17.99, 35.00, 0, -0.24, 0.03, 0.15],["2015-10-29", 17.85, 17.81, 17.8, 17.93, 27.00, 0, -0.24, 0.06, 0.18],["2015-10-30", 17.79, 17.93, 17.78, 18.08, 43.00, 0, -0.22, 0.11, 0.22],["2015-11-02", 17.78, 17.83, 17.78, 18.04, 27.00, 0, -0.20, 0.15, 0.25],["2015-11-03", 17.84, 17.9, 17.84, 18.06, 34.00, 0, -0.12, 0.22, 0.28],["2015-11-04", 17.97, 18.36, 17.85, 18.39, 62.00, 0, -0.00, 0.30, 0.30],["2015-11-05", 18.3, 18.57, 18.18, 19.08, 177.00, 0, 0.07, 0.33, 0.30],["2015-11-06", 18.53, 18.68, 18.3, 18.71, 95.00, 0, 0.12, 0.35, 0.29],["2015-11-09", 18.75, 19.08, 18.75, 19.98, 202.00, 1, 0.16, 0.35, 0.27],["2015-11-10", 18.85, 18.64, 18.56, 18.99, 85.00, 0, 0.09, 0.29, 0.25],["2015-11-11", 18.64, 18.44, 18.31, 18.64, 50.00, 0, 0.06, 0.27, 0.23],["2015-11-12", 18.55, 18.27, 18.17, 18.57, 43.00, 0, 0.05, 0.25, 0.23],["2015-11-13", 18.13, 18.14, 18.09, 18.34, 35.00, 0, 0.05, 0.24, 0.22],["2015-11-16", 18.01, 18.1, 17.93, 18.17, 34.00, 0, 0.07, 0.25, 0.21],["2015-11-17", 18.2, 18.14, 18.08, 18.45, 58.00, 0, 0.11, 0.25, 0.20],["2015-11-18", 18.23, 18.16, 18.0, 18.45, 47.00, 0, 0.13, 0.25, 0.19],["2015-11-19", 18.08, 18.2, 18.05, 18.25, 32.00, 0, 0.15, 0.24, 0.17],["2015-11-20", 18.15, 18.15, 18.11, 18.29, 36.00, 0, 0.13, 0.21, 0.15],["2015-11-23", 18.16, 18.19, 18.12, 18.34, 47.00, 0, 0.11, 0.18, 0.13],["2015-11-24", 18.23, 17.88, 17.7, 18.23, 62.00, 0, 0.03, 0.13, 0.11],["2015-11-25", 17.85, 17.73, 17.56, 17.85, 66.00, 0, -0.03, 0.09, 0.11],["2015-11-26", 17.79, 17.53, 17.5, 17.92, 63.00, 0, -0.10, 0.06, 0.11],["2015-11-27", 17.51, 17.04, 16.9, 17.51, 67.00, 0, -0.16, 0.05, 0.13],["2015-11-30", 17.07, 17.2, 16.98, 17.32, 55.00, 0, -0.12, 0.09, 0.15],["2015-12-01", 17.28, 17.11, 16.91, 17.28, 39.00, 0, -0.09, 0.12, 0.16],["2015-12-02", 17.13, 17.91, 17.05, 17.99, 102.00, 0, -0.01, 0.17, 0.18],["2015-12-03", 17.8, 17.78, 17.61, 17.98, 71.00, 0, -0.09, 0.14, 0.18],["2015-12-04", 17.6, 17.25, 17.13, 17.69, 51.00, 0, -0.18, 0.10, 0.19],["2015-12-07", 17.2, 17.39, 17.15, 17.45, 43.00, 0, -0.19, 0.12, 0.22],["2015-12-08", 17.3, 17.42, 17.18, 17.62, 45.00, 0, -0.23, 0.13, 0.24],["2015-12-09", 17.33, 17.39, 17.32, 17.59, 44.00, 0, -0.29, 0.13, 0.28],["2015-12-10", 17.39, 17.26, 17.21, 17.65, 44.00, 0, -0.37, 0.13, 0.32],["2015-12-11", 17.23, 16.92, 16.66, 17.26, 114.00, 1, -0.44, 0.15, 0.37],["2015-12-14", 16.75, 17.06, 16.5, 17.09, 94.00, 0, -0.44, 0.21, 0.44],["2015-12-15", 17.03, 17.03, 16.9, 17.06, 46.00, 0, -0.44, 0.28, 0.50],["2015-12-16", 17.08, 16.96, 16.87, 17.09, 30.00, 0, -0.40, 0.36, 0.56],["2015-12-17", 17.0, 17.1, 16.95, 17.12, 50.00, 0, -0.30, 0.47, 0.62],["2015-12-18", 17.09, 17.52, 17.04, 18.06, 156.00, 0, -0.14, 0.59, 0.66],["2015-12-21", 17.43, 18.23, 17.35, 18.45, 152.00, 1, 0.02, 0.69, 0.68],["2015-12-22", 18.14, 18.27, 18.06, 18.32, 94.00, 0, 0.08, 0.72, 0.68],["2015-12-23", 18.28, 18.19, 18.17, 18.71, 108.00, 0, 0.13, 0.73, 0.67],["2015-12-24", 18.18, 18.14, 18.01, 18.31, 37.00, 0, 0.19, 0.74, 0.65],["2015-12-25", 18.22, 18.33, 18.2, 18.36, 48.00, 0, 0.26, 0.75, 0.62],["2015-12-28", 18.35, 17.84, 17.8, 18.39, 48.00, 0, 0.27, 0.72, 0.59],["2015-12-29", 17.83, 17.94, 17.71, 17.97, 36.00, 0, 0.36, 0.73, 0.55],["2015-12-30", 17.9, 18.26, 17.55, 18.3, 71.00, 1, 0.43, 0.71, 0.50],["2015-12-31", 18.12, 17.99, 17.91, 18.33, 72.00, 0, 0.40, 0.63, 0.43],["2016-01-04", 17.91, 17.28, 17.16, 17.95, 37.00, 1, 0.34, 0.55, 0.38],["2016-01-05", 17.17, 17.23, 17.0, 17.55, 51.00, 0, 0.37, 0.51, 0.33],["2016-01-06", 17.2, 17.31, 17.06, 17.33, 31.00, 0, 0.37, 0.46, 0.28],["2016-01-07", 17.15, 16.67, 16.51, 17.15, 19.00, 0, 0.30, 0.37, 0.22],["2016-01-08", 16.8, 16.81, 16.61, 17.06, 60.00, 0, 0.29, 0.32, 0.18],["2016-01-11", 16.68, 16.04, 16.0, 16.68, 65.00, 0, 0.20, 0.24, 0.14],["2016-01-12", 16.03, 15.98, 15.88, 16.25, 46.00, 0, 0.20, 0.21, 0.11],["2016-01-13", 16.21, 15.87, 15.78, 16.21, 57.00, 0, 0.20, 0.18, 0.08],["2016-01-14", 15.55, 15.89, 15.52, 15.96, 42.00, 0, 0.20, 0.16, 0.05],["2016-01-15", 15.87, 15.48, 15.45, 15.92, 34.00, 1, 0.17, 0.11, 0.02],["2016-01-18", 15.39, 15.42, 15.36, 15.7, 26.00, 0, 0.21, 0.10, -0.00],["2016-01-19", 15.58, 15.71, 15.35, 15.77, 38.00, 0, 0.25, 0.09, -0.03],["2016-01-20", 15.56, 15.52, 15.24, 15.68, 38.00, 0, 0.23, 0.05, -0.07],["2016-01-21", 15.41, 15.3, 15.28, 15.68, 35.00, 0, 0.21, 0.00, -0.10],["2016-01-22", 15.48, 15.28, 15.13, 15.49, 30.00, 0, 0.21, -0.02, -0.13],["2016-01-25", 15.29, 15.48, 15.2, 15.49, 21.00, 0, 0.20, -0.06, -0.16],["2016-01-26", 15.33, 14.86, 14.78, 15.39, 30.00, 0, 0.12, -0.13, -0.19],["2016-01-27", 14.96, 15.0, 14.84, 15.22, 51.00, 0, 0.13, -0.14, -0.20],["2016-01-28", 14.96, 14.72, 14.62, 15.06, 25.00, 0, 0.10, -0.17, -0.22],["2016-01-29", 14.75, 14.99, 14.62, 15.08, 36.00, 0, 0.13, -0.17, -0.24],["2016-02-01", 14.98, 14.72, 14.48, 15.18, 27.00, 0, 0.10, -0.21, -0.26],["2016-02-02", 14.65, 14.85, 14.65, 14.95, 18.00, 0, 0.11, -0.21, -0.27],["2016-02-03", 14.72, 14.67, 14.55, 14.8, 23.00, 0, 0.10, -0.24, -0.29],["2016-02-04", 14.79, 14.88, 14.69, 14.93, 22.00, 0, 0.13, -0.24, -0.30],["2016-02-05", 14.9, 14.86, 14.78, 14.93, 16.00, 0, 0.12, -0.26, -0.32],["2016-02-15", 14.5, 14.66, 14.47, 14.82, 19.00, 0, 0.11, -0.28, -0.34],["2016-02-16", 14.77, 14.94, 14.72, 15.05, 26.00, 0, 0.14, -0.28, -0.35],["2016-02-17", 14.95, 15.03, 14.88, 15.07, 38.00, 0, 0.12, -0.31, -0.37],["2016-02-18", 14.95, 14.9, 14.87, 15.06, 28.00, 0, 0.07, -0.35, -0.39],["2016-02-19", 14.9, 14.75, 14.68, 14.94, 22.00, 0, 0.03, -0.38, -0.40],["2016-02-22", 14.88, 15.01, 14.79, 15.11, 38.00, 1, 0.01, -0.40, -0.40],["2016-02-23", 15.01, 14.83, 14.72, 15.01, 24.00, 0, -0.09, -0.45, -0.40],["2016-02-24", 14.75, 14.81, 14.67, 14.87, 21.00, 0, -0.17, -0.48, -0.39],["2016-02-25", 14.81, 14.25, 14.21, 14.81, 51.00, 1, -0.27, -0.50, -0.37],["2016-02-26", 14.35, 14.45, 14.28, 14.57, 28.00, 0, -0.26, -0.46, -0.33],["2016-02-29", 14.43, 14.56, 14.04, 14.6, 48.00, 0, -0.25, -0.41, -0.29],["2016-03-01", 14.56, 14.65, 14.36, 14.78, 32.00, 0, -0.21, -0.36, -0.25],["2016-03-02", 14.79, 14.96, 14.72, 14.97, 60.00, 0, -0.13, -0.29, -0.22],["2016-03-03", 14.95, 15.15, 14.91, 15.19, 53.00, 1, -0.05, -0.23, -0.21],["2016-03-04", 15.14, 15.97, 15.02, 16.02, 164.00, 1, 0.06, -0.17, -0.20],["2016-03-07", 15.9, 15.78, 15.65, 16.0, 41.00, 0, 0.04, -0.19, -0.21],["2016-03-08", 15.78, 15.96, 15.21, 15.99, 45.00, 0, 0.05, -0.19, -0.21],["2016-03-09", 15.73, 16.05, 15.41, 16.08, 74.00, 0, 0.03, -0.20, -0.22],["2016-03-10", 15.82, 15.66, 15.65, 15.98, 19.00, 0, -0.02, -0.23, -0.22],["2016-03-11", 15.59, 15.76, 15.42, 15.78, 32.00, 0, 0.01, -0.22, -0.22],["2016-03-14", 15.78, 15.72, 15.65, 16.04, 31.00, 0, 0.03, -0.20, -0.22],["2016-03-15", 15.81, 15.86, 15.6, 15.99, 35.00, 0, 0.10, -0.18, -0.23],["2016-03-16", 15.88, 16.42, 15.79, 16.45, 123.00, 0, 0.17, -0.16, -0.24],["2016-03-17", 16.39, 16.23, 16.11, 16.4, 46.00, 0, 0.14, -0.20, -0.26],["2016-03-18", 16.39, 16.17, 16.04, 16.4, 59.00, 0, 0.13, -0.22, -0.28],["2016-03-21", 16.21, 16.22, 16.11, 16.44, 50.00, 0, 0.12, -0.24, -0.30],["2016-03-22", 16.27, 16.19, 16.16, 16.42, 33.00, 0, 0.10, -0.27, -0.32],["2016-03-23", 16.26, 16.18, 16.18, 16.29, 19.00, 0, 0.08, -0.30, -0.33],["2016-03-24", 16.18, 16.11, 16.01, 16.23, 23.00, 0, 0.04, -0.33, -0.35],["2016-03-25", 16.12, 16.13, 16.1, 16.2, 15.00, 0, 0.00, -0.35, -0.35],["2016-03-28", 16.15, 15.85, 15.81, 16.2, 22.00, 0, -0.06, -0.38, -0.35],["2016-03-29", 15.9, 15.79, 15.76, 16.05, 19.00, 0, -0.06, -0.37, -0.34],["2016-03-30", 15.79, 16.24, 15.78, 16.3, 29.00, 0, -0.03, -0.35, -0.33],["2016-03-31", 16.3, 16.09, 16.02, 16.35, 25.00, 0, -0.07, -0.37, -0.33],["2016-04-01", 16.18, 16.27, 15.98, 16.3, 38.00, 0, -0.08, -0.36, -0.32],["2016-04-05", 16.13, 16.34, 16.07, 16.37, 39.00, 0, -0.13, -0.37, -0.31],["2016-04-06", 16.21, 16.26, 16.19, 16.35, 30.00, 0, -0.20, -0.39, -0.29],["2016-04-07", 16.32, 16.1, 16.05, 16.35, 29.00, 1, -0.26, -0.39, -0.26],["2016-04-08", 16.0, 16.16, 15.98, 16.21, 22.00, 0, -0.28, -0.37, -0.23],["2016-04-11", 16.16, 16.31, 16.15, 16.57, 31.00, 0, -0.30, -0.33, -0.19],["2016-04-12", 16.41, 16.29, 16.12, 16.41, 17.00, 0, -0.31, -0.30, -0.14],["2016-04-13", 16.39, 16.48, 16.0, 16.68, 40.00, 0, -0.30, -0.25, -0.10],["2016-04-14", 16.5, 16.46, 16.37, 16.68, 22.00, 0, -0.27, -0.19, -0.06],["2016-04-15", 16.56, 16.93, 16.46, 17.04, 58.00, 0, -0.20, -0.12, -0.02],["2016-04-18", 16.76, 17.06, 16.72, 17.27, 50.00, 0, -0.16, -0.07, 0.01],["2016-04-19", 17.21, 17.11, 17.02, 17.23, 30.00, 0, -0.12, -0.02, 0.03],["2016-04-20", 17.11, 17.33, 16.8, 17.36, 78.00, 0, -0.04, 0.03, 0.05],["2016-04-21", 17.27, 17.69, 17.17, 17.93, 79.00, 0, 0.05, 0.08, 0.06],["2016-04-22", 17.6, 17.87, 17.56, 18.02, 55.00, 0, 0.09, 0.10, 0.05],["2016-04-25", 17.75, 17.9, 17.41, 17.96, 39.00, 1, 0.11, 0.09, 0.04],["2016-04-26", 17.81, 17.91, 17.6, 17.95, 39.00, 0, 0.12, 0.08, 0.02],["2016-04-27", 17.9, 17.88, 17.81, 17.95, 25.00, 0, 0.12, 0.06, 0.00],["2016-04-28", 17.93, 17.88, 17.67, 17.93, 28.00, 0, 0.11, 0.04, -0.01],["2016-04-29", 17.87, 17.75, 17.73, 17.92, 19.00, 0, 0.08, 0.01, -0.03],["2016-05-03", 17.79, 17.7, 17.56, 17.85, 35.00, 0, 0.05, -0.01, -0.04],["2016-05-04", 17.7, 17.65, 17.59, 17.71, 24.00, 0, 0.02, -0.04, -0.05],["2016-05-05", 17.65, 17.62, 17.46, 17.7, 20.00, 0, -0.03, -0.06, -0.05],["2016-05-06", 17.62, 17.32, 17.3, 17.65, 29.00, 0, -0.10, -0.09, -0.05],["2016-05-09", 17.33, 17.3, 17.21, 17.45, 23.00, 0, -0.13, -0.10, -0.03],["2016-05-10", 17.11, 17.04, 16.98, 17.41, 28.00, 0, -0.15, -0.09, -0.01],["2016-05-11", 17.06, 17.15, 17.06, 17.32, 20.00, 0, -0.12, -0.05, 0.01],["2016-05-12", 17.02, 17.46, 17.02, 17.58, 26.00, 0, -0.07, -0.01, 0.03],["2016-05-13", 17.41, 17.57, 17.34, 17.62, 23.00, 0, -0.06, 0.01, 0.03],["2016-05-16", 17.55, 17.5, 17.48, 17.64, 37.00, 0, -0.06, 0.01, 0.04],["2016-05-17", 17.49, 17.48, 17.39, 17.53, 13.00, 0, -0.03, 0.03, 0.05],["2016-05-18", 17.41, 17.82, 17.39, 17.87, 46.00, 0, 0.01, 0.06, 0.06],["2016-05-19", 17.74, 17.81, 17.67, 17.86, 17.00, 0, -0.01, 0.05, 0.05],["2016-05-20", 17.76, 17.88, 17.7, 17.93, 14.00, 0, -0.03, 0.04, 0.06],["2016-05-23", 17.88, 17.52, 17.48, 17.97, 16.00, 0, -0.09, 0.02, 0.06],["2016-05-24", 17.51, 17.33, 17.32, 17.51, 8.00, 0, -0.09, 0.03, 0.07],["2016-05-25", 17.59, 17.55, 17.44, 17.59, 10.00, 0, -0.03, 0.07, 0.08],["2016-05-26", 17.5, 17.69, 17.5, 17.8, 12.00, 0, 0.00, 0.09, 0.09],["2016-05-27", 17.77, 17.66, 17.62, 17.77, 7.00, 0, 0.03, 0.10, 0.09],["2016-05-30", 17.75, 17.84, 17.62, 17.87, 20.00, 0, 0.08, 0.12, 0.08],["2016-05-31", 17.88, 18.0, 17.81, 18.03, 41.00, 0, 0.10, 0.12, 0.07],["2016-06-01", 18.09, 17.83, 17.73, 18.09, 22.00, 0, 0.08, 0.10, 0.06],["2016-06-02", 17.82, 17.73, 17.66, 17.88, 10.00, 0, 0.07, 0.08, 0.05],["2016-06-03", 17.8, 17.78, 17.71, 17.83, 9.00, 0, 0.08, 0.08, 0.04],["2016-06-06", 17.73, 17.64, 17.56, 17.83, 12.00, 0, 0.07, 0.06, 0.03],["2016-06-07", 17.76, 17.8, 17.59, 17.87, 11.00, 0, 0.08, 0.06, 0.02],["2016-06-08", 17.75, 17.77, 17.65, 17.84, 9.00, 0, 0.04, 0.03, 0.01],["2016-06-13", 17.58, 17.32, 17.29, 17.79, 16.00, 0, -0.02, -0.01, 0.00],["2016-06-14", 17.33, 17.38, 17.29, 17.5, 10.00, 0, -0.01, 0.00, 0.00],["2016-06-15", 17.25, 17.39, 17.25, 17.46, 18.00, 0, 0.00, 0.01, 0.00],["2016-06-16", 17.26, 17.4, 17.26, 17.46, 22.00, 0, 0.01, 0.01, 0.00],["2016-06-17", 17.38, 17.5, 17.37, 17.67, 13.00, 0, 0.03, 0.02, 0.00],["2016-06-20", 17.62, 17.51, 17.42, 17.63, 15.00, 0, 0.03, 0.01, -0.00],["2016-06-21", 17.53, 17.54, 17.5, 17.7, 11.00, 0, 0.02, 0.00, -0.01],["2016-06-22", 17.5, 17.5, 17.46, 17.6, 10.00, 0, -0.01, -0.01, -0.01],["2016-06-23", 17.52, 17.26, 17.24, 17.53, 16.00, 0, -0.04, -0.03, -0.01],["2016-06-24", 17.26, 17.25, 17.18, 17.38, 60.00, 0, -0.03, -0.02, -0.00],["2016-06-27", 17.25, 17.28, 17.18, 17.33, 19.00, 0, -0.01, -0.00, 0.00],["2016-06-28", 17.25, 17.29, 17.21, 17.32, 13.00, 0, 0.02, 0.01, 0.00],["2016-06-29", 17.31, 17.45, 17.27, 17.49, 21.00, 0, 0.07, 0.04, 0.00],["2016-06-30", 17.47, 17.5, 17.39, 17.55, 17.00, 0, 0.11, 0.04, -0.01],["2016-07-01", 17.5, 17.63, 17.49, 17.66, 10.00, 0, 0.14, 0.05, -0.03],["2016-07-04", 17.63, 17.72, 17.63, 17.92, 17.00, 0, 0.16, 0.03, -0.05],["2016-07-05", 17.79, 17.56, 17.45, 17.79, 18.00, 0, 0.14, 0.00, -0.07],["2016-07-06", 17.53, 17.42, 17.31, 17.54, 20.00, 0, 0.14, -0.02, -0.09],["2016-07-07", 17.41, 17.51, 17.35, 17.52, 15.00, 0, 0.16, -0.03, -0.11],["2016-07-08", 17.5, 17.39, 17.35, 17.51, 15.00, 0, 0.16, -0.05, -0.13],["2016-07-11", 17.49, 17.48, 17.4, 17.55, 16.00, 0, 0.17, -0.07, -0.15],["2016-07-12", 17.48, 17.71, 17.46, 17.75, 25.00, 0, 0.16, -0.10, -0.18],["2016-07-13", 17.13, 17.05, 17.02, 17.39, 28.00, 0, 0.07, -0.17, -0.20],["2016-07-14", 17.07, 17.09, 17.0, 17.16, 12.00, 0, 0.08, -0.17, -0.21],["2016-07-15", 17.08, 17.14, 17.08, 17.17, 11.00, 0, 0.09, -0.18, -0.22],["2016-07-18", 17.15, 17.26, 17.13, 17.49, 24.00, 0, 0.10, -0.19, -0.23],["2016-07-19", 17.26, 17.12, 17.09, 17.33, 13.00, 0, 0.07, -0.21, -0.25],["2016-07-20", 17.1, 17.07, 17.02, 17.14, 11.00, 0, 0.06, -0.23, -0.26],["2016-07-21", 17.07, 17.24, 17.07, 17.27, 14.00, 0, 0.07, -0.23, -0.27],["2016-07-22", 17.25, 17.08, 17.03, 17.25, 10.00, 0, 0.04, -0.26, -0.28],["2016-07-25", 17.09, 17.12, 17.01, 17.18, 8.00, 0, 0.04, -0.26, -0.28],["2016-07-26", 17.05, 17.17, 17.05, 17.2, 11.00, 0, 0.04, -0.27, -0.29],["2016-07-27", 17.2, 17.37, 16.89, 17.38, 32.00, 0, 0.02, -0.28, -0.29],["2016-07-28", 17.19, 17.14, 17.09, 17.29, 19.00, 0, -0.04, -0.32, -0.30],["2016-07-29", 17.15, 17.16, 17.04, 17.23, 12.00, 0, -0.08, -0.33, -0.29],["2016-08-01", 17.15, 17.18, 17.1, 17.24, 19.00, 0, -0.13, -0.34, -0.28],["2016-08-02", 17.21, 17.15, 17.12, 17.25, 9.00, 0, -0.19, -0.36, -0.26],["2016-08-03", 17.08, 17.07, 17.01, 17.16, 9.00, 0, -0.25, -0.36, -0.24],["2016-08-04", 17.11, 17.06, 16.98, 17.12, 11.00, 1, -0.29, -0.35, -0.20],["2016-08-05", 17.06, 17.1, 17.05, 17.15, 16.00, 0, -0.33, -0.32, -0.16],["2016-08-08", 17.14, 17.13, 17.07, 17.15, 13.00, 0, -0.35, -0.29, -0.11],["2016-08-09", 17.13, 17.17, 17.1, 17.2, 25.00, 0, -0.35, -0.24, -0.06],["2016-08-10", 17.17, 17.28, 17.15, 17.29, 18.00, 0, -0.31, -0.17, -0.01],["2016-08-11", 17.3, 17.45, 17.26, 17.87, 31.00, 0, -0.24, -0.09, 0.03],["2016-08-12", 17.51, 17.99, 17.47, 18.0, 44.00, 0, -0.14, -0.00, 0.07],["2016-08-15", 18.1, 18.42, 18.02, 18.99, 81.00, 0, -0.09, 0.04, 0.09],["2016-08-16", 18.64, 18.31, 18.12, 18.87, 60.00, 0, -0.10, 0.05, 0.10],["2016-08-17", 18.43, 18.4, 18.31, 18.68, 21.00, 0, -0.08, 0.08, 0.11],["2016-08-18", 18.33, 18.23, 18.13, 18.65, 32.00, 0, -0.07, 0.09, 0.13],["2016-08-19", 18.34, 18.62, 18.31, 18.75, 39.00, 0, 0.00, 0.14, 0.14],["2016-08-22", 18.62, 18.69, 18.51, 18.8, 20.00, 0, 0.01, 0.14, 0.13],["2016-08-23", 18.61, 18.66, 18.52, 19.0, 28.00, 0, 0.01, 0.14, 0.13],["2016-08-24", 18.66, 18.62, 18.43, 18.7, 19.00, 0, 0.00, 0.13, 0.13],["2016-08-25", 18.57, 18.51, 18.19, 18.64, 19.00, 0, -0.00, 0.13, 0.13],["2016-08-26", 18.49, 18.55, 18.44, 18.6, 16.00, 0, 0.01, 0.13, 0.13],["2016-08-29", 18.46, 18.27, 18.03, 18.48, 20.00, 0, 0.01, 0.13, 0.13],["2016-08-30", 18.24, 18.44, 18.23, 18.52, 19.00, 0, 0.07, 0.17, 0.13],["2016-08-31", 18.36, 18.63, 18.36, 18.76, 15.00, 0, 0.13, 0.18, 0.12],["2016-09-01", 18.6, 18.62, 18.55, 18.78, 15.00, 0, 0.16, 0.18, 0.10],["2016-09-02", 18.52, 18.68, 18.48, 18.72, 17.00, 0, 0.19, 0.17, 0.08],["2016-09-05", 18.68, 18.75, 18.57, 18.82, 19.00, 0, 0.20, 0.15, 0.05],["2016-09-06", 18.75, 18.51, 18.43, 18.78, 17.00, 0, 0.18, 0.11, 0.02],["2016-09-07", 18.51, 18.56, 18.4, 18.62, 17.00, 0, 0.17, 0.08, -0.00],["2016-09-08", 18.58, 18.53, 18.48, 18.63, 8.00, 0, 0.13, 0.04, -0.03],["2016-09-09", 18.52, 18.33, 18.31, 18.57, 8.00, 0, 0.06, -0.02, -0.05],["2016-09-12", 18.16, 17.9, 17.81, 18.18, 28.00, 0, -0.02, -0.07, -0.06],["2016-09-13", 17.91, 17.91, 17.9, 18.08, 13.00, 0, -0.05, -0.08, -0.05],["2016-09-14", 17.99, 17.54, 17.48, 17.99, 22.00, 0, -0.09, -0.09, -0.05],["2016-09-19", 17.55, 17.81, 17.55, 17.88, 16.00, 0, -0.06, -0.06, -0.03],["2016-09-20", 17.8, 17.74, 17.67, 17.85, 10.00, 0, -0.06, -0.05, -0.02],["2016-09-21", 17.75, 17.88, 17.75, 17.95, 7.00, 0, -0.03, -0.03, -0.02],["2016-09-22", 17.99, 17.97, 17.88, 18.17, 12.00, 0, -0.02, -0.02, -0.01],["2016-09-23", 17.99, 17.98, 17.93, 18.09, 13.00, 0, -0.01, -0.01, -0.01],["2016-09-26", 17.91, 18.0, 17.85, 18.09, 14.00, 0, -0.00, -0.01, -0.01],["2016-09-27", 17.97, 18.07, 17.94, 18.1, 10.00, 0, 0.00, -0.01, -0.01],["2016-09-28", 18.06, 17.89, 17.83, 18.06, 10.00, 0, -0.00, -0.01, -0.01],["2016-09-29", 17.96, 18.0, 17.92, 18.07, 10.00, 0, 0.03, 0.01, -0.01],["2016-09-30", 17.96, 18.0, 17.95, 18.1, 8.00, 0, 0.06, 0.02, -0.01],["2016-10-10", 18.03, 18.3, 18.03, 18.38, 19.00, 0, 0.11, 0.04, -0.02],["2016-10-11", 18.33, 18.33, 18.26, 18.49, 12.00, 0, 0.10, 0.02, -0.04],["2016-10-12", 18.28, 18.15, 18.1, 18.31, 10.00, 0, 0.07, -0.02, -0.05],["2016-10-13", 18.15, 18.09, 18.05, 18.21, 10.00, 0, 0.06, -0.03, -0.06],["2016-10-14", 18.1, 18.1, 18.0, 18.15, 12.00, 0, 0.04, -0.05, -0.07],["2016-10-17", 18.07, 17.86, 17.83, 18.1, 12.00, 0, 0.01, -0.07, -0.08],["2016-10-18", 17.86, 17.93, 17.84, 17.99, 14.00, 0, 0.03, -0.07, -0.08],["2016-10-19", 17.93, 17.88, 17.83, 18.05, 11.00, 0, 0.03, -0.07, -0.08],["2016-10-20", 17.9, 17.89, 17.83, 17.98, 12.00, 0, 0.05, -0.06, -0.09],["2016-10-21", 17.91, 17.91, 17.82, 17.93, 12.00, 0, 0.07, -0.06, -0.09],["2016-10-24", 17.93, 18.31, 17.86, 18.42, 29.00, 0, 0.11, -0.05, -0.10],["2016-10-25", 18.31, 18.13, 18.09, 18.46, 19.00, 0, 0.06, -0.09, -0.12],["2016-10-26", 18.12, 17.97, 17.95, 18.15, 14.00, 0, 0.02, -0.12, -0.13],["2016-10-27", 18.06, 17.81, 17.77, 18.06, 21.00, 0, -0.01, -0.13, -0.13],["2016-10-28", 17.8, 17.9, 17.8, 18.05, 20.00, 0, -0.01, -0.13, -0.13],["2016-10-31", 17.87, 17.86, 17.72, 17.96, 12.00, 0, -0.02, -0.14, -0.13],["2016-11-01", 17.87, 17.98, 17.79, 17.99, 18.00, 0, -0.03, -0.14, -0.12],["2016-11-02", 17.86, 17.84, 17.76, 17.94, 30.00, 0, -0.06, -0.15, -0.12],["2016-11-03", 17.83, 17.93, 17.79, 17.97, 27.00, 0, -0.07, -0.14, -0.11],["2016-11-04", 17.9, 17.91, 17.87, 18.0, 26.00, 0, -0.09, -0.15, -0.10],["2016-11-07", 17.91, 17.89, 17.85, 17.93, 20.00, 0, -0.11, -0.14, -0.09],["2016-11-08", 17.92, 17.99, 17.89, 18.06, 26.00, 0, -0.12, -0.13, -0.07],["2016-11-09", 18.0, 17.89, 17.77, 18.08, 34.00, 0, -0.15, -0.13, -0.06],["2016-11-10", 17.95, 18.0, 17.94, 18.11, 27.00, 0, -0.15, -0.11, -0.03],["2016-11-11", 17.95, 18.02, 17.93, 18.08, 27.00, 0, -0.17, -0.10, -0.01],["2016-11-14", 18.0, 18.04, 17.95, 18.25, 35.00, 0, -0.18, -0.08, 0.01],["2016-11-15", 18.1, 18.18, 18.03, 18.24, 25.00, 0, -0.18, -0.06, 0.04],["2016-11-16", 18.23, 18.12, 18.05, 18.29, 23.00, 0, -0.21, -0.04, 0.06],["2016-11-17", 18.11, 18.12, 18.01, 18.14, 27.00, 0, -0.21, -0.01, 0.09],["2016-11-18", 18.12, 18.1, 18.03, 18.16, 18.00, 0, -0.19, 0.03, 0.12],["2016-11-21", 18.08, 18.34, 18.08, 18.68, 41.00, 0, -0.13, 0.08, 0.15],["2016-11-22", 18.37, 18.37, 18.28, 18.49, 52.00, 0, -0.09, 0.12, 0.17],["2016-11-23", 18.4, 18.84, 18.37, 18.9, 66.00, 0, -0.02, 0.17, 0.18],["2016-11-24", 18.77, 18.74, 18.61, 18.97, 26.00, 0, -0.02, 0.17, 0.18],["2016-11-25", 18.8, 18.99, 18.66, 19.02, 40.00, 0, -0.01, 0.18, 0.19],["2016-11-28", 19.1, 18.65, 18.52, 19.2, 85.00, 0, -0.06, 0.16, 0.19],["2016-11-29", 18.65, 18.75, 18.51, 18.76, 49.00, 0, -0.06, 0.17, 0.20],["2016-11-30", 18.76, 18.55, 18.47, 18.82, 39.00, 0, -0.08, 0.17, 0.21],["2016-12-01", 18.55, 18.49, 18.41, 18.64, 53.00, 0, -0.06, 0.19, 0.22],["2016-12-02", 18.53, 18.49, 18.24, 18.54, 48.00, 0, -0.02, 0.21, 0.23],["2016-12-05", 18.39, 18.66, 18.34, 18.67, 50.00, 0, 0.03, 0.25, 0.23],["2016-12-06", 18.66, 18.6, 18.57, 18.78, 31.00, 0, 0.08, 0.26, 0.23],["2016-12-07", 18.65, 18.62, 18.58, 18.71, 12.00, 0, 0.15, 0.29, 0.21],["2016-12-08", 18.67, 18.76, 18.62, 18.88, 26.00, 0, 0.25, 0.32, 0.19],["2016-12-09", 18.76, 19.2, 18.75, 19.34, 62.00, 0, 0.34, 0.33, 0.16],["2016-12-12", 19.16, 19.25, 18.9, 19.65, 79.00, 1, 0.34, 0.28, 0.11],["2016-12-13", 19.09, 18.88, 18.81, 19.2, 24.00, 0, 0.27, 0.20, 0.06],["2016-12-14", 18.8, 18.82, 18.8, 19.14, 32.00, 0, 0.23, 0.13, 0.02],["2016-12-15", 18.73, 18.24, 18.2, 18.73, 36.00, 0, 0.13, 0.05, -0.01],["2016-12-16", 18.24, 18.18, 18.12, 18.4, 24.00, 0, 0.10, 0.02, -0.03],["2016-12-19", 18.15, 18.01, 17.93, 18.18, 24.00, 0, 0.06, -0.02, -0.05],["2016-12-20", 17.99, 17.79, 17.7, 17.99, 29.00, 1, 0.02, -0.05, -0.05],["2016-12-21", 17.83, 17.81, 17.77, 17.98, 30.00, 0, 0.00, -0.05, -0.06],["2016-12-22", 17.85, 17.72, 17.65, 17.85, 21.00, 0, -0.03, -0.07, -0.06],["2016-12-23", 17.77, 17.6, 17.54, 17.77, 18.00, 0, -0.04, -0.08, -0.05],["2016-12-26", 17.56, 17.75, 17.39, 17.77, 16.00, 0, -0.04, -0.07, -0.05],["2016-12-27", 17.73, 17.71, 17.65, 17.82, 10.00, 0, -0.06, -0.07, -0.04],["2016-12-28", 17.72, 17.62, 17.49, 17.77, 26.00, 0, -0.09, -0.07, -0.03],["2016-12-29", 17.6, 17.49, 17.43, 17.62, 28.00, 0, -0.09, -0.06, -0.02],["2016-12-30", 17.53, 17.6, 17.47, 17.61, 22.00, 0, -0.05, -0.03, -0.01],["2017-01-03", 17.6, 17.92, 17.57, 17.98, 28.00, 1, 0.00, 0.00, 0.00],
]def split_data(origin_data) -> dict:datas = []times = []vols = []macds = []difs = []deas = []for i in range(len(origin_data)):datas.append(origin_data[i][1:])times.append(origin_data[i][0:1][0])vols.append(origin_data[i][5])macds.append(origin_data[i][7])difs.append(origin_data[i][8])deas.append(origin_data[i][9])vols = [int(v) for v in vols]return {"datas": datas,"times": times,"vols": vols,"macds": macds,"difs": difs,"deas": deas,}def split_data_part() -> Sequence:mark_line_data = []idx = 0tag = 0vols = 0for i in range(len(data["times"])):if data["datas"][i][5] != 0 and tag == 0:idx = ivols = data["datas"][i][4]tag = 1if tag == 1:vols += data["datas"][i][4]if data["datas"][i][5] != 0 or tag == 1:mark_line_data.append([{"xAxis": idx,"yAxis": float("%.2f" % data["datas"][idx][3])if data["datas"][idx][1] > data["datas"][idx][0]else float("%.2f" % data["datas"][idx][2]),"value": vols,},{"xAxis": i,"yAxis": float("%.2f" % data["datas"][i][3])if data["datas"][i][1] > data["datas"][i][0]else float("%.2f" % data["datas"][i][2]),},])idx = ivols = data["datas"][i][4]tag = 2if tag == 2:vols += data["datas"][i][4]if data["datas"][i][5] != 0 and tag == 2:mark_line_data.append([{"xAxis": idx,"yAxis": float("%.2f" % data["datas"][idx][3])if data["datas"][i][1] > data["datas"][i][0]else float("%.2f" % data["datas"][i][2]),"value": str(float("%.2f" % (vols / (i - idx + 1)))) + " M",},{"xAxis": i,"yAxis": float("%.2f" % data["datas"][i][3])if data["datas"][i][1] > data["datas"][i][0]else float("%.2f" % data["datas"][i][2]),},])idx = ivols = data["datas"][i][4]return mark_line_datadef calculate_ma(day_count: int):result: List[Union[float, str]] = []for i in range(len(data["times"])):if i < day_count:result.append("-")continuesum_total = 0.0for j in range(day_count):sum_total += float(data["datas"][i - j][1])result.append(abs(float("%.2f" % (sum_total / day_count))))return resultdef draw_chart():kline = (Kline().add_xaxis(xaxis_data=data["times"]).add_yaxis(series_name="",y_axis=data["datas"],itemstyle_opts=opts.ItemStyleOpts(color="#ef232a",color0="#14b143",border_color="#ef232a",border_color0="#14b143",),markpoint_opts=opts.MarkPointOpts(data=[opts.MarkPointItem(type_="max", name="最大值"),opts.MarkPointItem(type_="min", name="最小值"),]),markline_opts=opts.MarkLineOpts(label_opts=opts.LabelOpts(position="middle", color="blue", font_size=15),data=split_data_part(),symbol=["circle", "none"],),).set_series_opts(markarea_opts=opts.MarkAreaOpts(is_silent=True, data=split_data_part())).set_global_opts(title_opts=opts.TitleOpts(title="K线周期图表", pos_left="0"),xaxis_opts=opts.AxisOpts(type_="category",is_scale=True,boundary_gap=False,axisline_opts=opts.AxisLineOpts(is_on_zero=False),splitline_opts=opts.SplitLineOpts(is_show=False),split_number=20,min_="dataMin",max_="dataMax",),yaxis_opts=opts.AxisOpts(is_scale=True, splitline_opts=opts.SplitLineOpts(is_show=True)),tooltip_opts=opts.TooltipOpts(trigger="axis", axis_pointer_type="line"),datazoom_opts=[opts.DataZoomOpts(is_show=False, type_="inside", xaxis_index=[0, 0], range_end=100),opts.DataZoomOpts(is_show=True, xaxis_index=[0, 1], pos_top="97%", range_end=100),opts.DataZoomOpts(is_show=False, xaxis_index=[0, 2], range_end=100),],# 三个图的 axis 连在一块# axispointer_opts=opts.AxisPointerOpts(#     is_show=True,#     link=[{"xAxisIndex": "all"}],#     label=opts.LabelOpts(background_color="#777"),# ),))kline_line = (Line().add_xaxis(xaxis_data=data["times"]).add_yaxis(series_name="MA5",y_axis=calculate_ma(day_count=5),is_smooth=True,linestyle_opts=opts.LineStyleOpts(opacity=0.5),label_opts=opts.LabelOpts(is_show=False),).set_global_opts(xaxis_opts=opts.AxisOpts(type_="category",grid_index=1,axislabel_opts=opts.LabelOpts(is_show=False),),yaxis_opts=opts.AxisOpts(grid_index=1,split_number=3,axisline_opts=opts.AxisLineOpts(is_on_zero=False),axistick_opts=opts.AxisTickOpts(is_show=False),splitline_opts=opts.SplitLineOpts(is_show=False),axislabel_opts=opts.LabelOpts(is_show=True),),))# Overlap Kline + Lineoverlap_kline_line = kline.overlap(kline_line)# Bar-1bar_1 = (Bar().add_xaxis(xaxis_data=data["times"]).add_yaxis(series_name="Volumn",y_axis=data["vols"],xaxis_index=1,yaxis_index=1,label_opts=opts.LabelOpts(is_show=False),itemstyle_opts=opts.ItemStyleOpts(color=JsCode("""function(params) {var colorList;if (barData[params.dataIndex][1] > barData[params.dataIndex][0]) {colorList = '#ef232a';} else {colorList = '#14b143';}return colorList;}""")),).set_global_opts(xaxis_opts=opts.AxisOpts(type_="category",grid_index=1,axislabel_opts=opts.LabelOpts(is_show=False),),legend_opts=opts.LegendOpts(is_show=False),))# Bar-2 (Overlap Bar + Line)bar_2 = (Bar().add_xaxis(xaxis_data=data["times"]).add_yaxis(series_name="MACD",y_axis=data["macds"],xaxis_index=2,yaxis_index=2,label_opts=opts.LabelOpts(is_show=False),itemstyle_opts=opts.ItemStyleOpts(color=JsCode("""function(params) {var colorList;if (params.data >= 0) {colorList = '#ef232a';} else {colorList = '#14b143';}return colorList;}""")),).set_global_opts(xaxis_opts=opts.AxisOpts(type_="category",grid_index=2,axislabel_opts=opts.LabelOpts(is_show=False),),yaxis_opts=opts.AxisOpts(grid_index=2,split_number=4,axisline_opts=opts.AxisLineOpts(is_on_zero=False),axistick_opts=opts.AxisTickOpts(is_show=False),splitline_opts=opts.SplitLineOpts(is_show=False),axislabel_opts=opts.LabelOpts(is_show=True),),legend_opts=opts.LegendOpts(is_show=False),))line_2 = (Line().add_xaxis(xaxis_data=data["times"]).add_yaxis(series_name="DIF",y_axis=data["difs"],xaxis_index=2,yaxis_index=2,label_opts=opts.LabelOpts(is_show=False),).add_yaxis(series_name="DIF",y_axis=data["deas"],xaxis_index=2,yaxis_index=2,label_opts=opts.LabelOpts(is_show=False),).set_global_opts(legend_opts=opts.LegendOpts(is_show=False)))# 最下面的柱状图和折线图overlap_bar_line = bar_2.overlap(line_2)# 最后的 Gridgrid_chart = Grid(init_opts=opts.InitOpts(width="1400px", height="800px"))# demo 中的代码也是用全局变量传的grid_chart.add_js_funcs("var barData = {}".format(data["datas"]))# K线图和 MA5 的折线图grid_chart.add(overlap_kline_line,grid_opts=opts.GridOpts(pos_left="3%", pos_right="1%", height="60%"),)# Volumn 柱状图grid_chart.add(bar_1,grid_opts=opts.GridOpts(pos_left="3%", pos_right="1%", pos_top="71%", height="10%"),)# MACD DIFS DEASgrid_chart.add(overlap_bar_line,grid_opts=opts.GridOpts(pos_left="3%", pos_right="1%", pos_top="82%", height="14%"),)grid_chart.render("K线图烛台(10).html")if __name__ == "__main__":data = split_data(origin_data=echarts_data)draw_chart()

注意:由于HTML代码量太大,所以以上代码只写了Python代码

且以上只是可视化实例图其中的一小部分,完整的可视化实例图及其源代码我已上传至资源文件,待审核完成后大家就可以自行下载了

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/228196.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

分享66个Java源码总有一个是你想要的

分享66个Java源码总有一个是你想要的 学习知识费力气&#xff0c;收集整理更不易。 知识付费甚欢喜&#xff0c;为咱码农谋福利。 链接&#xff1a;https://pan.baidu.com/s/1hKlZJB3KrHcOuKWyV1xjKw?pwd6666 提取码&#xff1a;6666 项目名称 ava web个人网站项目 ea…

不是生活有意思,是你热爱生活它才有意思

明制汉服的设计 同样是一款很重工的外套 细节上也是做到了极致 顺毛毛呢面料 领口袖口拼接仿貂毛环保毛条 前胸欧根纱刺绣圆形布 袖子贴民族风珠片刺绣织带 门襟搭配金属子母扣&#xff0c;真盘扣设计 时尚经典&#xff0c;搭配马面裙孩子穿上 真的很有气质奢华富贵 …

程序人生15年人生感悟

计算机程序员并不是一件什么高大上的职业。而仅仅是一份普通的工作。就像医生能治病救人&#xff0c;我们能治蓝屏救程序&#xff0c;我们都在为这个世界默默的做出自己的贡献。刻意或无意宣扬某个职业高大上&#xff0c;其实质是对其它行业从业者的不公平。但是有些人却常常这…

Node.js安装教程

虽然网上Node.js的安装教程有很多&#xff0c;但是基本上都是千篇一律。虽然跟着网上内容安装&#xff0c;却总会遇到乱七八糟的问题。为此&#xff0c;我写下这篇文章&#xff0c;除了描述node的安装教程&#xff0c;还会解释这样安装的过程起到一个什么作用。 文章大致上分为…

【PHP入门】1.2-常量与变量

-常量与变量- PHP是一种动态网站开发的脚本语言&#xff0c;动态语言特点是交互性&#xff0c;会有数据的传递&#xff0c;而PHP作为“中间人”&#xff0c;需要进行数据的传递&#xff0c;传递的前提就是PHP能自己存储数据&#xff08;临时存储&#xff09; 1.2.1变量基本概…

微服务实战系列之ZooKeeper(下)

前言 通过前序两篇关于ZooKeeper的介绍和总结&#xff0c;我们可以大致理解了它是什么&#xff0c;它有哪些重要组成部分。 今天&#xff0c;博主特别介绍一下ZooKeeper的一个核心应用场景&#xff1a;分布式锁。 应用ZooKeeper Q&#xff1a;什么是分布式锁 首先了解一下&…

04 python函数

4.1 函数的快速开发体验 """ 演示&#xff0c;快速体验函数的开发和使用 """#需求&#xff0c;统计字符串的长度&#xff0c;不使用内置函数len()str1 itheima str2 itcast str3 python#定义一个计数的变量 count 0 for i in str1:count 1…

FPGA使用乘法的方式

FPGA使用乘法的方式 方法一:直接使用乘法符“*” 源代码 module multiply(input [7:0] a,input [7:0] b,output wire [15:0] result);(*use_dsp48 = "yes"*) wire [15:0] result;assign result = a*b; endmodule仿真代码 module multiply_tb();reg [7:0] a; re…

java minio通过getPresignedObjectUrl设置(自定义)预签名URL下载文件的响应文件名之minio源码改造方案

Minio预签名URL自定义响应文件名之Minio源码改造 需求说明Minio源码改造一、环境准备二、下载Minio源代码三、修改源代码1.修改cmd目录下的api-router.go这个代码文件2.将filename参数值设置到响应头4.修改验证签名时是否需要带入filename参数验证 四、大功告成&#xff0c;编译…

残差网络中的BN (Batch Normalization 批标准化层)的作用是什么?

文章目录 什么是BN &#xff08;Batch Normalization 批标准化层&#xff09;一、BN层对输入信号进行以下操作:二、BN 层有什么作用&#xff1f; 什么是BN &#xff08;Batch Normalization 批标准化层&#xff09; BN层的全称是Batch Normalization层,中文可以翻译为批标准化…

如何让.NET应用使用更大的内存

我一直在思考为何Redis这种应用就能独占那么大的内存空间而我开发的应用为何只有4GB大小左右&#xff0c;在此基础上也问了一些大佬&#xff0c;最终还是验证下自己的猜测。 操作系统限制 主要为32位操作系统和64位操作系统。 每个进程自身还分为了用户进程空间和内核进程空…

Mybatis-Spring整合原理:MapperFactoryBean和MapperScannerConfigurer的区别及源码剖析

文章目录 引言MapperFactoryBean的用法和优缺点MapperScannerConfigurer的用法和优缺点MapperFactoryBean源码分析MapperScannerConfigurer源码分析Spring容器初始化流程回顾核心方法&#xff1a;postProcessBeanDefinitionRegistryBeanDefinitionRegistryPostProcessor和BeanF…

Java 并发编程(六)-Fork/Join异步回调

一、并发编程 1、Fork/Join分支合并框架 Fork/Join它可以将一个大的任务拆分成多个子任务进行并行处理&#xff0c;最后将子任务结果合并成最后的计算结果&#xff0c;并进行输出。Fork/Join框架要完成两件事情&#xff1a; Fork&#xff1a;把一个复杂任务进行分拆&#xff0…

下午好~ 我的论文【CV边角料】(第三期)

文章目录 CV边角料Pixel ShuffleSENetCBAMGlobal Context Block (GC)Criss-Cross Attention modules (CC) CV边角料 Pixel Shuffle Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network pixelshuffle算法的实现流…

EXCEL SUM类函数

目录 一. SUM二. SUMIF三. SUMIFS四. SUMPRODUCT 一. SUM ⏹对一列或一组单元格中的数字进行求和。 基本语法 SUM(number1, [number2], ...)✅统计所有产品的总数量 SUM(C2:C13) 二. SUMIF ⏹按照特定条件对范围内的单元格进行求和的函数。 基本语法 SUMIF(条件区域, 指定…

山西电力市场日前价格预测【2023-12-16】

日前价格预测 预测说明&#xff1a; 如上图所示&#xff0c;预测明日&#xff08;2023-12-16&#xff09;山西电力市场全天平均日前电价为259.00元/MWh。其中&#xff0c;最高日前电价为333.74元/MWh&#xff0c;预计出现在18:00。最低日前电价为0.00元/MWh&#xff0c;预计出…

C语言训练:三个字符串比较大小,实现两个整数数的交换统计二进制中1的个数

目录 一、编写程序&#xff0c;输入三个字符串&#xff0c;比较它们的大小&#xff0c;并将它们按由小到大的顺序输出。要求用函数、指针实现。要求:要采用函数调用&#xff0c;并用指向函数的指针作为函数的参数。 1.不使用函数指针作为参数&#xff0c;并自己模拟strcmp。 …

001 Windows虚拟机

一、虚拟机安装Windows10 选自定义安装 升级是针对你电脑上有系统的情况下&#xff0c;你要升级&#xff1b;没有系统就选择自定义。 硬盘60G 直接单击下一步就是一个盘 如果你想对磁盘进行分区 分第一个区的时候它会去创建系统的保留分区和系统分区&#xff0c;然后还剩20…

流量分析基础

定义&#xff1a; 流量分析&#xff08;Traffic Analysis&#xff09;是指对网络流量数据进行分析和解释&#xff0c;以获得有关网络中通信的信息和情报。这种技术可以用于网络安全、网络管理和网络优化等领域。 网络流量包含了许多有关网络通信的细节信息&#xff0c;如源IP地…

Linux c++开发-06-使用Linux API 进行文件的读写

先简单的介绍一下open,read,write 先用open接口去打开文件&#xff0c;flag表示打开文件的权限不同。 int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode);示例 结果&#xff1a;