boletia_ui 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +42 -0
  3. data/lib/boletia_ui/version.rb +3 -0
  4. data/lib/boletia_ui.rb +8 -0
  5. data/vendor/assets/boletia_ui/fonts/ss-standard.css +53 -0
  6. data/vendor/assets/boletia_ui/fonts/ss-standard.eot +0 -0
  7. data/vendor/assets/boletia_ui/fonts/ss-standard.js +84 -0
  8. data/vendor/assets/boletia_ui/fonts/ss-standard.svg +404 -0
  9. data/vendor/assets/boletia_ui/fonts/ss-standard.ttf +0 -0
  10. data/vendor/assets/boletia_ui/fonts/ss-standard.woff +0 -0
  11. data/vendor/assets/boletia_ui/images/cancel.png +0 -0
  12. data/vendor/assets/boletia_ui/images/check.png +0 -0
  13. data/vendor/assets/boletia_ui/images/default-search.png +0 -0
  14. data/vendor/assets/boletia_ui/images/download.png +0 -0
  15. data/vendor/assets/boletia_ui/images/edit.png +0 -0
  16. data/vendor/assets/boletia_ui/images/icon-logo140.png +0 -0
  17. data/vendor/assets/boletia_ui/images/logo/header-logo-black.png +0 -0
  18. data/vendor/assets/boletia_ui/images/logo/header-logo-white.png +0 -0
  19. data/vendor/assets/boletia_ui/images/logo/icon-logo140.png +0 -0
  20. data/vendor/assets/boletia_ui/images/resend.png +0 -0
  21. data/vendor/assets/boletia_ui/images/trash.png +0 -0
  22. data/vendor/assets/boletia_ui/images/trophy.png +0 -0
  23. data/vendor/assets/boletia_ui/images/white-resend.png +0 -0
  24. data/vendor/assets/boletia_ui/images/white-search.png +0 -0
  25. data/vendor/assets/boletia_ui/javascripts/boletia-ui/boletia-ui-components.js +117 -0
  26. data/vendor/assets/boletia_ui/javascripts/boletia-ui/classie.js +80 -0
  27. data/vendor/assets/boletia_ui/javascripts/boletia-ui/select_fx.js +335 -0
  28. data/vendor/assets/boletia_ui/javascripts/charts/Chart.Legend.js +56 -0
  29. data/vendor/assets/boletia_ui/javascripts/charts/chart.min.js +11 -0
  30. data/vendor/assets/boletia_ui/javascripts/charts/refundCharts.js +167 -0
  31. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Bar.js +302 -0
  32. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Core.js +2002 -0
  33. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Doughnut.js +184 -0
  34. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Line.js +374 -0
  35. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.PolarArea.js +250 -0
  36. data/vendor/assets/boletia_ui/javascripts/charts/src/Chart.Radar.js +343 -0
  37. data/vendor/assets/boletia_ui/javascripts/counter/counter.js +12 -0
  38. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  39. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  40. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_55_ffffff_40x100.png +0 -0
  41. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  42. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  43. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  44. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  45. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  46. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_0073ea_256x240.png +0 -0
  47. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_454545_256x240.png +0 -0
  48. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_666666_256x240.png +0 -0
  49. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_ff0084_256x240.png +0 -0
  50. data/vendor/assets/boletia_ui/javascripts/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  51. data/vendor/assets/boletia_ui/javascripts/jquery-ui/jquery-ui.min.js +8 -0
  52. data/vendor/assets/boletia_ui/javascripts/scrolling-header/scrolling-header.js +41 -0
  53. data/vendor/assets/boletia_ui/javascripts/styleguide/styleguide.js +87 -0
  54. data/vendor/assets/boletia_ui/javascripts/tooltips/jquery.tooltipster.min.js +1 -0
  55. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/core.js +966 -0
  56. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/fastclick.js +93 -0
  57. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/image.js +245 -0
  58. data/vendor/assets/boletia_ui/javascripts/vendor/magnific-popup/inline.js +66 -0
  59. data/vendor/assets/boletia_ui/stylesheets/boletia-admin.css.scss +41 -0
  60. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.css +53 -0
  61. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.eot +0 -0
  62. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.js +84 -0
  63. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.svg +404 -0
  64. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.ttf +0 -0
  65. data/vendor/assets/boletia_ui/stylesheets/fonts/ss-standard.woff +0 -0
  66. data/vendor/assets/boletia_ui/stylesheets/jquery-ui/jquery-ui.min.css +7 -0
  67. data/vendor/assets/boletia_ui/stylesheets/jquery-ui/jquery-ui.structure.min.css +5 -0
  68. data/vendor/assets/boletia_ui/stylesheets/jquery-ui/jquery-ui.theme.css +410 -0
  69. data/vendor/assets/boletia_ui/stylesheets/layouts/_event_details.scss +100 -0
  70. data/vendor/assets/boletia_ui/stylesheets/layouts/_refund-wizard.scss +290 -0
  71. data/vendor/assets/boletia_ui/stylesheets/layouts/_sales.scss +17 -0
  72. data/vendor/assets/boletia_ui/stylesheets/layouts/_style_guide.scss +216 -0
  73. data/vendor/assets/boletia_ui/stylesheets/menu/_footer.scss +117 -0
  74. data/vendor/assets/boletia_ui/stylesheets/menu/_header.scss +314 -0
  75. data/vendor/assets/boletia_ui/stylesheets/menu/_new_front_footer.scss +117 -0
  76. data/vendor/assets/boletia_ui/stylesheets/menu/_new_front_header.scss +314 -0
  77. data/vendor/assets/boletia_ui/stylesheets/partials/_alerts.scss +183 -0
  78. data/vendor/assets/boletia_ui/stylesheets/partials/_base.scss +376 -0
  79. data/vendor/assets/boletia_ui/stylesheets/partials/_boletia-cards.scss +401 -0
  80. data/vendor/assets/boletia_ui/stylesheets/partials/_buttons.scss +200 -0
  81. data/vendor/assets/boletia_ui/stylesheets/partials/_dashboard.scss +192 -0
  82. data/vendor/assets/boletia_ui/stylesheets/partials/_forms.scss +395 -0
  83. data/vendor/assets/boletia_ui/stylesheets/partials/_grid.scss +85 -0
  84. data/vendor/assets/boletia_ui/stylesheets/partials/_tables.scss +139 -0
  85. data/vendor/assets/boletia_ui/stylesheets/partials/_wizard.scss +125 -0
  86. data/vendor/assets/boletia_ui/stylesheets/vendor/_select.scss +109 -0
  87. data/vendor/assets/boletia_ui/stylesheets/vendor/magnific-popup/_magnific.scss +642 -0
  88. data/vendor/assets/boletia_ui/stylesheets/vendor/magnific-popup/_settings.scss +45 -0
  89. data/vendor/assets/boletia_ui/stylesheets/vendor/tooltipster.css +274 -0
  90. metadata +174 -0
