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