Sha256: 0ced1f9ce5f43d4c176117e3cfcb4ea336f55f9f464f38a40ae2cf5e0fcff492
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 KB
Contents
<%= javascript_include_tag "https://www.google.com/jsapi" %> <script> google.load('visualization', '1', {'packages':['corechart']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); var raw_data = [['<%= chart_legend_name %>', <%= chart_data_s %>]]; var years = [<%= chart_data_x_axis %>]; data.addColumn('string', 'Year'); for (var i = 0; i < raw_data.length; ++i) { data.addColumn('number', raw_data[i][0]); } data.addRows(years.length); for (var j = 0; j < years.length; ++j) { data.setValue(j, 0, years[j].toString()); } for (var i = 0; i < raw_data.length; ++i) { for (var j = 1; j < raw_data[i].length; ++j) { data.setValue(j-1, i+1, raw_data[i][j]); } } // Create and draw the visualization. var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); chart.draw(data, { title: '<%= chart_title %>', width: <%= chart_width %>, height: <%= chart_height %>, hAxis: {title: '<%= chart_h_axis_title %>'}}); } </script>
Version data entries
6 entries across 6 versions & 1 rubygems