Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OSUG
RESIF
ws-timeseries
Commits
d1a31a8b
Commit
d1a31a8b
authored
Jun 04, 2021
by
Jerome Touvier
Browse files
change xaxis date format
parent
9dd795b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/utils.py
View file @
d1a31a8b
...
...
@@ -558,7 +558,7 @@ def date_format_hours(x, pos=None):
"""See date_format_days function
Only the first tick contains the full date.
"""
fmt
=
"%
D
%H:%M:%S"
if
pos
==
1
else
"%H:%M:%S"
fmt
=
"%
Y-%m-%d
%H:%M:%S"
if
pos
==
1
else
"%H:%M:%S"
return
datetime
.
utcfromtimestamp
(
x
).
strftime
(
fmt
)
...
...
@@ -570,7 +570,7 @@ def date_format_days(x, pos=None):
:returns: a string containing the corresponding tick label
"""
return
datetime
.
utcfromtimestamp
(
x
).
strftime
(
"%
D
%H:%M:%S"
)
return
datetime
.
utcfromtimestamp
(
x
).
strftime
(
"%
Y-%m-%d
%H:%M:%S"
)
def
get_units
(
params
,
plot_channel
):
...
...
@@ -676,9 +676,12 @@ def static_plots(params, st):
ax
.
set_xlim
(
left
,
right
)
if
not
params
[
"spectrum"
]:
ax
.
xaxis
.
set_major_formatter
(
FuncFormatter
(
date_format_hours
))
if
params
[
"end"
].
day
-
params
[
"start"
].
day
>=
1
:
day1
=
datetime
.
utcfromtimestamp
(
left
).
day
day2
=
datetime
.
utcfromtimestamp
(
right
).
day
if
day1
!=
day2
:
ax
.
xaxis
.
set_major_formatter
(
FuncFormatter
(
date_format_days
))
else
:
ax
.
xaxis
.
set_major_formatter
(
FuncFormatter
(
date_format_hours
))
if
params
[
"showtitle"
]:
text
=
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment