opal-highcharts 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: f81ed5d10754ee8a70cc09109da65637c6d95e6a
4
- data.tar.gz: 7fecaea64303bb3cceffecc6cae3dff852eb6f72
3
+ metadata.gz: 3e6361808e95522f0af0935300d730687191864d
4
+ data.tar.gz: 5dbf3fd90ffb1572fc853cf38142a9df567faa35
5
5
  SHA512:
6
- metadata.gz: 5ddcd6d4486e035818469b64da7c54e0dc494f825d576d1f53079109d6a0a90cddf441c40c80eb3e562057b915fc67c5e0d4cf95ff9f3c67d6046c608f25be83
7
- data.tar.gz: ab9ca6a526caa07435c06d019fa0a917faf0b6a31f8e707f055ac88e3af6ce0affa0a04a6681e6f81a3b666154a71fa21d680c78c6f6dd56a32314afe2f87abe
6
+ metadata.gz: 8b7d841de76e6a80dab8b93167354fbba179fd68ed99493fbd6222d1ff116734a07edcf66916c6bc1051d63bba1d89600fa4f14b4ed81021a8ffbbf25582c9a3
7
+ data.tar.gz: 15aa37c80f398301e23afaadc883da7d747908bb8ea9b041aefc097ff7e288eb5fbd5229d4697926273a5bf169037bd98990de078de53ad7f88639dad60da5da
Binary file
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Ruby wrapper for the Highcharts.js and Highstock.js charting libraries
1
+ ## Ruby wrapper for Highcharts.js and Highstock.js charting libraries
2
2
 
3
3
  The goal of this project is to wrap the Highcharts and Highstock APIs in Opal, providing a simple Ruby interface to Highcharts' functionality.
4
4
 
@@ -39,7 +39,7 @@ $ git clone https://github.com/balmoral/opal-highcharts
39
39
  ```ruby
40
40
  # app/application.rb
41
41
  require 'opal'
42
- require 'opal-highcharts'
42
+ require 'opal/highcharts'
43
43
  ```
44
44
 
45
45
  > You need to bring your own `highcharts.js` or `highstock.js` file.
Binary file
@@ -22,13 +22,14 @@ module Highcharts
22
22
  def alias_native(new, old = new, options = {})
23
23
  if old.end_with? ?=
24
24
  define_method new do |value|
25
+ `console.log(#{"#{__FILE__}[#{__LINE__}]"})`
25
26
  `#@native[#{old[0 .. -2]}] = #{Native.convert(value)}`
26
27
  value
27
28
  end
28
- elsif klass = options[:as_array_of]
29
+ elsif as = options[:as_array_of]
29
30
  define_method new do |*args, &block|
30
31
  if value = Native.call(@native, old, *args, &block)
31
- value.map{ |e| klass.new(e) }
32
+ value.map { |e| as.new(e.to_n) }
32
33
  end
33
34
  end
34
35
  else
@@ -25,16 +25,16 @@ module Highcharts
25
25
  super(options_or_native)
26
26
  else
27
27
  options = options_or_native.to_h.dup
28
- case mode = options.delete(:mode)
28
+ case mode = options.delete(:mode) || :chart
29
29
  when :chart
30
30
  super(`new Highcharts.Chart( #{ options.to_n } )`)
31
31
  when :stock
32
- super(`new Highcharts.StockChart( #{ options.to_n } )`)
32
+ super(`new Highcharts.stockChart( #{ options.to_n } )`)
33
33
  when :map
34
- raise UnsupportedFeature, "chart mode : '#{mode}' (Highcharts.Map)"
34
+ raise UnsupportedFeature, "#{__FILE__}[#{__LINE__}] #{self.class.name}##{__method__} : chart mode : '#{mode}' (Highcharts.Map)"
35
35
  # super(`new Highcharts.Map( #{ options.to_n } )`)
36
36
  else
