Spaces:
Runtime error
Runtime error
Commit
·
2a2a47f
1
Parent(s):
b1bc81d
Color tweaks
Browse files
app.py
CHANGED
|
@@ -182,10 +182,7 @@ class RequestHandler(SimpleHTTPRequestHandler):
|
|
| 182 |
output['day'] = list(returned_values.keys())[::-1]
|
| 183 |
|
| 184 |
# Trim down to a smaller number of points.
|
| 185 |
-
if len(
|
| 186 |
-
output = {
|
| 187 |
-
k: [v for i, v in enumerate(value) if i % int(len(value) / 100) == 0] for k, value in output.items()
|
| 188 |
-
}
|
| 189 |
|
| 190 |
return self.response(output)
|
| 191 |
|
|
@@ -223,10 +220,9 @@ class RequestHandler(SimpleHTTPRequestHandler):
|
|
| 223 |
output['day'] = list(returned_values.keys())[::-1]
|
| 224 |
|
| 225 |
# Trim down to a smaller number of points.
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
}
|
| 230 |
|
| 231 |
return self.response(output)
|
| 232 |
|
|
|
|
| 182 |
output['day'] = list(returned_values.keys())[::-1]
|
| 183 |
|
| 184 |
# Trim down to a smaller number of points.
|
| 185 |
+
output = {k: [v for i, v in enumerate(value) if i % int(len(value) / 100) == 0] for k, value in output.items()}
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
return self.response(output)
|
| 188 |
|
|
|
|
| 220 |
output['day'] = list(returned_values.keys())[::-1]
|
| 221 |
|
| 222 |
# Trim down to a smaller number of points.
|
| 223 |
+
output = {
|
| 224 |
+
k: [v for i, v in enumerate(value) if i % int(len(value) / 100) == 0] for k, value in output.items()
|
| 225 |
+
}
|
|
|
|
| 226 |
|
| 227 |
return self.response(output)
|
| 228 |
|
index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
document.body.classList.add('dark-theme');
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
const load = () => {
|
| 6 |
const l0 = document.createElement('div')
|
|
@@ -33,8 +39,6 @@ const getCheckedOptions = () => {
|
|
| 33 |
optionsDict[key] = [value]
|
| 34 |
}
|
| 35 |
|
| 36 |
-
console.log('dict', optionsDict)
|
| 37 |
-
|
| 38 |
return optionsDict;
|
| 39 |
}
|
| 40 |
|
|
@@ -47,7 +51,6 @@ const addOption = (category, optionName) => {
|
|
| 47 |
let optionNumber = 0;
|
| 48 |
while (!found && ++optionNumber < 100) {
|
| 49 |
let previousOption = document.getElementById(`${category}-option-${optionNumber}`);
|
| 50 |
-
console.log(previousOption)
|
| 51 |
found = previousOption === null;
|
| 52 |
}
|
| 53 |
|
|
@@ -176,9 +179,8 @@ const retrievePipInstalls = async (libraryNames, options) => {
|
|
| 176 |
const relevantOptions = options['pip']
|
| 177 |
const inferResponse = await fetch(`retrievePipInstalls?input=${libraryNames}&options=${relevantOptions}`);
|
| 178 |
const inferJson = await inferResponse.json();
|
| 179 |
-
const colors = [
|
| 180 |
|
| 181 |
-
console.log(inferJson)
|
| 182 |
const labels = Array.from(inferJson['day']).map(e => new Date(e))
|
| 183 |
const datasets = [];
|
| 184 |
for (const element in inferJson) {
|
|
@@ -227,7 +229,7 @@ const retrieveStars = async (libraryNames, options) => {
|
|
| 227 |
const relevantOptions = options['stars']
|
| 228 |
const inferResponse = await fetch(`retrieveStars?input=${libraryNames}&options=${relevantOptions}`);
|
| 229 |
const inferJson = await inferResponse.json();
|
| 230 |
-
const colors = [
|
| 231 |
|
| 232 |
const labels = Array.from(inferJson['day']).map(e => new Date(e))
|
| 233 |
const datasets = [];
|
|
@@ -278,9 +280,8 @@ const retrieveIssues = async (libraryNames, options) => {
|
|
| 278 |
const relevantOptions = options['issue']
|
| 279 |
const inferResponse = await fetch(`retrieveIssues?input=${libraryNames}&options=${relevantOptions}`);
|
| 280 |
const inferJson = await inferResponse.json();
|
| 281 |
-
const colors = [
|
| 282 |
|
| 283 |
-
console.log(inferJson)
|
| 284 |
const labels = Array.from(inferJson['day']).map(e => new Date(e))
|
| 285 |
const datasets = [];
|
| 286 |
for (const element in inferJson) {
|
|
|
|
| 1 |
+
let dark = document.location.search.includes('dark-theme=true');
|
| 2 |
+
|
| 3 |
+
if (dark)
|
| 4 |
document.body.classList.add('dark-theme');
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
var COLORS = dark ?
|
| 8 |
+
['#FF0000', '#00FF00', '#0000FF', '#FF00FF', '#FFFF00', '#0000FF', '#F090F0', '#90F0F0', '#F0F090'] :
|
| 9 |
+
['#CC0000', '#00CC00', '#0000CC', '#CC00CC', '#CCCC00', '#0000CC', '#C060C0', '#60C0C0', '#C0C060']
|
| 10 |
|
| 11 |
const load = () => {
|
| 12 |
const l0 = document.createElement('div')
|
|
|
|
| 39 |
optionsDict[key] = [value]
|
| 40 |
}
|
| 41 |
|
|
|
|
|
|
|
| 42 |
return optionsDict;
|
| 43 |
}
|
| 44 |
|
|
|
|
| 51 |
let optionNumber = 0;
|
| 52 |
while (!found && ++optionNumber < 100) {
|
| 53 |
let previousOption = document.getElementById(`${category}-option-${optionNumber}`);
|
|
|
|
| 54 |
found = previousOption === null;
|
| 55 |
}
|
| 56 |
|
|
|
|
| 179 |
const relevantOptions = options['pip']
|
| 180 |
const inferResponse = await fetch(`retrievePipInstalls?input=${libraryNames}&options=${relevantOptions}`);
|
| 181 |
const inferJson = await inferResponse.json();
|
| 182 |
+
const colors = [...COLORS];
|
| 183 |
|
|
|
|
| 184 |
const labels = Array.from(inferJson['day']).map(e => new Date(e))
|
| 185 |
const datasets = [];
|
| 186 |
for (const element in inferJson) {
|
|
|
|
| 229 |
const relevantOptions = options['stars']
|
| 230 |
const inferResponse = await fetch(`retrieveStars?input=${libraryNames}&options=${relevantOptions}`);
|
| 231 |
const inferJson = await inferResponse.json();
|
| 232 |
+
const colors = [...COLORS];
|
| 233 |
|
| 234 |
const labels = Array.from(inferJson['day']).map(e => new Date(e))
|
| 235 |
const datasets = [];
|
|
|
|
| 280 |
const relevantOptions = options['issue']
|
| 281 |
const inferResponse = await fetch(`retrieveIssues?input=${libraryNames}&options=${relevantOptions}`);
|
| 282 |
const inferJson = await inferResponse.json();
|
| 283 |
+
const colors = [...COLORS];
|
| 284 |
|
|
|
|
| 285 |
const labels = Array.from(inferJson['day']).map(e => new Date(e))
|
| 286 |
const datasets = [];
|
| 287 |
for (const element in inferJson) {
|