Introduction
Introduction Statistics Contact Development Disclaimer Help
Add a reverse option to the report tag helpers. - reportable - Fork of reportab…
Log
Files
Refs
README
---
commit 42019b02a0cf723dd20b78850cc68a7be2730fe1
parent a634f6e205ca79484228ea21adbf3ad0176f05bb
Author: Dieter Komendera <[email protected]>
Date: Wed, 1 Feb 2012 18:11:16 +0100
Add a reverse option to the report tag helpers.
Diffstat:
M lib/saulabs/reportable/report_tag_… | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/lib/saulabs/reportable/report_tag_helper.rb b/lib/saulabs/reportab…
@@ -37,7 +37,8 @@ module Saulabs
#
def google_report_tag(data, options = {})
options.reverse_merge!(Config.google_options)
- data = data.to_a.collect { |d| d[1] }
+ data = options[:reverse] ? data.to_a.reverse : data.to_a
+ data = data.collect { |d| d[1] }
labels = ''
unless options[:labels].empty?
chxr = {}
@@ -88,13 +89,14 @@ module Saulabs
options.reverse_merge!(Config.raphael_options.slice(:width, :height, :…
options.reverse_merge!(:dom_id => default_dom_id)
raphael_options.reverse_merge!(Config.raphael_options.except(:width, :…
+ data = options[:reverse] ? data.to_a.reverse : data.to_a
%Q{<div id="#{options[:dom_id]}" style="width:#{options[:width]}px;hei…
<script type="text\/javascript" charset="utf-8">
var graph = Raphael('#{options[:dom_id]}');
graph.g.linechart(
-10, 4, #{options[:width]}, #{options[:height]},
- #{(0..data.to_a.size).to_a.to_json},
- #{data.to_a.map { |d| d[1].send(:eval, options[:format]) }.to_json…
+ #{(0..data.size).to_a.to_json},
+ #{data.map { |d| d[1].send(:eval, options[:format]) }.to_json},
#{raphael_options.to_json}
).hover(function() {
this.disc = graph.g.disc(this.x, this.y, 3).attr({fill: "#{options…
@@ -143,10 +145,11 @@ module Saulabs
options.reverse_merge!(Config.flot_options.slice(:width, :height, :for…
options.reverse_merge!(:dom_id => default_dom_id)
flot_options.reverse_merge!(Config.flot_options.except(:width, :height…
+ data = options[:reverse] ? data.to_a.reverse : data.to_a
%Q{<div id="#{options[:dom_id]}" style="width:#{options[:width]}px;hei…
<script type="text\/javascript" charset="utf-8">
$(function() {
- var set = #{data.to_a.map{|d| d[1] }.to_json},
+ var set = #{data.map{|d| d[1] }.to_json},
data = [];
for (var i = 0; i < set.length; i++) {
data.push([i, set[i]]);
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.