Removed needless debug logging

This commit is contained in:
2022-08-22 21:57:25 +02:00
parent 093fa1fb86
commit 487f4b4c90

View File

@@ -9,8 +9,8 @@
<script src="../assets/d3.v7.min.js" charset="utf-8"></script> <script src="../assets/d3.v7.min.js" charset="utf-8"></script>
<style> <style>
* { * {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
sans-serif; sans-serif;
} }
</style> </style>
@@ -26,7 +26,7 @@
</div> </div>
<script> <script>
url = 'https://duolingo.checksch.de/duo_user_info.json'; url = "https://duolingo.checksch.de/duo_user_info.json";
fetch(url) fetch(url)
.then((res) => res.json()) .then((res) => res.json())
@@ -36,15 +36,14 @@
langInfoPrepped = []; langInfoPrepped = [];
Object.entries(langInfo).forEach((el) => { Object.entries(langInfo).forEach((el) => {
item = {}; item = {};
item['name'] = el[1].learningLanguage; item["name"] = el[1].learningLanguage;
item['count'] = el[1].xp; item["count"] = el[1].xp;
// Filter irrelevant items // Filter irrelevant items
if (item['count'] > 500) { if (item["count"] > 500) {
langInfoPrepped.push(item); langInfoPrepped.push(item);
} }
}); });
console.log(langInfoPrepped);
const fn = (d) => d.count; const fn = (d) => d.count;
const data = d3.pie().value(fn)(langInfoPrepped); const data = d3.pie().value(fn)(langInfoPrepped);
@@ -57,35 +56,35 @@
.padAngle(2 / 300) .padAngle(2 / 300)
.cornerRadius(8); .cornerRadius(8);
const js = d3.select('#js'); const js = d3.select("#js");
js.select('.loading').remove(); js.select(".loading").remove();
const svg = js const svg = js
.append('svg') .append("svg")
.attr('viewBox', '-320 -320 640 640') .attr("viewBox", "-320 -320 640 640")
.attr('width', '400') .attr("width", "400")
.attr('height', '400'); .attr("height", "400");
for (const d of data) { for (const d of data) {
svg.append('path').style('fill', 'rebeccapurple').attr('d', arc(d)); svg.append("path").style("fill", "rebeccapurple").attr("d", arc(d));
const text = svg const text = svg
.append('text') .append("text")
.style('fill', 'white') .style("fill", "white")
.attr('transform', `translate(${arc.centroid(d).join(',')})`) .attr("transform", `translate(${arc.centroid(d).join(",")})`)
.attr('text-anchor', 'middle'); .attr("text-anchor", "middle");
text text
.append('tspan') .append("tspan")
.style('font-size', '24') .style("font-size", "24")
.attr('x', '0') .attr("x", "0")
.text(d.data.name); .text(d.data.name);
text text
.append('tspan') .append("tspan")
.style('font-size', '18') .style("font-size", "18")
.attr('x', '0') .attr("x", "0")
.attr('dy', '1.3em') .attr("dy", "1.3em")
.text(d.value); .text(d.value);
} }
}) })