Example #1
0
 def guide_sparkline(self):
     G = Sparkline([
         27, 25, 25, 25, 25, 27, 100, 31, 25, 36, 25, 25, 39, 25, 31, 25,
         25, 25, 26, 26, 25, 25, 28, 25, 25, 100, 28, 27, 31, 25, 27, 27,
         29, 25, 27, 26, 26, 25, 26, 26, 35, 33, 34, 25, 26, 25, 36, 25, 26,
         37, 33, 33, 37, 37, 39, 25, 25, 25, 25
     ],
                   encoding='text')
     G.color('0077CC')
     G.size(200, 40)
     G.marker('B', 'E6F2FA', 0, 0, 0)
     G.line(1, 0, 0)
     return G
Example #2
0
def graph(professor):
    scores = []
    comments = Comment.objects.filter(
        professor=professor, responsibility__gt=0)
    for c in comments:
        scores.append(float(c.responsibility+c.personality +
                            c.workload+c.difficulty)*5)

    if len(scores) == 0:
        scores.append(0)
    if len(scores) == 1:
        scores.append(scores[0])

    chart = Sparkline(scores, encoding='text')
    chart.color('0077CC')
    chart.size(450, 262)
    chart.marker('B', 'E6F2FA', 0, 0, 0)
    chart.line(1, 0, 0)
    chart.axes('y')

    if not settings.DEBUG:
        client = CamoClient(settings.CAMO_URL, key=settings.CAMO_KEY)
        url = client.image_url(chart.url)
    else:
        url = chart.url

    return url
Example #3
0
def graph(professor):
    scores = []
    comments = Comment.objects.filter(professor=professor,
                                      responsibility__gt=0)
    for c in comments:
        scores.append(
            float(c.responsibility + c.personality + c.workload + c.difficulty)
            * 5)

    if len(scores) == 0:
        scores.append(0)
    if len(scores) == 1:
        scores.append(scores[0])

    chart = Sparkline(scores, encoding='text')
    chart.color('0077CC')
    chart.size(450, 262)
    chart.marker('B', 'E6F2FA', 0, 0, 0)
    chart.line(1, 0, 0)
    chart.axes('y')

    if not settings.DEBUG:
        client = CamoClient(settings.CAMO_URL, key=settings.CAMO_KEY)
        url = client.image_url(chart.url)
    else:
        url = chart.url

    return url