FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
top-github-users/docs/javascript/graph.js at main · kyawsoe-dev/top-github-users · GitHub
kyawsoe-dev
/
top-github-users
Public
forked from
gayanvoice/top-github-users
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
top-github-users
/
docs
/
javascript
/
graph.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
54 lines (54 loc) · 1.94 KB
Breadcrumbs
top-github-users
/
docs
/
javascript
/
graph.js
Copy path
File metadata and controls
54 lines (54 loc) · 1.94 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
let
graph
=
function
(
)
{
let
setValue
=
function
(
rankingJsonFile
,
countryName
)
{
let
country
=
rankingJsonFile
.
ranking
.
find
(
o
=>
o
.
name
===
countryName
)
;
if
(
country
===
undefined
)
{
return
0
}
else
{
return
country
.
value
}
}
let
getRankingJsonFile
=
async
function
(
)
{
const
rankingJsonFilePath
=
`ranking.json`
;
return
await
fetch
(
rankingJsonFilePath
)
.
then
(
response
=>
response
.
json
(
)
)
;
}
let
getCountriesJsonFile
=
async
function
(
)
{
const
rankingJsonFilePath
=
`./json/countries-50m.json`
;
return
fetch
(
rankingJsonFilePath
)
.
then
(
response
=>
response
.
json
(
)
)
;
}
let
main
=
async
function
(
)
{
const
rankingJsonFile
=
await
getRankingJsonFile
(
)
;
const
countriesJsonFile
=
await
getCountriesJsonFile
(
)
;
const
countriesArray
=
ChartGeo
.
topojson
.
feature
(
countriesJsonFile
,
countriesJsonFile
.
objects
.
countries
)
.
features
;
new
Chart
(
document
.
getElementById
(
"canvas"
)
.
getContext
(
"2d"
)
,
{
type
:
'choropleth'
,
data
:
{
labels
:
countriesArray
.
map
(
(
d
)
=>
d
.
properties
.
name
)
,
datasets
:
[
{
label
:
'Countries'
,
data
:
countriesArray
.
map
(
(
d
)
=>
(
{
feature
:
d
,
value
:
setValue
(
rankingJsonFile
,
d
.
properties
.
name
)
}
)
)
,
}
]
}
,
options
:
{
showOutline
:
true
,
showGraticule
:
true
,
plugins
:
{
legend
:
{
display
:
false
}
,
}
,
scales
:
{
xy
:
{
projection
:
'equalEarth'
}
}
}
}
)
;
}
return
{
main
:
main
,
}
;
}
(
)
;
graph
.
main
(
)
.
then
(
(
)
=>
{
}
)
;
Back
|
FazBrowse Home
|
New Git URL