def makegraphs(): green = LEDController(led_pin=pins.GREEN_LED) green.on() pwgraphs.make_four_graphs(savefile=True) green.off()
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