Skip to content

Commit c7fc3cd

Browse files
committed
Added more examples
1 parent 6a14dc5 commit c7fc3cd

File tree

3 files changed

+1284
-4
lines changed

3 files changed

+1284
-4
lines changed

lib/daru/view/adapters/highcharts/display.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def to_html(placeholder=random_canvas_id)
3535
chart_hash_must_be_present
3636
# Provided by user and can take two values ('stock' or 'map').
3737
# Helps to denote either of the three classes.
38-
chart_class = options.delete(:chart_class) unless options[:chart_class].nil?
38+
chart_class = options.delete(:chart_class).to_s.downcase unless
39+
options[:chart_class].nil?
3940
# When user wants to plot a HighMap
4041
if chart_class == 'map'
4142
high_map(placeholder, self)
@@ -51,7 +52,8 @@ def to_html(placeholder=random_canvas_id)
5152
def show_in_iruby(placeholder=random_canvas_id)
5253
# TODO : placeholder pass, in plot#div
5354
chart_hash_must_be_present
54-
chart_class = options.delete(:chart_class) unless options[:chart_class].nil?
55+
chart_class = options.delete(:chart_class).to_s.downcase unless
56+
options[:chart_class].nil?
5557
if chart_class == 'map'
5658
IRuby.html high_map_iruby(placeholder, self)
5759
elsif chart_class == 'stock'
@@ -67,7 +69,8 @@ def show_in_iruby(placeholder=random_canvas_id)
6769
def to_html_iruby(placeholder=random_canvas_id)
6870
# TODO : placeholder pass, in plot#div
6971
chart_hash_must_be_present
70-
chart_class = options.delete(:chart_class) unless options[:chart_class].nil?
72+
chart_class = options.delete(:chart_class).to_s.downcase unless
73+
options[:chart_class].nil?
7174
if chart_class == 'map'
7275
IRuby.html high_map_iruby(placeholder, self)
7376
elsif chart_class == 'stock'

spec/adapters/highcharts/display_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
describe "#to_html" do
1515
it "should plot Highstock when chart_class is set to stock" do
16-
@hc.chart.options[:chart_class] = "stock";
16+
@hc.chart.options[:chart_class] = "STock";
1717
expect(@hc.chart.to_html(
1818
@placeholder)
1919
).to match(/window\.chart_placeholder\s+=\s+new\s+Highcharts.StockChart/)

0 commit comments

Comments
 (0)