outfielding-jqplot-rails 1.0.4.1121

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +17 -0
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +27 -0
  5. data/README-jqplot.txt +77 -0
  6. data/README.md +48 -0
  7. data/Rakefile +1 -0
  8. data/lib/outfielding-jqplot-rails/version.rb +7 -0
  9. data/lib/outfielding-jqplot-rails.rb +10 -0
  10. data/outfielding-jqplot-rails.gemspec +19 -0
  11. data/vendor/assets/javascripts/excanvas.js +1438 -0
  12. data/vendor/assets/javascripts/jqplot-plugins/jqplot.BezierCurveRenderer.js +313 -0
  13. data/vendor/assets/javascripts/jqplot-plugins/jqplot.barRenderer.js +797 -0
  14. data/vendor/assets/javascripts/jqplot-plugins/jqplot.blockRenderer.js +235 -0
  15. data/vendor/assets/javascripts/jqplot-plugins/jqplot.bubbleRenderer.js +759 -0
  16. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasAxisLabelRenderer.js +203 -0
  17. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasAxisTickRenderer.js +243 -0
  18. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasOverlay.js +865 -0
  19. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasTextRenderer.js +449 -0
  20. data/vendor/assets/javascripts/jqplot-plugins/jqplot.categoryAxisRenderer.js +673 -0
  21. data/vendor/assets/javascripts/jqplot-plugins/jqplot.ciParser.js +116 -0
  22. data/vendor/assets/javascripts/jqplot-plugins/jqplot.cursor.js +1108 -0
  23. data/vendor/assets/javascripts/jqplot-plugins/jqplot.dateAxisRenderer.js +737 -0
  24. data/vendor/assets/javascripts/jqplot-plugins/jqplot.donutRenderer.js +805 -0
  25. data/vendor/assets/javascripts/jqplot-plugins/jqplot.dragable.js +225 -0
  26. data/vendor/assets/javascripts/jqplot-plugins/jqplot.enhancedLegendRenderer.js +305 -0
  27. data/vendor/assets/javascripts/jqplot-plugins/jqplot.funnelRenderer.js +943 -0
  28. data/vendor/assets/javascripts/jqplot-plugins/jqplot.highlighter.js +465 -0
  29. data/vendor/assets/javascripts/jqplot-plugins/jqplot.json2.js +475 -0
  30. data/vendor/assets/javascripts/jqplot-plugins/jqplot.logAxisRenderer.js +529 -0
  31. data/vendor/assets/javascripts/jqplot-plugins/jqplot.mekkoAxisRenderer.js +611 -0
  32. data/vendor/assets/javascripts/jqplot-plugins/jqplot.mekkoRenderer.js +437 -0
  33. data/vendor/assets/javascripts/jqplot-plugins/jqplot.meterGaugeRenderer.js +1030 -0
  34. data/vendor/assets/javascripts/jqplot-plugins/jqplot.mobile.js +45 -0
  35. data/vendor/assets/javascripts/jqplot-plugins/jqplot.ohlcRenderer.js +373 -0
  36. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pieRenderer.js +904 -0
  37. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pointLabels.js +379 -0
  38. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pyramidAxisRenderer.js +728 -0
  39. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pyramidGridRenderer.js +429 -0
  40. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pyramidRenderer.js +514 -0
  41. data/vendor/assets/javascripts/jqplot-plugins/jqplot.trendline.js +223 -0
  42. data/vendor/assets/javascripts/jquery.jqplot.js +11381 -0
  43. data/vendor/assets/stylesheets/jquery.jqplot.css +259 -0
  44. metadata +88 -0
