From 6702ac818a750cb4f09f809b33f2755f1e02b2f7 Mon Sep 17 00:00:00 2001 From: Aryan Kothari <87589047+thearyadev@users.noreply.github.com> Date: Fri, 10 Nov 2023 15:26:18 -0500 Subject: [PATCH] Add # Entires to Charts (#42) * Add # Entries to each chart --- static/js/season.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/season.js b/static/js/season.js index c8dc6c9b..8a9c72ef 100644 --- a/static/js/season.js +++ b/static/js/season.js @@ -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 @@ -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 } @@ -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(`
Mean: ${stats?.mean} | Variance: ${stats?.variance} | Standard Deviation: ${stats?.standard_deviation}
`) + graphContainer.append(`Mean: ${stats?.mean} | Variance: ${stats?.variance} | Standard Deviation: ${stats?.standard_deviation} | # Entires: ${countSum}
`) } window.addEventListener('resize', function () { // redraw charts on resize