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


Python charts.Line方法代码示例

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


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

示例1: v_totvalue

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def v_totvalue(self, end=yesterdayobj(), rendered=True, vopts=None):
        """
        visualization on the total values daily change of the aim
        """
        partp = self.price[self.price["date"] >= self.cftable.iloc[0].date]
        # 多基金账单时起点可能非该基金持有起点
        partp = partp[partp["date"] <= end]

        date = [d.date() for d in partp.date]
        valuedata = [
            self.briefdailyreport(d).get("currentvalue", 0) for d in partp.date
        ]

        line = Line()
        if vopts is None:
            vopts = line_opts

        line.add_xaxis(date)
        line.add_yaxis(series_name="持仓总值", y_axis=valuedata, is_symbol_show=False)
        line.set_global_opts(**vopts)
        if rendered:
            return line.render_notebook()
        else:
            return line 
开发者ID:refraction-ray,项目名称:xalpha,代码行数:26,代码来源:trade.py

示例2: _draw_line

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def _draw_line(result: ClassifierResult) -> Line:
        # draw line chart
        x_axis = [str(i) for i in result.get_timestamp_list()]
        y_axis = result.get_stage_list()

        line = Line(init_opts=opts.InitOpts(bg_color=constants.BACKGROUND_COLOR))
        line.add_xaxis(x_axis)
        line.add_yaxis("stage", y_axis, is_step=False, is_symbol_show=True)
        line.set_global_opts(
            title_opts=opts.TitleOpts(
                title="Trend", subtitle="describe how these stages switching"
            ),
            toolbox_opts=opts.ToolboxOpts(is_show=True),
            tooltip_opts=opts.TooltipOpts(
                is_show=True, trigger="axis", axis_pointer_type="cross"
            ),
            brush_opts=opts.BrushOpts(x_axis_index="all", tool_box=["lineX"]),
        )
        return line 
开发者ID:williamfzc,项目名称:stagesepx,代码行数:21,代码来源:reporter.py

示例3: _draw_sim

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def _draw_sim(data: VideoCutResult) -> Line:
        x_axis = [str(i.start) for i in data.range_list]
        ssim_axis = [i.ssim for i in data.range_list]
        mse_axis = [i.mse for i in data.range_list]
        psnr_axis = [i.psnr for i in data.range_list]

        line = Line(init_opts=opts.InitOpts(bg_color=constants.BACKGROUND_COLOR))
        line.add_xaxis(x_axis)
        line.add_yaxis("ssim", ssim_axis)
        line.add_yaxis("mse", mse_axis)
        line.add_yaxis("psnr", psnr_axis)
        line.set_global_opts(
            title_opts=opts.TitleOpts(title="SIM"),
            toolbox_opts=opts.ToolboxOpts(is_show=True),
            tooltip_opts=opts.TooltipOpts(
                is_show=True, trigger="axis", axis_pointer_type="cross"
            ),
        )
        line.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
        return line 
开发者ID:williamfzc,项目名称:stagesepx,代码行数:22,代码来源:reporter.py

示例4: report

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def report(request):
    """返回慢SQL历史趋势"""
    checksum = request.GET.get('checksum')
    cnt_data = ChartDao().slow_query_review_history_by_cnt(checksum)
    pct_data = ChartDao().slow_query_review_history_by_pct_95_time(checksum)
    cnt_x_data = [row[1] for row in cnt_data['rows']]
    cnt_y_data = [int(row[0]) for row in cnt_data['rows']]
    pct_y_data = [str(row[0]) for row in pct_data['rows']]
    line = Line(init_opts=opts.InitOpts(width='800', height='380px'))
    line.add_xaxis(cnt_x_data)
    line.add_yaxis("慢查次数", cnt_y_data, is_smooth=True,
                   markline_opts=opts.MarkLineOpts(data=[opts.MarkLineItem(type_="max", name='最大值'),
                                                         opts.MarkLineItem(type_="average", name='平均值')]))
    line.add_yaxis("慢查时长(95%)", pct_y_data, is_smooth=True, is_symbol_show=False)
    line.set_series_opts(areastyle_opts=opts.AreaStyleOpts(opacity=0.5, ))
    line.set_global_opts(title_opts=opts.TitleOpts(title='SQL历史趋势'),
                         legend_opts=opts.LegendOpts(selected_mode='single'),
                         xaxis_opts=opts.AxisOpts(
                             axistick_opts=opts.AxisTickOpts(is_align_with_label=True),
                             is_scale=False,
                             boundary_gap=False,
                         ), )

    result = {"status": 0, "msg": '', "data": line.render_embed()}
    return HttpResponse(json.dumps(result), content_type='application/json') 
