chart-js-rails 0.0.3 → 0.0.4

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.
@@ -1,7 +1,7 @@
1
1
  module Chart
2
2
  module Js
3
3
  module Rails
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -8,14 +8,14 @@
8
8
  */
9
9
 
10
10
  //Define the global Chart Variable as a class.
11
- var Chart = function(context){
11
+ window.Chart = function(context){
12
12
 
13
13
  var chart = this;
14
-
15
-
14
+
15
+
16
16
  //Easing functions adapted from Robert Penner's easing equations
17
17
  //http://www.robertpenner.com/easing/
18
-
18
+
19
19
  var animationOptions = {
20
20
  linear : function (t){
21
21
  return t;
@@ -123,7 +123,7 @@ var Chart = function(context){
123
123
  return 1*((t=t/1-1)*t*((s+1)*t + s) + 1);
124
124
  },
125
125
  easeInOutBack: function (t) {
126
- var s = 1.70158;
126
+ var s = 1.70158;
127
127
  if ((t/=1/2) < 1) return 1/2*(t*t*(((s*=(1.525))+1)*t - s));
128
128
  return 1/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2);
129
129
  },
@@ -162,7 +162,7 @@ var Chart = function(context){
162
162
  }
163
163
 
164
164
  this.PolarArea = function(data,options){
165
-
165
+
166
166
  chart.PolarArea.defaults = {
167
167
  scaleOverlay : true,
168
168
  scaleOverride : false,
@@ -192,14 +192,14 @@ var Chart = function(context){
192
192
  animateScale : false,
193
193
  onAnimationComplete : null
194
194
  };
195
-
195
+
196
196
  var config = (options)? mergeChartConfig(chart.PolarArea.defaults,options) : chart.PolarArea.defaults;
197
-
197
+
198
198
  return new PolarArea(data,config,context);
199
199
  };
200
200
 
201
201
  this.Radar = function(data,options){
202
-
202
+
203
203
  chart.Radar.defaults = {
204
204
  scaleOverlay : false,
205
205
  scaleOverride : false,
@@ -221,7 +221,7 @@ var Chart = function(context){
221
221
  scaleBackdropPaddingX : 2,
222
222
  angleShowLineOut : true,
223
223
  angleLineColor : "rgba(0,0,0,.1)",
224
- angleLineWidth : 1,
224
+ angleLineWidth : 1,
225
225
  pointLabelFontFamily : "'Arial'",
226
226
  pointLabelFontStyle : "normal",
227
227
  pointLabelFontSize : 12,
@@ -237,12 +237,12 @@ var Chart = function(context){
237
237
  animationEasing : "easeOutQuart",
238
238
  onAnimationComplete : null
239
239
  };
240
-
240
+
241
241
  var config = (options)? mergeChartConfig(chart.Radar.defaults,options) : chart.Radar.defaults;
242
242
 
243
243
  return new Radar(data,config,context);
244
244
  };
245
-
245
+
246
246
  this.Pie = function(data,options){
247
247
  chart.Pie.defaults = {
248
248
  segmentShowStroke : true,
@@ -254,15 +254,15 @@ var Chart = function(context){
254
254
  animateRotate : true,
255
255
  animateScale : false,
256
256
  onAnimationComplete : null
257
- };
257
+ };
258
258
 
259
259
  var config = (options)? mergeChartConfig(chart.Pie.defaults,options) : chart.Pie.defaults;
260
-
261
- return new Pie(data,config,context);
260
+
261
+ return new Pie(data,config,context);
262
262
  };
263
-
263
+
264
264
  this.Doughnut = function(data,options){
265
-
265
+
266
266
  chart.Doughnut.defaults = {
267
267
  segmentShowStroke : true,
268
268
  segmentStrokeColor : "#fff",
@@ -274,16 +274,16 @@ var Chart = function(context){
274
274
  animateRotate : true,
275
275
  animateScale : false,
276
276
  onAnimationComplete : null
277
- };
277
+ };
278
278
 
279
279
  var config = (options)? mergeChartConfig(chart.Doughnut.defaults,options) : chart.Doughnut.defaults;
280
-
281
- return new Doughnut(data,config,context);
282
-
280
+
281
+ return new Doughnut(data,config,context);
282
+
283
283
  };
284
284
 
285
285
  this.Line = function(data,options){
286
-
286
+
287
287
  chart.Line.defaults = {
288
288
  scaleOverlay : false,
289
289
  scaleOverride : false,
@@ -312,12 +312,12 @@ var Chart = function(context){
312
312
  animationSteps : 60,
313
313
  animationEasing : "easeOutQuart",
314
314
  onAnimationComplete : null
315
- };
315
+ };
316
316
  var config = (options) ? mergeChartConfig(chart.Line.defaults,options) : chart.Line.defaults;
317
-
317
+
318
318
  return new Line(data,config,context);
319
319
  }
320
-
320
+
321
321
  this.Bar = function(data,options){
322
322
  chart.Bar.defaults = {
323
323
  scaleOverlay : false,
@@ -344,29 +344,29 @@ var Chart = function(context){
344
344
  animationSteps : 60,
345
345
  animationEasing : "easeOutQuart",
346
346
  onAnimationComplete : null
347
- };
347
+ };
348
348
  var config = (options) ? mergeChartConfig(chart.Bar.defaults,options) : chart.Bar.defaults;
349
-
350
- return new Bar(data,config,context);
349
+
350
+ return new Bar(data,config,context);
351
351
  }
352
-
352
+
353
353
  var clear = function(c){
354
354
  c.clearRect(0, 0, width, height);
355
355
  };
356
356
 
357
357
  var PolarArea = function(data,config,ctx){
358
- var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString;
359
-
360
-
358
+ var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString;
359
+
360
+
361
361
  calculateDrawingSizes();
362
-
362
+
363
363
  valueBounds = getValueBounds();
364
364
 
365
365
  labelTemplateString = (config.scaleShowLabels)? config.scaleLabel : null;
366
366
 
367
367
  //Check and set the scale
368
368
  if (!config.scaleOverride){
369
-
369
+
370
370
  calculatedScale = calculateScale(scaleHeight,valueBounds.maxSteps,valueBounds.minSteps,valueBounds.maxValue,valueBounds.minValue,labelTemplateString);
371
371
  }
372
372
  else {
@@ -376,13 +376,9 @@ var Chart = function(context){
376
376
  graphMin : config.scaleStartValue,
377
377
  labels : []
378
378
  }
379
- for (var i=0; i<calculatedScale.steps; i++){
380
- if(labelTemplateString){
381
- calculatedScale.labels.push(tmpl(labelTemplateString,{value:(config.scaleStartValue + (config.scaleStepWidth * i)).toFixed(getDecimalPlaces (config.scaleStepWidth))}));
382
- }
383
- }
379
+ populateLabels(labelTemplateString, calculatedScale.labels,calculatedScale.steps,config.scaleStartValue,config.scaleStepWidth);
384
380
  }
385
-
381
+
386
382
  scaleHop = maxSize/(calculatedScale.steps);
387
383
 
388
384
  //Wrap in an animation loop wrapper
@@ -391,16 +387,16 @@ var Chart = function(context){
391
387
  function calculateDrawingSizes(){
392
388
  maxSize = (Min([width,height])/2);
393
389
  //Remove whatever is larger - the font size or line width.
394
-
390
+
395
391
  maxSize -= Max([config.scaleFontSize*0.5,config.scaleLineWidth*0.5]);
396
-
392
+
397
393
  labelHeight = config.scaleFontSize*2;
398
394
  //If we're drawing the backdrop - add the Y padding to the label height and remove from drawing region.
399
395
  if (config.scaleShowLabelBackdrop){
400
396
  labelHeight += (2 * config.scaleBackdropPaddingY);
401
397
  maxSize -= config.scaleBackdropPaddingY*1.5;
402
398
  }
403
-
399
+
404
400
  scaleHeight = maxSize;
405
401
  //If the label height is less than 5, set it to 5 so we don't have lines on top of each other.
406
402
  labelHeight = Default(labelHeight,5);
@@ -480,24 +476,24 @@ var Chart = function(context){
480
476
 
481
477
  var maxSteps = Math.floor((scaleHeight / (labelHeight*0.66)));
482
478
  var minSteps = Math.floor((scaleHeight / labelHeight*0.5));
483
-
479
+
484
480
  return {
485
481
  maxValue : upperValue,
486
482
  minValue : lowerValue,
487
483
  maxSteps : maxSteps,
488
484
  minSteps : minSteps
489
485
  };
490
-
486
+
491
487
 
492
488
  }
493
489
  }
494
490
 
495
491
  var Radar = function (data,config,ctx) {
496
- var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString;
497
-
492
+ var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString;
493
+
498
494
  //If no labels are defined set to an empty array, so referencing length for looping doesn't blow up.
499
495
  if (!data.labels) data.labels = [];
500
-
496
+
501
497
  calculateDrawingSizes();
502
498
 
503
499
  var valueBounds = getValueBounds();
@@ -506,7 +502,7 @@ var Chart = function(context){
506
502
 
507
503
  //Check and set the scale
508
504
  if (!config.scaleOverride){
509
-
505
+
510
506
  calculatedScale = calculateScale(scaleHeight,valueBounds.maxSteps,valueBounds.minSteps,valueBounds.maxValue,valueBounds.minValue,labelTemplateString);
511
507
  }
512
508
  else {
@@ -516,17 +512,13 @@ var Chart = function(context){
516
512
  graphMin : config.scaleStartValue,
517
513
  labels : []
518
514
  }
519
- for (var i=0; i<calculatedScale.steps; i++){
520
- if(labelTemplateString){
521
- calculatedScale.labels.push(tmpl(labelTemplateString,{value:(config.scaleStartValue + (config.scaleStepWidth * i)).toFixed(getDecimalPlaces (config.scaleStepWidth))}));
522
- }
523
- }
515
+ populateLabels(labelTemplateString, calculatedScale.labels,calculatedScale.steps,config.scaleStartValue,config.scaleStepWidth);
524
516
  }
525
-
517
+
526
518
  scaleHop = maxSize/(calculatedScale.steps);
527
-
519
+
528
520
  animationLoop(config,drawScale,drawAllDataPoints,ctx);
529
-
521
+
530
522
  //Radar specific functions.
531
523
  function drawAllDataPoints(animationDecimal){
532
524
  var rotationDegree = (2*Math.PI)/data.datasets[0].data.length;
@@ -534,27 +526,27 @@ var Chart = function(context){
534
526
  ctx.save();
535
527
  //translate to the centre of the canvas.
536
528
  ctx.translate(width/2,height/2);
537
-
529
+
538
530
  //We accept multiple data sets for radar charts, so show loop through each set
539
531
  for (var i=0; i<data.datasets.length; i++){
540
532
  ctx.beginPath();
541
533
 
542
534
  ctx.moveTo(0,animationDecimal*(-1*calculateOffset(data.datasets[i].data[0],calculatedScale,scaleHop)));
543
535
  for (var j=1; j<data.datasets[i].data.length; j++){
544
- ctx.rotate(rotationDegree);
536
+ ctx.rotate(rotationDegree);
545
537
  ctx.lineTo(0,animationDecimal*(-1*calculateOffset(data.datasets[i].data[j],calculatedScale,scaleHop)));
546
-
538
+
547
539
  }
548
540
  ctx.closePath();
549
-
550
-
541
+
542
+
551
543
  ctx.fillStyle = data.datasets[i].fillColor;
552
544
  ctx.strokeStyle = data.datasets[i].strokeColor;
553
545
  ctx.lineWidth = config.datasetStrokeWidth;
554
546
  ctx.fill();
555
547
  ctx.stroke();
556
-
557
-
548
+
549
+
558
550
  if (config.pointDot){
559
551
  ctx.fillStyle = data.datasets[i].pointColor;
560
552
  ctx.strokeStyle = data.datasets[i].pointStrokeColor;
@@ -565,26 +557,26 @@ var Chart = function(context){
565
557
  ctx.arc(0,animationDecimal*(-1*calculateOffset(data.datasets[i].data[k],calculatedScale,scaleHop)),config.pointDotRadius,2*Math.PI,false);
566
558
  ctx.fill();
567
559
  ctx.stroke();
568
- }
569
-
560
+ }
561
+
570
562
  }
571
563
  ctx.rotate(rotationDegree);
572
-
564
+
573
565
  }
574
566
  ctx.restore();
575
-
576
-
567
+
568
+
577
569
  }
578
570
  function drawScale(){
579
571
  var rotationDegree = (2*Math.PI)/data.datasets[0].data.length;
580
572
  ctx.save();
581
- ctx.translate(width / 2, height / 2);
582
-
573
+ ctx.translate(width / 2, height / 2);
574
+
583
575
  if (config.angleShowLineOut){
584
- ctx.strokeStyle = config.angleLineColor;
576
+ ctx.strokeStyle = config.angleLineColor;
585
577
  ctx.lineWidth = config.angleLineWidth;
586
578
  for (var h=0; h<data.datasets[0].data.length; h++){
587
-
579
+
588
580
  ctx.rotate(rotationDegree);
589
581
  ctx.beginPath();
590
582
  ctx.moveTo(0,0);
@@ -595,25 +587,25 @@ var Chart = function(context){
595
587
 
596
588
  for (var i=0; i<calculatedScale.steps; i++){
597
589
  ctx.beginPath();
598
-
590
+
599
591
  if(config.scaleShowLine){
600
592
  ctx.strokeStyle = config.scaleLineColor;
601
593
  ctx.lineWidth = config.scaleLineWidth;
602
- ctx.moveTo(0,-scaleHop * (i+1));
594
+ ctx.moveTo(0,-scaleHop * (i+1));
603
595
  for (var j=0; j<data.datasets[0].data.length; j++){
604
596
  ctx.rotate(rotationDegree);
605
597
  ctx.lineTo(0,-scaleHop * (i+1));
606
598
  }
607
599
  ctx.closePath();
608
- ctx.stroke();
609
-
600
+ ctx.stroke();
601
+
610
602
  }
611
-
612
- if (config.scaleShowLabels){
603
+
604
+ if (config.scaleShowLabels){
613
605
  ctx.textAlign = 'center';
614
- ctx.font = config.scaleFontStyle + " " + config.scaleFontSize+"px " + config.scaleFontFamily;
606
+ ctx.font = config.scaleFontStyle + " " + config.scaleFontSize+"px " + config.scaleFontFamily;
615
607
  ctx.textBaseline = "middle";
616
-
608
+
617
609
  if (config.scaleShowLabelBackdrop){
618
610
  var textWidth = ctx.measureText(calculatedScale.labels[i]).width;
619
611
  ctx.fillStyle = config.scaleBackdropColor;
@@ -625,18 +617,18 @@ var Chart = function(context){
625
617
  Math.round(config.scaleFontSize + (config.scaleBackdropPaddingY*2)) //Height
626
618
  );
627
619
  ctx.fill();
628
- }
620
+ }
629
621
  ctx.fillStyle = config.scaleFontColor;
630
622
  ctx.fillText(calculatedScale.labels[i],0,-scaleHop*(i+1));
631
623
  }
632
624
 
633
625
  }
634
- for (var k=0; k<data.labels.length; k++){
626
+ for (var k=0; k<data.labels.length; k++){
635
627
  ctx.font = config.pointLabelFontStyle + " " + config.pointLabelFontSize+"px " + config.pointLabelFontFamily;
636
628
  ctx.fillStyle = config.pointLabelFontColor;
637
629
  var opposite = Math.sin(rotationDegree*k) * (maxSize + config.pointLabelFontSize);
638
630
  var adjacent = Math.cos(rotationDegree*k) * (maxSize + config.pointLabelFontSize);
639
-
631
+
640
632
  if(rotationDegree*k == Math.PI || rotationDegree*k == 0){
641
633
  ctx.textAlign = "center";
642
634
  }
@@ -646,11 +638,11 @@ var Chart = function(context){
646
638
  else{
647
639
  ctx.textAlign = "left";
648
640
  }
649
-
641
+
650
642
  ctx.textBaseline = "middle";
651
-
643
+
652
644
  ctx.fillText(data.labels[k],opposite,-adjacent);
653
-
645
+
654
646
  }
655
647
  ctx.restore();
656
648
  };
@@ -658,17 +650,17 @@ var Chart = function(context){
658
650
  maxSize = (Min([width,height])/2);
659
651
 
660
652
  labelHeight = config.scaleFontSize*2;
661
-
653
+
662
654
  var labelLength = 0;
663
655
  for (var i=0; i<data.labels.length; i++){
664
656
  ctx.font = config.pointLabelFontStyle + " " + config.pointLabelFontSize+"px " + config.pointLabelFontFamily;
665
657
  var textMeasurement = ctx.measureText(data.labels[i]).width;
666
658
  if(textMeasurement>labelLength) labelLength = textMeasurement;
667
659
  }
668
-
660
+
669
661
  //Figure out whats the largest - the height of the text or the width of what's there, and minus it from the maximum usable size.
670
- maxSize -= Max([labelLength,((config.pointLabelFontSize/2)*1.5)]);
671
-
662
+ maxSize -= Max([labelLength,((config.pointLabelFontSize/2)*1.5)]);
663
+
672
664
  maxSize -= config.pointLabelFontSize;
673
665
  maxSize = CapValue(maxSize, null, 0);
674
666
  scaleHeight = maxSize;
@@ -678,7 +670,7 @@ var Chart = function(context){
678
670
  function getValueBounds() {
679
671
  var upperValue = Number.MIN_VALUE;
680
672
  var lowerValue = Number.MAX_VALUE;
681
-
673
+
682
674
  for (var i=0; i<data.datasets.length; i++){
683
675
  for (var j=0; j<data.datasets[i].data.length; j++){
684
676
  if (data.datasets[i].data[j] > upperValue){upperValue = data.datasets[i].data[j]}
@@ -688,31 +680,31 @@ var Chart = function(context){
688
680
 
689
681
  var maxSteps = Math.floor((scaleHeight / (labelHeight*0.66)));
690
682
  var minSteps = Math.floor((scaleHeight / labelHeight*0.5));
691
-
683
+
692
684
  return {
693
685
  maxValue : upperValue,
694
686
  minValue : lowerValue,
695
687
  maxSteps : maxSteps,
696
688
  minSteps : minSteps
697
689
  };
698
-
690
+
699
691
 
700
692
  }
701
693
  }
702
694
 
703
695
  var Pie = function(data,config,ctx){
704
696
  var segmentTotal = 0;
705
-
697
+
706
698
  //In case we have a canvas that is not a square. Minus 5 pixels as padding round the edge.
707
699
  var pieRadius = Min([height/2,width/2]) - 5;
708
-
700
+
709
701
  for (var i=0; i<data.length; i++){
710
702
  segmentTotal += data[i].value;
711
703
  }
712
-
713
-
704
+
705
+
714
706
  animationLoop(config,null,drawPieSegments,ctx);
715
-
707
+
716
708
  function drawPieSegments (animationDecimal){
717
709
  var cumulativeAngle = -Math.PI/2,
718
710
  scaleAnimation = 1,
@@ -733,33 +725,33 @@ var Chart = function(context){
733
725
  ctx.closePath();
734
726
  ctx.fillStyle = data[i].color;
735
727
  ctx.fill();
736
-
728
+
737
729
  if(config.segmentShowStroke){
738
730
  ctx.lineWidth = config.segmentStrokeWidth;
739
731
  ctx.strokeStyle = config.segmentStrokeColor;
740
732
  ctx.stroke();
741
733
  }
742
734
  cumulativeAngle += segmentAngle;
743
- }
744
- }
735
+ }
736
+ }
745
737
  }
746
738
 
747
739
  var Doughnut = function(data,config,ctx){
748
740
  var segmentTotal = 0;
749
-
741
+
750
742
  //In case we have a canvas that is not a square. Minus 5 pixels as padding round the edge.
751
743
  var doughnutRadius = Min([height/2,width/2]) - 5;
752
-
744
+
753
745
  var cutoutRadius = doughnutRadius * (config.percentageInnerCutout/100);
754
-
746
+
755
747
  for (var i=0; i<data.length; i++){
756
748
  segmentTotal += data[i].value;
757
749
  }
758
-
759
-
750
+
751
+
760
752
  animationLoop(config,null,drawPieSegments,ctx);
761
-
762
-
753
+
754
+
763
755
  function drawPieSegments (animationDecimal){
764
756
  var cumulativeAngle = -Math.PI/2,
765
757
  scaleAnimation = 1,
@@ -780,30 +772,30 @@ var Chart = function(context){
780
772
  ctx.closePath();
781
773
  ctx.fillStyle = data[i].color;
782
774
  ctx.fill();
783
-
775
+
784
776
  if(config.segmentShowStroke){
785
777
  ctx.lineWidth = config.segmentStrokeWidth;
786
778
  ctx.strokeStyle = config.segmentStrokeColor;
787
779
  ctx.stroke();
788
780
  }
789
781
  cumulativeAngle += segmentAngle;
790
- }
791
- }
792
-
793
-
794
-
782
+ }
783
+ }
784
+
785
+
786
+
795
787
  }
796
788
 
797
789
  var Line = function(data,config,ctx){
798
790
  var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString, valueHop,widestXLabel, xAxisLength,yAxisPosX,xAxisPosY, rotateLabels = 0;
799
-
791
+
800
792
  calculateDrawingSizes();
801
-
793
+
802
794
  valueBounds = getValueBounds();
803
795
  //Check and set the scale
804
796
  labelTemplateString = (config.scaleShowLabels)? config.scaleLabel : "";
805
797
  if (!config.scaleOverride){
806
-
798
+
807
799
  calculatedScale = calculateScale(scaleHeight,valueBounds.maxSteps,valueBounds.minSteps,valueBounds.maxValue,valueBounds.minValue,labelTemplateString);
808
800
  }
809
801
  else {
@@ -813,17 +805,13 @@ var Chart = function(context){
813
805
  graphMin : config.scaleStartValue,
814
806
  labels : []
815
807
  }
816
- for (var i=0; i<calculatedScale.steps; i++){
817
- if(labelTemplateString){
818
- calculatedScale.labels.push(tmpl(labelTemplateString,{value:(config.scaleStartValue + (config.scaleStepWidth * i)).toFixed(getDecimalPlaces (config.scaleStepWidth))}));
819
- }
820
- }
808
+ populateLabels(labelTemplateString, calculatedScale.labels,calculatedScale.steps,config.scaleStartValue,config.scaleStepWidth);
821
809
  }
822
-
810
+
823
811
  scaleHop = Math.floor(scaleHeight/calculatedScale.steps);
824
812
  calculateXAxisSize();
825
- animationLoop(config,drawScale,drawLines,ctx);
826
-
813
+ animationLoop(config,drawScale,drawLines,ctx);
814
+
827
815
  function drawLines(animPc){
828
816
  for (var i=0; i<data.datasets.length; i++){
829
817
  ctx.strokeStyle = data.datasets[i].strokeColor;
@@ -862,9 +850,9 @@ var Chart = function(context){
862
850
  }
863
851
  }
864
852
  }
865
-
853
+
866
854
  function yPos(dataSet,iteration){
867
- return xAxisPosY - animPc*(calculateOffset(data.datasets[dataSet].data[iteration],calculatedScale,scaleHop));
855
+ return xAxisPosY - animPc*(calculateOffset(data.datasets[dataSet].data[iteration],calculatedScale,scaleHop));
868
856
  }
869
857
  function xPos(iteration){
870
858
  return yAxisPosX + (valueHop * iteration);
@@ -878,8 +866,8 @@ var Chart = function(context){
878
866
  ctx.moveTo(width-widestXLabel/2+5,xAxisPosY);
879
867
  ctx.lineTo(width-(widestXLabel/2)-xAxisLength-5,xAxisPosY);
880
868
  ctx.stroke();
881
-
882
-
869
+
870
+
883
871
  if (rotateLabels > 0){
884
872
  ctx.save();
885
873
  ctx.textAlign = "right";
@@ -896,26 +884,26 @@ var Chart = function(context){
896
884
  ctx.fillText(data.labels[i], 0,0);
897
885
  ctx.restore();
898
886
  }
899
-
887
+
900
888
  else{
901
- ctx.fillText(data.labels[i], yAxisPosX + i*valueHop,xAxisPosY + config.scaleFontSize+3);
889
+ ctx.fillText(data.labels[i], yAxisPosX + i*valueHop,xAxisPosY + config.scaleFontSize+3);
902
890
  }
903
891
 
904
892
  ctx.beginPath();
905
893
  ctx.moveTo(yAxisPosX + i * valueHop, xAxisPosY+3);
906
-
894
+
907
895
  //Check i isnt 0, so we dont go over the Y axis twice.
908
896
  if(config.scaleShowGridLines && i>0){
909
897
  ctx.lineWidth = config.scaleGridLineWidth;
910
- ctx.strokeStyle = config.scaleGridLineColor;
898
+ ctx.strokeStyle = config.scaleGridLineColor;
911
899
  ctx.lineTo(yAxisPosX + i * valueHop, 5);
912
900
  }
913
901
  else{
914
- ctx.lineTo(yAxisPosX + i * valueHop, xAxisPosY+3);
902
+ ctx.lineTo(yAxisPosX + i * valueHop, xAxisPosY+3);
915
903
  }
916
904
  ctx.stroke();
917
905
  }
918
-
906
+
919
907
  //Y axis
920
908
  ctx.lineWidth = config.scaleLineWidth;
921
909
  ctx.strokeStyle = config.scaleLineColor;
@@ -923,7 +911,7 @@ var Chart = function(context){
923
911
  ctx.moveTo(yAxisPosX,xAxisPosY+5);
924
912
  ctx.lineTo(yAxisPosX,5);
925
913
  ctx.stroke();
926
-
914
+
927
915
  ctx.textAlign = "right";
928
916
  ctx.textBaseline = "middle";
929
917
  for (var j=0; j<calculatedScale.steps; j++){
@@ -932,20 +920,20 @@ var Chart = function(context){
932
920
  if (config.scaleShowGridLines){
933
921
  ctx.lineWidth = config.scaleGridLineWidth;
934
922
  ctx.strokeStyle = config.scaleGridLineColor;
935
- ctx.lineTo(yAxisPosX + xAxisLength + 5,xAxisPosY - ((j+1) * scaleHop));
923
+ ctx.lineTo(yAxisPosX + xAxisLength + 5,xAxisPosY - ((j+1) * scaleHop));
936
924
  }
937
925
  else{
938
926
  ctx.lineTo(yAxisPosX-0.5,xAxisPosY - ((j+1) * scaleHop));
939
927
  }
940
-
928
+
941
929
  ctx.stroke();
942
-
930
+
943
931
  if (config.scaleShowLabels){
944
932
  ctx.fillText(calculatedScale.labels[j],yAxisPosX-8,xAxisPosY - ((j+1) * scaleHop));
945
933
  }
946
934
  }
947
-
948
-
935
+
936
+
949
937
  }
950
938
  function calculateXAxisSize(){
951
939
  var longestText = 1;
@@ -960,11 +948,11 @@ var Chart = function(context){
960
948
  longestText +=10;
961
949
  }
962
950
  xAxisLength = width - longestText - widestXLabel;
963
- valueHop = Math.floor(xAxisLength/(data.labels.length-1));
964
-
951
+ valueHop = Math.floor(xAxisLength/(data.labels.length-1));
952
+
965
953
  yAxisPosX = width-widestXLabel/2-xAxisLength;
966
- xAxisPosY = scaleHeight + config.scaleFontSize/2;
967
- }
954
+ xAxisPosY = scaleHeight + config.scaleFontSize/2;
955
+ }
968
956
  function calculateDrawingSizes(){
969
957
  maxSize = height;
970
958
 
@@ -980,7 +968,7 @@ var Chart = function(context){
980
968
  rotateLabels = 45;
981
969
  if (width/data.labels.length < Math.cos(rotateLabels) * widestXLabel){
982
970
  rotateLabels = 90;
983
- maxSize -= widestXLabel;
971
+ maxSize -= widestXLabel;
984
972
  }
985
973
  else{
986
974
  maxSize -= Math.sin(rotateLabels) * widestXLabel;
@@ -989,21 +977,21 @@ var Chart = function(context){
989
977
  else{
990
978
  maxSize -= config.scaleFontSize;
991
979
  }
992
-
980
+
993
981
  //Add a little padding between the x line and the text
994
982
  maxSize -= 5;
995
-
996
-
983
+
984
+
997
985
  labelHeight = config.scaleFontSize;
998
-
986
+
999
987
  maxSize -= labelHeight;
1000
988
  //Set 5 pixels greater than the font size to allow for a little padding from the X axis.
1001
-
989
+
1002
990
  scaleHeight = maxSize;
1003
-
991
+
1004
992
  //Then get the area above we can safely draw on.
1005
-
1006
- }
993
+
994
+ }
1007
995
  function getValueBounds() {
1008
996
  var upperValue = Number.MIN_VALUE;
1009
997
  var lowerValue = Number.MAX_VALUE;
@@ -1013,33 +1001,33 @@ var Chart = function(context){
1013
1001
  if ( data.datasets[i].data[j] < lowerValue) { lowerValue = data.datasets[i].data[j] };
1014
1002
  }
1015
1003
  };
1016
-
1004
+
1017
1005
  var maxSteps = Math.floor((scaleHeight / (labelHeight*0.66)));
1018
1006
  var minSteps = Math.floor((scaleHeight / labelHeight*0.5));
1019
-
1007
+
1020
1008
  return {
1021
1009
  maxValue : upperValue,
1022
1010
  minValue : lowerValue,
1023
1011
  maxSteps : maxSteps,
1024
1012
  minSteps : minSteps
1025
1013
  };
1026
-
1027
-
1014
+
1015
+
1028
1016
  }
1029
1017
 
1030
-
1018
+
1031
1019
  }
1032
-
1020
+
1033
1021
  var Bar = function(data,config,ctx){
1034
1022
  var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString, valueHop,widestXLabel, xAxisLength,yAxisPosX,xAxisPosY,barWidth, rotateLabels = 0;
1035
-
1023
+
1036
1024
  calculateDrawingSizes();
1037
-
1025
+
1038
1026
  valueBounds = getValueBounds();
1039
1027
  //Check and set the scale
1040
1028
  labelTemplateString = (config.scaleShowLabels)? config.scaleLabel : "";
1041
1029
  if (!config.scaleOverride){
1042
-
1030
+
1043
1031
  calculatedScale = calculateScale(scaleHeight,valueBounds.maxSteps,valueBounds.minSteps,valueBounds.maxValue,valueBounds.minValue,labelTemplateString);
1044
1032
  }
1045
1033
  else {
@@ -1049,17 +1037,13 @@ var Chart = function(context){
1049
1037
  graphMin : config.scaleStartValue,
1050
1038
  labels : []
1051
1039
  }
1052
- for (var i=0; i<calculatedScale.steps; i++){
1053
- if(labelTemplateString){
1054
- calculatedScale.labels.push(tmpl(labelTemplateString,{value:(config.scaleStartValue + (config.scaleStepWidth * i)).toFixed(getDecimalPlaces (config.scaleStepWidth))}));
1055
- }
1056
- }
1040
+ populateLabels(labelTemplateString, calculatedScale.labels,calculatedScale.steps,config.scaleStartValue,config.scaleStepWidth);
1057
1041
  }
1058
-
1042
+
1059
1043
  scaleHop = Math.floor(scaleHeight/calculatedScale.steps);
1060
1044
  calculateXAxisSize();
1061
- animationLoop(config,drawScale,drawBars,ctx);
1062
-
1045
+ animationLoop(config,drawScale,drawBars,ctx);
1046
+
1063
1047
  function drawBars(animPc){
1064
1048
  ctx.lineWidth = config.barStrokeWidth;
1065
1049
  for (var i=0; i<data.datasets.length; i++){
@@ -1067,7 +1051,7 @@ var Chart = function(context){
1067
1051
  ctx.strokeStyle = data.datasets[i].strokeColor;
1068
1052
  for (var j=0; j<data.datasets[i].data.length; j++){
1069
1053
  var barOffset = yAxisPosX + config.barValueSpacing + valueHop*j + barWidth*i + config.barDatasetSpacing*i + config.barStrokeWidth*i;
1070
-
1054
+
1071
1055
  ctx.beginPath();
1072
1056
  ctx.moveTo(barOffset, xAxisPosY);
1073
1057
  ctx.lineTo(barOffset, xAxisPosY - animPc*calculateOffset(data.datasets[i].data[j],calculatedScale,scaleHop)+(config.barStrokeWidth/2));
@@ -1080,7 +1064,7 @@ var Chart = function(context){
1080
1064
  ctx.fill();
1081
1065
  }
1082
1066
  }
1083
-
1067
+
1084
1068
  }
1085
1069
  function drawScale(){
1086
1070
  //X axis line
@@ -1090,8 +1074,8 @@ var Chart = function(context){
1090
1074
  ctx.moveTo(width-widestXLabel/2+5,xAxisPosY);
1091
1075
  ctx.lineTo(width-(widestXLabel/2)-xAxisLength-5,xAxisPosY);
1092
1076
  ctx.stroke();
1093
-
1094
-
1077
+
1078
+
1095
1079
  if (rotateLabels > 0){
1096
1080
  ctx.save();
1097
1081
  ctx.textAlign = "right";
@@ -1108,21 +1092,21 @@ var Chart = function(context){
1108
1092
  ctx.fillText(data.labels[i], 0,0);
1109
1093
  ctx.restore();
1110
1094
  }
1111
-
1095
+
1112
1096
  else{
1113
- ctx.fillText(data.labels[i], yAxisPosX + i*valueHop + valueHop/2,xAxisPosY + config.scaleFontSize+3);
1097
+ ctx.fillText(data.labels[i], yAxisPosX + i*valueHop + valueHop/2,xAxisPosY + config.scaleFontSize+3);
1114
1098
  }
1115
1099
 
1116
1100
  ctx.beginPath();
1117
1101
  ctx.moveTo(yAxisPosX + (i+1) * valueHop, xAxisPosY+3);
1118
-
1102
+
1119
1103
  //Check i isnt 0, so we dont go over the Y axis twice.
1120
1104
  ctx.lineWidth = config.scaleGridLineWidth;
1121
- ctx.strokeStyle = config.scaleGridLineColor;
1105
+ ctx.strokeStyle = config.scaleGridLineColor;
1122
1106
  ctx.lineTo(yAxisPosX + (i+1) * valueHop, 5);
1123
1107
  ctx.stroke();
1124
1108
  }
1125
-
1109
+
1126
1110
  //Y axis
1127
1111
  ctx.lineWidth = config.scaleLineWidth;
1128
1112
  ctx.strokeStyle = config.scaleLineColor;
@@ -1130,7 +1114,7 @@ var Chart = function(context){
1130
1114
  ctx.moveTo(yAxisPosX,xAxisPosY+5);
1131
1115
  ctx.lineTo(yAxisPosX,5);
1132
1116
  ctx.stroke();
1133
-
1117
+
1134
1118
  ctx.textAlign = "right";
1135
1119
  ctx.textBaseline = "middle";
1136
1120
  for (var j=0; j<calculatedScale.steps; j++){
@@ -1139,19 +1123,19 @@ var Chart = function(context){
1139
1123
  if (config.scaleShowGridLines){
1140
1124
  ctx.lineWidth = config.scaleGridLineWidth;
1141
1125
  ctx.strokeStyle = config.scaleGridLineColor;
1142
- ctx.lineTo(yAxisPosX + xAxisLength + 5,xAxisPosY - ((j+1) * scaleHop));
1126
+ ctx.lineTo(yAxisPosX + xAxisLength + 5,xAxisPosY - ((j+1) * scaleHop));
1143
1127
  }
1144
1128
  else{
1145
1129
  ctx.lineTo(yAxisPosX-0.5,xAxisPosY - ((j+1) * scaleHop));
1146
1130
  }
1147
-
1131
+
1148
1132
  ctx.stroke();
1149
1133
  if (config.scaleShowLabels){
1150
1134
  ctx.fillText(calculatedScale.labels[j],yAxisPosX-8,xAxisPosY - ((j+1) * scaleHop));
1151
1135
  }
1152
1136
  }
1153
-
1154
-
1137
+
1138
+
1155
1139
  }
1156
1140
  function calculateXAxisSize(){
1157
1141
  var longestText = 1;
@@ -1166,13 +1150,13 @@ var Chart = function(context){
1166
1150
  longestText +=10;
1167
1151
  }
1168
1152
  xAxisLength = width - longestText - widestXLabel;
1169
- valueHop = Math.floor(xAxisLength/(data.labels.length));
1170
-
1153
+ valueHop = Math.floor(xAxisLength/(data.labels.length));
1154
+
1171
1155
  barWidth = (valueHop - config.scaleGridLineWidth*2 - (config.barValueSpacing*2) - (config.barDatasetSpacing*data.datasets.length-1) - ((config.barStrokeWidth/2)*data.datasets.length-1))/data.datasets.length;
1172
-
1156
+
1173
1157
  yAxisPosX = width-widestXLabel/2-xAxisLength;
1174
- xAxisPosY = scaleHeight + config.scaleFontSize/2;
1175
- }
1158
+ xAxisPosY = scaleHeight + config.scaleFontSize/2;
1159
+ }
1176
1160
  function calculateDrawingSizes(){
1177
1161
  maxSize = height;
1178
1162
 
@@ -1188,7 +1172,7 @@ var Chart = function(context){
1188
1172
  rotateLabels = 45;
1189
1173
  if (width/data.labels.length < Math.cos(rotateLabels) * widestXLabel){
1190
1174
  rotateLabels = 90;
1191
- maxSize -= widestXLabel;
1175
+ maxSize -= widestXLabel;
1192
1176
  }
1193
1177
  else{
1194
1178
  maxSize -= Math.sin(rotateLabels) * widestXLabel;
@@ -1197,21 +1181,21 @@ var Chart = function(context){
1197
1181
  else{
1198
1182
  maxSize -= config.scaleFontSize;
1199
1183
  }
1200
-
1184
+
1201
1185
  //Add a little padding between the x line and the text
1202
1186
  maxSize -= 5;
1203
-
1204
-
1187
+
1188
+
1205
1189
  labelHeight = config.scaleFontSize;
1206
-
1190
+
1207
1191
  maxSize -= labelHeight;
1208
1192
  //Set 5 pixels greater than the font size to allow for a little padding from the X axis.
1209
-
1193
+
1210
1194
  scaleHeight = maxSize;
1211
-
1195
+
1212
1196
  //Then get the area above we can safely draw on.
1213
-
1214
- }
1197
+
1198
+ }
1215
1199
  function getValueBounds() {
1216
1200
  var upperValue = Number.MIN_VALUE;
1217
1201
  var lowerValue = Number.MAX_VALUE;
@@ -1221,39 +1205,39 @@ var Chart = function(context){
1221
1205
  if ( data.datasets[i].data[j] < lowerValue) { lowerValue = data.datasets[i].data[j] };
1222
1206
  }
1223
1207
  };
1224
-
1208
+
1225
1209
  var maxSteps = Math.floor((scaleHeight / (labelHeight*0.66)));
1226
1210
  var minSteps = Math.floor((scaleHeight / labelHeight*0.5));
1227
-
1211
+
1228
1212
  return {
1229
1213
  maxValue : upperValue,
1230
1214
  minValue : lowerValue,
1231
1215
  maxSteps : maxSteps,
1232
1216
  minSteps : minSteps
1233
1217
  };
1234
-
1235
-
1218
+
1219
+
1236
1220
  }
1237
1221
  }
1238
-
1222
+
1239
1223
  function calculateOffset(val,calculatedScale,scaleHop){
1240
1224
  var outerValue = calculatedScale.steps * calculatedScale.stepValue;
1241
1225
  var adjustedValue = val - calculatedScale.graphMin;
1242
1226
  var scalingFactor = CapValue(adjustedValue/outerValue,1,0);
1243
1227
  return (scaleHop*calculatedScale.steps) * scalingFactor;
1244
1228
  }
1245
-
1229
+
1246
1230
  function animationLoop(config,drawScale,drawData,ctx){
1247
1231
  var animFrameAmount = (config.animation)? 1/CapValue(config.animationSteps,Number.MAX_VALUE,1) : 1,
1248
1232
  easingFunction = animationOptions[config.animationEasing],
1249
1233
  percentAnimComplete =(config.animation)? 0 : 1;
1250
-
1251
-
1252
-
1234
+
1235
+
1236
+
1253
1237
  if (typeof drawScale !== "function") drawScale = function(){};
1254
-
1238
+
1255
1239
  requestAnimFrame(animLoop);
1256
-
1240
+
1257
1241
  function animateFrame(){
1258
1242
  var easeAdjustedAnimationPercent =(config.animation)? CapValue(easingFunction(percentAnimComplete),null,0) : 1;
1259
1243
  clear(ctx);
@@ -1263,12 +1247,12 @@ var Chart = function(context){
1263
1247
  } else {
1264
1248
  drawScale();
1265
1249
  drawData(easeAdjustedAnimationPercent);
1266
- }
1250
+ }
1267
1251
  }
1268
1252
  function animLoop(){
1269
1253
  //We need to check if the animation is incomplete (less than 1), or complete (1).
1270
1254
  percentAnimComplete += animFrameAmount;
1271
- animateFrame();
1255
+ animateFrame();
1272
1256
  //Stop the loop continuing forever
1273
1257
  if (percentAnimComplete <= 1){
1274
1258
  requestAnimFrame(animLoop);
@@ -1276,14 +1260,14 @@ var Chart = function(context){
1276
1260
  else{
1277
1261
  if (typeof config.onAnimationComplete == "function") config.onAnimationComplete();
1278
1262
  }
1279
-
1280
- }
1281
-
1263
+
1264
+ }
1265
+
1282
1266
  }
1283
1267
 
1284
1268
  //Declare global functions to be called within this namespace here.
1285
-
1286
-
1269
+
1270
+
1287
1271
  // shim layer with setTimeout fallback
1288
1272
  var requestAnimFrame = (function(){
1289
1273
  return window.requestAnimationFrame ||
@@ -1298,22 +1282,22 @@ var Chart = function(context){
1298
1282
 
1299
1283
  function calculateScale(drawingHeight,maxSteps,minSteps,maxValue,minValue,labelTemplateString){
1300
1284
  var graphMin,graphMax,graphRange,stepValue,numberOfSteps,valueRange,rangeOrderOfMagnitude,decimalNum;
1301
-
1285
+
1302
1286
  valueRange = maxValue - minValue;
1303
-
1287
+
1304
1288
  rangeOrderOfMagnitude = calculateOrderOfMagnitude(valueRange);
1305
1289
 
1306
1290
  graphMin = Math.floor(minValue / (1 * Math.pow(10, rangeOrderOfMagnitude))) * Math.pow(10, rangeOrderOfMagnitude);
1307
-
1291
+
1308
1292
  graphMax = Math.ceil(maxValue / (1 * Math.pow(10, rangeOrderOfMagnitude))) * Math.pow(10, rangeOrderOfMagnitude);
1309
-
1293
+
1310
1294
  graphRange = graphMax - graphMin;
1311
-
1295
+
1312
1296
  stepValue = Math.pow(10, rangeOrderOfMagnitude);
1313
-
1297
+
1314
1298
  numberOfSteps = Math.round(graphRange / stepValue);
1315
-
1316
- //Compare number of steps to the max and min for that size graph, and add in half steps if need be.
1299
+
1300
+ //Compare number of steps to the max and min for that size graph, and add in half steps if need be.
1317
1301
  while(numberOfSteps < minSteps || numberOfSteps > maxSteps) {
1318
1302
  if (numberOfSteps < minSteps){
1319
1303
  stepValue /= 2;
@@ -1324,35 +1308,35 @@ var Chart = function(context){
1324
1308
  numberOfSteps = Math.round(graphRange/stepValue);
1325
1309
  }
1326
1310
  };
1327
-
1328
1311
 
1329
-
1330
- //Create an array of all the labels by interpolating the string.
1331
-
1332
1312
  var labels = [];
1333
-
1334
- if(labelTemplateString){
1335
- //Fix floating point errors by setting to fixed the on the same decimal as the stepValue.
1336
- for (var i=1; i<numberOfSteps+1; i++){
1337
- labels.push(tmpl(labelTemplateString,{value:(graphMin + (stepValue*i)).toFixed(getDecimalPlaces (stepValue))}));
1338
- }
1339
- }
1340
-
1313
+ populateLabels(labelTemplateString, labels, numberOfSteps, graphMin, stepValue);
1314
+
1341
1315
  return {
1342
1316
  steps : numberOfSteps,
1343
1317
  stepValue : stepValue,
1344
1318
  graphMin : graphMin,
1345
- labels : labels
1346
-
1319
+ labels : labels
1320
+
1347
1321
  }
1348
-
1322
+
1349
1323
  function calculateOrderOfMagnitude(val){
1350
1324
  return Math.floor(Math.log(val) / Math.LN10);
1351
- }
1325
+ }
1352
1326
 
1353
1327
 
1354
1328
  }
1355
-
1329
+
1330
+ //Populate an array of all the labels by interpolating the string.
1331
+ function populateLabels(labelTemplateString, labels, numberOfSteps, graphMin, stepValue) {
1332
+ if (labelTemplateString) {
1333
+ //Fix floating point errors by setting to fixed the on the same decimal as the stepValue.
1334
+ for (var i = 1; i < numberOfSteps + 1; i++) {
1335
+ labels.push(tmpl(labelTemplateString, {value: (graphMin + (stepValue * i)).toFixed(getDecimalPlaces(stepValue))}));
1336
+ }
1337
+ }
1338
+ }
1339
+
1356
1340
  //Max value from array
1357
1341
  function Max( array ){
1358
1342
  return Math.max.apply( Math, array );
@@ -1395,34 +1379,34 @@ var Chart = function(context){
1395
1379
  else{
1396
1380
  return 0;
1397
1381
  }
1398
-
1399
- }
1400
-
1382
+
1383
+ }
1384
+
1401
1385
  function mergeChartConfig(defaults,userDefined){
1402
1386
  var returnObj = {};
1403
1387
  for (var attrname in defaults) { returnObj[attrname] = defaults[attrname]; }
1404
1388
  for (var attrname in userDefined) { returnObj[attrname] = userDefined[attrname]; }
1405
1389
  return returnObj;
1406
1390
  }
1407
-
1391
+
1408
1392
  //Javascript micro templating by John Resig - source at http://ejohn.org/blog/javascript-micro-templating/
1409
1393
  var cache = {};
1410
-
1394
+
1411
1395
  function tmpl(str, data){
1412
1396
  // Figure out if we're getting a template, or if we need to
1413
1397
  // load the template - and be sure to cache the result.
1414
1398
  var fn = !/\W/.test(str) ?
1415
1399
  cache[str] = cache[str] ||
1416
1400
  tmpl(document.getElementById(str).innerHTML) :
1417
-
1401
+
1418
1402
  // Generate a reusable function that will serve as a template
1419
1403
  // generator (and which will be cached).
1420
1404
  new Function("obj",
1421
1405
  "var p=[],print=function(){p.push.apply(p,arguments);};" +
1422
-
1406
+
1423
1407
  // Introduce the data as local variables using with(){}
1424
1408
  "with(obj){p.push('" +
1425
-
1409
+
1426
1410
  // Convert the template into pure JavaScript
1427
1411
  str
1428
1412
  .replace(/[\r\t\n]/g, " ")
@@ -1433,10 +1417,9 @@ var Chart = function(context){
1433
1417
  .split("%>").join("p.push('")
1434
1418
  .split("\r").join("\\'")
1435
1419
  + "');}return p.join('');");
1436
-
1420
+
1437
1421
  // Provide some basic currying to the user
1438
1422
  return data ? fn( data ) : fn;
1439
1423
  };
1440
1424
  }
1441
1425
 
1442
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chart-js-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-26 00:00:00.000000000 -04:00
12
+ date: 2013-04-15 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
17
- requirement: &70111345020200 !ruby/object:Gem::Requirement
17
+ requirement: &70272322155920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '3.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70111345020200
25
+ version_requirements: *70272322155920
26
26
  description: Chart.js for use in Rails asset pipeline
27
27
  email:
28
28
  - walsh1kt@gmail.com