From 076bfadc5924690fad40a8f92fb143413d0fa2c9 Mon Sep 17 00:00:00 2001 From: dmotte <37443982+dmotte@users.noreply.github.com> Date: Sun, 29 Dec 2024 04:32:40 +0100 Subject: [PATCH] Introduced latest_date variable --- example/plots.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/example/plots.py b/example/plots.py index dedb0f3..175eb5b 100644 --- a/example/plots.py +++ b/example/plots.py @@ -78,6 +78,8 @@ def main(argv=None): data = list(load_data(file_in_data)) values = load_values(file_in_values) + latest_date = data[-1]['date'] + if args.plot_rate: fig = px.line( data, @@ -88,7 +90,7 @@ def main(argv=None): ) fig.add_vline( annotation_text='today', - x=dt.combine(data[-1]['date'], dt.min.time()).timestamp() * 1000, + x=dt.combine(latest_date, dt.min.time()).timestamp() * 1000, line_color='#0cc', ) fig.show() @@ -118,7 +120,7 @@ def main(argv=None): ) fig.add_vline( annotation_text='today', - x=dt.combine(data[-1]['date'], dt.min.time()).timestamp() * 1000, + x=dt.combine(latest_date, dt.min.time()).timestamp() * 1000, line_color='#0cc', ) fig.show() @@ -148,7 +150,7 @@ def main(argv=None): ) fig.add_vline( annotation_text='today', - x=dt.combine(data[-1]['date'], dt.min.time()).timestamp() * 1000, + x=dt.combine(latest_date, dt.min.time()).timestamp() * 1000, line_color='#0cc', ) fig.show()