Skip to content

Commit

Permalink
Resolved issues with dates - they now display correctly along the x-a…
Browse files Browse the repository at this point in the history
…xis of the chart
  • Loading branch information
kevin-pierce committed Jul 24, 2020
1 parent e192dda commit ceba57a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions commands/deaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,20 @@ module.exports = {

let deathData = [];
let xAxisLabels = [];
// Must refactor dates later

// Format x-axis labels and compile data to be used on graph
for (day in info["deaths"]){
let tempDate = new Date(day);
//xAxisLabels.push((monthArr[tempDate.getMonth().toString()] + tempDate.getDate().toString()));
xAxisLabels.push((tempDate.getDate() + "/" + tempDate.getMonth()).toString());
xAxisLabels.push("\"" + day + "\"");
deathData.push(info["deaths"][`${day}`])
}
console.log(xAxisLabels);
console.log(deathData);

// Create a new embedded message for the bot to display the historic deaths
const historicDeathEmbed = new Discord.MessageEmbed()
.setColor("#990000")
.setTitle("Historic Deaths for Past 30 Days")
.setImage(`https://quickchart.io/chart?c={type:'line',data:{labels:[${xAxisLabels}],datasets:[{label:'Deaths',data:[${deathData}],fill:false,borderColor:"red",pointBackgroundColor:"red"}]}}`)


// for (day in info["deaths"]) {
// botMsg += (day + ": " + info["deaths"][`${day}`] + " \n");
// }
//return message.channel.send(`Here are the statistics for the past 30 days: ${botMsg}`);
return message.channel.send(historicDeathEmbed);
}
}
Expand Down

0 comments on commit ceba57a

Please sign in to comment.