rails_admin_charts 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 266b332b8541fb9ac4387da769b9f78874f02bb8
|
4
|
+
data.tar.gz: ca477c107656fb0b679197761cd1fb6af0a7ca89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72b8f394ad3ee3c257478fa8f9d68aa887148069027e7a2862e54c4732cde4a3db0fc0369fc3d09a1c54a1399286a5d5fc646b0ba2f7db82c80c634564c1bc37
|
7
|
+
data.tar.gz: e4730588c82e9cfa863fd099078f0c956042737b726a27ce6ca7548e64a1dfa814a22d18665b046c14f8af67f79b22519d2c5b496cabf3e34e9ca4edebb187de
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ In your RailsAdmin initializer (`app/config/initializers/rails_admin.rb`), enabl
|
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
config.actions do
|
19
|
+
all # NB: comment out this line for RailsAdmin < 0.6.0
|
19
20
|
charts
|
20
21
|
end
|
21
22
|
```
|
@@ -48,4 +49,21 @@ The data displayed in the chart can be altered by overriding the class method `g
|
|
48
49
|
end
|
49
50
|
```
|
50
51
|
|
52
|
+
You can set custom categories by overriding the method `xaxis`
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
def self.xaxis
|
56
|
+
['cat a', 'cat b', 'cat c' 'cat d', 'cat e', 'cat f', 'cat g', 'cat h']
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
You can set label rotation by overriding the method `label_rotation`
|
61
|
+
It expects a string `-45` or `-90`
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
def self.label_rotation
|
65
|
+
"-45"
|
66
|
+
end
|
67
|
+
```
|
68
|
+
|
51
69
|
This project uses MIT-LICENSE.
|
@@ -4,25 +4,43 @@
|
|
4
4
|
$(document).ready(function() {
|
5
5
|
chart = new Highcharts.Chart({
|
6
6
|
chart: {
|
7
|
-
|
7
|
+
<% if @abstract_model.model.chart_type == "column" %>
|
8
|
+
type: 'column',
|
9
|
+
<% end %>
|
10
|
+
renderTo: 'growth_rate'
|
8
11
|
},
|
9
12
|
title: {
|
10
13
|
text: '<%= @abstract_model.to_s.pluralize %>'
|
11
14
|
},
|
12
15
|
xAxis: {
|
13
|
-
|
16
|
+
labels: {
|
17
|
+
<% if @abstract_model.model.label_rotation == "-45" %>
|
18
|
+
rotation: -45,
|
19
|
+
<% elsif @abstract_model.model.label_rotation == "-90" %>
|
20
|
+
rotation: -90,
|
21
|
+
<% end %>
|
22
|
+
align: 'right'
|
23
|
+
},
|
24
|
+
<% if @abstract_model.model.xaxis == "datetime" %>
|
25
|
+
type: 'datetime'
|
26
|
+
<% elsif @abstract_model.model.chart_type == "pie" %>
|
27
|
+
<% else %>
|
28
|
+
categories: <%=raw @abstract_model.model.xaxis.to_json %>
|
29
|
+
<% end %>
|
30
|
+
|
14
31
|
},
|
32
|
+
|
15
33
|
// yAxis: {
|
16
34
|
// title: {
|
17
35
|
// text: 'Counts'
|
18
36
|
// }
|
19
37
|
// },
|
20
|
-
tooltip: {
|
21
|
-
formatter: function() {
|
22
|
-
return ''
|
23
|
-
Highcharts.dateFormat('%e. %b', this.x) +' -> '+ this.y
|
24
|
-
}
|
25
|
-
}
|
38
|
+
<%#tooltip: {%>
|
39
|
+
<%#formatter: function() {%>
|
40
|
+
<%#return ''+%>
|
41
|
+
<%#Highcharts.dateFormat('%e. %b', this.x) +' -> '+ this.y;%>
|
42
|
+
<%#}%>
|
43
|
+
<%#},%>
|
26
44
|
plotOptions: {
|
27
45
|
spline: {
|
28
46
|
lineWidth: 4,
|
@@ -44,7 +62,15 @@
|
|
44
62
|
}
|
45
63
|
}
|
46
64
|
},
|
47
|
-
|
65
|
+
<% if @abstract_model.model.chart_type == "pie" %>
|
66
|
+
series: [{
|
67
|
+
type: 'pie',
|
68
|
+
name: 'Number of <%= @abstract_model.to_s.pluralize %>',
|
69
|
+
data: <%=raw @abstract_model.model.graph_data(100.days.ago).to_json %>
|
70
|
+
}],
|
71
|
+
<% else %>
|
72
|
+
series: <%=raw @abstract_model.model.graph_data(100.days.ago).to_json %>,
|
73
|
+
<% end %>
|
48
74
|
navigation: {
|
49
75
|
menuItemStyle: {
|
50
76
|
fontSize: '10px'
|
@@ -53,4 +79,4 @@
|
|
53
79
|
});
|
54
80
|
});
|
55
81
|
});
|
56
|
-
</script>
|
82
|
+
</script>
|
data/lib/rails_admin_charts.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_charts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Geraghty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|