37
- raise ArgumentError, "invalid chart mode '#{mode}'"
37
+ raise ArgumentError, "#{__FILE__}[#{__LINE__}] #{self.class.name}##{__method__} : invalid chart mode '#{mode}'"
38
38
  end
39
39
  end
40
40
  end
@@ -102,6 +102,16 @@ module Highcharts
102
102
  # @see http://api.highcharts.com/highstock#Chart.redraw
103
103
  alias_native :redraw
104
104
 
105
+ # Reflows the chart to its container.
106
+ # By default, the chart reflows automatically to its
107
+ # container following a window.resize event, as per
108
+ # the chart.reflow option. However, there are no
109
+ # reliable events for div resize, so if the container
110
+ # is resized without a window resize event, this must
111
+ # be called explicitly.
112
+ # @see http://api.highcharts.com/highstock#Chart.reflow
113
+ alias_native :reflow
114
+
105
115
  # Returns the renderer for the chart.
106
116
  # @see http://api.highcharts.com/highcharts#Renderer
107
117
  # @return [Highcharts::Renderer]
@@ -119,9 +129,11 @@ module Highcharts
119
129
  # @return [Array<Series>]
120
130
  alias_native :series, :series, as_array_of: Series # requires ##alias_native patch
121
131
 
132
+ # @see http://api.highcharts.com/highstock#Chart.update
133
+ alias_native :update, :update
122
134
 
123
135
  # Change the title (but not subtitle) of the chart.
124
- # @param text_or_options [String,Hash]
136
+ # @param string_or_hash [String,Hash]
125
137
  # If a string, then only the title text will be changed.
126
138
  # If a hash it should contain title options.
127
139
  # @param redraw [Boolean] optional, whether to redraw immediately, defaults to true
@@ -132,7 +144,7 @@ module Highcharts
132
144
  end
133
145
 
134
146
  # Change the subtitle (but not title) of the chart.
135
- # @param text_or_options [String,Hash] string_or_hash
147
+ # @param string_or_hash [String,Hash] string_or_hash
136
148
  # If a string, then only the subtitle text will be changed.
137
149
  # If a hash it should contain title options.
138
150
  # @param redraw [Boolean] optional, whether to redraw immediately, defaults to true
@@ -17,11 +17,11 @@ module Highcharts
17
17
  alias_native :set_data, :setData
18
18
  alias_method :data=, :set_data
19
19
  alias_native :set_visible, :setVisible
20
+ alias_method :visible=, :set_visible
20
21
  alias_native :show
21
22
  alias_native :type
22
23
  alias_native :update
23
24
  alias_native :visible
24
- alias_method :visible=, :set_visible
25
25
  alias_native :x_axis, :xAxis, as: Axis
26
26
  alias_native :y_axis, :yAxis, as: Axis
27
27
 
@@ -1,7 +1,6 @@
1
1
  module Opal
2
-
3
2
  module Highcharts
4
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
5
4
  end
6
5
 
7
6
  end
@@ -7,8 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.authors = [ 'Colin Gunn' ]
8
8
  spec.email = [ 'colgunn@icloud.com' ]
9
9
  spec.homepage = 'http://github.com/balmoral/opal-highcharts'
10
- spec.summary = 'Ruby Opal wrapper for Highcharts/Highstock JS.'
11
- spec.description = 'Ruby Opal wrapper for Highcharts/Highstock JS.'
10
+ spec.summary = 'Ruby wrapper for Highcharts/Highstock JS.'
12
11
  spec.license = 'MIT'
13
12
 
14
13
  spec.files = `git ls-files -z`.split("\x0")
@@ -16,9 +15,5 @@ Gem::Specification.new do |spec|
16
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
16
  spec.require_paths = ['lib']
18
17
 
19
- spec.required_ruby_version = '>= 1.9.3'
20
- spec.add_runtime_dependency 'opal', '>= 0.8.0', '< 0.9.0'
21
- # spec.add_development_dependency 'opal-rspec', '~> 0.4.0'
22
- # spec.add_development_dependency 'yard'
23
- # spec.add_development_dependency 'rake'
18
+ spec.add_dependency 'opal'
24
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-highcharts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Gunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-10 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -16,33 +16,27 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 0.9.0
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 0.8.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 0.9.0
33
- description: Ruby Opal wrapper for Highcharts/Highstock JS.
26
+ version: '0'
27
+ description:
34
28
  email:
