I want to plot agraph using plotly.js library and the inputs to the graph is taken from the user through an html form.
I have created a html form to read X and Y values for the plot. In the views.py, i accessed the form data using request.POST.get and then added to a list x[],y[].
from django.shortcuts import render
x=[]
y=[]
def index(request):
return render(request,'home.html')
def inputplot(request):
if(request.method=="POST"):
xvalue=request.POST.get('xvalue')
yvalue=request.POST.get('yvalue')
x.append(xvalue)
y.append(yvalue)
print x
print y
return render(request,'inputplot.html')
del x[:]
del y[:]
return render(request,'inputplot.html')
def plot(request):
`return render(request,'plot.html',{'x':x,'y':y})
I want the lists in plot.html but when i append data to the list it automatically add some characters. For example i input a number 12 for x value, but this number appears in the list as [u'12'].
Why this happened?
pls give me a solution or show me another method to read user data and plot the values.??? Help me