A
A
Anatoly2016-07-07 01:16:43
Django
Anatoly, 2016-07-07 01:16:43

Live chart update?

Hello everyone, how to make it in django so that when it is added to the database, it is immediately added to the chart.
Now the graph is like this

cur.execute('SELECT volt FROM Robot')
    mas_volt = cur.fetchall()
    cur.execute('SELECT amper FROM Robot')
    mas_amper = cur.fetchall()
    cur.execute('SELECT time FROM Robot')
    mas_time = cur.fetchall()
    l = []

    for time in mas_time:
        for ti in time:
            t = int(ti)/1000
            l.append( '{ x:'+str(t) )
    i=0
    for amper in mas_amper:
        for amp in amper:
            l[i] += ',y:' + str(amp) + '},'
            i+=1
    conn.close()
    global mylistwr
    mylistwr.mylist=l
    return render_to_response('index.html',{'list':l,'mass':mas_volt})


I build the graph on the canvasjs library. I read about ajax, I tried it and could not start it, maybe there are other mechanisms for updating the graph?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zelsky, 2016-07-07
@reactive93

Google about long pull

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question