當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。