merge all streamers - only 1 color for the moment
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -30,6 +31,23 @@ def read_json(streamer):
|
||||
)
|
||||
|
||||
|
||||
def json_all():
|
||||
path = Settings.analytics_path
|
||||
return Response(
|
||||
json.dumps(
|
||||
[
|
||||
{
|
||||
"name": streamer.strip(".json"),
|
||||
"data": json.load(open(os.path.join(path, streamer))),
|
||||
}
|
||||
for streamer in streamers_available()
|
||||
]
|
||||
),
|
||||
status=200,
|
||||
mimetype="application/json",
|
||||
)
|
||||
|
||||
|
||||
def index(refresh=5):
|
||||
return render_template(
|
||||
"charts.html",
|
||||
@@ -53,6 +71,7 @@ class AnalyticsServer(Thread):
|
||||
)
|
||||
self.app.add_url_rule("/", "index", index, defaults={"refresh": refresh})
|
||||
self.app.add_url_rule("/json/<string:streamer>", "json", read_json)
|
||||
self.app.add_url_rule("/json_all", "json_all", json_all)
|
||||
|
||||
def run(self):
|
||||
logger.info(
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
flex-grow: 0px;
|
||||
}
|
||||
.tabs {
|
||||
margin-top: 20px;
|
||||
|
||||
max-height: 425px;
|
||||
overflow-y: auto;
|
||||
direction: rtl;
|
||||
@@ -57,36 +55,34 @@
|
||||
<br>
|
||||
|
||||
<div class="columns">
|
||||
<div class="column"></div>
|
||||
<div class="column is-3" style="text-align: right;">
|
||||
<label class="checkbox" style="padding-left: 15px;">
|
||||
Annotations
|
||||
<input type="checkbox" checked="true" id="annotations">
|
||||
</label>
|
||||
<label class="checkbox" style="padding-left: 15px;">
|
||||
Dark mode
|
||||
<input type="checkbox" checked="true" id="dark-mode">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column is-2">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li onCLick="getAllStreamersData()"><a>★ [All Streamers]</a></li>
|
||||
{% for streamer in streamers.split(',')|sort %}
|
||||
<li onClick="changeStreamer('{{ streamer }}', {{ loop.index }})"><a>{{ streamer.replace(".json", "") }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div style="text-align: right;">
|
||||
<label class="checkbox" style="padding-left: 15px;">
|
||||
Annotations
|
||||
<input type="checkbox" checked="true" id="annotations">
|
||||
</label>
|
||||
<label class="checkbox" style="padding-left: 15px;">
|
||||
Dark mode
|
||||
<input type="checkbox" checked="true" id="dark-mode">
|
||||
</label>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column is-2">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% for streamer in streamers.split(',')|sort %}
|
||||
<li onClick="changeStreamer('{{ streamer }}', {{ loop.index }})"><a>{{ streamer.replace(".json", "") }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="box" id="chart" style="padding: 0.30rem; margin-top: 15px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box" id="chart" style="padding: 0.30rem;></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <hr style="margin: 1.2rem 0;"> -->
|
||||
<div style="text-align: center">If you want to help on this project, please leave a star 🌟 and share it with your friends! 😎 - A coffee is always a gesture of LOVE ❤️
|
||||
<a href="https://www.buymeacoffee.com/tkdalex" target="_blank">
|
||||
<img style="margin-bottom: -8px; margin-left: 10px;" src="https://cdn.buymeacoffee.com/buttons/lato-yellow.png" alt="Buy Me A Coffee" height="5" width="138">
|
||||
@@ -207,6 +203,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
function getAllStreamersData(){
|
||||
$.getJSON(`./json_all`, function (response) {apexcharts:6 It is a possibility that you may have not included 'data' property in series.
|
||||
for(var i in response){
|
||||
chart.appendSeries({
|
||||
name: response[i]["name"].replace(".json", ""),
|
||||
data: response[i]["data"]["series"]
|
||||
}, true)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateAnnotations() {
|
||||
if($('#annotations').prop("checked") === true){
|
||||
clearAnnotations()
|
||||
|
||||
Reference in New Issue
Block a user