示例#1
0
文件: views.py 项目: gitbronak/Voyage
def articles_js(request):
    keywords_pie_chart = analyzer.articles_keywords_pie_chart()
    articles_annotation_chart = analyzer.articles_annotation_chart()
    msites_bar_chart = analyzer.msites_bar_chart()


    context = {'keywords_pie_chart':  keywords_pie_chart, 
                'referring_sites': articles_annotation_chart[0], 
                'article_by_date': articles_annotation_chart[1], 
                'referringsite_bar_chart': msites_bar_chart,
                'referringsite_bar_table':msites_bar_chart[1:],
                'bar_chart_height': max((len(msites_bar_chart) - 1) * 3, 30),}

    return render(request, 'statistics/articles_js.html', context)
示例#2
0
def setArticleCachedData():
        keywords_pie_chart =  analyzer.articles_keywords_pie_chart()
        articles_annotation_chart =  analyzer.articles_annotation_chart()
        msites_bar_chart =   analyzer.msites_bar_chart()

        with open("Article_Statistics.Json", 'w') as outfile:

            context = {'keywords_pie_chart':  keywords_pie_chart,
            'referring_sites': articles_annotation_chart[0],
            'article_by_date': articles_annotation_chart[1],
            'referringsite_bar_chart': msites_bar_chart,
            'referringsite_bar_table':msites_bar_chart[1:],
            'bar_chart_height': max((len(msites_bar_chart) - 1) * 3, 30),}


            json.dump(context, outfile)
示例#3
0
def articles(request):
    if not request.user.is_authenticated():
        return redirect("/admin/login/?next=%s" % request.path)

    keywords_pie_chart = analyzer.articles_keywords_pie_chart()
    articles_annotation_chart = analyzer.articles_annotation_chart()
    msites_bar_chart = analyzer.msites_bar_chart()

    context = {
        "keywords_pie_chart": keywords_pie_chart,
        "monitoring_sites": articles_annotation_chart[0],
        "article_by_date": articles_annotation_chart[1],
        "msites_bar_chart": msites_bar_chart,
        "msites_bar_table": msites_bar_chart[1:],
        "bar_chart_height": max((len(msites_bar_chart) - 1) * 3, 30),
    }

    return render(request, "statistics/articles.html", context)