@@ -0,0 +1,184 @@
1
+ (function(){
2
+ "use strict";
3
+
4
+ var root = this,
5
+ Chart = root.Chart,
6
+ //Cache a local reference to Chart.helpers
7
+ helpers = Chart.helpers;
8
+
9
+ var defaultConfig = {
10
+ //Boolean - Whether we should show a stroke on each segment
11
+ segmentShowStroke : true,
12
+
13
+ //String - The colour of each segment stroke
14
+ segmentStrokeColor : "#33495f",
15
+
16
+ //Number - The width of each segment stroke
17
+ segmentStrokeWidth : 2,
18
+
19
+ //The percentage of the chart that we cut out of the middle.
20
+ percentageInnerCutout : 50,
21
+
22
+ //Number - Amount of animation steps
23
+ animationSteps : 100,
24
+
25
+ //String - Animation easing effect
26
+ animationEasing : "easeOutBounce",
27
+
28
+ //Boolean - Whether we animate the rotation of the Doughnut
29
+ animateRotate : true,
30
+
31
+ //Boolean - Whether we animate scaling the Doughnut from the centre
32
+ animateScale : false,
33
+
34
+ //String - A legend template
35
+ legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
36
+
37
+ };
38
+
39
+
40
+ Chart.Type.extend({
41
+ //Passing in a name registers this chart in the Chart namespace
42
+ name: "Doughnut",
43
+ //Providing a defaults will also register the deafults in the chart namespace
44
+ defaults : defaultConfig,
45
+ //Initialize is fired when the chart is initialized - Data is passed in as a parameter
46
+ //Config is automatically merged by the core of Chart.js, and is available at this.options
47
+ initialize: function(data){
48
+
49
+ //Declare segments as a static property to prevent inheriting across the Chart type prototype
50
+ this.segments = [];
51
+ this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2;
52
+
53
+ this.SegmentArc = Chart.Arc.extend({
54
+ ctx : this.chart.ctx,
55
+ x : this.chart.width/2,
56
+ y : this.chart.height/2
57
+ });
58
+
59
+ //Set up tooltip events on the chart
60
+ if (this.options.showTooltips){
61
+ helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
62
+ var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];
63
+
64
+ helpers.each(this.segments,function(segment){
65
+ segment.restore(["fillColor"]);
66
+ });
67
+ helpers.each(activeSegments,function(activeSegment){
68
+ activeSegment.fillColor = activeSegment.highlightColor;
69
+ });
70
+ this.showTooltip(activeSegments);
71
+ });
72
+ }
73
+ this.calculateTotal(data);
74
+
75
+ helpers.each(data,function(datapoint, index){
76
+ this.addData(datapoint, index, true);
77
+ },this);
78
+
79
+ this.render();
80
+ },
81
+ getSegmentsAtEvent : function(e){
82
+ var segmentsArray = [];
83
+
84
+ var location = helpers.getRelativePosition(e);
85
+
86
+ helpers.each(this.segments,function(segment){
87
+ if (segment.inRange(location.x,location.y)) segmentsArray.push(segment);
88
+ },this);
89
+ return segmentsArray;
90
+ },
91
+ addData : function(segment, atIndex, silent){
92
+ var index = atIndex || this.segments.length;
93
+ this.segments.splice(index, 0, new this.SegmentArc({
94
+ value : segment.value,
95
+ outerRadius : (this.options.animateScale) ? 0 : this.outerRadius,
96
+ innerRadius : (this.options.animateScale) ? 0 : (this.outerRadius/100) * this.options.percentageInnerCutout,
97
+ fillColor : segment.color,
98
+ highlightColor : segment.highlight || segment.color,
99
+ showStroke : this.options.segmentShowStroke,
100
+ strokeWidth : this.options.segmentStrokeWidth,
101
+ strokeColor : this.options.segmentStrokeColor,
102
+ startAngle : Math.PI * 1.5,
103
+ circumference : (this.options.animateRotate) ? 0 : this.calculateCircumference(segment.value),
104
+ label : segment.label
105
+ }));
106
+ if (!silent){
107
+ this.reflow();
108
+ this.update();
109
+ }
110
+ },
111
+ calculateCircumference : function(value){
112
+ return (Math.PI*2)*(Math.abs(value) / this.total);
113
+ },
114
+ calculateTotal : function(data){
115
+ this.total = 0;
116
+ helpers.each(data,function(segment){
117
+ this.total += Math.abs(segment.value);
118
+ },this);
119
+ },
120
+ update : function(){
121
+ this.calculateTotal(this.segments);
122
+
123
+ // Reset any highlight colours before updating.
124
+ helpers.each(this.activeElements, function(activeElement){
125
+ activeElement.restore(['fillColor']);
126
+ });
127
+
128
+ helpers.each(this.segments,function(segment){
129
+ segment.save();
130
+ });
131
+ this.render();
132
+ },
133
+
134
+ removeData: function(atIndex){
135
+ var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1;
136
+ this.segments.splice(indexToDelete, 1);
137
+ this.reflow();
138
+ this.update();
139
+ },
140
+
141
+ reflow : function(){
142
+ helpers.extend(this.SegmentArc.prototype,{
143
+ x : this.chart.width/2,
144
+ y : this.chart.height/2
145
+ });
146
+ this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2;
147
+ helpers.each(this.segments, function(segment){
148
+ segment.update({
149
+ outerRadius : this.outerRadius,
150
+ innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout
151
+ });
152
+ }, this);
153
+ },
154
+ draw : function(easeDecimal){
155
+ var animDecimal = (easeDecimal) ? easeDecimal : 1;
156
+ this.clear();
157
+ helpers.each(this.segments,function(segment,index){
158
+ segment.transition({
159
+ circumference : this.calculateCircumference(segment.value),
160
+ outerRadius : this.outerRadius,
161
+ innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout
162
+ },animDecimal);
163
+
164
+ segment.endAngle = segment.startAngle + segment.circumference;
165
+
166
+ segment.draw();
167
+ if (index === 0){
168
+ segment.startAngle = Math.PI * 1.5;
169
+ }
170
+ //Check to see if it's the last segment, if not get the next and update the start angle
171
+ if (index < this.segments.length-1){
172
+ this.segments[index+1].startAngle = segment.endAngle;
173
+ }
174
+ },this);
175
+
176
+ }
177
+ });
178
+
179
+ Chart.types.Doughnut.extend({
180
+ name : "Pie",
181
+ defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})
182
+ });
183
+
184
+ }).call(this);
@@ -0,0 +1,374 @@
1
+ (function(){
2
+ "use strict";
3
+
4
+ var root = this,
5
+ Chart = root.Chart,
6
+ helpers = Chart.helpers;
7
+
8
+ var defaultConfig = {
9
+
10
+ ///Boolean - Whether grid lines are shown across the chart
11
+ scaleShowGridLines : true,
12
+
13
+ //String - Colour of the grid lines
14
+ scaleGridLineColor : "rgba(0,0,0,.05)",
15
+
16
+ //Number - Width of the grid lines
17
+ scaleGridLineWidth : 1,
18
+
19
+ //Boolean - Whether to show horizontal lines (except X axis)
20
+ scaleShowHorizontalLines: true,
21
+
22
+ //Boolean - Whether to show vertical lines (except Y axis)
23
+ scaleShowVerticalLines: true,
24
+
25
+ //Boolean - Whether the line is curved between points
26
+ bezierCurve : true,
27
+
28
+ //Number - Tension of the bezier curve between points
29
+ bezierCurveTension : 0.4,
30
+
31
+ //Boolean - Whether to show a dot for each point
32
+ pointDot : true,
33
+
34
+ //Number - Radius of each point dot in pixels
35
+ pointDotRadius : 4,
36
+
37
+ //Number - Pixel width of point dot stroke
38
+ pointDotStrokeWidth : 1,
39
+
40
+ //Number - amount extra to add to the radius to cater for hit detection outside the drawn point
41
+ pointHitDetectionRadius : 20,
42
+
43
+ //Boolean - Whether to show a stroke for datasets
44
+ datasetStroke : true,
45
+
46
+ //Number - Pixel width of dataset stroke
47
+ datasetStrokeWidth : 2,
48
+
49
+ //Boolean - Whether to fill the dataset with a colour
50
+ datasetFill : true,
51
+
52
+ //String - A legend template
53
+ legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
54
+
55
+ };
56
+
57
+
58
+ Chart.Type.extend({
59
+ name: "Line",
60
+ defaults : defaultConfig,
61
+ initialize: function(data){
62
+ //Declare the extension of the default point, to cater for the options passed in to the constructor
63
+ this.PointClass = Chart.Point.extend({
64
+ strokeWidth : this.options.pointDotStrokeWidth,
65
+ radius : this.options.pointDotRadius,
66
+ display: this.options.pointDot,
67
+ hitDetectionRadius : this.options.pointHitDetectionRadius,
68
+ ctx : this.chart.ctx,
69
+ inRange : function(mouseX){
70
+ return (Math.pow(mouseX-this.x, 2) < Math.pow(this.radius + this.hitDetectionRadius,2));
71
+ }
72
+ });
73
+
74
+ this.datasets = [];
75
+
76
+ //Set up tooltip events on the chart
77
+ if (this.options.showTooltips){
78
+ helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
79
+ var activePoints = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : [];
80
+ this.eachPoints(function(point){
81
+ point.restore(['fillColor', 'strokeColor']);
82
+ });
83
+ helpers.each(activePoints, function(activePoint){
84
+ activePoint.fillColor = activePoint.highlightFill;
85
+ activePoint.strokeColor = activePoint.highlightStroke;
86
+ });
87
+ this.showTooltip(activePoints);
88
+ });
89
+ }
90
+
91
+ //Iterate through each of the datasets, and build this into a property of the chart
92
+ helpers.each(data.datasets,function(dataset){
93
+
94
+ var datasetObject = {
95
+ label : dataset.label || null,
96
+ fillColor : dataset.fillColor,
97
+ strokeColor : dataset.strokeColor,
98
+ pointColor : dataset.pointColor,
99
+ pointStrokeColor : dataset.pointStrokeColor,
100
+ points : []
101
+ };
102
+
103
+ this.datasets.push(datasetObject);
104
+
105
+
106
+ helpers.each(dataset.data,function(dataPoint,index){
107
+ //Add a new point for each piece of data, passing any required data to draw.
108
+ datasetObject.points.push(new this.PointClass({
109
+ value : dataPoint,
110
+ label : data.labels[index],
111
+ datasetLabel: dataset.label,
112
+ strokeColor : dataset.pointStrokeColor,
113
+ fillColor : dataset.pointColor,
114
+ highlightFill : dataset.pointHighlightFill || dataset.pointColor,
115
+ highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
116
+ }));
117
+ },this);
118
+
119
+ this.buildScale(data.labels);
120
+
121
+
122
+ this.eachPoints(function(point, index){
123
+ helpers.extend(point, {
124
+ x: this.scale.calculateX(index),
125
+ y: this.scale.endPoint
126
+ });
127
+ point.save();
128
+ }, this);
129
+
130
+ },this);
131
+
132
+
133
+ this.render();
134
+ },
135
+ update : function(){
136
+ this.scale.update();
137
+ // Reset any highlight colours before updating.
138
+ helpers.each(this.activeElements, function(activeElement){
139
+ activeElement.restore(['fillColor', 'strokeColor']);
140
+ });
141
+ this.eachPoints(function(point){
142
+ point.save();
143
+ });
144
+ this.render();
145
+ },
146
+ eachPoints : function(callback){
147
+ helpers.each(this.datasets,function(dataset){
148
+ helpers.each(dataset.points,callback,this);
149
+ },this);
150
+ },
151
+ getPointsAtEvent : function(e){
152
+ var pointsArray = [],
153
+ eventPosition = helpers.getRelativePosition(e);
154
+ helpers.each(this.datasets,function(dataset){
155
+ helpers.each(dataset.points,function(point){
156
+ if (point.inRange(eventPosition.x,eventPosition.y)) pointsArray.push(point);
157
+ });
158
+ },this);
159
+ return pointsArray;
160
+ },
161
+ buildScale : function(labels){
162
+ var self = this;
163
+
164
+ var dataTotal = function(){
165
+ var values = [];
166
+ self.eachPoints(function(point){
167
+ values.push(point.value);
168
+ });
169
+
170
+ return values;
171
+ };
172
+
173
+ var scaleOptions = {
174
+ templateString : this.options.scaleLabel,
175
+ height : this.chart.height,
176
+ width : this.chart.width,
177
+ ctx : this.chart.ctx,
178
+ textColor : this.options.scaleFontColor,
179
+ fontSize : this.options.scaleFontSize,
180
+ fontStyle : this.options.scaleFontStyle,
181
+ fontFamily : this.options.scaleFontFamily,
182
+ valuesCount : labels.length,
183
+ beginAtZero : this.options.scaleBeginAtZero,
184
+ integersOnly : this.options.scaleIntegersOnly,
185
+ calculateYRange : function(currentHeight){
186
+ var updatedRanges = helpers.calculateScaleRange(
187
+ dataTotal(),
188
+ currentHeight,
189
+ this.fontSize,
190
+ this.beginAtZero,
191
+ this.integersOnly
192
+ );
193
+ helpers.extend(this, updatedRanges);
194
+ },
195
+ xLabels : labels,
196
+ font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
197
+ lineWidth : this.options.scaleLineWidth,
198
+ lineColor : this.options.scaleLineColor,
199
+ showHorizontalLines : this.options.scaleShowHorizontalLines,
200
+ showVerticalLines : this.options.scaleShowVerticalLines,
201
+ gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
202
+ gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
203
+ padding: (this.options.showScale) ? 0 : this.options.pointDotRadius + this.options.pointDotStrokeWidth,
204
+ showLabels : this.options.scaleShowLabels,
205
+ display : this.options.showScale
206
+ };
207
+
208
+ if (this.options.scaleOverride){
209
+ helpers.extend(scaleOptions, {
210
+ calculateYRange: helpers.noop,
211
+ steps: this.options.scaleSteps,
212
+ stepValue: this.options.scaleStepWidth,
213
+ min: this.options.scaleStartValue,
214
+ max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)
215
+ });
216
+ }
217
+
218
+
219
+ this.scale = new Chart.Scale(scaleOptions);
220
+ },
221
+ addData : function(valuesArray,label){
222
+ //Map the values array for each of the datasets
223
+
224
+ helpers.each(valuesArray,function(value,datasetIndex){
225
+ //Add a new point for each piece of data, passing any required data to draw.
226
+ this.datasets[datasetIndex].points.push(new this.PointClass({
227
+ value : value,
228
+ label : label,
229
+ x: this.scale.calculateX(this.scale.valuesCount+1),
230
+ y: this.scale.endPoint,
231
+ strokeColor : this.datasets[datasetIndex].pointStrokeColor,
232
+ fillColor : this.datasets[datasetIndex].pointColor
233
+ }));
234
+ },this);
235
+
236
+ this.scale.addXLabel(label);
237
+ //Then re-render the chart.
238
+ this.update();
239
+ },
240
+ removeData : function(){
241
+ this.scale.removeXLabel();
242
+ //Then re-render the chart.
243
+ helpers.each(this.datasets,function(dataset){
244
+ dataset.points.shift();
245
+ },this);
246
+ this.update();
247
+ },
248
+ reflow : function(){
249
+ var newScaleProps = helpers.extend({
250
+ height : this.chart.height,
251
+ width : this.chart.width
252
+ });
253
+ this.scale.update(newScaleProps);
254
+ },
255
+ draw : function(ease){
256
+ var easingDecimal = ease || 1;
257
+ this.clear();
258
+
259
+ var ctx = this.chart.ctx;
260
+
261
+ // Some helper methods for getting the next/prev points
262
+ var hasValue = function(item){
263
+ return item.value !== null;
264
+ },
265
+ nextPoint = function(point, collection, index){
266
+ return helpers.findNextWhere(collection, hasValue, index) || point;
267
+ },
268
+ previousPoint = function(point, collection, index){
269
+ return helpers.findPreviousWhere(collection, hasValue, index) || point;
270
+ };
271
+
272
+ this.scale.draw(easingDecimal);
273
+
274
+
275
+ helpers.each(this.datasets,function(dataset){
276
+ var pointsWithValues = helpers.where(dataset.points, hasValue);
277
+
278
+ //Transition each point first so that the line and point drawing isn't out of sync
279
+ //We can use this extra loop to calculate the control points of this dataset also in this loop
280
+
281
+ helpers.each(dataset.points, function(point, index){
282
+ if (point.hasValue()){
283
+ point.transition({
284
+ y : this.scale.calculateY(point.value),
285
+ x : this.scale.calculateX(index)
286
+ }, easingDecimal);
287
+ }
288
+ },this);
289
+
290
+
291
+ // Control points need to be calculated in a seperate loop, because we need to know the current x/y of the point
292
+ // This would cause issues when there is no animation, because the y of the next point would be 0, so beziers would be skewed
293
+ if (this.options.bezierCurve){
294
+ helpers.each(pointsWithValues, function(point, index){
295
+ var tension = (index > 0 && index < pointsWithValues.length - 1) ? this.options.bezierCurveTension : 0;
296
+ point.controlPoints = helpers.splineCurve(
297
+ previousPoint(point, pointsWithValues, index),
298
+ point,
299
+ nextPoint(point, pointsWithValues, index),
300
+ tension
301
+ );
302
+
303
+ // Prevent the bezier going outside of the bounds of the graph
304
+
305
+ // Cap puter bezier handles to the upper/lower scale bounds
306
+ if (point.controlPoints.outer.y > this.scale.endPoint){
307
+ point.controlPoints.outer.y = this.scale.endPoint;
308
+ }
309
+ else if (point.controlPoints.outer.y < this.scale.startPoint){
310
+ point.controlPoints.outer.y = this.scale.startPoint;
311
+ }
312
+
313
+ // Cap inner bezier handles to the upper/lower scale bounds
314
+ if (point.controlPoints.inner.y > this.scale.endPoint){
315
+ point.controlPoints.inner.y = this.scale.endPoint;
316
+ }
317
+ else if (point.controlPoints.inner.y < this.scale.startPoint){
318
+ point.controlPoints.inner.y = this.scale.startPoint;
319
+ }
320
+ },this);
321
+ }
322
+
323
+
324
+ //Draw the line between all the points
325
+ ctx.lineWidth = this.options.datasetStrokeWidth;
326
+ ctx.strokeStyle = dataset.strokeColor;
327
+ ctx.beginPath();
328
+
329
+ helpers.each(pointsWithValues, function(point, index){
330
+ if (index === 0){
331
+ ctx.moveTo(point.x, point.y);
332
+ }
333
+ else{
334
+ if(this.options.bezierCurve){
335
+ var previous = previousPoint(point, pointsWithValues, index);
336
+
337
+ ctx.bezierCurveTo(
338
+ previous.controlPoints.outer.x,
339
+ previous.controlPoints.outer.y,
340
+ point.controlPoints.inner.x,
341
+ point.controlPoints.inner.y,
342
+ point.x,
343
+ point.y
344
+ );
345
+ }
346
+ else{
347
+ ctx.lineTo(point.x,point.y);
348
+ }
349
+ }
350
+ }, this);
351
+
352
+ ctx.stroke();
353
+
354
+ if (this.options.datasetFill && pointsWithValues.length > 0){
355
+ //Round off the line by going to the base of the chart, back to the start, then fill.
356
+ ctx.lineTo(pointsWithValues[pointsWithValues.length - 1].x, this.scale.endPoint);
357
+ ctx.lineTo(pointsWithValues[0].x, this.scale.endPoint);
358
+ ctx.fillStyle = dataset.fillColor;
359
+ ctx.closePath();
360
+ ctx.fill();
361
+ }
362
+
363
+ //Now draw the points over the line
364
+ //A little inefficient double looping, but better than the line
365
+ //lagging behind the point positions
366
+ helpers.each(pointsWithValues,function(point){
367
+ point.draw();
368
+ });
369
+ },this);
370
+ }
371
+ });
372
+
373
+
374
+ }).call(this);