standard good-bad colors through front and backend

This commit is contained in:
simon 2021-03-21 16:58:56 +07:00
parent e2b0506b9f
commit f7cb5ffb03
3 changed files with 6 additions and 6 deletions

View File

@ -87,15 +87,15 @@ def build_pm_plot(x, y, y_max, thresh, title):
col = []
for val in y:
if val < thresh:
col.append('#00cc00')
col.append('#6ecd65')
else:
col.append('#cc0000')
col.append('#ff4d4d')
# title
plt_title = f'Daily avg PM {title} exposure'
# plot
plt.style.use('seaborn')
plt.bar(x_dates, y, color=col, width=0.5)
plt.axhline(y=thresh, color='#00cc00', linestyle=':')
plt.axhline(y=thresh, color='#6ecd65', linestyle=':')
plt.xticks(ticks=x_range, labels=x_dates)
plt.yticks(np.arange(0, y_max, step=25))
plt.title(plt_title, fontsize=20)

View File

@ -88,7 +88,7 @@ def write_df(mean):
avg_change = 'same'
# build avg df
avg_row = {'timestamp': '10 days avg', 'now_aqi': now_avg, 'year_aqi': year_avg, 'change': avg_change}
avg_row = {'timestamp': 'avg 10 days', 'now_aqi': now_avg, 'year_aqi': year_avg, 'change': avg_change}
new_row = pd.DataFrame(avg_row, index = [0]).round()
mean = pd.concat([new_row, mean]).reset_index(drop = True)
# convert to int

View File

@ -252,10 +252,10 @@ function tableContent() {
}
if (cell == 'down') {
td.textContent = '\u25BC';
td.style.backgroundColor = '#00cc00';
td.style.backgroundColor = '#6ecd65';
} else if (cell == 'up') {
td.textContent = '\u25B2';
td.style.backgroundColor = '#cc0000';
td.style.backgroundColor = '#ff4d4d';
} else if (cell == 'same') {
td.textContent = '\u301C';
td.style.backgroundColor = '#bdbdbd';