chart-js-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Chart.Js for Rails
1
+ # Chart.js for Rails
2
2
 
3
3
  Integrate Chart.js into Rails Asset Pipeline
4
4
 
@@ -16,9 +16,42 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install chart-js-rails
18
18
 
19
- In your application.js file, add
20
- $ //= require chart
19
+ Add this to your application.js file:
20
+
21
+ //= require chart
21
22
 
22
23
  ## Usage
23
24
 
24
- Visit: http://www.chartjs.org/docs/ for general Chart.js usage
25
+ Example Line Chart (coffeescript/haml):
26
+
27
+ app.js.coffee:
28
+
29
+ jQuery ->
30
+ data = {
31
+ labels : ["January","February","March","April","May","June","July"],
32
+ datasets : [
33
+ {
34
+ fillColor : "rgba(220,220,220,0.5)",
35
+ strokeColor : "rgba(220,220,220,1)",
36
+ pointColor : "rgba(220,220,220,1)",
37
+ pointStrokeColor : "#fff",
38
+ data : [65,59,90,81,56,55,40]
39
+ },
40
+ {
41
+ fillColor : "rgba(151,187,205,0.5)",
42
+ strokeColor : "rgba(151,187,205,1)",
43
+ pointColor : "rgba(151,187,205,1)",
44
+ pointStrokeColor : "#fff",
45
+ data : [28,48,40,19,96,27,100]
46
+ }
47
+ ]
48
+ }
49
+
50
+ myNewChart = new Chart($("#canvas").get(0).getContext("2d")).Line(data)
51
+
52
+ index.haml.html:
53
+
54
+ %canvas#canvas{:height => "450", :width => "600"}
55
+
56
+
57
+ Visit: http://www.chartjs.org/docs/ for more Chart.js usage
@@ -1,7 +1,7 @@
1
1
  module Chart
2
2
  module Js
3
3
  module Rails
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,12 @@
1
+ /*!
2
+ * Chart.js
3
+ * http://chartjs.org/
4
+ *
5
+ * Copyright 2013 Nick Downie
6
+ * Released under the MIT license
7
+ * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
8
+ */
9
+
1
10
  //Define the global Chart Variable as a class.
2
11
  var Chart = function(context){
3
12
 
@@ -525,7 +534,7 @@ var Chart = function(context){
525
534
  ctx.save();
526
535
  //translate to the centre of the canvas.
527
536
  ctx.translate(width/2,height/2);
528
- ctx.rotate(rotationDegree);
537
+
529
538
  //We accept multiple data sets for radar charts, so show loop through each set
530
539
  for (var i=0; i<data.datasets.length; i++){
531
540
  ctx.beginPath();
@@ -559,6 +568,7 @@ var Chart = function(context){
559
568
  }
560
569
 
561
570
  }
571
+ ctx.rotate(rotationDegree);
562
572
 
563
573
  }
564
574
  ctx.restore();
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.2
4
+ version: 0.0.3
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-19 00:00:00.000000000 -04:00
12
+ date: 2013-03-26 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: &70271470155980 !ruby/object:Gem::Requirement
17
+ requirement: &70111345020200 !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: *70271470155980
25
+ version_requirements: *70111345020200
26
26
  description: Chart.js for use in Rails asset pipeline
27
27
  email:
28
28
  - walsh1kt@gmail.com