예제 #1
0
def recent():
    """Render the recent SMS activity graph on home page."""
    bar_chart = pygal.Bar(
        height=200, style=CleanStyle, margin=15, spacing=5, show_y_labels=True, x_label_rotation=90, legend_box_size=10
    )
    bar_chart.add('In', sms_graph_data(direction='in'))
    bar_chart.add('Out', sms_graph_data(direction='out'))
    td = timezone.now()
    xlabels = []
    for x in range(-30, 1):
        delta = timezone.timedelta(days=x)
        today = td + delta
        xlabels.append(today.strftime('%d %b'))
        bar_chart.x_labels = xlabels

    return bar_chart.render()
예제 #2
0
def recent():
    """Render the recent SMS activity graph on home page."""
    bar_chart = pygal.Bar(height=200,
                          style=CleanStyle,
                          margin=15,
                          spacing=5,
                          show_y_labels=True,
                          x_label_rotation=90,
                          legend_box_size=10)
    bar_chart.add("In", sms_graph_data(direction="in"))
    bar_chart.add("Out", sms_graph_data(direction="out"))
    td = timezone.now()
    xlabels = []
    for x in range(-30, 1):
        delta = timezone.timedelta(days=x)
        today = td + delta
        xlabels.append(today.strftime("%d %b"))
        bar_chart.x_labels = xlabels

    return bar_chart.render()
예제 #3
0
 def test_sms_freq_in(self, smsin):
     graph_data = sms_graph_data(direction="in")
     assert 3 in graph_data
예제 #4
0
 def test_sms_freq_out(self, smsout):
     graph_data = sms_graph_data(direction="out")
     assert 1 in graph_data
예제 #5
0
 def test_sms_freq_in(self, smsin):
     graph_data = sms_graph_data(direction='in')
     assert 3 in graph_data
예제 #6
0
 def test_sms_freq_out(self, smsout):
     graph_data = sms_graph_data(direction='out')
     assert 1 in graph_data