【pyechats】面向对象模式

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pyecharts.charts import Bar

from pyecharts import options as opts
from pyecharts.charts import Funnel, Page
from pyecharts import options as opts
from pyecharts.charts import Gauge, Page,Line
from pyecharts.components import Table
from pyecharts.options import ComponentTitleOpts

from pyecharts.faker import Faker
from pyecharts import options as opts
from pyecharts.charts import Funnel, Page
from pyecharts import options as opts
from pyecharts.charts import Gauge, Page
# 内置主题类型可查看 pyecharts.globals.ThemeType
from pyecharts.globals import ThemeType
class barx(object):
 def bar_border_radius(self):
    c = (
        Bar()
        .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
        .add_yaxis("商家A", [5, 20, 36, 10, 75, 90], itemstyle_opts=opts.ItemStyleOpts(color='red'), )
    # render 会生成本地 HTML 文件,默认会在当前目录生成 render.html 文件
    # 也可以传入路径参数,如 bar.render("mycharts.html")
    #bar.render('t1.html')
    )
    return c


obj=barx()
page=Page()
page.add(obj.bar_border_radius())
page.render('t7.html')
#obj.bar_border_radius().render('t7.html')

猜你喜欢

转载自blog.csdn.net/zhaoyangjian724/article/details/112146421
今日推荐