def update_graph(test, n): """ update graph in time and dropdown """ #ADD MORE FIGURES FOR MORE GRAPHICS fig = plotly.tools.make_subplots() if test != TEST: # callback input was value, so has changed test type print(f'FILNAME {file_name}') TEST = test if file_name != None and save_file == False: shell.run(['rm', file_name]) file_name = 'T' + str(TEST) + 'csv' data['y'] = [] data['x'] = [] if pass_interval != n: new_data = rd.uniform(-10 * TEST, 10 * TEST) #get_data_from_test pass_interval = n if n > LENGHT: data['y'] = data['y'][1:] + [new_data] data['x'] = list(map(lambda x: x + 1, data['x'])) # all data are new, so save into the cvs file if n % SAVE_LENGHT == 0: my_csv.save_csv(file_name, [data['x'], data['y']]) print("Updating in data.cvs") else: data['x'].append(new_data) fig.append_trace({'x': data['x'], 'y': data['y'], 'type': 'scatter'}, 1, 1) return fig
def update_data(data,test): """update data of a particular test """ data['time'].append(time.time()) for i in PARAMETERS: # add here comunication data[test][i].append( rd.randrange(MIN_Y ,MAX_Y) ) #sabe data my_csv.save_csv(test ,[ data['time'] , data[test]['voltage'] , data[test]['current'] , data[test]['capacity'] ] ) return data
def update_graph(n): fig = plotly.tools.make_subplots() new_data = rd.uniform(-10, 10) if n > LENGHT: data['y'] = data['y'][1:] + [new_data] data['x'] = list(map(lambda x: x + 1, data['x'])) # all data are new, so save into the cvs file if n % LENGHT == 0: my_csv.save_csv("data.cvs", [data['x'], data['y']]) print("Updating in data.cvs") else: data['x'].append(new_data) fig.append_trace({'x': data['x'], 'y': data['y'], 'type': 'scatter'}, 1, 1) return fig