Commit 924e1f841c1d47acee7bdb790761cd8f46640a6e
Committed by
Paulo Meireles
1 parent
ecf44598
Exists in
master
and in
28 other branches
[Mezuro] Google chart helper added to content viewer.
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
| 1 | +require 'googlecharts' | |
| 2 | + | |
| 1 | 3 | class MezuroPlugin::Helpers::ContentViewerHelper |
| 2 | 4 | def self.format_grade(grade) |
| 3 | 5 | sprintf("%.2f", grade.to_f) |
| ... | ... | @@ -6,4 +8,14 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
| 6 | 8 | def self.create_periodicity_options |
| 7 | 9 | [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweeky", 15], ["Monthly", 30]] |
| 8 | 10 | end |
| 11 | + | |
| 12 | + def self.generate_chart(values) | |
| 13 | + Gchart.line( | |
| 14 | + :title_color => 'FF0000', | |
| 15 | + :size => '700x180', | |
| 16 | + :bg => {:color => 'efefef', :type => 'stripes'}, | |
| 17 | + :line_colors => 'c4a000', | |
| 18 | + :data => values, | |
| 19 | + :axis_with_labels => 'y') | |
| 20 | + end | |
| 9 | 21 | end | ... | ... |