当前位置: 首页>>代码示例>>Python>>正文


Python Bar.render_embed方法代码示例

本文整理汇总了Python中pyecharts.Bar.render_embed方法的典型用法代码示例。如果您正苦于以下问题:Python Bar.render_embed方法的具体用法?Python Bar.render_embed怎么用?Python Bar.render_embed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyecharts.Bar的用法示例。


在下文中一共展示了Bar.render_embed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_numpy_array

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render_embed [as 别名]
def test_numpy_array():
    v1 = np.array([5, 20, 36, 10, 75, 90])
    bar = Bar(TITLE)
    bar.add("商家A", CLOTHES, v1, is_stack=True)
    html = bar.render_embed()
    json_encoded_title = json.dumps(TITLE)
    assert json_encoded_title in html
开发者ID:MandyCh,项目名称:pyecharts,代码行数:9,代码来源:test_base.py

示例2: test_numpy_array

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render_embed [as 别名]
def test_numpy_array():
    import numpy as np

    title = "柱状图数据堆叠示例"
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    v1 = np.array([5, 20, 36, 10, 75, 90])
    bar = Bar(title)
    bar.add("商家A", attr, v1, is_stack=True)
    html = bar.render_embed()
    json_encoded_title = json.dumps(title)
    assert json_encoded_title in html
开发者ID:shuxiang,项目名称:pyecharts,代码行数:13,代码来源:test_base.py

示例3: test_pandas_dataframe

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render_embed [as 别名]
def test_pandas_dataframe():
    title = "bar chart"
    index = pd.date_range("3/8/2017", periods=6, freq="M")
    df1 = pd.DataFrame(np.random.randn(6), index=index)
    df2 = pd.DataFrame(np.random.randn(6), index=index)

    dtvalue1 = [i[0] for i in df1.values]
    dtvalue2 = [i[0] for i in df2.values]
    _index = [i for i in df1.index.format()]

    bar = Bar(title, "Profit and loss situation")
    bar.add("profit", _index, dtvalue1)
    bar.add("loss", _index, dtvalue2)
    html = bar.render_embed()
    assert title in html
开发者ID:MandyCh,项目名称:pyecharts,代码行数:17,代码来源:test_base.py

示例4: test_embed_option

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render_embed [as 别名]
def test_embed_option():

    # bar_0
    title = "柱状图数据堆叠示例"
    attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
    v1 = [5, 20, 36, 10, 75, 90]
    v2 = [10, 25, 8, 60, 20, 80]
    bar = Bar(title)
    bar.add("商家A", attr, v1, is_stack=True)
    bar.add("商家B", attr, v2, is_stack=True)
    html = bar.render_embed()
    json_encoded_title = json.dumps(title)
    assert json_encoded_title in html
    assert "<html>" not in html
    assert "<body>" not in html
开发者ID:shuxiang,项目名称:pyecharts,代码行数:17,代码来源:test_base.py

示例5: test_pandas_dataframe

# 需要导入模块: from pyecharts import Bar [as 别名]
# 或者: from pyecharts.Bar import render_embed [as 别名]
def test_pandas_dataframe():
    import pandas as pd
    import numpy as np

    title = 'Bar chart'
    index = pd.date_range('3/8/2017', periods=6, freq='M')
    df1 = pd.DataFrame(np.random.randn(6), index=index)

    df2 = pd.DataFrame(np.random.randn(6), index=index)

    dtvalue1 = [i[0] for i in df1.values]
    dtvalue2 = [i[0] for i in df2.values]

    bar = Bar(title, 'Profit and loss situation')
    bar.add('profit', df1.index, dtvalue1)
    bar.add('loss', df2.index,  dtvalue2)
    html = bar.render_embed()
    assert title in html
开发者ID:shuxiang,项目名称:pyecharts,代码行数:20,代码来源:test_base.py


注:本文中的pyecharts.Bar.render_embed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。