示例#1
0
def newPlot(request, data):
	figure = plot.staticPlot(data)
	canvas = FigureCanvasAgg(figure)
	response = HttpResponse(content_type='image/png')
	canvas.print_png(response)
	figure.close()
	return response
示例#2
0
def newPlot(request, data):
    figure = plot.staticPlot(data)
    canvas = FigureCanvasAgg(figure)
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    figure.close()
    return response
示例#3
0
def formatData(request):
    if request.method == "POST":
        buff = request.POST["to_plot"]
        if buff:
            data = None
            try:
                data = plot.parse(
                    daqeq_home + "trunk/" +
                    buff)  #Suppose there's a stream of data running.
            except IOError:
                data = plot.parse(daqeq_home + "trunk/enviados/" + buff)
            figure = plot.staticPlot(data)
            canvas = FigureCanvasAgg(figure)
            response = HttpResponse(content_type='image/png')
            canvas.print_png(response)
            return render(request, "plot/index.html", {
                "page_title": "Visualización",
                "plot": True,
                "data": data
            })
        else:
            files = sorted(map(
                lambda p: '/home/pi/Desktop/daqeq/trunk/enviados/' + str(p),
                os.listdir('/home/pi/Desktop/daqeq/trunk/enviados')),
                           key=os.path.getctime)
            return render(request, 'plot/index.html', {
                "graph": "Something to show, but no",
                "file": files[-1]
            })
    else:
        return render(request, 'plot/index.html', {"graph": "Nothing to show"})
示例#4
0
def formatData(request):
	if request.method == "POST":
		buff = request.POST["to_plot"]
		if buff:
			data = None
			try:
				data = plot.parse(daqeq_home+"trunk/"+buff) #Suppose there's a stream of data running.
			except IOError:
				data = plot.parse(daqeq_home+"trunk/enviados/"+buff)
			figure = plot.staticPlot(data)
			canvas = FigureCanvasAgg(figure)
			response = HttpResponse(content_type='image/png')
			canvas.print_png(response)
			return render(request, "plot/index.html", { "page_title" : "Visualización" , "plot" : True , "data" : data })
		else:
			files = sorted( map(lambda p : '/home/pi/Desktop/daqeq/trunk/enviados/'+str(p), os.listdir('/home/pi/Desktop/daqeq/trunk/enviados')), key=os.path.getctime)
			return render(request, 'plot/index.html', { "graph" : "Something to show, but no" , "file" : files[-1] })
	else:
		return render(request, 'plot/index.html',{ "graph" : "Nothing to show"})