Fixed broken setting of the x-Axis limits
This commit is contained in:
parent
769b768818
commit
282e434d67
2 changed files with 4 additions and 5 deletions
|
|
@ -35,7 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- /.panel-heading -->
|
<!-- /.panel-heading -->
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<img id="img" src="/histogram.png?start_time=-120&end_time=9000000000&bin_size_seconds=1"/>
|
<img id="img" src="/histogram.png?start_time=-120&end_time=9000000000&bin_size_seconds=2"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ config.read(CONFIG_FILE)
|
||||||
SQLITE_LOCATION = config.get("Storage", "sqlite_location")
|
SQLITE_LOCATION = config.get("Storage", "sqlite_location")
|
||||||
UI_USER = config.get("UI", "username")
|
UI_USER = config.get("UI", "username")
|
||||||
UI_PASS = config.get("UI", "password")
|
UI_PASS = config.get("UI", "password")
|
||||||
print(UI_USER, UI_PASS)
|
|
||||||
|
|
||||||
|
|
||||||
# start flask
|
# start flask
|
||||||
|
|
@ -195,7 +194,7 @@ def build_plot():
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
# only get the last n seconds if the start time was negative
|
# only get the last n seconds if the start time was negative
|
||||||
if start_time < 0:
|
if start_time < 0:
|
||||||
plot_title += "Histogram of events over the last " + str(-start_time/60) + " minutes\nbin size: "+str(bin_size_seconds)+" [s]"
|
plot_title += "Histogram of events over the last {0:.1f} minutes\nbin size: {1:d} [s]".format(-start_time/60., bin_size_seconds)
|
||||||
cursor.execute("SELECT * FROM Events ORDER BY UTCUnixTime DESC, SubSeconds DESC;")
|
cursor.execute("SELECT * FROM Events ORDER BY UTCUnixTime DESC, SubSeconds DESC;")
|
||||||
start_time = cursor.fetchone()[0] + start_time
|
start_time = cursor.fetchone()[0] + start_time
|
||||||
end_time = 9000000000
|
end_time = 9000000000
|
||||||
|
|
@ -214,7 +213,7 @@ def build_plot():
|
||||||
event_time_list = [data[i][0] + data[i][1] for i in range(len(data))]
|
event_time_list = [data[i][0] + data[i][1] for i in range(len(data))]
|
||||||
#event_time_list = [data[i][0] for i in range(len(data))]
|
#event_time_list = [data[i][0] for i in range(len(data))]
|
||||||
bin_edges = range(int(event_time_list[len(event_time_list) - 1]), int(event_time_list[0]), bin_size_seconds)
|
bin_edges = range(int(event_time_list[len(event_time_list) - 1]), int(event_time_list[0]), bin_size_seconds)
|
||||||
x_axis_limits = (int(event_time_list[len(event_time_list) - 1]), int(event_time_list[0])+1)
|
x_axis_limits = (start_time, int(event_time_list[0])+1)
|
||||||
# convert our unix timestamps to Matplotlib format
|
# convert our unix timestamps to Matplotlib format
|
||||||
event_time_list = mdates.epoch2num(event_time_list)
|
event_time_list = mdates.epoch2num(event_time_list)
|
||||||
bin_edges = mdates.epoch2num(bin_edges)
|
bin_edges = mdates.epoch2num(bin_edges)
|
||||||
|
|
@ -224,7 +223,7 @@ def build_plot():
|
||||||
plt.hist(event_time_list,bins=bin_edges)
|
plt.hist(event_time_list,bins=bin_edges)
|
||||||
plt.title(plot_title)
|
plt.title(plot_title)
|
||||||
plt.xlabel("Time [UTC]")
|
plt.xlabel("Time [UTC]")
|
||||||
plt.ylabel("Number of Events [1]")
|
plt.ylabel("Number of Events per {0:d} second [1]".format(bin_size_seconds))
|
||||||
|
|
||||||
plt.subplots_adjust(bottom=0.2)
|
plt.subplots_adjust(bottom=0.2)
|
||||||
plt.xticks(rotation=25)
|
plt.xticks(rotation=25)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue