how_are_we_doing 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/app/controllers/reports_controller.rb +1 -52
  2. data/app/helpers/reports_helper.rb +30 -4
  3. data/app/models/print.rb +1 -29
  4. data/app/models/share.rb +3 -29
  5. data/app/models/total.rb +2 -21
  6. data/app/models/view.rb +1 -29
  7. data/app/views/reports/_bar_graph.html.erb +48 -0
  8. data/app/views/reports/_line_graph.html.erb +40 -0
  9. data/app/views/reports/_recent_bar_graph.html.erb +41 -0
  10. data/app/views/reports/index.html.erb +12 -22
  11. data/config/locales/en.yml +16 -0
  12. data/lib/generators/how_are_we_doing/install/install_generator.rb +1 -0
  13. data/lib/generators/how_are_we_doing/install/templates/public/images/hawd/blank.png +0 -0
  14. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/API.txt +85 -68
  15. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/FAQ.txt +0 -0
  16. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/NEWS.txt +12 -32
  17. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/PLUGINS.txt +0 -0
  18. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/README.txt +3 -3
  19. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/excanvas.js +160 -663
  20. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/excanvas.min.js +1 -1
  21. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.crosshair.js +12 -51
  22. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.image.js +0 -0
  23. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.js +509 -155
  24. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.navigate.js +0 -1
  25. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.stack.js +0 -0
  26. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.flot.threshold.js +0 -0
  27. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/flot/jquery.js +0 -0
  28. data/lib/generators/how_are_we_doing/install/templates/public/javascripts/how_are_we_doing.js +50 -8
  29. data/lib/how_are_we_doing/acts_as_analytical.rb +98 -0
  30. data/lib/{acts_as_printable.rb → how_are_we_doing/acts_as_printable.rb} +0 -0
  31. data/lib/{acts_as_shareable.rb → how_are_we_doing/acts_as_shareable.rb} +0 -0
  32. data/lib/{acts_as_totalable.rb → how_are_we_doing/acts_as_totalable.rb} +0 -0
  33. data/lib/{acts_as_viewable.rb → how_are_we_doing/acts_as_viewable.rb} +0 -0
  34. data/lib/how_are_we_doing/controllers/reports_helpers.rb +92 -0
  35. data/lib/how_are_we_doing/version.rb +1 -1
  36. data/lib/how_are_we_doing.rb +16 -8
  37. metadata +13 -6
@@ -166,6 +166,8 @@ If you want the legend to appear somewhere else in the DOM, you can
166
166
  specify "container" as a jQuery object/expression to put the legend
167
167
  table into. The "position" and "margin" etc. options will then be
168
168
  ignored. Note that Flot will overwrite the contents of the container.
169
+ Most of the above settings do not apply
170
+
169
171
 
170
172
 
171
173
  Customizing the axes
@@ -176,13 +178,9 @@ Customizing the axes
176
178
  min: null or number
177
179
  max: null or number
178
180
  autoscaleMargin: null or number
179
-
180
181
  labelWidth: null or number
181
182
  labelHeight: null or number
182
183
 
183
- transform: null or fn: number -> number
184
- inverseTransform: null or fn: number -> number
185
-
186
184
  ticks: null or number or ticks array or (fn: range -> ticks array)
187
185
  tickSize: number or array
188
186
  minTickSize: number or array
@@ -210,29 +208,6 @@ nearest whole tick. The default value is "null" for the x axis and
210
208
  labels in pixels. They're useful in case you need to align several
211
209
  plots.
212
210
 
213
- "transform" and "inverseTransform" are callbacks you can put in to
214
- change the way the data is drawn. You can design a function to
215
- compress or expand certain parts of the axis non-linearly, e.g.
216
- suppress weekends or compress far away points with a logarithm or some
217
- other means. When Flot draws the plot, each value is first put through
218
- the transform function. Here's an example, the x axis can be turned
219
- into a natural logarithm axis with the following code:
220
-
221
- xaxis: {
222
- transform: function (v) { return Math.log(v); },
223
- inverseTransform: function (v) { return Math.exp(v); }
224
- }
225
-
226
- Note that for finding extrema, Flot assumes that the transform
227
- function does not reorder values (monotonicity is assumed).
228
-
229
- The inverseTransform is simply the inverse of the transform function
230
- (so v == inverseTransform(transform(v)) for all relevant v). It is
231
- required for converting from canvas coordinates to data coordinates,
232
- e.g. for a mouse interaction where a certain pixel is clicked. If you
233
- don't use any interactive features of Flot, you may not need it.
234
-
235
-
236
211
  The rest of the options deal with the ticks.
237
212
 
