iruby-chartkick 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +22 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +39 -24
- data/LICENSE.txt +1 -1
- data/README.md +97 -14
- data/iruby-chartkick.gemspec +3 -3
- data/lib/iruby/chartkick/base_chart.rb +7 -21
- data/lib/iruby/chartkick/version.rb +1 -1
- data/package-lock.json +1034 -0
- data/package.json +14 -0
- data/vendor/assets/javascripts/bundle.js +2 -0
- data/vendor/assets/javascripts/main.js +1 -0
- metadata +18 -16
- data/.travis.yml +0 -5
- data/vendor/assets/javascripts/chartkick.js +0 -1
- data/vendor/assets/javascripts/google_charts_loader.js +0 -295
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e8f8b33a66cf346d45cd17af944f59c50ab4ec1b27e53dcf27fe966fe4d49cb
|
4
|
+
data.tar.gz: 7bf93e6795e174417d86fd40230c0471d47bf3c89be2dd177d750b29e9b002e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09685ed42121528fbf96d7082b850e71eb1f13fbb84c9eb1ebebc9dc44e1d21eadd03ac104503e4e859a45b437e19a6eaade189af2a09cf4f7ca208a1adf9057'
|
7
|
+
data.tar.gz: e907f5d6a6fe505ee2df30cc1d9183bd5aaf8bb67511d106714c7a4d6134797821ef809cd6ff2251df3228688a5b5dd1f74dd5b0bec47a2b79d178d30291a512
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: build
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- master
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby: [ '2.6', '3.0' ]
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
bundler-cache: true
|
22
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.1
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,41 +1,56 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iruby-chartkick (0.
|
5
|
-
chartkick
|
4
|
+
iruby-chartkick (0.3.0)
|
5
|
+
chartkick (~> 4.0.5)
|
6
6
|
iruby
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
chartkick (3.3.0)
|
11
|
+
chartkick (4.0.5)
|
13
12
|
data_uri (0.1.0)
|
14
|
-
diff-lcs (1.
|
15
|
-
|
16
|
-
|
13
|
+
diff-lcs (1.4.4)
|
14
|
+
ffi (1.15.4)
|
15
|
+
ffi-rzmq (2.0.7)
|
16
|
+
ffi-rzmq-core (>= 1.0.7)
|
17
|
+
ffi-rzmq-core (1.0.7)
|
18
|
+
ffi
|
19
|
+
io-console (0.5.9)
|
20
|
+
irb (1.3.7)
|
21
|
+
reline (>= 0.2.7)
|
22
|
+
iruby (0.7.4)
|
17
23
|
data_uri (~> 0.1)
|
18
|
-
|
24
|
+
ffi-rzmq
|
25
|
+
irb
|
26
|
+
mime-types (>= 3.3.1)
|
19
27
|
multi_json (~> 1.11)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
rspec
|
28
|
+
native-package-installer
|
29
|
+
mime-types (3.3.1)
|
30
|
+
mime-types-data (~> 3.2015)
|
31
|
+
mime-types-data (3.2021.0901)
|
32
|
+
multi_json (1.15.0)
|
33
|
+
native-package-installer (1.1.1)
|
34
|
+
rake (13.0.6)
|
35
|
+
reline (0.2.7)
|
36
|
+
io-console (~> 0.5)
|
37
|
+
rspec (3.10.0)
|
38
|
+
rspec-core (~> 3.10.0)
|
39
|
+
rspec-expectations (~> 3.10.0)
|
40
|
+
rspec-mocks (~> 3.10.0)
|
41
|
+
rspec-core (3.10.1)
|
42
|
+
rspec-support (~> 3.10.0)
|
43
|
+
rspec-expectations (3.10.1)
|
30
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-mocks (3.
|
45
|
+
rspec-support (~> 3.10.0)
|
46
|
+
rspec-mocks (3.10.2)
|
33
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-support (3.
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-support (3.10.2)
|
36
50
|
|
37
51
|
PLATFORMS
|
38
|
-
|
52
|
+
x86_64-darwin-20
|
53
|
+
x86_64-linux
|
39
54
|
|
40
55
|
DEPENDENCIES
|
41
56
|
bundler
|
@@ -44,4 +59,4 @@ DEPENDENCIES
|
|
44
59
|
rspec (~> 3.0)
|
45
60
|
|
46
61
|
BUNDLED WITH
|
47
|
-
2.
|
62
|
+
2.2.15
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# iruby-chartkick [![
|
1
|
+
# iruby-chartkick [![build](https://github.com/Absolventa/iruby-chartkick/actions/workflows/build.yml/badge.svg)](https://github.com/Absolventa/iruby-chartkick/actions/workflows/build.yml)
|
2
2
|
|
3
|
-
You like writing [Ruby within Juypter](
|
3
|
+
You like writing [Ruby within Juypter](https://github.com/SciRuby/iruby/) notebooks? Awesome, you're not alone - we do so, too ☀️ Since we also fell in love with the handy charting API of [ankane/chartkick](https://github.com/ankane/chartkick), we wrote this little gem bringing them together.
|
4
4
|
|
5
5
|
`iruby-chartkick` was made for easy plug-n-play plotting data using the awesomeness of chartkick within IRuby-backed Jupyter notebooks.
|
6
6
|
|
@@ -12,7 +12,7 @@ You like writing [Ruby within Juypter](https://github.com/SciRuby/iruby/) noteb
|
|
12
12
|
|
13
13
|
You can either include the module `IRuby::Chartkick` and use the wrapper methods, like `line_chart`:
|
14
14
|
|
15
|
-
```
|
15
|
+
```ruby
|
16
16
|
include IRuby::Chartkick
|
17
17
|
|
18
18
|
data = {
|
@@ -26,7 +26,7 @@ line_chart(data)
|
|
26
26
|
|
27
27
|
Or you use the chart wrapper classes directly:
|
28
28
|
|
29
|
-
```
|
29
|
+
```ruby
|
30
30
|
include IRuby::Chartkick
|
31
31
|
|
32
32
|
data = {
|
@@ -40,14 +40,97 @@ IRuby::Chartkick::LineChart.new(data).plot
|
|
40
40
|
|
41
41
|
### Examples:
|
42
42
|
|
43
|
+
```ruby
|
44
|
+
include IRuby::Chartkick
|
45
|
+
|
46
|
+
data = [
|
47
|
+
{
|
48
|
+
name: "Monkeys",
|
49
|
+
data: {
|
50
|
+
2010 => 20,
|
51
|
+
2011 => 190,
|
52
|
+
2012 => 188,
|
53
|
+
2013 => 230,
|
54
|
+
2014 => 422,
|
55
|
+
2015 => 56,
|
56
|
+
2016 => 299,
|
57
|
+
2019 => 100
|
58
|
+
}
|
59
|
+
},
|
60
|
+
{
|
61
|
+
name: "Pirates",
|
62
|
+
data: {
|
63
|
+
2010 => 20,
|
64
|
+
2011 => 90,
|
65
|
+
2012 => 488,
|
66
|
+
2013 => 430,
|
67
|
+
2014 => 122,
|
68
|
+
2015 => 6,
|
69
|
+
2016 => 399,
|
70
|
+
2019 => 500
|
71
|
+
}
|
72
|
+
}
|
73
|
+
]
|
74
|
+
```
|
75
|
+
|
76
|
+
#### LineChart
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
line_chart(data)
|
80
|
+
```
|
81
|
+
![LineChart](https://user-images.githubusercontent.com/3856862/136750966-3fe8908d-356c-477e-8c0e-220bc302d07e.png)
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
line_chart(data, points: false)
|
85
|
+
```
|
86
|
+
![LineChart](https://user-images.githubusercontent.com/3856862/136767403-a2839f21-d6af-45af-a710-2f9f0ed2203c.png)
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
line_chart(data, points: false, width: "700px", min: 50, max: 300)
|
90
|
+
```
|
91
|
+
![LineChart](https://user-images.githubusercontent.com/3856862/136751184-7d96c152-ec1f-490a-9676-0ea16606addf.png)
|
92
|
+
|
93
|
+
#### AreaChart
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
area_chart(data)
|
97
|
+
```
|
98
|
+
![AreaChart](https://user-images.githubusercontent.com/3856862/136751437-9ceb092c-b1a1-4aee-a868-91a0ac3e9cbc.png)
|
43
99
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
![
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
100
|
+
#### ColumnChart
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
column_chart(data)
|
104
|
+
```
|
105
|
+
![ColumnChart](https://user-images.githubusercontent.com/3856862/136751574-252b40cb-b842-41ff-8a25-57695eb4e5b0.png)
|
106
|
+
|
107
|
+
#### BarChart
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
bar_chart(data)
|
111
|
+
```
|
112
|
+
![BarChart](https://user-images.githubusercontent.com/3856862/136751822-8383166d-894b-42fd-8ea7-fecf00964567.png)
|
113
|
+
|
114
|
+
#### ScatterChart
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
scatter_chart(data)
|
118
|
+
```
|
119
|
+
![ScatterChart](https://user-images.githubusercontent.com/3856862/136751938-35acbdc7-baee-4262-ac67-1fe1262f071c.png)
|
120
|
+
|
121
|
+
#### PieChart
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
include IRuby::Chartkick
|
125
|
+
|
126
|
+
data = [
|
127
|
+
["Blueberry", 44],
|
128
|
+
["Strawberry", 23],
|
129
|
+
["Banana", 22],
|
130
|
+
["Apple", 21],
|
131
|
+
["Grape", 13]
|
132
|
+
]
|
133
|
+
|
134
|
+
pie_chart(data)
|
135
|
+
```
|
136
|
+
![PieChart](https://user-images.githubusercontent.com/3856862/136752074-d5bc9ecb-b046-4b84-9108-546326125db4.png)
|
data/iruby-chartkick.gemspec
CHANGED
@@ -5,8 +5,8 @@ require "iruby/chartkick/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "iruby-chartkick"
|
7
7
|
spec.version = IRuby::Chartkick::VERSION
|
8
|
-
spec.authors = ["Robin
|
9
|
-
spec.email = ["robin.
|
8
|
+
spec.authors = ["Robin Stammer\n"]
|
9
|
+
spec.email = ["robin.stammer@posteo.de"]
|
10
10
|
|
11
11
|
spec.summary = %q{Minimalistic wrapper around chartkick to use it within IRuby}
|
12
12
|
spec.homepage = "https://github.com/Absolventa/iruby-chartkick"
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
|
28
28
|
spec.add_runtime_dependency "iruby"
|
29
|
-
spec.
|
29
|
+
spec.add_dependency "chartkick", "~> 4.0.5"
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler"
|
32
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
@@ -23,32 +23,18 @@ module IRuby
|
|
23
23
|
return "" if IRuby::Chartkick.js_loaded?
|
24
24
|
IRuby::Chartkick.mark_js_as_loaded
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
JS
|
32
|
-
end.join("\n")
|
26
|
+
<<-JS
|
27
|
+
<script name="iruby-chartkick-charting-engine-loaders" type="text/javascript">
|
28
|
+
#{javascript}
|
29
|
+
</script>
|
30
|
+
JS
|
33
31
|
end
|
34
32
|
|
35
|
-
def
|
36
|
-
|
37
|
-
adapter_javascript,
|
38
|
-
chartkick_javascript
|
39
|
-
]
|
40
|
-
end
|
41
|
-
|
42
|
-
def adapter_javascript
|
43
|
-
adapter_js_path = File.join(File.dirname(__FILE__), "..", "..", "..", "vendor", "assets", "javascripts", "google_charts_loader.js")
|
33
|
+
def javascript
|
34
|
+
adapter_js_path = File.join(File.dirname(__FILE__), "..", "..", "..", "vendor", "assets", "javascripts", "bundle.js")
|
44
35
|
File.read(adapter_js_path)
|
45
36
|
end
|
46
37
|
|
47
|
-
def chartkick_javascript
|
48
|
-
chartkick_js_path = File.join(File.dirname(__FILE__), "..", "..", "..", "vendor", "assets", "javascripts", "chartkick.js")
|
49
|
-
File.read(chartkick_js_path)
|
50
|
-
end
|
51
|
-
|
52
38
|
def randomized_dom_id
|
53
39
|
"#{self.class.to_s.downcase.gsub("::", "-")}-#{rand(100000)}"
|
54
40
|
end
|