示例#1
0
def makegraphs():
    green = LEDController(led_pin=pins.GREEN_LED)
    green.on()

    pwgraphs.make_four_graphs(savefile=True)

    green.off()
示例#2
0
    def get_context_data(self, **kwargs):
        context = super(FourChartsDynamicView, self).get_context_data(**kwargs)
        fig = pwgraph.make_four_graphs()

        pngdata = StringIO.StringIO()
        fig.savefig(pngdata, format='png', facecolor='w', bbox_inches='tight')

        context['pngstr'] = base64.b64encode(pngdata.getvalue())
        return context
示例#3
0
文件: views.py 项目: gruen/piweb.site
    def get_context_data(self, **kwargs):
        context = super(FourChartsDynamicView, self).get_context_data(**kwargs)
        fig = pwgraph.make_four_graphs()

        pngdata = StringIO.StringIO()
        fig.savefig(pngdata, format='png', facecolor='w', bbox_inches='tight')


        context['pngstr'] = base64.b64encode(pngdata.getvalue())
        return context