238
213
  If you don't specify any ticks, a tick generator algorithm will make
@@ -309,6 +284,7 @@ an example of a custom formatter:
309
284
  return val.toFixed(axis.tickDecimals) + " B";
310
285
  }
311
286
 
287
+
312
288
  Time series data
313
289
  ================
314
290
 
@@ -379,7 +355,6 @@ through the following axis options:
379
355
  minTickSize: array
380
356
  timeformat: null or format string
381
357
  monthNames: null or array of size 12 of strings
382
- twelveHourClock: boolean
383
358
 
384
359
  Here "timeformat" is a format string to use. You might use it like
385
360
  this:
@@ -392,25 +367,20 @@ this:
392
367
  This will result in tick labels like "2000/12/24". The following
393
368
  specifiers are supported
394
369
 
395
- %h: hours
396
- %H: hours (left-padded with a zero)
397
- %M: minutes (left-padded with a zero)
398
- %S: seconds (left-padded with a zero)
399
- %d: day of month (1-31)
400
- %m: month (1-12)
401
- %y: year (four digits)
402
- %b: month name (customizable)
403
- %p: am/pm, additionally switches %h/%H to 12 hour instead of 24
404
- %P: AM/PM (uppercase version of %p)
370
+ %h': hours
371
+ %H': hours (left-padded with a zero)
372
+ %M': minutes (left-padded with a zero)
373
+ %S': seconds (left-padded with a zero)
374
+ %d': day of month (1-31)
375
+ %m': month (1-12)
376
+ %y': year (four digits)
377
+ %b': month name (customizable)
405
378
 
406
379
  You can customize the month names with the "monthNames" option. For
407
380
  instance, for Danish you might specify:
408
381
 
409
382
  monthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]
410
383
 
411
- If you set "twelveHourClock" to true, the autogenerated timestamps
412
- will use 12 hour AM/PM timestamps instead of 24 hour.
413
-
414
384
  The format string and month names are used by a very simple built-in
415
385
  format function that takes a date object, a format string (and
416
386
  optionally an array of month names) and returns the formatted string.
@@ -665,6 +635,39 @@ can set "hoverable" and "clickable" to false in the options for that
665
635
  series, like this { data: [...], label: "Foo", clickable: false }.
666
636
 
667
637
 
638
+ Customizing the selection
639
+ =========================
640
+
641
+ selection: {
642
+ mode: null or "x" or "y" or "xy",
643
+ color: color
644
+ }
645
+
646
+ You enable selection support by setting the mode to one of "x", "y" or
647
+ "xy". In "x" mode, the user will only be able to specify the x range,
648
+ similarly for "y" mode. For "xy", the selection becomes a rectangle
649
+ where both ranges can be specified. "color" is color of the selection.
650
+
651
+ When selection support is enabled, a "plotselected" event will be emitted
652
+ on the DOM element you passed into the plot function. The event
653
+ handler gets one extra parameter with the ranges selected on the axes,
654
+ like this:
655
+
656
+ placeholder.bind("plotselected", function(event, ranges) {
657
+ alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)
658
+ // similar for yaxis, secondary axes are in x2axis
659
+ // and y2axis if present
660
+ });
661
+
662
+ The "plotselected" event is only fired when the user has finished
663
+ making the selection. A "plotselecting" event is fired during the
664
+ process with the same parameters as the "plotselected" event, in case
665
+ you want to know what's happening while it's happening,
666
+
667
+ A "plotunselected" event with no arguments is emitted when the user
668
+ clicks the mouse to remove the selection.
669
+
670
+
668
671
  Specifying gradients
669
672
  ====================
670
673
 
@@ -683,18 +686,10 @@ For the series you can specify the gradient as an object that
683
686
  specifies the scaling of the brightness and the opacity of the series
684
687
  color, e.g.
685
688
 
