예제 #1
0
def echarts_container(env, chart):
    """ Render a div html element for a chart.

    :param env:
    :param chart: A pyecharts.base.Base object
    """

    return Markup(
        CHART_DIV_FORMATTER.format(chart_id=chart.chart_id,
                                   width=utils.to_css_length(chart.width),
                                   height=utils.to_css_length(chart.height)))
예제 #2
0
파일: engine.py 프로젝트: Jesszen/pyecharts
def echarts_container(env, chart):
    """
    Render a div html element for a chart.

    :param env:
    :param chart: A pyecharts.base.Base object
    """

    return Markup(
        CHART_DIV_FORMATTER.format(
            chart_id=chart.chart_id,
            width=utils.to_css_length(chart.width),
            height=utils.to_css_length(chart.height),
        )
    )
예제 #3
0
def echarts_container(env, chart):
    """
    Render <p></p><div></div> html elements for a chart.

    :param env:
    :param chart: A pyecharts.base.Base object
    """
    _container_and_text = ""
    _text_label = chart.extra_html_text_label
    if _text_label:
        if len(_text_label) == 1 and isinstance(_text_label, list):
            _text_label.append("")
        _text, _style = _text_label
        _container_and_text += EXTRA_TEXT_FORMATTER.format(text=_text,
                                                           style=_style)

    _container_and_text += CHART_DIV_FORMATTER.format(
        chart_id=chart.chart_id,
        width=utils.to_css_length(chart.width),
        height=utils.to_css_length(chart.height),
    )
    return Markup(_container_and_text)