<html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.3.2/echarts.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<div id="main"></div>
</body>
</html>
xxxxxxxxxx
#main {
width: 600px;
height: 400px;
border: 1px solid red;
}
xxxxxxxxxx
var container = document.getElementById('main');
var chart = echarts.init(container);
var baseUrl = 'https://oss.x-lab.info/open_digger/github/';
var repoName = 'X-lab2017/open-digger';
$.getJSON(`${baseUrl}${repoName}/participants.json`, participants => {
$.getJSON(`${baseUrl}${repoName}/new_contributors.json`, newContributors => {
$.getJSON(`${baseUrl}${repoName}/inactive_contributors.json`, inactiveContributors => {
var keys = Object.keys(participants).filter(k => k.length === 7);
chart.setOption({
title: { text: `Developer status for ${repoName}`, left: 'center', top: 'bottom' },
xAxis: {
type: 'category',
data: keys,
},
yAxis: { type: 'value' },
legend: { data: ['participants', 'newContributors', 'inactiveContributors'] },
series: [{
name: 'participants',
type: 'line',
smooth: 'true',
data: Object.values(participants),
}, {
name: 'newContributors',
type: 'bar',
data: keys.map(k => newContributors[k] ?? 0),
}, {
name: 'inactiveContributors',
type: 'bar',
data: keys.map(k => -inactiveContributors[k] ?? 0),
}],
});
})
})
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.