Created line and bar multi chart for games over time
This commit is contained in:
parent
06e1599461
commit
41441db75d
1 changed files with 14 additions and 5 deletions
|
|
@ -140,20 +140,29 @@ async function loadStatistics(){
|
||||||
const overtimechart = document.getElementById("overtimechart")
|
const overtimechart = document.getElementById("overtimechart")
|
||||||
|
|
||||||
games_over_time_statistic = await makeRequest(api_url + '/statistics/amount_of_games_over_time?day_step=30')
|
games_over_time_statistic = await makeRequest(api_url + '/statistics/amount_of_games_over_time?day_step=30')
|
||||||
|
games_over_time_statistic_no_expanions = await makeRequest(api_url + '/statistics/amount_of_games_over_time?day_step=30&filter_expansions_out=true')
|
||||||
console.log(games_over_time_statistic)
|
games_over_time_statistic_only_expanions = await makeRequest(api_url + '/statistics/amount_of_games_over_time?day_step=30&only_expansions=true')
|
||||||
console.log(Object.keys(games_over_time_statistic.result))
|
|
||||||
console.log(Object.values(games_over_time_statistic.result))
|
|
||||||
|
|
||||||
new Chart(overtimechart, {
|
new Chart(overtimechart, {
|
||||||
type: 'line',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
labels: Object.keys(games_over_time_statistic.result),
|
labels: Object.keys(games_over_time_statistic.result),
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: games_over_time_statistic.name,
|
label: games_over_time_statistic.name,
|
||||||
data: Object.values(games_over_time_statistic.result),
|
data: Object.values(games_over_time_statistic.result),
|
||||||
|
borderWidth: 1,
|
||||||
|
type: 'line'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Base games",
|
||||||
|
data: Object.values(games_over_time_statistic_no_expanions.result),
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Expansions",
|
||||||
|
data: Object.values(games_over_time_statistic_only_expanions.result),
|
||||||
|
borderWidth: 1
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue