gentelella-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +107 -0
  4. data/Rakefile +30 -0
  5. data/assets/javascripts/autosize.js +254 -0
  6. data/assets/javascripts/bootstrap-progressbar.js +168 -0
  7. data/assets/javascripts/bootstrap-wysiwyg.js +306 -0
  8. data/assets/javascripts/data_tables.coffee +12 -0
  9. data/assets/javascripts/data_tables/jquery.data_tables.js +15277 -0
  10. data/assets/javascripts/data_tables/net-bs.bootstrap.js +182 -0
  11. data/assets/javascripts/data_tables/net-buttons-bs.buttons.js +68 -0
  12. data/assets/javascripts/data_tables/net-buttons.buttons.flash.js +1325 -0
  13. data/assets/javascripts/data_tables/net-buttons.buttons.html5.js +1322 -0
  14. data/assets/javascripts/data_tables/net-buttons.buttons.js +1634 -0
  15. data/assets/javascripts/data_tables/net-buttons.buttons.print.js +172 -0
  16. data/assets/javascripts/data_tables/net-fixedheader.js +672 -0
  17. data/assets/javascripts/data_tables/net-keytable.js +883 -0
  18. data/assets/javascripts/data_tables/net-responsive-bs.js +81 -0
  19. data/assets/javascripts/data_tables/net-responsive.js +1232 -0
  20. data/assets/javascripts/data_tables/net-scroller.js +1349 -0
  21. data/assets/javascripts/echarts.js +56282 -0
  22. data/assets/javascripts/echarts.map.world.js +27 -0
  23. data/assets/javascripts/fullcalendar.js +14206 -0
  24. data/assets/javascripts/gauge.coffee +524 -0
  25. data/assets/javascripts/gentelella.coffee +50 -0
  26. data/assets/javascripts/jquery.autocomplete.js +979 -0
  27. data/assets/javascripts/jquery.easypiechart.js +360 -0
  28. data/assets/javascripts/jquery.flot.curvedLines.js +483 -0
  29. data/assets/javascripts/jquery.flot.curved_lines.js +483 -0
  30. data/assets/javascripts/jquery.flot.orderBars.js +201 -0
  31. data/assets/javascripts/jquery.flot.order_bars.js +201 -0
  32. data/assets/javascripts/jquery.flot.spline.js +212 -0
  33. data/assets/javascripts/jquery.hotkeys.js +204 -0
  34. data/assets/javascripts/jquery.mCustomScrollbar.concat.min.js +6 -0
  35. data/assets/javascripts/jquery.mCustomScrollbar.js +2425 -0
  36. data/assets/javascripts/jquery.sparkline.js +3063 -0
  37. data/assets/javascripts/jquery.tagsinput.js +390 -0
  38. data/assets/javascripts/jquery.vmap.js +1281 -0
  39. data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.africa.js +2 -0
  40. data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.asia.js +2 -0
  41. data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.australia.js +2 -0
  42. data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.europe.js +2 -0
  43. data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.north-america.js +2 -0
  44. data/assets/javascripts/jqvmap/maps/continents/jquery.vmap.south-america.js +2 -0
  45. data/assets/javascripts/jqvmap/maps/jquery.vmap.algeria.js +2 -0
  46. data/assets/javascripts/jqvmap/maps/jquery.vmap.argentina.js +1 -0
  47. data/assets/javascripts/jqvmap/maps/jquery.vmap.brazil.js +2 -0
  48. data/assets/javascripts/jqvmap/maps/jquery.vmap.canada.js +2 -0
  49. data/assets/javascripts/jqvmap/maps/jquery.vmap.europe.js +2 -0
  50. data/assets/javascripts/jqvmap/maps/jquery.vmap.france.js +1 -0
  51. data/assets/javascripts/jqvmap/maps/jquery.vmap.germany.js +2 -0
  52. data/assets/javascripts/jqvmap/maps/jquery.vmap.greece.js +1 -0
  53. data/assets/javascripts/jqvmap/maps/jquery.vmap.iran.js +6 -0
  54. data/assets/javascripts/jqvmap/maps/jquery.vmap.iraq.js +1 -0
  55. data/assets/javascripts/jqvmap/maps/jquery.vmap.russia.js +2 -0
  56. data/assets/javascripts/jqvmap/maps/jquery.vmap.tunisia.js +2 -0
  57. data/assets/javascripts/jqvmap/maps/jquery.vmap.turkey.js +11 -0
  58. data/assets/javascripts/jqvmap/maps/jquery.vmap.usa.js +2 -0
  59. data/assets/javascripts/jqvmap/maps/jquery.vmap.world.js +2 -0
  60. data/assets/javascripts/jszip.js +9344 -0
  61. data/assets/javascripts/morris.js +1892 -0
  62. data/assets/javascripts/parsley.js.map +1 -0
  63. data/assets/javascripts/pdfmake.js +68149 -0
  64. data/assets/javascripts/pnotify.buttons.js +8 -0
  65. data/assets/javascripts/pnotify.js +31 -0
  66. data/assets/javascripts/pnotify.nonblock.js +6 -0
  67. data/assets/javascripts/prettify.coffee +29 -0
  68. data/assets/javascripts/prettify/lang-apollo.js +51 -0
  69. data/assets/javascripts/prettify/lang-basic.js +32 -0
  70. data/assets/javascripts/prettify/lang-clj.js +64 -0
  71. data/assets/javascripts/prettify/lang-css.js +159 -0
  72. data/assets/javascripts/prettify/lang-dart.js +88 -0
  73. data/assets/javascripts/prettify/lang-erlang.js +92 -0
  74. data/assets/javascripts/prettify/lang-go.js +58 -0
  75. data/assets/javascripts/prettify/lang-hs.js +101 -0
  76. data/assets/javascripts/prettify/lang-lisp.js +94 -0
  77. data/assets/javascripts/prettify/lang-llvm.js +61 -0
  78. data/assets/javascripts/prettify/lang-lua.js +59 -0
  79. data/assets/javascripts/prettify/lang-matlab.js +180 -0
  80. data/assets/javascripts/prettify/lang-ml.js +56 -0
  81. data/assets/javascripts/prettify/lang-mumps.js +139 -0
  82. data/assets/javascripts/prettify/lang-n.js +65 -0
  83. data/assets/javascripts/prettify/lang-pascal.js +32 -0
  84. data/assets/javascripts/prettify/lang-proto.js +35 -0
  85. data/assets/javascripts/prettify/lang-r.js +57 -0
  86. data/assets/javascripts/prettify/lang-rd.js +47 -0
  87. data/assets/javascripts/prettify/lang-scala.js +54 -0
  88. data/assets/javascripts/prettify/lang-sql.js +58 -0
  89. data/assets/javascripts/prettify/lang-tcl.js +62 -0
  90. data/assets/javascripts/prettify/lang-tex.js +46 -0
  91. data/assets/javascripts/prettify/lang-vb.js +66 -0
  92. data/assets/javascripts/prettify/lang-vhdl.js +34 -0
  93. data/assets/javascripts/prettify/lang-wiki.js +53 -0
  94. data/assets/javascripts/prettify/lang-xq.js +67 -0
  95. data/assets/javascripts/prettify/lang-yaml.js +27 -0
  96. data/assets/javascripts/prettify/prettify.js +1655 -0
  97. data/assets/javascripts/prettify/run_prettify.js +1905 -0
  98. data/assets/javascripts/raphael.js +8330 -0
  99. data/assets/javascripts/skycons.js +730 -0
  100. data/assets/javascripts/starrr.js +98 -0
  101. data/assets/javascripts/vfs_fonts.js +1 -0
  102. data/assets/stylesheets/bootstrap-progressbar-3.3.0-3.x.x.scss +74 -0
  103. data/assets/stylesheets/bootstrap-wysiwyg.css +88 -0
  104. data/assets/stylesheets/data_tables/net-bs.bootstrap.css +185 -0
  105. data/assets/stylesheets/data_tables/net-buttons-bs.buttons.css +102 -0
  106. data/assets/stylesheets/data_tables/net-fixedheader-bs.bootstrap.css +20 -0
  107. data/assets/stylesheets/data_tables/net-responsive-bs.bootstrap.css +181 -0
  108. data/assets/stylesheets/data_tables/net-scroller-bs.bootstrap.css +24 -0
  109. data/assets/stylesheets/fullcalendar.css +1406 -0
  110. data/assets/stylesheets/fullcalendar.print.css +208 -0
  111. data/assets/stylesheets/gentelella.scss +39 -0
  112. data/assets/stylesheets/jquery.mCustomScrollbar.css +1267 -0
  113. data/assets/stylesheets/jqvmap.css +50 -0
  114. data/assets/stylesheets/morris.css +2 -0
  115. data/assets/stylesheets/pnotify.buttons.css +1 -0
  116. data/assets/stylesheets/pnotify.css +1 -0
  117. data/assets/stylesheets/pnotify.nonblock.css +1 -0
  118. data/assets/stylesheets/prettify/prettify.css +52 -0
  119. data/assets/stylesheets/starrr.css +8 -0
  120. data/lib/generators/gentelella/install/USAGE +9 -0
  121. data/lib/generators/gentelella/install/install_generator.rb +14 -0
  122. data/lib/generators/gentelella/install/templates/gentelella-custom.js +5067 -0
  123. data/lib/generators/gentelella/install/templates/gentelella-custom.scss +4241 -0
  124. data/lib/gentelella-rails.rb +58 -0
  125. data/lib/gentelella/engine.rb +15 -0
  126. data/lib/gentelella/version.rb +3 -0
  127. data/lib/tasks/bower.rake +153 -0
  128. data/lib/tasks/gentelella/rails_tasks.rake +4 -0
  129. metadata +409 -0