开发者ID:hhyo,项目名称:Archery,代码行数:27,代码来源:slowlog.py

示例5: v_netvalue

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def v_netvalue(self, end=yesterdayobj(), vopts=None, rendered=True):
        """
        起点对齐归一的,各参考基金或指数的净值比较可视化

        :param end: string or object of date, the end date of the line
        :param vkwds: pyechart line.add() options
        :param vopts: dict, options for pyecharts instead of builtin settings
        :returns: pyecharts.charts.Line.render_notebook()
        """
        partprice = self.totprice[self.totprice["date"] <= end]

        line = Line()
        if vopts is None:
            vopts = line_opts
        line.set_global_opts(**vopts)
        line.add_xaxis([d.date() for d in list(partprice.date)])
        for fund in self.fundobjs:
            line.add_yaxis(
                series_name=fund.name,
                y_axis=list(partprice[fund.code]),
                is_symbol_show=False,
            )
        if rendered:
            return line.render_notebook()
        else:
            return line 
开发者ID:refraction-ray,项目名称:xalpha,代码行数:28,代码来源:evaluate.py

示例6: v_netvalue

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def v_netvalue(self, end=yesterdayobj(), benchmark=True, rendered=True, vopts=None):
        """
        visulaization on  netvalue curve

        :param end: dateobject for indicating the end date in the figure, default to yesterday
        :param benchmark: bool, whether include benchmark's netvalue curve, default true
        :param vopts: dict, options for pyecharts instead of builtin settings
        """
        if getattr(self, "bmprice", None) is None:
            benchmark = False
        if benchmark:
            a, b = self.comparison(end)
        else:
            a = self.price
        if vopts is None:
            vopts = line_opts
        line = Line()
        line.add_xaxis([d.date() for d in list(a.date)])
        line.add_yaxis(
            y_axis=list(a.netvalue), series_name=self.name, is_symbol_show=False
        )
        line.set_global_opts(**vopts)
        if benchmark:
            line.add_yaxis(
                series_name=self.benchmark.name,
                y_axis=list(b.netvalue),
                is_symbol_show=False,
            )
        if rendered:
            return line.render_notebook()
        else:
            return line 
开发者ID:refraction-ray,项目名称:xalpha,代码行数:34,代码来源:indicator.py

示例7: v_techindex

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def v_techindex(self, end=yesterdayobj(), col=None, rendered=True, vopts=None):
        """
        visualization on netvalue curve and specified indicators

        :param end: date string or obj, the end date of the figure
        :param col: list, list of strings for price col name, eg.['MA5','BBI']
            remember generate these indicators before the visualization,
            these cols don't automatically generate for visualization
        :param vopts: dict, options for pyecharts instead of builtin settings
        """
        partprice = self.price[self.price["date"] <= end]
        xdata = [d.date() for d in list(partprice.date)]
        netvaldata = list(partprice.netvalue)
        if vopts is None:
            vopts = line_opts
        line = Line()
        line.add_xaxis(xdata)
        line.add_yaxis(series_name="netvalue", y_axis=netvaldata, is_symbol_show=False)
        line.set_global_opts(**vopts)
        if col is not None:
            for ind in col:
                inddata = list(partprice[ind])
                line.add_yaxis(series_name=ind, y_axis=inddata, is_symbol_show=False)
        if rendered:
            return line.render_notebook()
        else:
            return line 
开发者ID:refraction-ray,项目名称:xalpha,代码行数:29,代码来源:indicator.py

示例8: api_profile_line_chart

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def api_profile_line_chart() -> Line:
    """
    接口平均耗时
    :return:
    """
    xaxis = get_xaxis_days(days=10)

    apis = list(filter(lambda x: x, R.smembers(settings.REDIS_API_KEY)))

    line = (
        Line()
        .add_xaxis(xaxis)
        .set_global_opts(title_opts=options.TitleOpts(title="API 耗时走势"),
                         yaxis_opts=options.AxisOpts(
                             is_scale=True,
                             splitline_opts=options.SplitLineOpts(is_show=True)
                         ),
                         tooltip_opts=options.TooltipOpts(trigger='axis'),
                         )
    )
    for api in apis:
        if api in get_profile_apis():
            api_redis_keys = [settings.REDIS_API_AVG_KEY % (api, day) for day in xaxis]
            api_profile = R.mget(*api_redis_keys)
            line.add_yaxis(api, api_profile, is_connect_nones=True, is_smooth=True,
                           label_opts=options.LabelOpts(is_show=False))

    return line.dump_options() 
