コード例 #1
0
ファイル: chart.py プロジェクト: emilybobwang/monitor
    def liqiud_html(self, chart_id, title, val):
        liquid = Liquid("{}-{}".format(self.datetime, title),
                        title_pos="center",
                        width="100%",
                        title_color="white",
                        title_text_size=14,
                        height=300)

        liquid.chart_id = chart_id
        liquid.add("", [round(val / 100, 4)])
        return liquid.render_embed()
コード例 #2
0
ファイル: chart.py プロジェクト: Sbwillbealier/monitor_demo
    def liquid_html(self, chart_id, title, val):
        """CPU水球图"""
        # 实例一个具体类型图表的对象,并配置基本项
        liquid = Liquid(title="{}-{}".format(self.dt, title),
                        title_pos='center',
                        width='100%',
                        title_color='white',
                        title_text_size=14,
                        height=300)

        # 绑定id
        liquid.chart_id = chart_id

        # 绑定参数
        liquid.add("", [round(val / 100, 4)])

        return liquid.render_embed()  # 返回图表html代码
コード例 #3
0
ファイル: charts.py プロジェクト: bamcool/flasktest
    def liquid_html(self, chart_id, title, val):
        #基本配置
        '''
        :param title
        :param subtitle
        :param val 水球图的值

        :return: html+css+js
        '''
        liquid = Liquid(
            "{}-{}".format(self.dt, title),

            #标题的位置
            title_pos="center",
            #图形的宽度比例
            width='100%',
            #图形的高度
            height=300,
            #标题的颜色
            title_color="black",
            #标题的大小 px
            title_text_size=14,
        )
        #打印图形,每个图形的id要不一致,图形id会变成js中的一个变量
        liquid.chart_id = chart_id

        #水球图的其它参数
        #data表示的是水球图中波纹的个数和高度,值是一个list
        #0.56
        liquid.add(name='Liquid',
                   data=[
                       round((val / 100), 2),
                       round((val / 100), 2) / 2,
                       round((val / 100), 2) / 4
                   ],
                   shape="roundRect",
                   is_liquid_outline_show=False)

        #render_embed把当前的liquid对象解析成html css js
        return liquid.render_embed()