opal-highcharts 0.1.1
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 +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +81 -0
- data/gemfile +2 -0
- data/lib/Rakefile +48 -0
- data/lib/opal-highcharts.rb +1 -0
- data/lib/opal/highcharts.rb +8 -0
- data/lib/opal/highcharts/axis.rb +25 -0
- data/lib/opal/highcharts/base.rb +60 -0
- data/lib/opal/highcharts/chart.rb +147 -0
- data/lib/opal/highcharts/extremes.rb +14 -0
- data/lib/opal/highcharts/highcharts.rb +36 -0
- data/lib/opal/highcharts/options.rb +15 -0
- data/lib/opal/highcharts/point.rb +20 -0
- data/lib/opal/highcharts/renderer.rb +18 -0
- data/lib/opal/highcharts/series.rb +30 -0
- data/lib/opal/highcharts/setup.rb +13 -0
- data/lib/opal/highcharts/version.rb +7 -0
- data/opal-highcharts.gemspec +24 -0
- data/spec/spec_helper.rb +2 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d08409c708ece33c6ec981fe2a181258e31bd7e
|
4
|
+
data.tar.gz: c102f3aedf955483d30a1b9002cc469b8430786a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 09c83318246190c26ba317edd194012c676b9e33914afa64eaa32bb506ec642ca0db2a75b22a8b8c1321481b530ef94980a6295fb4677d91de6878502ce13c37
|
7
|
+
data.tar.gz: 79d984e22a2f549f55cd7ae07899ff798c96265d35f39a8c9e9d60c2901180e01f20b553652fc5786e53ea48f27f68cf7e830145d06991fd2ca8c12e2f81a6a5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Colin Gunn
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
## Ruby wrapper for the Highcharts.js and Highstock.js charting libraries
|
2
|
+
|
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
|
+
|
5
|
+
To find out more about Highcharts, check out these links:
|
6
|
+
|
7
|
+
* Highcharts: http://www.highcharts.com/products/highcharts
|
8
|
+
* Highcharts Demos: http://www.highcharts.com/demo
|
9
|
+
* Highstock Demos: http://www.highcharts.com/stock/demo
|
10
|
+
|
11
|
+
To find out more about Opal, go to http://opalrb.org
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Install opal-highcharts from RubyGems:
|
16
|
+
|
17
|
+
```
|
18
|
+
$ gem install opal-highcharts
|
19
|
+
```
|
20
|
+
|
21
|
+
Or include it in your Gemfile for Bundler:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'opal-highcharts'
|
25
|
+
```
|
26
|
+
|
27
|
+
## Cloning this repository
|
28
|
+
|
29
|
+
```
|
30
|
+
$ git clone https://github.com/balmoral/opal-highcharts
|
31
|
+
```
|
32
|
+
|
33
|
+
## Getting Started
|
34
|
+
|
35
|
+
### Usage
|
36
|
+
|
37
|
+
`opal-highcharts` can be added to your opal application sources using a standard require:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# app/application.rb
|
41
|
+
require 'opal'
|
42
|
+
require 'opal-highcharts'
|
43
|
+
```
|
44
|
+
|
45
|
+
> You need to bring your own `highcharts.js` or `highstock.js` file.
|
46
|
+
> If you require Highstock functionality use `highstock.js`, which includes Highcharts.
|
47
|
+
> If you only require Highcharts functionality use `highcharts.js`.
|
48
|
+
> Download from
|
49
|
+
> http://code.highcharts.com/highcharts.js or
|
50
|
+
> http://code.highcharts.com/stock/highstock.js
|
51
|
+
> and put the file in `app/` or whichever directory you are compiling assets from.
|
52
|
+
|
53
|
+
## To do
|
54
|
+
|
55
|
+
* Implement Highstock features
|
56
|
+
* Documentation
|
57
|
+
* Testing
|
58
|
+
|
59
|
+
## Getting involved
|
60
|
+
|
61
|
+
To contribute to this project, follow the steps below.
|
62
|
+
|
63
|
+
1. Fork the repo ( https://github.com/balmoral/opal-highcharts/fork )
|
64
|
+
2. Create your feature branch (`git checkout -b new-branch`)
|
65
|
+
3. Commit your changes (`git commit -am 'description of commit'`)
|
66
|
+
4. Push to the branch (`git push origin new-branch`)
|
67
|
+
5. Create a Pull Request
|
68
|
+
|
69
|
+
Contributions welcome.
|
70
|
+
|
71
|
+
## Licenses
|
72
|
+
|
73
|
+
### Highcharts
|
74
|
+
Free for non-commercial use.
|
75
|
+
See http://www.highcharts.com/ for details.
|
76
|
+
|
77
|
+
###opal-highcharts
|
78
|
+
MIT Licence.
|
79
|
+
See LICENSE.txt
|
80
|
+
|
81
|
+
|
data/gemfile
ADDED
data/lib/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'opal/highcharts'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
# http://api.highcharts.com/highcharts#Axis
|
4
|
+
class Axis
|
5
|
+
include Base
|
6
|
+
|
7
|
+
alias_native :add_plot_band, :addPlotBand
|
8
|
+
alias_native :add_plot_line, :addPlotLine
|
9
|
+
alias_native :extremes, :getExtremes, as: Extremes
|
10
|
+
alias_native :remove
|
11
|
+
alias_native :remove_plot_band, :removePlotBand
|
12
|
+
alias_native :remove_plot_line, :removePlotLine
|
13
|
+
alias_native :set_categories, :setCategories
|
14
|
+
alias_method :categories=, :set_categories
|
15
|
+
alias_native :set_extremes, :setExtremes
|
16
|
+
alias_method :extremes=, :set_extremes
|
17
|
+
alias_native :set_title, :setTitle
|
18
|
+
alias_method :title, :set_title
|
19
|
+
alias_native :to_pixels, :toPixels
|
20
|
+
alias_native :to_value, :toValue
|
21
|
+
alias_native :update
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
class UnsupportedFeature < RuntimeError; end
|
4
|
+
|
5
|
+
class Axis; end
|
6
|
+
class Chart; end
|
7
|
+
class Extremes; end
|
8
|
+
class Highcharts; end
|
9
|
+
class Options; end
|
10
|
+
class Point; end
|
11
|
+
class Renderer; end
|
12
|
+
class Series; end
|
13
|
+
|
14
|
+
module NativePatches
|
15
|
+
extend Native::Helpers
|
16
|
+
|
17
|
+
# Patch of Native.alias_native to provide us
|
18
|
+
# with ability to specify:
|
19
|
+
# alias_native :ruby_name, :js_name, array: Class
|
20
|
+
# which will map the elements of the native array
|
21
|
+
# to elements type Class.
|
22
|
+
def alias_native(new, old = new, options = {})
|
23
|
+
if old.end_with? ?=
|
24
|
+
define_method new do |value|
|
25
|
+
`#@native[#{old[0 .. -2]}] = #{Native.convert(value)}`
|
26
|
+
value
|
27
|
+
end
|
28
|
+
elsif klass = options[:array]
|
29
|
+
define_method new do |*args, &block|
|
30
|
+
if value = Native.call(@native, old, *args, &block)
|
31
|
+
value.map{ |e| klass.new(e) }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
else
|
35
|
+
if as = options[:as]
|
36
|
+
define_method new do |*args, &block|
|
37
|
+
if value = Native.call(@native, old, *args, &block)
|
38
|
+
as.new(value.to_n)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
define_method new do |*args, &block|
|
43
|
+
Native.call(@native, old, *args, &block)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Base
|
51
|
+
include Native
|
52
|
+
|
53
|
+
def self.included(klass)
|
54
|
+
#klass.extend Native::Helpers
|
55
|
+
klass.extend NativePatches
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,147 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
# Ruby wrapper for Highcharts.Chart.js
|
4
|
+
#
|
5
|
+
# @author Colin Gunn
|
6
|
+
# @see http://api.highcharts.com/highcharts#Chart
|
7
|
+
|
8
|
+
class Chart
|
9
|
+
include Base
|
10
|
+
|
11
|
+
# Creates a Highcharts or Highstock chart.
|
12
|
+
#
|
13
|
+
# @param [Hash,Native] options_or_native
|
14
|
+
# If the argument is a native object it is wrapped
|
15
|
+
# otherwise a new native chart is created and wrapped.
|
16
|
+
# @option options_or_native [Symbol] :mode Either :chart, :stock, :map
|
17
|
+
# @option options_or_native [Hash] :chart and others per Highcharts docs
|
18
|
+
#
|
19
|
+
# Highcharts.Map is not currently supported.
|
20
|
+
#
|
21
|
+
# @see http://api.highcharts.com/highcharts#chart
|
22
|
+
# @see http://api.highcharts.com/highstock#chart
|
23
|
+
def initialize(options_or_native)
|
24
|
+
if native?(options_or_native)
|
25
|
+
super(options_or_native)
|
26
|
+
else
|
27
|
+
options = options_or_native.to_h.dup
|
28
|
+
case mode = options.delete(:mode)
|
29
|
+
when :chart
|
30
|
+
super(`new Highcharts.Chart( #{ options.to_n } )`)
|
31
|
+
when :stock
|
32
|
+
super(`new Highcharts.StockChart( #{ options.to_n } )`)
|
33
|
+
when :map
|
34
|
+
raise UnsupportedFeature, "chart mode : '#{mode}' (Highcharts.Map)"
|
35
|
+
# super(`new Highcharts.Map( #{ options.to_n } )`)
|
36
|
+
else
|
37
|
+
raise ArgumentError, "invalid chart mode '#{mode}'"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Adds an axis to the chart after render time.
|
43
|
+
# @param options [Hash] axis configuration options
|
44
|
+
# @param is_x [Boolean] optional, whether axis is X or Y axis, defaults to true
|
45
|
+
# @param redraw [Boolean] optional, whether to redraw after adding axis, defaults to true
|
46
|
+
# @param animation [Boolean,Hash] optional, whether to animate redraw, defaults to true
|
47
|
+
# @see http://api.highcharts.com/highcharts#Chart.addAxis
|
48
|
+
alias_native :add_axis, :addAxis
|
49
|
+
|
50
|
+
# Adds a series to the chart after render time.
|
51
|
+
# @param options [Hash] series configuration options
|
52
|
+
# @param is_x [Boolean] optional, whether axis is X or Y axis, defaults to true
|
53
|
+
# @param redraw [Boolean] optional, whether to redraw after adding axis, defaults to true
|
54
|
+
# @param animation [Boolean,Hash] optional, whether to animate redraw, defaults to true
|
55
|
+
# @see http://api.highcharts.com/highcharts#Chart.addSeries
|
56
|
+
alias_native :add_series, :addSeries
|
57
|
+
|
58
|
+
# Add a series to the chart as drilldown from a specific point in the parent series.
|
59
|
+
# @see http://api.highcharts.com/highcharts#Chart.addSeriesAsDrilldown
|
60
|
+
alias_native :add_series_as_drilldown, :addSeriesAsDrilldown
|
61
|
+
|
62
|
+
# Returns a (native) reference to the containing HTML element.
|
63
|
+
# @see http://api.highcharts.com/highcharts#Chart.container
|
64
|
+
alias_native :container
|
65
|
+
|
66
|
+
# Removes the chart and purges memory.
|
67
|
+
# @see http://api.highcharts.com/highcharts#Chart.destroy
|
68
|
+
alias_native :destroy
|
69
|
+
|
70
|
+
# When the chart is drilled down to a child series,
|
71
|
+
# chart.drill_up will drill up to the parent series.
|
72
|
+
# @see http://api.highcharts.com/highcharts#Chart.drillUp
|
73
|
+
alias_native :drill_up, :drillUp
|
74
|
+
|
75
|
+
# Exporting module required.
|
76
|
+
# Submit an SVG version of the chart to a server
|
77
|
+
# along with some parameters for conversion.
|
78
|
+
# @see http://api.highcharts.com/highcharts#Chart.exportChart
|
79
|
+
alias_native :export_chart, :exportChart
|
80
|
+
|
81
|
+
# Returns a chart element for a given a id.
|
82
|
+
# @see http://api.highcharts.com/highcharts#Chart.get
|
83
|
+
# @param id [String] the id of the chart element as set in configuration options
|
84
|
+
# @return [Axis,Series,Point,nil] the axis, series or point
|
85
|
+
alias_native :get
|
86
|
+
|
87
|
+
# Returns an SVG string representing the chart.
|
88
|
+
# Highcharts exporting module required.
|
89
|
+
# @see http://api.highcharts.com/highcharts#Chart.getSVG
|
90
|
+
# @param options [Hash] additional options
|
91
|
+
# @return [String]
|
92
|
+
alias_native :get_svg, :getSVG
|
93
|
+
alias_method :svg, :get_svg
|
94
|
+
|
95
|
+
# Returns the current configuration options of the chart.
|
96
|
+
# @see http://api.highcharts.com/highstock#Chart.options
|
97
|
+
# @return [Highcharts::Options]
|
98
|
+
alias_native :options, :options, as: Options
|
99
|
+
|
100
|
+
# Redraw the chart after any changes have been made.
|
101
|
+
# @param animation [Boolean,Hash] optional, whether to animate redraw, defaults to true
|
102
|
+
# @see http://api.highcharts.com/highstock#Chart.redraw
|
103
|
+
alias_native :redraw
|
104
|
+
|
105
|
+
# Returns the renderer for the chart.
|
106
|
+
# @see http://api.highcharts.com/highcharts#Renderer
|
107
|
+
# @return [Highcharts::Renderer]
|
108
|
+
alias_native :renderer, :renderer, as: Renderer
|
109
|
+
|
110
|
+
# Set a new title or subtitle for the chart.
|
111
|
+
# @param title [Hash] optional, configuration options for the title, default is nil
|
112
|
+
# @param subtitle [Hash] subtitle optional, configuration options for the subtitle. default is nil
|
113
|
+
# @param redraw [Boolean] optional, whether to redraw immediately, defaults to true
|
114
|
+
# @see http://api.highcharts.com/highstock#Chart.setTitle
|
115
|
+
alias_native :set_title, :setTitle
|
116
|
+
|
117
|
+
# Returns an array of the series in the chart.
|
118
|
+
# @see http://api.highcharts.com/highstock#Chart.series
|
119
|
+
# @return [Array<Series>]
|
120
|
+
alias_native :series, :series, array: Series # requires ##alias_native patch
|
121
|
+
|
122
|
+
|
123
|
+
# Change the title (but not subtitle) of the chart.
|
124
|
+
# @param text_or_options [String,Hash]
|
125
|
+
# If a string, then only the title text will be changed.
|
126
|
+
# If a hash it should contain title options.
|
127
|
+
# @param redraw [Boolean] optional, whether to redraw immediately, defaults to true
|
128
|
+
# @see http://api.highcharts.com/highstock#Chart.setTitle
|
129
|
+
def title=(string_or_hash, redraw = true)
|
130
|
+
t = string_or_hash.is_a?(String) ? {text: string_or_hash} : string_or_hash.to_h
|
131
|
+
set_title(t, nil, redraw)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Change the subtitle (but not title) of the chart.
|
135
|
+
# @param text_or_options [String,Hash] string_or_hash
|
136
|
+
# If a string, then only the subtitle text will be changed.
|
137
|
+
# If a hash it should contain title options.
|
138
|
+
# @param redraw [Boolean] optional, whether to redraw immediately, defaults to true
|
139
|
+
# @see http://api.highcharts.com/highstock#Chart.setTitle
|
140
|
+
def subtitle=(string_or_hash, redraw = true)
|
141
|
+
t = string_or_hash.is_a?(String) ? {text: string_or_hash} : string_or_hash.to_h
|
142
|
+
set_title(nil, t, redraw)
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
# http://api.highcharts.com/highcharts#Axis.getExtremes
|
4
|
+
class Extremes
|
5
|
+
include Base
|
6
|
+
|
7
|
+
alias_native :data_max, :dataMax
|
8
|
+
alias_native :data_min, :dataMin
|
9
|
+
alias_native :max, :max
|
10
|
+
alias_native :min, :min
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# http://api.highcharts.com/highcharts#Highcharts
|
2
|
+
|
3
|
+
module Highcharts
|
4
|
+
include Base
|
5
|
+
|
6
|
+
def self.chart(options)
|
7
|
+
Chart.new(options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.charts
|
11
|
+
Native(`Highcharts.charts`).map { |e| Chart.new(e) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.date_format(format, time = nil, capitalize = false)
|
15
|
+
`Highcharts.dateFormat(#{format}, #{time}, #{capitalize})`
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.date_formats(*args, &block)
|
19
|
+
raise UnsupportedFeature, 'Highcharts.dateFormats'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.number_format(number, decimals = nil, decimal_point = nil, thousands_sep = nil)
|
23
|
+
`Highcharts.dateFormat(#{number}, #{decimals}, #{decimal_point}, #{thousands_sep})`
|
24
|
+
end
|
25
|
+
|
26
|
+
# Set global/default chart options (hash)
|
27
|
+
def self.set_options(options)
|
28
|
+
`Highcharts.setOptions( #{ options.to_n } )`
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set global/default chart options (hash)
|
32
|
+
def self.options=(options)
|
33
|
+
set_options(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
# http://api.highcharts.com/highcharts#Point
|
4
|
+
class Point
|
5
|
+
include Base
|
6
|
+
|
7
|
+
alias_native :category
|
8
|
+
alias_native :percentage
|
9
|
+
alias_native :remove
|
10
|
+
alias_native :select
|
11
|
+
alias_native :selected
|
12
|
+
alias_native :slice
|
13
|
+
alias_native :total
|
14
|
+
alias_native :update
|
15
|
+
alias_native :x
|
16
|
+
alias_native :y
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
# http://api.highcharts.com/highcharts#Renderer
|
4
|
+
class Renderer
|
5
|
+
include Base
|
6
|
+
|
7
|
+
alias_native :arc
|
8
|
+
alias_native :circle
|
9
|
+
alias_native :g
|
10
|
+
alias_native :image
|
11
|
+
alias_native :label
|
12
|
+
alias_native :path
|
13
|
+
alias_native :rect
|
14
|
+
alias_native :text
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Highcharts
|
2
|
+
|
3
|
+
# http://api.highcharts.com/highcharts#Series
|
4
|
+
class Series
|
5
|
+
include Base
|
6
|
+
|
7
|
+
alias_native :add_point, :addPoint
|
8
|
+
alias_native :chart, :chart, as: Chart
|
9
|
+
alias_native :data, :data, array: Point
|
10
|
+
alias_native :hide
|
11
|
+
alias_native :name
|
12
|
+
alias_native :options # TODO: determine class for series options
|
13
|
+
alias_native :remove
|
14
|
+
alias_native :remove_point, :removePoint
|
15
|
+
alias_native :select
|
16
|
+
alias_native :selected
|
17
|
+
alias_native :set_data, :setData
|
18
|
+
alias_method :data=, :set_data
|
19
|
+
alias_native :set_visible, :setVisible
|
20
|
+
alias_native :show
|
21
|
+
alias_native :type
|
22
|
+
alias_native :update
|
23
|
+
alias_native :visible
|
24
|
+
alias_method :visible=, :set_visible
|
25
|
+
alias_native :x_axis, :xAxis, as: Axis
|
26
|
+
alias_native :y_axis, :yAxis, as: Axis
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# We need the Opal Native support library here:
|
2
|
+
require 'native'
|
3
|
+
|
4
|
+
# These requires must be loaded in order of dependency:
|
5
|
+
require 'opal/highcharts/base'
|
6
|
+
require 'opal/highcharts/options'
|
7
|
+
require 'opal/highcharts/point'
|
8
|
+
require 'opal/highcharts/extremes'
|
9
|
+
require 'opal/highcharts/axis'
|
10
|
+
require 'opal/highcharts/series'
|
11
|
+
require 'opal/highcharts/renderer'
|
12
|
+
require 'opal/highcharts/chart'
|
13
|
+
require 'opal/highcharts/highcharts'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/opal/highcharts/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'opal-highcharts'
|
6
|
+
spec.version = Opal::Highcharts::VERSION
|
7
|
+
spec.authors = [ 'Colin Gunn' ]
|
8
|
+
spec.email = [ 'colgunn@icloud.com' ]
|
9
|
+
spec.homepage = 'http://github.com/balmoral/opal-highcharts'
|
10
|
+
spec.summary = 'Opal access to Highcharts and Highstock'
|
11
|
+
spec.description = 'Opal DOM library for Highcharts and Highstock'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
|
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'
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opal-highcharts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Colin Gunn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: opal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.0
|
33
|
+
description: Opal DOM library for Highcharts and Highstock
|
34
|
+
email:
|
35
|
+
- colgunn@icloud.com
|
36
|
+
executables: []
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- ".gitignore"
|
41
|
+
- LICENSE.txt
|
42
|
+
- README.md
|
43
|
+
- gemfile
|
44
|
+
- lib/Rakefile
|
45
|
+
- lib/opal-highcharts.rb
|
46
|
+
- lib/opal/highcharts.rb
|
47
|
+
- lib/opal/highcharts/axis.rb
|
48
|
+
- lib/opal/highcharts/base.rb
|
49
|
+
- lib/opal/highcharts/chart.rb
|
50
|
+
- lib/opal/highcharts/extremes.rb
|
51
|
+
- lib/opal/highcharts/highcharts.rb
|
52
|
+
- lib/opal/highcharts/options.rb
|
53
|
+
- lib/opal/highcharts/point.rb
|
54
|
+
- lib/opal/highcharts/renderer.rb
|
55
|
+
- lib/opal/highcharts/series.rb
|
56
|
+
- lib/opal/highcharts/setup.rb
|
57
|
+
- lib/opal/highcharts/version.rb
|
58
|
+
- opal-highcharts.gemspec
|
59
|
+
- spec/spec_helper.rb
|
60
|
+
homepage: http://github.com/balmoral/opal-highcharts
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.4.6
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Opal access to Highcharts and Highstock
|
84
|
+
test_files:
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
has_rdoc:
|