686
- { colors: [{ opacity: 0.8 }, { brightness: 0.6, opacity: 0.8 } ] }
689
+ { colors: [{ opacity: 0.8 }, { brightness: 0.6, opacity: 0.8 } ]
687
690
 
688
691
  where the first color simply has its alpha scaled, whereas the second
689
- is also darkened. For instance, for bars the following makes the bars
690
- gradually disappear, without outline:
691
-
692
- bars: {
693
- show: true,
694
- lineWidth: 0,
695
- fill: true,
696
- fillColor: { colors: [ { opacity: 0.8 }, { opacity: 0.1 } ] }
697
- }
692
+ is also darkened.
698
693
 
699
694
  Flot currently only supports vertical gradients drawn from top to
700
695
  bottom because that's what works with IE.
@@ -706,6 +701,34 @@ Plot Methods
706
701
  The Plot object returned from the plot function has some methods you
707
702
  can call:
708
703
 
704
+ - setSelection(ranges, preventEvent)
705
+
706
+ Set the selection rectangle. The passed in ranges is on the same
707
+ form as returned in the "plotselected" event. If the selection
708
+ mode is "x", you should put in either an xaxis (or x2axis) object,
709
+ if the mode is "y" you need to put in an yaxis (or y2axis) object
710
+ and both xaxis/x2axis and yaxis/y2axis if the selection mode is
711
+ "xy", like this:
712
+
713
+ setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });
714
+
715
+ setSelection will trigger the "plotselected" event when called. If
716
+ you don't want that to happen, e.g. if you're inside a
717
+ "plotselected" handler, pass true as the second parameter.
718
+
719
+
720
+ - clearSelection(preventEvent)
721
+
722
+ Clear the selection rectangle. Pass in true to avoid getting a
723
+ "plotunselected" event.
724
+
725
+ - getSelection()
726
+
727
+ Returns the current selection in the same format as the
728
+ "plotselected" event. If there's currently no selection, it
729
+ returns null.
730
+
731
+
709
732
  - highlight(series, datapoint)
710
733
 
711
734
  Highlight a specific datapoint in the data series. You can either
@@ -754,7 +777,7 @@ can call:
754
777
  - triggerRedrawOverlay()
755
778
 
756
779
  Schedules an update of an overlay canvas used for drawing
757
- interactive things like a selection and point highlights. This
780
+ interactive things like the selection and point highlights. This
758
781
  is mostly useful for writing plugins. The redraw doesn't happen
759
782
  immediately, instead a timer is set to catch multiple successive
760
783
  redraws (e.g. from a mousemove).
@@ -866,23 +889,18 @@ Here's an overview of the phases Flot goes through:
866
889
 
867
890
  7. Responding to events, if any
868
891
 
869
- Each hook is simply a function which is put in the appropriate array.
870
- You can add them through the "hooks" option, and they are also available
871
- after the plot is constructed as the "hooks" attribute on the returned
872
- plot object, e.g.
892
+ The hooks are simple arrays. They are available on the "hooks"
893
+ sub-object on the Plot object with the names mentioned below, e.g.
873
894
 
874
- // define a simple draw hook
875
- function hellohook(plot, canvascontext) { alert("hello!"); };
895
+ var plot = $.plot(...);
876
896
 
877
- // pass it in, in an array since we might want to specify several
878
- var plot = $.plot(placeholder, data, { hooks: { draw: [hellohook] } });
897
+ function f(plot, series, datapoints) { alert("hello!")};
898
+
899
+ plot.hooks.processDatapoints.push(f);
879
900
 
880
- // we can now find it again in plot.hooks.draw[0] unless a plugin
881
- // has added other hooks
901
+ All hooks get the plot object as first parameter.
882
902
 
883
- The available hooks are described below. All hook callbacks get the
884
- plot object as first parameter. You can find some examples of defined
885
- hooks in the plugins bundled with Flot.
903
+ Currently available hooks (when in doubt, check the Flot source):
886
904
 
887
905
  - processOptions [phase 1]
888
906
 
@@ -1007,7 +1025,7 @@ Plugins extend the functionality of Flot. To use a plugin, simply
1007
1025
  include its Javascript file after Flot in the HTML page.
1008
1026
 
1009
1027
  If you're worried about download size/latency, you can concatenate all
1010
- the plugins you use, and Flot itself for that matter, into one big file
1028
+ the plugins you use and Flot itself for that matter into one big file
1011
1029
  (make sure you get the order right), then optionally run it through a
1012
1030
  Javascript minifier such as YUI Compressor.
1013
1031
 
@@ -1020,5 +1038,4 @@ from its "option" attribute. The init function gets a reference to the
1020
1038
  plot object created and uses this to register hooks and add new public
1021
1039
  methods if needed.
1022
1040
 
1023
- See the PLUGINS.txt file for details on how to write a plugin. As the
1024
- above description hints, it's actually pretty easy.
1041
+ See the PLUGINS.txt file for details on how to write a plugin.
@@ -1,32 +1,26 @@
1
- Flot 0.6
1
+ Flot 0.x
2
2
  --------
3
3
 
4
4
  API changes:
5
5
 
6
- 1. Selection support has been moved to a plugin. Thus if you're
7
- passing selection: { mode: something }, you MUST include the file
8
- jquery.flot.selection.js after jquery.flot.js. This reduces the size
9
- of base Flot and makes it easier to customize the selection as well as
10
- improving code clarity. The change is based on patch from andershol.
11
-
12
- 2. In the global options specified in the $.plot command,
6
+ 1. In the global options specified in the $.plot command,
13
7
  "lines", "points", "bars" and "shadowSize" have been moved to a
