コード例 #1
0
ファイル: views.py プロジェクト: plutoese/mars
def bokeh():

    file = 'd:/temp/airquality.xlsx'
    ldata = LoadData(file)
    bgraph = BokehGraph(ldata.load())
    #result = bgraph.bar_plot('AQI指数','city')
    #result = bgraph.scatter('PM10','PM25','city')
    result = bgraph.line_plot(xvar='日期',yvar='AQI指数',group={'city':['上海','北京','三亚']},timeseries=True)

    return render_template('bokehexample.html',script=result['script'],div=result['div'])
コード例 #2
0
ファイル: views.py プロジェクト: plutoese/mars
def edatool():
    ldata = LoadData(session['savedfile'])
    data_loaded = ldata.load()
    bgraph = BokehGraph(data_loaded)
    variables = data_loaded.get('header')
    if request.method == 'POST':
        choice = request.form.get('edatools')
        xvar = request.form.get('xvar')
        yvar = request.form.get('yvar')
        group = request.form.get('group')
        print(request.form)
        if choice == '1':
            if xvar == '0':
                return "没有选择变量"
            else:
                if group == '0':
                    result = bgraph.bar_plot(xvar)
                else:
                    result = bgraph.bar_plot(xvar,group)
        elif choice == '2':
            if xvar == '0' or yvar == '0':
                return "没有选择变量"
            else:
                if group == '0':
                    result = bgraph.line_plot(xvar=xvar,yvar=yvar,timeseries=True)
                else:
                    result = bgraph.line_plot(xvar=xvar,yvar=yvar,group=group,timeseries=True)
        else:
            if xvar == '0' or yvar == '0':
                return "没有选择变量"
            else:
                if group == '0':
                    result = bgraph.scatter(xvar,yvar)
                else:
                    result = bgraph.scatter(xvar,yvar,group)
        return render_template('edatool.html',variables=variables,script=result['script'],div=result['div'])
    return render_template('edatool.html',variables=variables)