-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
82 lines (76 loc) · 1.8 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
(async function () {
const response = await fetch(
"https://github.com/gitapi/search/repositories?q=stars%3A%3E10000+data-visualization&sort=stars&order=desc"
);
const json = await response.json();
const repositories = json.items;
const filterRepos = repositories.filter(
(repo) =>
![
"GitHub-Chinese-Top-Charts",
"helm",
"data-science",
"umami",
"tui.editor",
"charts",
"analytics",
"sampler",
"netdata",
"pixijs",
"metabase",
"directus",
"awesome-datascience",
"Data-Science-For-Beginners",
"awesome-creative-coding",
"best-of-ml-python",
"awesome-bigdata",
].includes(repo.name)
);
const repos = filterRepos.map((repository) => ({
name: repository.name,
stars: repository.stargazers_count,
}));
console.log("repositories: ", repositories);
var chartDom = document.querySelector("div.diagram");
if (chartDom === null) {
throw new Error("div.diagram not found");
}
var myChart = echarts.init(chartDom, "dark");
var option = {
grid: {
top: 10,
bottom: 50,
left: 200,
right: 30,
},
axisLabel: {
color: "white",
},
yAxis: {
type: "category",
data: repos.map((r) => r.name).reverse(),
},
xAxis: {
type: "value",
},
series: [
{
data: repos.map((r) => r.stars).reverse(),
type: "bar",
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
},
label: {
show: true,
precision: 1,
position: "right",
color: "white",
Fontweight: "bold",
fontFamily: "monospace",
},
},
],
};
myChart.setOption(option);
})();