Merge pull request #9 from tpokorra/TP-202101-charts-fixes
multiple fixes for charts
This commit was merged in pull request #9.
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
|
||||
tabButtons.map(function(button) {
|
||||
button.addEventListener('click', function() {
|
||||
document.querySelector('li a.active.button').classList.remove('active');
|
||||
active = document.querySelector('li a.active.button')
|
||||
if (active) active.classList.remove('active');
|
||||
button.classList.add('active');
|
||||
|
||||
document.querySelector('.tab-pane.active').classList.remove('active');
|
||||
active = document.querySelector('.tab-pane.active')
|
||||
if (active) active.classList.remove('active');
|
||||
document.querySelector(button.getAttribute('href')).classList.add('active');
|
||||
})
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ class Graph:
|
||||
y = []
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
sql = """SELECT date(datetime_valid), rate FROM
|
||||
sql = """SELECT datetime_valid, rate FROM
|
||||
(select date(datetime_valid) as day, max(datetime_valid) as last
|
||||
from exchangerate WHERE crypto_currency = %s AND fiat_currency = %s
|
||||
AND datetime_valid >= %s
|
||||
@@ -28,7 +28,7 @@ class Graph:
|
||||
cursor.execute(sql, [Crypto, Fiat, startDate, Crypto, Fiat])
|
||||
rows = cursor.fetchall()
|
||||
for row in rows:
|
||||
x.append(datetime.datetime.strptime(row[0], '%Y-%m-%d'))
|
||||
x.append(row[0])
|
||||
y.append(row[1])
|
||||
|
||||
if len(x) == 0:
|
||||
@@ -46,7 +46,7 @@ class Graph:
|
||||
marker='o', markerfacecolor='blue', markersize=2)
|
||||
|
||||
loc = plticker.MultipleLocator(base=(len(x)/4.0))
|
||||
ax.xaxis.set_major_locator(loc)
|
||||
#ax.xaxis.set_major_locator(loc)
|
||||
|
||||
ax.set_xlabel("time")
|
||||
ax.set_ylabel(Fiat)
|
||||
@@ -84,7 +84,7 @@ class Graph:
|
||||
marker='o', markerfacecolor='blue', markersize=2)
|
||||
|
||||
loc = plticker.MultipleLocator(base=(len(x)/5.0))
|
||||
ax.xaxis.set_major_locator(loc)
|
||||
#ax.xaxis.set_major_locator(loc)
|
||||
|
||||
ax.set_xlabel("time")
|
||||
ax.set_ylabel(Fiat)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<ul class="tab-nav">
|
||||
<li>
|
||||
<a class="button active" href="#h48{{ c.crypto }}">48 hours</a>
|
||||
<a class="button" href="#h48{{ c.crypto }}">48 hours</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="button" href="#d3{{ c.crypto }}">3 days</a>
|
||||
@@ -68,17 +68,17 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="h48{{ c.crypto }}">
|
||||
<div class="tab-pane" id="h48{{ c.crypto }}">
|
||||
48 hours
|
||||
<img src="/graph?crypto={{ c.crypto }}&fiat=EUR&number_of_hours=48" loading="lazy">
|
||||
</div>
|
||||
<div class="tab-pane" id="d3{{ c.crypto }}">
|
||||
3 days
|
||||
<img src="/graph?crypto={{ c.crypto }}&fiat=EUR&number_of_days=3" loading="lazy">
|
||||
<img src="/graph?crypto={{ c.crypto }}&fiat=EUR&number_of_hours=72" loading="lazy">
|
||||
</div>
|
||||
<div class="tab-pane" id="w1{{ c.crypto }}">
|
||||
1 week
|
||||
<img src="/graph?crypto={{ c.crypto }}&fiat=EUR&number_of_days=7" loading="lazy">
|
||||
<img src="/graph?crypto={{ c.crypto }}&fiat=EUR&number_of_hours=168" loading="lazy">
|
||||
</div>
|
||||
<div class="tab-pane" id="m1{{ c.crypto }}">
|
||||
1 month
|
||||
|
||||
Reference in New Issue
Block a user