@@ -0,0 +1,201 @@
1
+ /*
2
+ * Flot plugin to order bars side by side.
3
+ *
4
+ * Released under the MIT license by Benjamin BUFFET, 20-Sep-2010.
5
+ * Modifications made by Steven Hall <github.com/emmerich>, 01-May-2013.
6
+ *
7
+ * This plugin is an alpha version.
8
+ *
9
+ * To activate the plugin you must specify the parameter "order" for the specific serie :
10
+ *
11
+ * $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }])
12
+ *
13
+ * If 2 series have the same order param, they are ordered by the position in the array;
14
+ *
15
+ * The plugin adjust the point by adding a value depanding of the barwidth
16
+ * Exemple for 3 series (barwidth : 0.1) :
17
+ *
18
+ * first bar décalage : -0.15
19
+ * second bar décalage : -0.05
20
+ * third bar décalage : 0.05
21
+ *
22
+ */
23
+
24
+ // INFO: decalage/decallage is French for gap. It's used to denote the spacing applied to each
25
+ // bar.
26
+ (function($){
27
+ function init(plot){
28
+ var orderedBarSeries;
29
+ var nbOfBarsToOrder;
30
+ var borderWidth;
31
+ var borderWidthInXabsWidth;
32
+ var pixelInXWidthEquivalent = 1;
33
+ var isHorizontal = false;
34
+
35
+ // A mapping of order integers to decallage.
36
+ var decallageByOrder = {};
37
+
38
+ /*
39
+ * This method add shift to x values
40
+ */
41
+ function reOrderBars(plot, serie, datapoints){
42
+ var shiftedPoints = null;
43
+
44
+ if(serieNeedToBeReordered(serie)){
45
+ checkIfGraphIsHorizontal(serie);
46
+ calculPixel2XWidthConvert(plot);
47
+ retrieveBarSeries(plot);
48
+ calculBorderAndBarWidth(serie);
49
+
50
+ if(nbOfBarsToOrder >= 2){
51
+ var position = findPosition(serie);
52
+ var decallage = 0;
53
+
54
+ var centerBarShift = calculCenterBarShift();
55
+
56
+ // If we haven't already calculated the decallage for this order value, do it.
57
+ if(typeof decallageByOrder[serie.bars.order] === 'undefined') {
58
+ if (isBarAtLeftOfCenter(position)){
59
+ decallageByOrder[serie.bars.order] = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;
60
+ }else{
61
+ decallageByOrder[serie.bars.order] = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;
62
+ }
63
+ }
64
+
65
+ // Lookup the decallage based on the series' order value.
66
+ decallage = decallageByOrder[serie.bars.order];
67
+
68
+ shiftedPoints = shiftPoints(datapoints,serie,decallage);
69
+ datapoints.points = shiftedPoints;
70
+ }
71
+ }
72
+ return shiftedPoints;
73
+ }
74
+
75
+ function serieNeedToBeReordered(serie){
76
+ return serie.bars != null
77
+ && serie.bars.show
78
+ && serie.bars.order != null;
79
+ }
80
+
81
+ function calculPixel2XWidthConvert(plot){
82
+ var gridDimSize = isHorizontal ? plot.getPlaceholder().innerHeight() : plot.getPlaceholder().innerWidth();
83
+ var minMaxValues = isHorizontal ? getAxeMinMaxValues(plot.getData(),1) : getAxeMinMaxValues(plot.getData(),0);
84
+ var AxeSize = minMaxValues[1] - minMaxValues[0];
85
+ pixelInXWidthEquivalent = AxeSize / gridDimSize;
86
+ }
87
+
88
+ function getAxeMinMaxValues(series,AxeIdx){
89
+ var minMaxValues = new Array();
90
+ for(var i = 0; i < series.length; i++){
91
+ minMaxValues[0] = (series[i].data[0]) ? series[i].data[0][AxeIdx]: null;
92
+ minMaxValues[1] = (series[i].data[series[i].data.length - 1]) ? series[i].data[series[i].data.length - 1][AxeIdx]: null;
93
+ }
94
+ return minMaxValues;
95
+ }
96
+
97
+ function retrieveBarSeries(plot){
98
+ orderedBarSeries = findOthersBarsToReOrders(plot.getData());
99
+ nbOfBarsToOrder = orderedBarSeries.length;
100
+ }
101
+
102
+ function findOthersBarsToReOrders(series){
103
+ var retSeries = new Array();
104
+ var orderValuesSeen = [];
105
+
106
+ for(var i = 0; i < series.length; i++){
107
+ if(series[i].bars.order != null && series[i].bars.show &&
108
+ orderValuesSeen.indexOf(series[i].bars.order) < 0){
109
+
110
+ orderValuesSeen.push(series[i].bars.order);
111
+ retSeries.push(series[i]);
112
+ }
113
+ }
114
+ return retSeries.sort(sortByOrder);
115
+ }
116
+
117
+ function sortByOrder(serie1,serie2){
118
+ var x = serie1.bars.order;
119
+ var y = serie2.bars.order;
120
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
121
+ }
122
+
123
+ function calculBorderAndBarWidth(serie){
124
+ borderWidth = typeof serie.bars.lineWidth !== 'undefined' ? serie.bars.lineWidth : 2;
125
+ borderWidthInXabsWidth = borderWidth * pixelInXWidthEquivalent;
126
+ }
127
+
128
+ function checkIfGraphIsHorizontal(serie){
129
+ if(serie.bars.horizontal){
130
+ isHorizontal = true;
131
+ }
132
+ }
133
+
134
+ function findPosition(serie){
135
+ var pos = 0
136
+ for (var i = 0; i < orderedBarSeries.length; ++i) {
137
+ if (serie == orderedBarSeries[i]){
138
+ pos = i;
139
+ break;
140
+ }
141
+ }
142
+
143
+ return pos+1;
144
+ }
145
+
146
+ function calculCenterBarShift(){
147
+ var width = 0;
148
+
149
+ if(nbOfBarsToOrder%2 != 0)
150
+ width = (orderedBarSeries[Math.ceil(nbOfBarsToOrder / 2)].bars.barWidth)/2;
151
+
152
+ return width;
153
+ }
154
+
155
+ function isBarAtLeftOfCenter(position){
156
+ return position <= Math.ceil(nbOfBarsToOrder / 2);
157
+ }
158
+
159
+ function sumWidth(series,start,end){
160
+ var totalWidth = 0;
161
+
162
+ for(var i = start; i <= end; i++){
163
+ totalWidth += series[i].bars.barWidth+borderWidthInXabsWidth*2;
164
+ }
165
+
166
+ return totalWidth;
167
+ }
168
+
169
+ function shiftPoints(datapoints,serie,dx){
170
+ var ps = datapoints.pointsize;
171
+ var points = datapoints.points;
172
+ var j = 0;
173
+ for(var i = isHorizontal ? 1 : 0;i < points.length; i += ps){
174
+ points[i] += dx;
175
+ //Adding the new x value in the serie to be abble to display the right tooltip value,
176
+ //using the index 3 to not overide the third index.
177
+ serie.data[j][3] = points[i];
178
+ j++;
179
+ }
180
+
181
+ return points;
182
+ }
183
+
184
+ plot.hooks.processDatapoints.push(reOrderBars);
185
+
186
+ }
187
+
188
+ var options = {
189
+ series : {
190
+ bars: {order: null} // or number/string
191
+ }
192
+ };
193
+
194
+ $.plot.plugins.push({
195
+ init: init,
196
+ options: options,
197
+ name: "orderBars",
198
+ version: "0.2"
199
+ });
200
+
201
+ })(jQuery);
@@ -0,0 +1,201 @@
1
+ /*
2
+ * Flot plugin to order bars side by side.
3
+ *
4
+ * Released under the MIT license by Benjamin BUFFET, 20-Sep-2010.
5
+ * Modifications made by Steven Hall <github.com/emmerich>, 01-May-2013.
6
+ *
7
+ * This plugin is an alpha version.
8
+ *
9
+ * To activate the plugin you must specify the parameter "order" for the specific serie :
10
+ *
11
+ * $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }])
12
+ *
13
+ * If 2 series have the same order param, they are ordered by the position in the array;
14
+ *
15
+ * The plugin adjust the point by adding a value depanding of the barwidth
16
+ * Exemple for 3 series (barwidth : 0.1) :
17
+ *
18
+ * first bar décalage : -0.15
19
+ * second bar décalage : -0.05
20
+ * third bar décalage : 0.05
21
+ *
22
+ */
23
+
24
+ // INFO: decalage/decallage is French for gap. It's used to denote the spacing applied to each
25
+ // bar.
26
+ (function($){
27
+ function init(plot){
28
+ var orderedBarSeries;
29
+ var nbOfBarsToOrder;
30
+ var borderWidth;
31
+ var borderWidthInXabsWidth;
32
+ var pixelInXWidthEquivalent = 1;
33
+ var isHorizontal = false;
34
+
35
+ // A mapping of order integers to decallage.
36
+ var decallageByOrder = {};
37
+
38
+ /*
39
+ * This method add shift to x values
40
+ */
41
+ function reOrderBars(plot, serie, datapoints){
42
+ var shiftedPoints = null;
43
+
44
+ if(serieNeedToBeReordered(serie)){
45
+ checkIfGraphIsHorizontal(serie);
46
+ calculPixel2XWidthConvert(plot);
47
+ retrieveBarSeries(plot);
48
+ calculBorderAndBarWidth(serie);
49
+
50
+ if(nbOfBarsToOrder >= 2){
51
+ var position = findPosition(serie);
52
+ var decallage = 0;
53
+
54
+ var centerBarShift = calculCenterBarShift();
55
+
56
+ // If we haven't already calculated the decallage for this order value, do it.
57
+ if(typeof decallageByOrder[serie.bars.order] === 'undefined') {
58
+ if (isBarAtLeftOfCenter(position)){
59
+ decallageByOrder[serie.bars.order] = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;
60
+ }else{
61
+ decallageByOrder[serie.bars.order] = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;
62
+ }
63
+ }
64
+
65
+ // Lookup the decallage based on the series' order value.
66
+ decallage = decallageByOrder[serie.bars.order];
67
+
68
+ shiftedPoints = shiftPoints(datapoints,serie,decallage);
69
+ datapoints.points = shiftedPoints;
70
+ }
71
+ }
72
+ return shiftedPoints;
73
+ }
74
+
75
+ function serieNeedToBeReordered(serie){
76
+ return serie.bars != null
77
+ && serie.bars.show
78
+ && serie.bars.order != null;
79
+ }
80
+
81
+ function calculPixel2XWidthConvert(plot){
82
+ var gridDimSize = isHorizontal ? plot.getPlaceholder().innerHeight() : plot.getPlaceholder().innerWidth();
83
+ var minMaxValues = isHorizontal ? getAxeMinMaxValues(plot.getData(),1) : getAxeMinMaxValues(plot.getData(),0);
84
+ var AxeSize = minMaxValues[1] - minMaxValues[0];
85
+ pixelInXWidthEquivalent = AxeSize / gridDimSize;
86
+ }
87
+
88
+ function getAxeMinMaxValues(series,AxeIdx){
89
+ var minMaxValues = new Array();
90
+ for(var i = 0; i < series.length; i++){
91
+ minMaxValues[0] = (series[i].data[0]) ? series[i].data[0][AxeIdx]: null;
92
+ minMaxValues[1] = (series[i].data[series[i].data.length - 1]) ? series[i].data[series[i].data.length - 1][AxeIdx]: null;
93
+ }
94
+ return minMaxValues;
95
+ }
96
+
97
+ function retrieveBarSeries(plot){
98
+ orderedBarSeries = findOthersBarsToReOrders(plot.getData());
99
+ nbOfBarsToOrder = orderedBarSeries.length;
100
+ }
101
+
102
+ function findOthersBarsToReOrders(series){
103
+ var retSeries = new Array();
104
+ var orderValuesSeen = [];
105
+
106
+ for(var i = 0; i < series.length; i++){
107
+ if(series[i].bars.order != null && series[i].bars.show &&
108
+ orderValuesSeen.indexOf(series[i].bars.order) < 0){
109
+
110
+ orderValuesSeen.push(series[i].bars.order);
111
+ retSeries.push(series[i]);
112
+ }
113
+ }
114
+ return retSeries.sort(sortByOrder);
115
+ }
116
+
117
+ function sortByOrder(serie1,serie2){
118
+ var x = serie1.bars.order;
119
+ var y = serie2.bars.order;
120
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
121
+ }
122
+
123
+ function calculBorderAndBarWidth(serie){
124
+ borderWidth = typeof serie.bars.lineWidth !== 'undefined' ? serie.bars.lineWidth : 2;
125
+ borderWidthInXabsWidth = borderWidth * pixelInXWidthEquivalent;
126
+ }
127
+
128
+ function checkIfGraphIsHorizontal(serie){
129
+ if(serie.bars.horizontal){
130
+ isHorizontal = true;
131
+ }
132
+ }
133
+
134
+ function findPosition(serie){
135
+ var pos = 0
136
+ for (var i = 0; i < orderedBarSeries.length; ++i) {
137
+ if (serie == orderedBarSeries[i]){
138
+ pos = i;
139
+ break;
140
+ }
141
+ }
142
+
143
+ return pos+1;
144
+ }
145
+
146
+ function calculCenterBarShift(){
147
+ var width = 0;
148
+
149
+ if(nbOfBarsToOrder%2 != 0)
150
+ width = (orderedBarSeries[Math.ceil(nbOfBarsToOrder / 2)].bars.barWidth)/2;
151
+
152
+ return width;
153
+ }
154
+
155
+ function isBarAtLeftOfCenter(position){
156
+ return position <= Math.ceil(nbOfBarsToOrder / 2);
157
+ }
158
+
159
+ function sumWidth(series,start,end){
160
+ var totalWidth = 0;
161
+
162
+ for(var i = start; i <= end; i++){
163
+ totalWidth += series[i].bars.barWidth+borderWidthInXabsWidth*2;
164
+ }
165
+
166
+ return totalWidth;
167
+ }
168
+
169
+ function shiftPoints(datapoints,serie,dx){
170
+ var ps = datapoints.pointsize;
171
+ var points = datapoints.points;
172
+ var j = 0;
173
+ for(var i = isHorizontal ? 1 : 0;i < points.length; i += ps){
174
+ points[i] += dx;
175
+ //Adding the new x value in the serie to be abble to display the right tooltip value,
176
+ //using the index 3 to not overide the third index.
177
+ serie.data[j][3] = points[i];
178
+ j++;
179
+ }
180
+
181
+ return points;
182
+ }
183
+
184
+ plot.hooks.processDatapoints.push(reOrderBars);
185
+
186
+ }
187
+
188
+ var options = {
189
+ series : {
190
+ bars: {order: null} // or number/string
191
+ }
192
+ };
193
+
194
+ $.plot.plugins.push({
195
+ init: init,
196
+ options: options,
197
+ name: "orderBars",
198
+ version: "0.2"
199
+ });
200
+
201
+ })(jQuery);
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Flot plugin that provides spline interpolation for line graphs
3
+ * author: Alex Bardas < alex.bardas@gmail.com >
4
+ * modified by: Avi Kohn https://github.com/AMKohn
5
+ * based on the spline interpolation described at:
6
+ * http://scaledinnovation.com/analytics/splines/aboutSplines.html
7
+ *
8
+ * Example usage: (add in plot options series object)
9
+ * for linespline:
10
+ * series: {
11
+ * ...
12
+ * lines: {
13
+ * show: false
14
+ * },
15
+ * splines: {
16
+ * show: true,
17
+ * tension: x, (float between 0 and 1, defaults to 0.5),
18
+ * lineWidth: y (number, defaults to 2),
19
+ * fill: z (float between 0 .. 1 or false, as in flot documentation)
20
+ * },
21
+ * ...
22
+ * }
23
+ * areaspline:
24
+ * series: {
25
+ * ...
26
+ * lines: {
27
+ * show: true,
28
+ * lineWidth: 0, (line drawing will not execute)
29
+ * fill: x, (float between 0 .. 1, as in flot documentation)
30
+ * ...
31
+ * },
32
+ * splines: {
33
+ * show: true,
34
+ * tension: 0.5 (float between 0 and 1)
35
+ * },
36
+ * ...
37
+ * }
38
+ *
39
+ */
40
+
41
+ (function($) {
42
+ 'use strict'
43
+
44
+ /**
45
+ * @param {Number} x0, y0, x1, y1: coordinates of the end (knot) points of the segment
46
+ * @param {Number} x2, y2: the next knot (not connected, but needed to calculate p2)
47
+ * @param {Number} tension: control how far the control points spread
48
+ * @return {Array}: p1 -> control point, from x1 back toward x0
49
+ * p2 -> the next control point, returned to become the next segment's p1
50
+ *
51
+ * @api private
52
+ */
53
+ function getControlPoints(x0, y0, x1, y1, x2, y2, tension) {
54
+
55
+ var pow = Math.pow,
56
+ sqrt = Math.sqrt,
57
+ d01, d12, fa, fb, p1x, p1y, p2x, p2y;
58
+
59
+ // Scaling factors: distances from this knot to the previous and following knots.
60
+ d01 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
61
+ d12 = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
62
+
63
+ fa = tension * d01 / (d01 + d12);
64
+ fb = tension - fa;
65
+
66
+ p1x = x1 + fa * (x0 - x2);
67
+ p1y = y1 + fa * (y0 - y2);
68
+
69
+ p2x = x1 - fb * (x0 - x2);
70
+ p2y = y1 - fb * (y0 - y2);
71
+
72
+ return [p1x, p1y, p2x, p2y];
73
+ }
74
+
75
+ var line = [];
76
+
77
+ function drawLine(points, ctx, height, fill, seriesColor) {
78
+ var c = $.color.parse(seriesColor);
79
+
80
+ c.a = typeof fill == "number" ? fill : .3;
81
+ c.normalize();
82
+ c = c.toString();
83
+
84
+ ctx.beginPath();
85
+ ctx.moveTo(points[0][0], points[0][1]);
86
+
87
+ var plength = points.length;
88
+
89
+ for (var i = 0; i < plength; i++) {
90
+ ctx[points[i][3]].apply(ctx, points[i][2]);
91
+ }
92
+
93
+ ctx.stroke();
94
+
95
+ ctx.lineWidth = 0;
96
+ ctx.lineTo(points[plength - 1][0], height);
97
+ ctx.lineTo(points[0][0], height);
98
+
99
+ ctx.closePath();
100
+
101
+ if (fill !== false) {
102
+ ctx.fillStyle = c;
103
+ ctx.fill();
104
+ }
105
+ }
106
+
107
+ /**
108
+ * @param {Object} ctx: canvas context
109
+ * @param {String} type: accepted strings: 'bezier' or 'quadratic' (defaults to quadratic)
110
+ * @param {Array} points: 2 points for which to draw the interpolation
111
+ * @param {Array} cpoints: control points for those segment points
112
+ *
113
+ * @api private
114
+ */
115
+ function queue(ctx, type, points, cpoints) {
116
+ if (type === void 0 || (type !== 'bezier' && type !== 'quadratic')) {
117
+ type = 'quadratic';
118
+ }
119
+ type = type + 'CurveTo';
120
+
121
+ if (line.length == 0) line.push([points[0], points[1], cpoints.concat(points.slice(2)), type]);
122
+ else if (type == "quadraticCurveTo" && points.length == 2) {
123
+ cpoints = cpoints.slice(0, 2).concat(points);
124
+
125
+ line.push([points[0], points[1], cpoints, type]);
126
+ }
127
+ else line.push([points[2], points[3], cpoints.concat(points.slice(2)), type]);
128
+ }
129
+
130
+ /**
131
+ * @param {Object} plot
132
+ * @param {Object} ctx: canvas context
133
+ * @param {Object} series
134
+ *
135
+ * @api private
136
+ */
137
+
138
+ function drawSpline(plot, ctx, series) {
139
+ // Not interested if spline is not requested
140
+ if (series.splines.show !== true) {
141
+ return;
142
+ }
143
+
144
+ var cp = [],
145
+ // array of control points
146
+ tension = series.splines.tension || 0.5,
147
+ idx, x, y, points = series.datapoints.points,
148
+ ps = series.datapoints.pointsize,
149
+ plotOffset = plot.getPlotOffset(),
150
+ len = points.length,
151
+ pts = [];
152
+
153
+ line = [];
154
+
155
+ // Cannot display a linespline/areaspline if there are less than 3 points
156
+ if (len / ps < 4) {
157
+ $.extend(series.lines, series.splines);
158
+ return;
159
+ }
160
+
161
+ for (idx = 0; idx < len; idx += ps) {
162
+ x = points[idx];
163
+ y = points[idx + 1];
164
+ if (x == null || x < series.xaxis.min || x > series.xaxis.max || y < series.yaxis.min || y > series.yaxis.max) {
165
+ continue;
166
+ }
167
+
168
+ pts.push(series.xaxis.p2c(x) + plotOffset.left, series.yaxis.p2c(y) + plotOffset.top);
169
+ }
170
+
171
+ len = pts.length;
172
+
173
+ // Draw an open curve, not connected at the ends
174
+ for (idx = 0; idx < len - 2; idx += 2) {
175
+ cp = cp.concat(getControlPoints.apply(this, pts.slice(idx, idx + 6).concat([tension])));
176
+ }
177
+
178
+ ctx.save();
179
+ ctx.strokeStyle = series.color;
180
+ ctx.lineWidth = series.splines.lineWidth;
181
+
182
+ queue(ctx, 'quadratic', pts.slice(0, 4), cp.slice(0, 2));
183
+
184
+ for (idx = 2; idx < len - 3; idx += 2) {
185
+ queue(ctx, 'bezier', pts.slice(idx, idx + 4), cp.slice(2 * idx - 2, 2 * idx + 2));
186
+ }
187
+
188
+ queue(ctx, 'quadratic', pts.slice(len - 2, len), [cp[2 * len - 10], cp[2 * len - 9], pts[len - 4], pts[len - 3]]);
189
+
190
+ drawLine(line, ctx, plot.height() + 10, series.splines.fill, series.color);
191
+
192
+ ctx.restore();
193
+ }
194
+
195
+ $.plot.plugins.push({
196
+ init: function(plot) {
197
+ plot.hooks.drawSeries.push(drawSpline);
198
+ },
199
+ options: {
200
+ series: {
201
+ splines: {
202
+ show: false,
203
+ lineWidth: 2,
204
+ tension: 0.5,
205
+ fill: false
206
+ }
207
+ }
208
+ },
209
+ name: 'spline',
210
+ version: '0.8.2'
211
+ });
212
+ })(jQuery);