开发者ID:richshaw2015,项目名称:oh-my-rss,代码行数:30,代码来源:views_dash.py

示例9: uv_line_chart

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def uv_line_chart() -> Line:
    """
    UV折线图,包括总 UV、新用户 UV、注册 UV
    """
    xaxis = get_xaxis_days()

    uv_all_redis_keys = [settings.REDIS_UV_ALL_KEY % day for day in xaxis]
    uv_new_redis_keys = [settings.REDIS_UV_NEW_KEY % day for day in xaxis]
    uv_reg_redis_keys = [settings.REDIS_REG_KEY % day for day in xaxis]

    uv_all = R.mget(*uv_all_redis_keys)
    uv_new = R.mget(*uv_new_redis_keys)
    uv_reg = R.mget(*uv_reg_redis_keys)

    line = (
        Line()
        .add_xaxis(xaxis)
        .add_yaxis("总用户数(访问设备)", uv_all, is_connect_nones=True, is_smooth=True)
        .add_yaxis("新用户数(一周未访问)", uv_new, is_connect_nones=True, is_smooth=True)
        .add_yaxis("注册用户数", uv_reg, is_connect_nones=True, is_smooth=True)
        .set_global_opts(title_opts=options.TitleOpts(title="用户数走势"),
                         yaxis_opts=options.AxisOpts(
                             is_scale=True,
                             splitline_opts=options.SplitLineOpts(is_show=True)
                         ),
                         tooltip_opts=options.TooltipOpts(trigger='axis'),
                         )
        .dump_options()
    )
    return line 
开发者ID:richshaw2015,项目名称:oh-my-rss,代码行数:32,代码来源:views_dash.py

示例10: refer_pv_line_chart

# 需要导入模块: from pyecharts import charts [as 别名]
# 或者: from pyecharts.charts import Line [as 别名]
def refer_pv_line_chart() -> Line:
    """
    UV折线图,外域的每天流量趋势
    """
    xaxis = get_xaxis_days()

    uv_zhihu_redis_keys = [settings.REDIS_REFER_PV_DAY_KEY % ('link.zhihu.com', day) for day in xaxis]
    uv_ryf_redis_keys = [settings.REDIS_REFER_PV_DAY_KEY % ('www.ruanyifeng.com', day) for day in xaxis]
    uv_github_redis_keys = [settings.REDIS_REFER_PV_DAY_KEY % ('github.com', day) for day in xaxis]
    uv_baidu_redis_keys = [settings.REDIS_REFER_PV_DAY_KEY % ('www.baidu.com', day) for day in xaxis]
    uv_google_redis_keys = [settings.REDIS_REFER_PV_DAY_KEY % ('www.google.com', day) for day in xaxis]
    uv_wanqu_redis_keys = [settings.REDIS_REFER_PV_DAY_KEY % ('wanqu.co', day) for day in xaxis]

    uv_zhihu = R.mget(*uv_zhihu_redis_keys)
    uv_ryf = R.mget(*uv_ryf_redis_keys)
    uv_github = R.mget(*uv_github_redis_keys)
    uv_baidu = R.mget(*uv_baidu_redis_keys)
    uv_google = R.mget(*uv_google_redis_keys)
    uv_wanqu = R.mget(*uv_wanqu_redis_keys)

    line = (
        Line()
        .add_xaxis(xaxis)
        .add_yaxis("zhihu", uv_zhihu, is_connect_nones=True, is_smooth=True)
        .add_yaxis("ruanyifeng", uv_ryf, is_connect_nones=True, is_smooth=True)
        .add_yaxis("github", uv_github, is_connect_nones=True, is_smooth=True)
        .add_yaxis("baidu", uv_baidu, is_connect_nones=True, is_smooth=True)
        .add_yaxis("google", uv_google, is_connect_nones=True, is_smooth=True)
        .add_yaxis("wanqu", uv_wanqu, is_connect_nones=True, is_smooth=True)
        .set_global_opts(title_opts=options.TitleOpts(title="Referer各域名PV走势"),
                         yaxis_opts=options.AxisOpts(
                             is_scale=True,
                             splitline_opts=options.SplitLineOpts(is_show=True)
                         ),
                         tooltip_opts=options.TooltipOpts(trigger='axis'),
                         )
        .dump_options()
    )
    return line 
开发者ID:richshaw2015,项目名称:oh-my-rss,代码行数:41,代码来源:views_dash.py


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