示例#1
0
def whale_shape_liquid(cate, rate):
    shape = ("path://M367.855,428.202c-3.674-1.385-7.452-1.966-11.146-1"
             ".794c0.659-2.922,0.844-5.85,0.58-8.719 c-0.937-10.407-7."
             "663-19.864-18.063-23.834c-10.697-4.043-22.298-1.168-29.9"
             "02,6.403c3.015,0.026,6.074,0.594,9.035,1.728 c13.626,5."
             "151,20.465,20.379,15.32,34.004c-1.905,5.02-5.177,9.115-9"
             ".22,12.05c-6.951,4.992-16.19,6.536-24.777,3.271 c-13.625"
             "-5.137-20.471-20.371-15.32-34.004c0.673-1.768,1.523-3.423"
             ",2.526-4.992h-0.014c0,0,0,0,0,0.014 c4.386-6.853,8.145-14"
             ".279,11.146-22.187c23.294-61.505-7.689-130.278-69.215-153"
             ".579c-61.532-23.293-130.279,7.69-153.579,69.202 c-6.371,"
             "16.785-8.679,34.097-7.426,50.901c0.026,0.554,0.079,1.121,"
             "0.132,1.688c4.973,57.107,41.767,109.148,98.945,130.793 c58."
             "162,22.008,121.303,6.529,162.839-34.465c7.103-6.893,17.826"
             "-9.444,27.679-5.719c11.858,4.491,18.565,16.6,16.719,28.643 "
             "c4.438-3.126,8.033-7.564,10.117-13.045C389.751,449.992,"
             "382.411,433.709,367.855,428.202z")

    liquid = Liquid()
    # liquid.width = '630px'
    # liquid.height = '350px'
    liquid.add("Liquid", [rate], shape=shape,
               is_outline_show=False).set_global_opts(
                   title_opts=options.TitleOpts(title=cate, pos_left="center"))
    # liquid.add("Liquid", [rate], shape=shape, is_outline_show=False)
    return liquid
示例#2
0
 def liquid_html(self, chart_id, title, val):
     # 实例化
     liquid = Liquid(self.init_opts)
     # 绑定id
     liquid.chart_id = chart_id
     # 添加参数
     liquid.add("", [round(val / 100, 4)])
     # 全局参数
     liquid.set_global_opts(title_opts=self.title_opts(title))
     # 返回图表html代码
     return liquid.render_embed()
示例#3
0
 def liquid_html(self, chart_id, title, val):
     # 基本配置
     liquid = Liquid(init_opts=opts.InitOpts(width="100%", height="300px"))
     liquid.set_global_opts(
         title_opts=opts.TitleOpts(
             title="{}-{}".format(self.dt, title),
             pos_left="center",
             title_textstyle_opts=opts.TextStyleOpts(font_size=14, color="white")
         ),
     )
     # 绑定id
     liquid.chart_id = chart_id
     # 添加参数
     liquid.add("", [round(val / 100, 4)])
     return liquid.render_embed()  # 返回图表html代码
示例#4
0
        "type": "category",
        "data": ["Excellent", "Good", "OK", "Bad"],
    },
]

parallel_data = [[12.99, 100, 82, "Good"], [9.99, 80, 77, "OK"],
                 [20, 120, 60, "Excellent"]]
# init_opts=opts.InitOpts(width="800px",height="300px")
parallel = Parallel(init_opts=opts.InitOpts(width="800px", height="300px"))
parallel.add_schema(parallel_axis)
parallel.add(series_name="Related Indexes",
             data=parallel_data,
             linestyle_opts=opts.LineStyleOpts(width=4, opacity=0.5))

liquid = Liquid(init_opts=opts.InitOpts(width="300px", height="300px"))
liquid.add("liquid", [0.6, 0.7, 0.3])
liquid.set_global_opts(title_opts=opts.TitleOpts(title="Basic Example"))

