Exemple #1
0
def dashboard():
    try:

        graph_data = []
        for key in indicator_dict.keys():
            barplot = plot_BAR_indicator_top5(indicator_dict[key][0], key)
            lineplot = plot_LINE_indicator_top5(indicator_dict[key][0], key)
            graphs = column(barplot, lineplot)
            script, div = components(graphs)
            graph_data.append((script, div))

        return render_template("graph.html",
                               indicator_dict=indicator_dict,
                               country_list=country_names,
                               region_list=region_names,
                               econ_script=graph_data[1][0],
                               econ_graph=graph_data[1][1],
                               health_script=graph_data[5][0],
                               health_graph=graph_data[5][1],
                               edu_script=graph_data[2][0],
                               edu_graph=graph_data[2][1],
                               fin_script=graph_data[4][0],
                               fin_graph=graph_data[4][1],
                               dev_script=graph_data[0][0],
                               dev_graph=graph_data[0][1],
                               pov_script=graph_data[6][0],
                               pov_graph=graph_data[6][1],
                               env_script=graph_data[3][0],
                               env_graph=graph_data[3][1])
    except Exception as e:
        return render_template("500.html", error=e)
Exemple #2
0
def econ_data():
    indicator = request.args.get('econ_indicator', 'potato', type=str)
    print(indicator)

    barplot = plot_BAR_indicator_top5(indicator, 'Economy')
    lineplot = plot_LINE_indicator_top5(indicator, 'Economy')
    graphs = column(barplot, lineplot)
    script, div = components(graphs)

    return jsonify(script=script, graph=div)