iruby-chartkick 0.2.1 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab2ca18a38cb0327f226e2f1fa79daecb9f4614152b3dc6546dbfd7bb979a6a8
4
- data.tar.gz: 54fba5937c512fcfb4db7f05f11751c14bfb978ec3c8e9e0b7e97a3c6b21f67f
3
+ metadata.gz: 5e8f8b33a66cf346d45cd17af944f59c50ab4ec1b27e53dcf27fe966fe4d49cb
4
+ data.tar.gz: 7bf93e6795e174417d86fd40230c0471d47bf3c89be2dd177d750b29e9b002e4
5
5
  SHA512:
6
- metadata.gz: 0dc4fa1b62a0182d3fad7c043bed9b2db9adbdc86674fa30cf5efd396483b748f1405abeedad274fcfdf15dde28a01bd52f6afed6d0a9a74dd730bfa99583382
7
- data.tar.gz: f5f5bbc2d7d45423952c4b2d17a616289a683907f004a4db334c7bed292b5d6aee7d0b10db9e02d4c9c91e3b0770365d7d6af7b7850032a01e8b85e8ba76d8ad
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
@@ -1,3 +1,4 @@
1
+ /node_modules/
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /_yardoc/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 3.0.1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ### HEAD (not released yet)
4
4
 
5
+ ### v0.3.0
6
+
7
+ * Update all javascript (chartkick v.4.0.5 & chart.js v.3.5.1)
8
+ * Use webpack to create javascript bundle
9
+ * Switch from travis to github actions
10
+
5
11
  ### v0.2.1
6
12
 
7
13
  * Only load JS scripts once
data/Gemfile.lock CHANGED
@@ -1,41 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iruby-chartkick (0.2.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
- bond (0.5.1)
12
- chartkick (3.3.0)
11
+ chartkick (4.0.5)
13
12
  data_uri (0.1.0)
14
- diff-lcs (1.3)
15
- iruby (0.4.0)
16
- bond (~> 0.5)
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
- mimemagic (~> 0.3)
24
+ ffi-rzmq
25
+ irb
26
+ mime-types (>= 3.3.1)
19
27
  multi_json (~> 1.11)
20
- mimemagic (0.3.3)
21
- multi_json (1.14.1)
22
- rake (13.0.1)
23
- rspec (3.9.0)
24
- rspec-core (~> 3.9.0)
25
- rspec-expectations (~> 3.9.0)
26
- rspec-mocks (~> 3.9.0)
27
- rspec-core (3.9.0)
28
- rspec-support (~> 3.9.0)
29
- rspec-expectations (3.9.0)
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.9.0)
32
- rspec-mocks (3.9.0)
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.9.0)
35
- rspec-support (3.9.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-support (3.10.2)
36
50
 
37
51
  PLATFORMS
38
- ruby
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.0.2
62
+ 2.2.15
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Robin Neumann
3
+ Copyright (c) 2019 Robin Stammer
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # iruby-chartkick [![Build Status](https://travis-ci.com/Absolventa/iruby-chartkick.svg?branch=master)](https://travis-ci.com/Absolventa/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](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.
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
- ```Ruby
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
- ```Ruby
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
- ![Bildschirmfoto 2019-11-04 um 16 57 36](https://user-images.githubusercontent.com/3685123/68135598-3be0bb00-ff24-11e9-9d09-237c8aeb15d8.png)
45
- ![Bildschirmfoto 2019-11-04 um 16 54 38](https://user-images.githubusercontent.com/3685123/68135613-426f3280-ff24-11e9-96a0-0e3cfe834524.png)
46
- ![Bildschirmfoto 2019-11-04 um 16 55 35](https://user-images.githubusercontent.com/3685123/68135621-456a2300-ff24-11e9-8de9-a95d6b5d67c6.png)
47
- ![Bildschirmfoto 2019-11-04 um 16 56 04](https://user-images.githubusercontent.com/3685123/68135631-47cc7d00-ff24-11e9-982a-90885b8ddf94.png)
48
- ![Bildschirmfoto 2019-11-04 um 16 56 17](https://user-images.githubusercontent.com/3685123/68135638-48fdaa00-ff24-11e9-9a51-36494509c3b7.png)
49
- ![Bildschirmfoto 2019-11-04 um 16 56 31](https://user-images.githubusercontent.com/3685123/68135648-4bf89a80-ff24-11e9-8ba0-fae17d670995.png)
50
- ![Bildschirmfoto 2019-11-04 um 16 47 49](https://user-images.githubusercontent.com/3685123/68135661-5024b800-ff24-11e9-96ad-9c4deba61c57.png)
51
- ![Bildschirmfoto 2019-11-04 um 16 56 17](https://user-images.githubusercontent.com/3685123/68135689-59158980-ff24-11e9-8fab-8ab529dfaeb4.png)
52
- ![Bildschirmfoto 2019-11-04 um 16 43 15](https://user-images.githubusercontent.com/3685123/68135699-5d41a700-ff24-11e9-9267-ee37516620c8.png)
53
- ![Bildschirmfoto 2019-11-04 um 16 46 17](https://user-images.githubusercontent.com/3685123/68135704-5f0b6a80-ff24-11e9-8165-e682ea70975d.png)
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)
@@ -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 Neumann\n"]
9
- spec.email = ["robin.neumann@posteo.de"]
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.add_runtime_dependency "chartkick"
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
- javascripts.map do |js|
27
- <<-JS
28
- <script name="iruby-chartkick-charting-engine-loaders" type="text/javascript">
29
- #{js}
30
- </script>
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 javascripts
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module IRuby
3
3
  module Chartkick
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end