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


Python Line.render_response方法代码示例

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


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

示例1: test_interpolate_secondary

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_interpolate_secondary():
     chart = Line(title=u"Some different points", interpolate="cubic")
     chart.add("line", [1000, 2000, 7000])
     chart.add("other line", [100, 500, 500], secondary=True)
     chart.range = 0, 10000
     chart.secondary_range = 0, 1000
     return chart.render_response()
开发者ID:rnjdeltaYoda,项目名称:pygal,代码行数:9,代码来源:tests.py

示例2: test_stroke_config

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
    def test_stroke_config():
        line = Line(stroke_style={'width': .5})
        line.add('test_no_line', range(12), stroke=False)
        line.add('test', reversed(range(12)), stroke_style={'width': 3})
        line.add(
            'test_no_dots', [5] * 12,
            show_dots=False,
            stroke_style={
                'width': 2,
                'dasharray': '12, 31'
            }
        )
        line.add(
            'test_big_dots', [randint(1, 12) for _ in range(12)], dots_size=5
        )
        line.add(
            'test_fill', [randint(1, 3) for _ in range(12)],
            fill=True,
            stroke_style={
                'width': 5,
                'dasharray': '4, 12, 7, 20'
            }
        )

        line.x_labels = [
            'lol', 'lol1', 'lol2', 'lol3', 'lol4', 'lol5', 'lol6', 'lol7',
            'lol8', 'lol9', 'lol10', 'lol11'
        ]
        return line.render_response()
开发者ID:Kozea,项目名称:pygal,代码行数:31,代码来源:tests.py

示例3: test_stroke_config

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
    def test_stroke_config():
        line = Line(stroke_style={"width": 0.5})
        line.add("test_no_line", range(12), stroke=False)
        line.add("test", reversed(range(12)), stroke_style={"width": 3})
        line.add("test_no_dots", [5] * 12, show_dots=False, stroke_style={"width": 2, "dasharray": "12, 31"})
        line.add("test_big_dots", [randint(1, 12) for _ in range(12)], dots_size=5)
        line.add(
            "test_fill",
            [randint(1, 3) for _ in range(12)],
            fill=True,
            stroke_style={"width": 5, "dasharray": "4, 12, 7, 20"},
        )

        line.x_labels = [
            "lol",
            "lol1",
            "lol2",
            "lol3",
            "lol4",
            "lol5",
            "lol6",
            "lol7",
            "lol8",
            "lol9",
            "lol10",
            "lol11",
        ]
        return line.render_response()
开发者ID:rnjdeltaYoda,项目名称:pygal,代码行数:30,代码来源:tests.py

示例4: test_major_dots

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_major_dots():
     line = Line(x_labels_major_count=2, show_only_major_dots=True)
     line.add('test', range(12))
     line.x_labels = [
         'lol', 'lol1', 'lol2', 'lol3', 'lol4', 'lol5',
         'lol6', 'lol7', 'lol8', 'lol9', 'lol10', 'lol11']
     # line.x_labels_major = ['lol3']
     return line.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:10,代码来源:tests.py

示例5: simulation

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
def simulation():
    x = w.x_odeint(w.initial)
    line = Line(show_dots=False,show_minor_x_labels=False)
    for c in x:
        line.add(c,x[c])
    line.x_labels = map(str,x.index.values)
    line.x_labels_major = map(str,range(x.index[0],x.index[-1]+50,50))
    return line.render_response()
开发者ID:mortbauer,项目名称:limitsofgrowth,代码行数:10,代码来源:web.py

示例6: test_interruptions

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_interruptions():
     chart = Line(allow_interruptions=True)
     chart.add(
         'interrupt', [22, 34, 43, 12, None, 12, 55, None, 56],
         allow_interruptions=False)
     chart.add('not interrupt', [
         -a if a else None
         for a in (22, 34, 43, 12, None, 12, 55, None, 56)])
     return chart.render_response()
开发者ID:ConnorMooreLUC,项目名称:pygal,代码行数:11,代码来源:tests.py

示例7: test_erfinv

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
    def test_erfinv():
        from scipy import stats as sstats
        chart = Line(show_dots=False)
        chart.add('scipy', [sstats.norm.ppf(x / 1000) for x in range(1, 999)])
        chart.add('approx', [stats.ppf(x / 1000) for x in range(1, 999)])

        # chart.add('approx', [
        #    special.erfinv(x/1000) - erfinv(x/1000)
        #    for x in range(-999, 1000)])
        return chart.render_response()
开发者ID:Kozea,项目名称:pygal,代码行数:12,代码来源:tests.py

