Skip to content

Commit

Permalink
Add # Entires to Charts (#42)
Browse files Browse the repository at this point in the history
* Add # Entries to each chart
  • Loading branch information
thearyadev authored Nov 10, 2023
1 parent dcb7ab2 commit 6702ac8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions static/js/season.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function drawChart(value) {
styles.push(...styles)
styles.push(...styles)


let countSum = 0;
const graphContainer = $(`#${value}`) // get the graph container of the current iter
const graphData = graphContainer.data().graphdata // get the graph data from the container
const stats = graphData.statistic // get the stats from the graph data
Expand All @@ -48,6 +48,7 @@ function drawChart(value) {
]
for (var i = 0; i < graphData.graph.length; i++) {
let current = graphData.graph[i]
countSum += current.count
table.push([current.hero, stats.mean, stats.standard_deviation, current.count, styles[i]]) // push to table
}

Expand Down Expand Up @@ -78,7 +79,7 @@ function drawChart(value) {
var chart = new google.visualization.ComboChart(document.getElementById(value)); // draw chart
chart.draw(data, options);
// add stats to the bottom
graphContainer.append(`<p class='small text-muted'><small>Mean: ${stats?.mean} | Variance: ${stats?.variance} | Standard Deviation: ${stats?.standard_deviation}</small></p>`)
graphContainer.append(`<p class='small text-muted'><small>Mean: ${stats?.mean} | Variance: ${stats?.variance} | Standard Deviation: ${stats?.standard_deviation} | # Entires: ${countSum}</small></p>`)
}

window.addEventListener('resize', function () { // redraw charts on resize
Expand Down

0 comments on commit 6702ac8

Please sign in to comment.