14
8
  sub-object called "series", i.e.
15
9
 
16
10
  $.plot(placeholder, data, { lines: { show: true }})
17
11
 
18
- should be changed to
12
+ becomes
19
13
 
20
14
  $.plot(placeholder, data, { series: { lines: { show: true }}})
21
15
 
22
16
  All future series-specific options will go into this sub-object to
23
- simplify plugin writing. Backward-compatibility code is in place, so
24
- old code should not break.
17
+ simplify plugin writing. Backward-compatibility hooks are in place,
18
+ so old code should not break.
25
19
 
26
- 3. "plothover" no longer provides the original data point, but instead
20
+ 2. "plothover" no longer provides the original data point, but instead
27
21
  a normalized one, since there may be no corresponding original point.
28
22
 
29
- 4. Due to a bug in previous versions of jQuery, you now need at least
23
+ 3. Due to a bug in previous versions of jQuery, you now need at least
30
24
  jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some
31
25
  improvements in event handling speed.
32
26
 
@@ -91,9 +85,9 @@ Changes:
91
85
  offset within the placeholder.
92
86
 
93
87
  - Plugin system: register an init method in the $.flot.plugins array
94
- to get started, see PLUGINS.txt for details on how to write plugins
95
- (it's easy). There are also some extra methods to enable access to
96
- internal state.
88
+ to get started, see PLUGINS.txt for details on how to write plugins.
89
+ There are also some extra methods to enable access to internal
90
+ state.
97
91
 
98
92
  - Hooks: you can register functions that are called while Flot is
99
93
  crunching the data and doing the plot. This can be used to modify
@@ -117,16 +111,7 @@ Changes:
117
111
 
118
112
  - More configurable grid.
119
113
 
120
- - Axis transformation support, useful for non-linear plots, e.g. log
121
- axes and compressed time axes (like omitting weekends).
122
-
123
- - Support for twelve-hour date formatting (patch by Forrest Aldridge).
124
-
125
- - The color parsing code in Flot has been cleaned up and split out so
126
- it's now available as a separate jQuery plugin. It's included inline
127
- in the Flot source to make dependency managing easier. This also
128
- makes it really easy to use the color helpers in Flot plugins.
129
-
114
+
130
115
  Bug fixes:
131
116
 
132
117
  - Fixed two corner-case bugs when drawing filled curves (report and
@@ -141,7 +126,7 @@ Bug fixes:
141
126
  problem reported by Sergio Nunes).
142
127
  - Updated mousemove position expression to the latest from jQuery (bug
143
128
  reported by meyuchas).
144
- - Use CSS borders instead of background in legend (fix printing issue 25
129
+ - Use borders instead of background in legend (fix printing issue 25
145
130
  and 45).
146
131
  - Explicitly convert axis min/max to numbers.
147
132
  - Fixed a bug with drawing marking lines with different colors
@@ -167,11 +152,6 @@ Bug fixes:
167
152
  smarter.
168
153
  - Fix for uneven axis margins (report and patch by Paul Kienzle) and
169
154
  snapping to ticks (concurrent report and patch by lifthrasiir).
170
- - Fixed bug with slicing in findNearbyItems (patch by zollman).
171
- - Make heuristic for x axis label widths more dynamic (patch by
172
- rickinhethuis).
173
- - Make sure points on top take precedence when finding nearby points
174
- when hovering (reported by didroe, issue 224).
175
155
 
176
156
  Flot 0.5
177
157
  --------
@@ -64,7 +64,7 @@ in the file "API.txt". Here's a quick example that'll draw a line from
64
64
 
65
65
  $.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } });
66
66
 
67
- The plot function immediately draws the chart and then returns a plot
67
+ The plot function immediately draws the chart and then returns a Plot
68
68
  object with a couple of methods.
69
69
 
70
70
 
@@ -73,9 +73,9 @@ What's with the name?
73
73
 
74
74
  First: it's pronounced with a short o, like "plot". Not like "flawed".
75
75
 
76
- So "Flot" rhymes with "plot".
76
+ So "Flot" is like "Plot".
77
77
 
78
78
  And if you look up "flot" in a Danish-to-English dictionary, some up
79
79
  the words that come up are "good-looking", "attractive", "stylish",
80
80
  "smart", "impressive", "extravagant". One of the main goals with Flot
81
- is pretty looks.
81
+ is pretty looks. Flot is supposed to be "flot".