示例8: graph

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
def graph(graph, type, year, month):
    """Create graphs with the parameters passed."""
    db = get_db()
    now = datetime.now()
    timestamp = now.timestamp()
    time_first_day = datetime(year, month, 1).timestamp()
    first_day = datetime(year, month, 1)
    cal = calendar.monthrange(year, month)
    time_last_day = datetime(year, month, cal[1], 23, 59, 59).timestamp()
    last_day = datetime(year, month, cal[1])
    
    if graph in ['ligne', 'histogramme']:
        line_chart = Line(interpolate='cubic') if graph == 'ligne' else Bar()
        if type == 'hour':
            line_chart.title = (
                'Somme des hoquets par heure en %s' % 
                calendar.month_name[month])
            requete = db.execute(
                'select CAST(strftime(\'%H\', datetime(moment, \'unixepoch\','
                ' \'localtime\')) as integer) as hour, count(*) from ok '
                'where moment between (?) and (?) group by hour', 
                [time_first_day, time_last_day])
            hoquet = dict(requete)
            line_chart.x_labels = [
               str(hour) for hour, val in sorted(hoquet.items())]
            line_chart.add('Annabelle', [
                val for hour, val in sorted(hoquet.items())])
        else:
            hoquet = []
            x_labels = []
            x_labels_major = []
            line_chart.title = (
                'Nombre de hoquets par jour en %s' % 
                calendar.month_name[month])
            for i,day in enumerate(range (int(time_first_day),
            int(time_last_day), 86400)):                 
                if is_in_weekend(day):
                    requete = None
                else:
                    requete = db.execute(
                        'select count(*) from ok where moment >= (?) '
                        'and moment <= (?)', [day, day+86400]).fetchone()[0]
                    x_labels_major.append(i+1)
                    
                x_labels.append(i+1)                   
                hoquet.append(requete)
            line_chart.x_labels = map(str, x_labels)
            line_chart.x_labels_major = list(map(str, x_labels_major))
            line_chart.add('Annabelle', hoquet)
        return line_chart.render_response()
            
        return gauge_chart.render_response()
开发者ID:Kozea,项目名称:hadokey,代码行数:54,代码来源:hadokey.py

示例9: test_stroke_config

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
    def test_stroke_config():
        line = Line()
        line.add('test_no_line', range(12), stroke=False)
        line.add('test', reversed(range(12)))
        line.add('test_no_dots', [5] * 12, show_dots=False)
        line.add('test_big_dots', [
            randint(1, 12) for _ in range(12)], dots_size=5)
        line.add('test_fill', [
            randint(1, 3) for _ in range(12)], fill=True)

        line.x_labels = [
            'lol', 'lol1', 'lol2', 'lol3', 'lol4', 'lol5',
            'lol6', 'lol7', 'lol8', 'lol9', 'lol10', 'lol11']
        return line.render_response()
开发者ID:ChaliZhg,项目名称:pygal,代码行数:16,代码来源:tests.py

示例10: test_major_dots

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_major_dots():
     line = Line(x_labels_major_count=2, show_only_major_dots=True)
     line.add("test", range(12))
     line.x_labels = [
         "lol",
         "lol1",
         "lol2",
         "lol3",
         "lol4",
         "lol5",
         "lol6",
         "lol7",
         "lol8",
         "lol9",
         "lol10",
         "lol11",
     ]
     # line.x_labels_major = ['lol3']
     return line.render_response()
开发者ID:rnjdeltaYoda,项目名称:pygal,代码行数:21,代码来源:tests.py

示例11: test_stroke_config

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
    def test_stroke_config():
        line = Line()
        line.add("test_no_line", range(12), stroke=False)
        line.add("test", reversed(range(12)))
        line.add("test_no_dots", [5] * 12, show_dots=False)
        line.add("test_big_dots", [randint(1, 12) for _ in range(12)], dots_size=5)
        line.add("test_fill", [randint(1, 3) for _ in range(12)], fill=True)

        line.x_labels = [
            "lol",
            "lol1",
            "lol2",
            "lol3",
            "lol4",
            "lol5",
            "lol6",
            "lol7",
            "lol8",
            "lol9",
            "lol10",
            "lol11",
        ]
        return line.render_response()
开发者ID:Cortana-,项目名称:pygal,代码行数:25,代码来源:tests.py

示例12: test_order_min

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_order_min():
     line = Line(order_min=-32)
     line.add('_', [1, 32, 12, .4, .009])
     return line.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:6,代码来源:tests.py

示例13: test_only_zeroes

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_only_zeroes():
     line = Line()
     line.add('zeroes', [])
     line.add('zeroes 2', [0])
     return line.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:7,代码来源:tests.py

示例14: test_ylabels

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_ylabels():
     chart = Line()
     chart.x_labels = "Red", "Blue", "Green"
     chart.y_labels = 0.0001, 0.0003, 0.0004, 0.00045, 0.0005
     chart.add("line", [0.0002, 0.0005, 0.00035])
     return chart.render_response()
开发者ID:Cortana-,项目名称:pygal,代码行数:8,代码来源:tests.py

示例15: test_labels

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_response [as 别名]
 def test_labels():
     line = Line()
     line.add('test1', range(100))
     line.x_labels = map(str, range(11))
     return line.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:7,代码来源:tests.py


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