@@ -0,0 +1,116 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.4
6
+ * Revision: 1121
7
+ *
8
+ * Copyright (c) 2009-2012 Chris Leonello
9
+ * jqPlot is currently available for use in all personal or commercial projects
10
+ * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
11
+ * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
12
+ * choose the license that best suits your project and use it accordingly.
13
+ *
14
+ * Although not required, the author would appreciate an email letting him
15
+ * know of any substantial use of jqPlot. You can reach the author at:
16
+ * chris at jqplot dot com or see http://www.jqplot.com/info.php .
17
+ *
18
+ * If you are feeling kind and generous, consider supporting the project by
19
+ * making a donation at: http://www.jqplot.com/donate.php .
20
+ *
21
+ * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
22
+ *
23
+ * version 2007.04.27
24
+ * author Ash Searle
25
+ * http://hexmen.com/blog/2007/03/printf-sprintf/
26
+ * http://hexmen.com/js/sprintf.js
27
+ * The author (Ash Searle) has placed this code in the public domain:
28
+ * "This code is unrestricted: you are free to use it however you like."
29
+ *
30
+ */
31
+ (function($) {
32
+ /**
33
+ * Class: $.jqplot.ciParser
34
+ * Data Renderer function which converts a custom JSON data object into jqPlot data format.
35
+ * Set this as a callable on the jqplot dataRenderer plot option:
36
+ *
37
+ * > plot = $.jqplot('mychart', [data], { dataRenderer: $.jqplot.ciParser, ... });
38
+ *
39
+ * Where data is an object in JSON format or a JSON encoded string conforming to the
40
+ * City Index API spec.
41
+ *
42
+ * Note that calling the renderer function is handled internally by jqPlot. The
43
+ * user does not have to call the function. The parameters described below will
44
+ * automatically be passed to the ciParser function.
45
+ *
46
+ * Parameters:
47
+ * data - JSON encoded string or object.
48
+ * plot - reference to jqPlot Plot object.
49
+ *
50
+ * Returns:
51
+ * data array in jqPlot format.
52
+ *
53
+ */
54
+ $.jqplot.ciParser = function (data, plot) {
55
+ var ret = [],
56
+ line,
57
+ temp,
58
+ i, j, k, kk;
59
+
60
+ if (typeof(data) == "string") {
61
+ data = $.jqplot.JSON.parse(data, handleStrings);
62
+ }
63
+
64
+ else if (typeof(data) == "object") {
65
+ for (k in data) {
66
+ for (i=0; i<data[k].length; i++) {
67
+ for (kk in data[k][i]) {
68
+ data[k][i][kk] = handleStrings(kk, data[k][i][kk]);
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ else {
75
+ return null;
76
+ }
77
+
78
+ // function handleStrings
79
+ // Checks any JSON encoded strings to see if they are
80
+ // encoded dates. If so, pull out the timestamp.
81
+ // Expects dates to be represented by js timestamps.
82
+
83
+ function handleStrings(key, value) {
84
+ var a;
85
+ if (value != null) {
86
+ if (value.toString().indexOf('Date') >= 0) {
87
+ //here we will try to extract the ticks from the Date string in the "value" fields of JSON returned data
88
+ a = /^\/Date\((-?[0-9]+)\)\/$/.exec(value);
89
+ if (a) {
90
+ return parseInt(a[1], 10);
91
+ }
92
+ }
93
+ return value;
94
+ }
95
+ }
96
+
97
+ for (var prop in data) {
98
+ line = [];
99
+ temp = data[prop];
100
+ switch (prop) {
101
+ case "PriceTicks":
102
+ for (i=0; i<temp.length; i++) {
103
+ line.push([temp[i]['TickDate'], temp[i]['Price']]);
104
+ }
105
+ break;
106
+ case "PriceBars":
107
+ for (i=0; i<temp.length; i++) {
108
+ line.push([temp[i]['BarDate'], temp[i]['Open'], temp[i]['High'], temp[i]['Low'], temp[i]['Close']]);
109
+ }
110
+ break;
111
+ }
112
+ ret.push(line);
113
+ }
114
+ return ret;
115
+ };
116
+ })(jQuery);