-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added HighMaps #92
Added HighMaps #92
Changes from 5 commits
196dba5
02237bf
634b1bb
75909cb
c293605
633be78
dc876d0
c242a7c
f423193
05e0e90
11479ed
b219f80
8d1449f
a801c65
5db05fa
2b15433
1b5990f
ba3dd19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
module LazyHighCharts | ||
def self.init_script( | ||
dependent_js=['highstock.js', 'highcharts-more.js', 'modules/exporting.js', | ||
dependent_js=['highstock.js', 'map.js', 'modules/exporting.js', | ||
'highcharts-3d.js', 'modules/data.js'] | ||
) | ||
# Highstock is based on Highcharts, meaning it has all the core | ||
|
@@ -33,22 +33,25 @@ class HighChart | |
# | ||
def to_html(placeholder=random_canvas_id) | ||
chart_hash_must_be_present | ||
script = load_modules('web_frameworks') | ||
# Helps to denote either of the three classes. | ||
chart_class = extract_chart_class | ||
# When user wants to plot a HighMap | ||
if chart_class == 'Map' | ||
high_map(placeholder, self) | ||
script << high_map(placeholder, self) | ||
# When user wants to plot a HighStock | ||
elsif chart_class == 'StockChart' | ||
high_stock(placeholder, self) | ||
script << high_stock(placeholder, self) | ||
# When user wants to plot a HighChart | ||
elsif chart_class == 'Chart' | ||
high_chart(placeholder, self) | ||
script << high_chart(placeholder, self) | ||
end | ||
script | ||
end | ||
|
||
def show_in_iruby(placeholder=random_canvas_id) | ||
# TODO : placeholder pass, in plot#div | ||
load_modules('iruby') | ||
IRuby.html to_html_iruby(placeholder) | ||
end | ||
|
||
|
@@ -61,6 +64,17 @@ def to_html_iruby(placeholder=random_canvas_id) | |
high_chart_iruby(extract_chart_class, placeholder, self) | ||
end | ||
|
||
# @return load the dependent modules of the chart | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least Input parameter and return object must be documented according to yard. |
||
def load_modules(type) | ||
modules = options.delete(:modules).collect { |module_js| 'modules/' + module_js } unless | ||
options[:modules].nil? | ||
if type == 'iruby' | ||
LazyHighCharts.init_iruby(modules) unless modules.nil? | ||
elsif type == 'web_frameworks' | ||
modules.nil? ? '' : LazyHighCharts.init_script(modules) | ||
end | ||
end | ||
|
||
# @return [String] the class of the chart | ||
def extract_chart_class | ||
# Provided by user and can take two values ('stock' or 'map'). | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is constant we must place all the constant variable into one file, to make it loosely coupled. Accessing these constants into multiple files will be better.