Hello all, I’m new to Dash and have what is probably a simple question. I’m plotting data pulled from an SQL server as a function of time. Having trouble with the axis formatting as can be seen here:
I want the time data to show up as hour:minute:seconds instead of the current format. How would I go about fixing this?
def update_graph_scatter(n):
dataSQL = []
conn = pymysql.connect("localhost","root","abc123","db")
sql_select_Query = "select Time,Value4 from Weather"
cursor = conn.cursor()
cursor.execute(sql_select_Query)
records = cursor.fetchall()
X = deque(maxlen=10)
Y = deque(maxlen=10)
for row in records:
dataSQL.append(list(row))
labels = ['Time','Value-4']
df = pd.DataFrame.from_records(dataSQL, columns=labels)
X = df['Time']
Y = df['Value-4']
data = plotly.graph_objs.Scatter(
x=list(X),
y=list(Y),
name='Scatter',
mode= 'lines+markers'
)
return {'data': [data],'layout' : go.Layout(
xaxis=dict(range=[min(X),max(X)]),
yaxis=dict(range=[min(Y),max(Y)]))}
if __name__ == "__main__":
app.run_server(debug=True)