diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-21 16:22:01 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-21 16:22:01 -0400 |
commit | a9a078a7f4a7a0a9c4e57c02f66722f4d6c1cec6 (patch) | |
tree | ca97ab63790afd99bd5f24da4e3aa2fe026a0a6f /app/views/quotes/stats.html.haml | |
parent | 491783a28a26739062f5cda29a028bd1166617cb (diff) | |
download | thoughts-a9a078a7f4a7a0a9c4e57c02f66722f4d6c1cec6.tar.gz thoughts-a9a078a7f4a7a0a9c4e57c02f66722f4d6c1cec6.tar.bz2 thoughts-a9a078a7f4a7a0a9c4e57c02f66722f4d6c1cec6.zip |
Added quotes stats page
Diffstat (limited to 'app/views/quotes/stats.html.haml')
-rw-r--r-- | app/views/quotes/stats.html.haml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/views/quotes/stats.html.haml b/app/views/quotes/stats.html.haml new file mode 100644 index 0000000..d7a8140 --- /dev/null +++ b/app/views/quotes/stats.html.haml | |||
@@ -0,0 +1,41 @@ | |||
1 | %script{ :type => "text/javascript", :src => "https://www.gstatic.com/charts/loader.js" } | ||
2 | %script{ :type => "text/javascript" } | ||
3 | google.charts.load('visualization', '1.0', {'packages':['corechart']}); | ||
4 | google.charts.setOnLoadCallback(drawChart); | ||
5 | function drawChart() | ||
6 | { | ||
7 | var data = new google.visualization.DataTable(); | ||
8 | data.addColumn('string', 'Month'); | ||
9 | data.addColumn('number', 'Quotes Submitted'); | ||
10 | data.addRows([ | ||
11 | - @months.each do |month| | ||
12 | ['#{month[:name]}', #{month[:number]}], | ||
13 | ]); | ||
14 | var options = {'title':'Quotes Submitted in the Last 12 Months', 'width':1000, 'height':500, 'legend':'none', 'hAxis.maxAlternation':1}; | ||
15 | var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); | ||
16 | chart.draw(data, options); | ||
17 | //var data2 = new google.visualization.DataTable(); | ||
18 | //data2.addColumn('string', 'Month'); | ||
19 | //data2.addColumn('number', 'Quotes'); | ||
20 | //data2.addRows([ | ||
21 | //- @months2.each do |month| | ||
22 | // ['\#{month[:name]}', \#{month[:number]}], | ||
23 | //]); | ||
24 | //var options2 = {'title':'Number of Quotes', 'width':1000, 'height':500, 'legend':'none', 'hAxis.maxAlternation':1}; | ||
25 | //var chart2 = new google.visualization.AreaChart(document.getElementById('chart2_div')); | ||
26 | //chart2.draw(data2, options2); | ||
27 | var data3 = new google.visualization.DataTable(); | ||
28 | data3.addColumn('string', 'Speaker'); | ||
29 | data3.addColumn('number', 'Quotes'); | ||
30 | data3.addRows([ | ||
31 | - @by_speaker.each do |speaker| | ||
32 | ['#{speaker[0]}', #{speaker[1]}], | ||
33 | ]); | ||
34 | var options3 = {'title':'Number of Quotes per Speaker', 'width':1000, 'height':500}; | ||
35 | var chart3 = new google.visualization.ColumnChart(document.getElementById('chart3_div')); | ||
36 | chart3.draw(data3, options3); | ||
37 | } | ||
38 | %p.normal Because charts are fun, we've compiled a few charts here containing statistics about the Four Island Quotes DB. | ||
39 | #chart2_div | ||
40 | #chart_div | ||
41 | #chart3_div | ||