Пример #1
0
def results():
    fig, ax = plt.subplots()

    resultString = "<br/><br/>"
    for chalkboardId in STATA_CHALKBOARDS:
        resultString += str(chalkboardId) + "<br/>"
        resultString += str(STATA_CHALKBOARDS[chalkboardId]) + "<br/>"
        resultString += str(storage.read_unique_total_counts_for_chalkboardid(chalkboardId))
        resultString += "<br/><hr/><br/><br/>"

        resultsSeries = storage.read_lastday_timeseries_for_chalkboardid(chalkboardId)
        ax.plot(resultsSeries.dates, resultsSeries.values, label=str(chalkboardId))

    ax.legend(loc=2)
    graphHTML = mpld3.fig_to_html(fig)
    resultString = graphHTML + "<br/>hits in the last 12 hours<br/>" + resultString
    return resultString
Пример #2
0
def unique_results_for_chalkboard(chalkboardId):
    if chalkboardId not in STATA_CHALKBOARDS:
        return "chalkboard does not exist"
    return str(storage.read_unique_total_counts_for_chalkboardid(chalkboardId))