heatmap_data = [[i, j, random.randint(0, 50)] for i in range(7)
                for j in range(7)]
heatmap = HeatMap()
heatmap.add_xaxis(Faker.week)
heatmap.add_yaxis(
    "相关表",
    Faker.week,
    heatmap_data,
    label_opts=opts.LabelOpts(is_show=True, position="inside"),
)

heatmap.set_global_opts(
    title_opts=opts.TitleOpts(title="HeatMap-Label 显示"),
geo.add("高质量高校数量段位图", [list(z) for z in zip(data_985_211['name'].values.tolist(), data_985_211['counts'].values.tolist())],
        type_=ChartType.EFFECT_SCATTER)
geo.set_global_opts(
    visualmap_opts=opts.VisualMapOpts(is_piecewise=True, max_=12, split_number=4),
    title_opts=opts.TitleOpts(title="高质量高校数量段位图", subtitle="包括211与985高校")
)
geo.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
page.add(geo)
page.render("templates/geo.html")


# 水球图页面
page = Page()
# 北京985高校占比
liquid = Liquid()
liquid.add('', [data_985['rate'].values[0]])
liquid.set_global_opts(title_opts=opts.TitleOpts(title="北京985高校占比"))
page.add(liquid)
# 北京211高校占比
liquid = Liquid()
liquid.add('', [data_211['rate'].values[0]])
liquid.set_global_opts(title_opts=opts.TitleOpts(title="北京211高校占比"))
page.add(liquid)
# 北京上海江苏985高校占比
liquid = Liquid()
liquid.add('', [sum(data_985['rate'].values[:3])])
liquid.set_global_opts(title_opts=opts.TitleOpts(title="北京上海江苏985高校占比"))
page.add(liquid)
# 北京上海江苏211高校占比
liquid = Liquid()
liquid.add('', [sum(data_211['rate'].values[:3])])
示例#6
0
data = 
funnel = Funnel()
funnem.add('',data)
funne.render()

#==============================================================================

# 仪表盘

from pyecharts.charts import Gauge
gauge = Gauge()
gauge.add('',[('完成率',60)],
              # 不同颜色
              axisline_opts=opts.AxisLineOpts(
                linestyle_opts=opts.LineStyleOpts(
                    color=[(0.6, "#67e0e3"), (1, "#37a2da")], width=30
                )))
gauge.render(r'D:\PythonSpyder\数据可视化\My PyEcharts\仪表盘(不同颜色).html')

#==============================================================================

# 水球图
from pyecharts.charts import Liquid
liquid = Liquid()
liquid.add('',[0.6])
liquid.render(r'D:\PythonSpyder\数据可视化\My PyEcharts\水球图.html')




示例#7
0
v1 = [11, 12, 13, 10, 10, 10]
pie = Pie("饼图", title_pos="55%")
pie.add("",
        attr,
        v1,
        radius=[45, 65],
        center=[65, 50],
        legend_pos="80%",
        legend_orient="vertical")
grid = Grid()
grid.add(line, grid_right="55%")
grid.add(pie, grid_left="60%")
grid.render(r".\my_first_Zuhetu.html")
"""水球图"""
liquid = Liquid("水球图示例")
liquid.add("Liquid", [0.8])
liquid.show_config()
liquid.render(r".\my_first_Shuiqiu1.html")

liquid = Liquid("水球图示例")
liquid.add("Liquid", [0.6, 0.5, 0.4, 0.3],
           is_liquid_animation=False,
           shape='diamond')
liquid.show_config()
liquid.render(r".\my_first_Shuiqiu2.html")
"""地图"""
value = [155, 10, 66, 78, 33, 80, 190, 53, 49.6]
attr = ["福建", "山东", "北京", "上海", "甘肃", "新疆", "河南", "广西", "西藏"]
map = Map("Map 结合 VisualMap 示例", width=1200, height=600)
map.add("",
        attr,
funnel.render(path='pyecharts-funnel.html')

# 地理图
geo = Geo()
geo.add_schema(maptype='china')
data = [list(z) for z in zip(Faker.provinces, Faker.values())]
geo.add('geo', data, type_='heatmap')
geo.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
geo.set_global_opts(title_opts=opts.TitleOpts(title='Geo Sample'),
                    visualmap_opts=opts.VisualMapOpts())
geo.render('pyecharts-geo.html')

# 水球图
liquid = Liquid()
shape = 'path://M512 1024c-209.066667 0-384-170.666667-384-379.733333V640c145.066667 0 277.333333 81.066667 341.333333 204.8v-115.2c-51.2-12.8-89.6-51.2-106.666666-102.4-12.8 4.266667-21.333333 4.266667-34.133334 4.266667-55.466667 0-106.666667-29.866667-136.533333-76.8-34.133333-59.733333-25.6-136.533333 21.333333-183.466667-46.933333-51.2-55.466667-128-21.333333-187.733333 29.866667-46.933333 81.066667-76.8 136.533333-76.8 12.8 0 21.333333 0 34.133334 4.266666C384 42.666667 443.733333 0 512 0s128 42.666667 149.333333 110.933333c12.8-4.266667 21.333333-4.266667 34.133334-4.266666 55.466667 0 106.666667 29.866667 136.533333 76.8 34.133333 59.733333 25.6 136.533333-21.333333 183.466666 46.933333 51.2 55.466667 123.733333 21.333333 183.466667-29.866667 46.933333-81.066667 76.8-136.533333 76.8-12.8 0-21.333333 0-34.133334-4.266667-17.066667 51.2-55.466667 89.6-106.666666 102.4v115.2c64-128 196.266667-209.066667 341.333333-204.8 0 217.6-170.666667 388.266667-384 388.266667zM362.666667 362.666667c0 81.066667 68.266667 149.333333 149.333333 149.333333s149.333333-68.266667 149.333333-149.333333S593.066667 213.333333 512 213.333333 362.666667 281.6 362.666667 362.666667z'
liquid.add('Liquid', [0.7, 0.6, 0.5], is_outline_show=False, shape=shape)
liquid.set_global_opts(title_opts=opts.TitleOpts(title='Liquid Sample'))
liquid.render('pyecharts-liquid.html')

# 雷达图
v1 = [[4300, 10000, 28000, 35000, 50000, 19000],
      [3300, 13000, 25000, 30000, 48000, 24000]]
v2 = [[5000, 14000, 28000, 31000, 42000, 21000]]
radar = Radar()
radar.add_schema(schema=[
    opts.RadarIndicatorItem(name='销售', max_=6500),
    opts.RadarIndicatorItem(name='管理', max_=16000),
    opts.RadarIndicatorItem(name='信息技术', max_=30000),
    opts.RadarIndicatorItem(name='客服', max_=38000),
    opts.RadarIndicatorItem(name='研发', max_=52000),
    opts.RadarIndicatorItem(name='市场', max_=25000),
示例#9
0
from pyecharts.charts import Liquid
from pyecharts.faker import Faker #虚构的数据
from pyecharts import options as opts #配置
from pyecharts.charts import Bar #导入bar图
from pyecharts.globals import ThemeType
import random

liquid=Liquid()
liquid.add("Liquid",[0.7,0.6,0.5])

liquid.set_global_opts(
    title_opts=opts.TitleOpts(title="Geo-基本示例"),

)
liquid.render()
示例#10
0
from pyecharts.charts import Liquid

liquid = Liquid()
liquid.add("liquid", [0.5])

liquid.render()
示例#11
0
def DrawLiquid(city_name):
	data = int(qr.get_data(city_name)['SD'].strip('%')) / 100
	liquid = Liquid('%s城市湿度' % city_name)
	liquid.add('湿度', [data])
	liquid.render('weatherLiquid.html')