35
29
  - colgunn@icloud.com
36
30
  executables: []
37
31
  extensions: []
38
32
  extra_rdoc_files: []
39
33
  files:
34
+ - ".DS_Store"
40
35
  - ".gitignore"
41
36
  - LICENSE.txt
42
37
  - README.md
43
38
  - gemfile
44
- - lib/Rakefile
45
- - lib/opal-highcharts.rb
39
+ - lib/.DS_Store
46
40
  - lib/opal/highcharts.rb
47
41
  - lib/opal/highcharts/axis.rb
48
42
  - lib/opal/highcharts/base.rb
@@ -56,7 +50,6 @@ files:
56
50
  - lib/opal/highcharts/setup.rb
57
51
  - lib/opal/highcharts/version.rb
58
52
  - opal-highcharts.gemspec
59
- - spec/spec_helper.rb
60
53
  homepage: http://github.com/balmoral/opal-highcharts
61
54
  licenses:
62
55
  - MIT
@@ -69,7 +62,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
62
  requirements:
70
63
  - - ">="
71
64
  - !ruby/object:Gem::Version
72
- version: 1.9.3
65
+ version: '0'
73
66
  required_rubygems_version: !ruby/object:Gem::Requirement
74
67
  requirements:
75
68
  - - ">="
@@ -77,10 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
70
  version: '0'
78
71
  requirements: []
79
72
  rubyforge_project:
80
- rubygems_version: 2.4.6
73
+ rubygems_version: 2.5.2
81
74
  signing_key:
82
75
  specification_version: 4
83
- summary: Ruby Opal wrapper for Highcharts/Highstock JS.
84
- test_files:
85
- - spec/spec_helper.rb
86
- has_rdoc:
76
+ summary: Ruby wrapper for Highcharts/Highstock JS.
77
+ test_files: []
@@ -1,48 +0,0 @@
1
- require 'bundler'
2
- Bundler.require
3
- Bundler::GemHelper.install_tasks
4
-
5
- require 'opal/rspec/rake_task'
6
- Opal::RSpec::RakeTask.new(:default) do |s|
7
- s.index_path = 'spec/html/index.html.erb'
8
- end
9
-
10
- desc "Build build/opal-highcharts.js"
11
- task :dist do
12
- require 'fileutils'
13
- FileUtils.mkdir_p 'build'
14
-
15
- src = Opal::Builder.build('opal-highcharts')
16
- #min = uglify src
17
- #gzp = gzip min
18
-
19
- File.open('build/opal-highcharts.js', 'w+') do |out|
20
- out << src
21
- end
22
-
23
- #puts "development: #{src.size}, minified: #{min.size}, gzipped: #{gzp.size}"
24
- end
25
-
26
- # Used for uglifying source to minify
27
- def uglify(str)
28
- IO.popen('uglifyjs', 'r+') do |i|
29
- i.puts str
30
- i.close_write
31
- return i.read
32
- end
33
- rescue Errno::ENOENT
34
- $stderr.puts '"uglifyjs" command not found (install with: "npm install -g uglify-js")'
35
- nil
36
- end
37
-
38
- # Gzip code to check file size
39
- def gzip(str)
40
- IO.popen('gzip -f', 'r+') do |i|
41
- i.puts str
42
- i.close_write
43
- return i.read
44
- end
45
- rescue Errno::ENOENT
46
- $stderr.puts '"gzip" command not found, it is required to produce the .gz version'
47
- nil
48
- end
@@ -1 +0,0 @@
1
- require 'opal/highcharts'
@@ -1,2 +0,0 @@
1
- # require 'opal-rspec'
2
- # require 'opal-highcharts'