Hi! I've created a bar chart and embedded it into a web page using base64 and Flask. Data is being retrieved from a csv file and formatted in some way ... I had to sort a dictionary and format it to recognize dates. So everything is fantastic as soon as I start the application. Chart is being displayed and all is great.
Now ... if I refresh the page, data is being duplicated in the chart but if I restart the app everything is back to normal, but if I hit refresh many times, data is being added to the original values.
Do you know if is there a way I can prevent it?
This is the code:
`
@app.route('/pygalexample/')
def paygalexample():
try:
open_file = open('info/solicitudes_procesos.csv', 'r')
for x in open_file:
datos_temp = x.split(",")
fecha = datos_temp[0]
listado_fecha.append(fecha[:5])
Hi! I've created a bar chart and embedded it into a web page using base64 and Flask. Data is being retrieved from a csv file and formatted in some way ... I had to sort a dictionary and format it to recognize dates. So everything is fantastic as soon as I start the application. Chart is being displayed and all is great. Now ... if I refresh the page, data is being duplicated in the chart but if I restart the app everything is back to normal, but if I hit refresh many times, data is being added to the original values. Do you know if is there a way I can prevent it?
This is the code:
` @app.route('/pygalexample/') def paygalexample(): try: open_file = open('info/solicitudes_procesos.csv', 'r') for x in open_file: datos_temp = x.split(",") fecha = datos_temp[0] listado_fecha.append(fecha[:5])
Here it is the normal graph as soon as I start the server
And here it is the same graph after I press refresh on the browser. As you can see, values are being duplicated
Any ideas?