about summary refs log tree commit diff stats
path: root/app/views/quotes/stats.html.haml
blob: d7a814059394cfdde2f214ae95017249cde34420 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%script{ :type => "text/javascript", :src => "https://www.gstatic.com/charts/loader.js" }
%script{ :type => "text/javascript" }
    google.charts.load('visualization', '1.0', {'packages':['corechart']});
    google.charts.setOnLoadCallback(drawChart);
    function drawChart()
    {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Month');
    data.addColumn('number', 'Quotes Submitted');
    data.addRows([
    - @months.each do |month|
        ['#{month[:name]}', #{month[:number]}],
    ]);
    var options = {'title':'Quotes Submitted in the Last 12 Months', 'width':1000, 'height':500, 'legend':'none', 'hAxis.maxAlternation':1};
    var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
    chart.draw(data, options);
    //var data2 = new google.visualization.DataTable();
    //data2.addColumn('string', 'Month');
    //data2.addColumn('number', 'Quotes');
    //data2.addRows([
    //- @months2.each do |month|
    //    ['\#{month[:name]}', \#{month[:number]}],
    //]);
    //var options2 = {'title':'Number of Quotes', 'width':1000, 'height':500, 'legend':'none', 'hAxis.maxAlternation':1};
    //var chart2 = new google.visualization.AreaChart(document.getElementById('chart2_div'));
    //chart2.draw(data2, options2);
    var data3 = new google.visualization.DataTable();
    data3.addColumn('string', 'Speaker');
    data3.addColumn('number', 'Quotes');
    data3.addRows([
    - @by_speaker.each do |speaker|
        ['#{speaker[0]}', #{speaker[1]}],
    ]);
    var options3 = {'title':'Number of Quotes per Speaker', 'width':1000, 'height':500};
    var chart3 = new google.visualization.ColumnChart(document.getElementById('chart3_div'));
    chart3.draw(data3, options3);
    }
%p.normal Because charts are fun, we've compiled a few charts here containing statistics about the Four Island Quotes DB.
#chart2_div
#chart_div
#chart3_div