Hi @empet
I use to plot directly from numpy arrays retrieved with sqlalchemy command from a database dates are in datatime64[s] format and unfortunately month names stay in english whatever solution I try. Is there a way to change language with the right format ?
today = datetime.datetime.now()
start = str(int(round(today.timestamp())) - 173400)
dateTime DESC LIMIT 288)Var1 ORDER BY datetime ASC'
sql48h = 'SELECT dateTime, inTemp, outTemp, windchill, dewpoint, heatindex FROM archive WHERE dateTime >= ' + start + ' ORDER BY dateTime ASC '
with engine.connect() as conn:
result = conn.execute(text(sql48h))
data48h = np.empty((0,6), dtype = 'datetime64[s], float, float, float, float, float')
for row in result.all():
data48h = np.append(data48h, [[np.datetime64(datetime.datetime.fromtimestamp(row[0]), 's'),
row[1],
row[2],
row[3],
row[4],
row[5]]], axis=0)
dateT48h = data48h[:,0]
inTemp48h = data48h[:,1]
outTemp48h = data48h[:,2]
windchill48h = data48h[:,3]
dewpoint48h = data48h[:,4]
heatindex48h = data48h[:,5]
fig = go.Figure()
fig.add_trace(go.Scatter(x=dateT48h, y=inTemp48h, name='Temp. Intérieure',
line=dict(color='darkorange', width=2)))fig.update_layout(title=figTitle + '(48 heures)',
height=800,
width=1200,
paper_bgcolor='lightyellow',
xaxis_title='Date',
yaxis_title='Temperature (degrés Celsius)',
legend=dict(orientation='h',
bgcolor='lightblue',
x=0.2,
y=-0.12,
bordercolor='#444',
borderwidth=1))
fig.update_xaxes(linecolor='#444',
linewidth=1,
dtick='10800000',
tickformat='%H:%M\n%d/%b',
minor_ticklen=3)
fig.show()
Here is the firs line of the numpy array :
[numpy.datetime64('2022-08-26T10:10:00') 24.0500367917587 22.891464311994
22.891464311994 17.5628838729488 23.1155610743195]
thanks