@@ -54,6 +54,7 @@ class HighChart
5454 # be rendered in
5555 attr_accessor :div_id
5656 attr_accessor :user_options
57+
5758 # @example
5859 #
5960 # To display the html code of the chart, use `to_html`. To see the same
@@ -71,14 +72,15 @@ def to_html(placeholder=random_canvas_id)
7172 script << high_chart_css ( placeholder )
7273 # Helps to denote either of the three classes.
7374 chart_class = extract_chart_class
75+ case chart_class
7476 # When user wants to plot a HighMap
75- if chart_class == 'Map'
77+ when 'Map'
7678 script << high_map ( placeholder , self )
7779 # When user wants to plot a HighStock
78- elsif chart_class == 'StockChart'
80+ when 'StockChart'
7981 script << high_stock ( placeholder , self )
8082 # When user wants to plot a HighChart
81- elsif chart_class == 'Chart'
83+ when 'Chart'
8284 script << high_chart ( placeholder , self )
8385 end
8486 script
@@ -117,7 +119,7 @@ def high_chart_css(placeholder)
117119 css_script << "\n <style>"
118120 # Applying the css to chart div
119121 css_data . each do |css |
120- css_script << "\n #" + placeholder + ' '
122+ css_script << "\n ##{ placeholder } "
121123 css_script << css
122124 end
123125 css_script << "\n </style>"
@@ -133,9 +135,10 @@ def high_chart_css(placeholder)
133135 # notebook and returns initial script of the modules for web frameworks
134136 def load_dependencies ( type )
135137 dep_js = extract_dependencies
136- if type == 'iruby'
138+ case type
139+ when 'iruby'
137140 LazyHighCharts . init_iruby ( dep_js ) unless dep_js . nil?
138- elsif type == 'web_frameworks'
141+ when 'web_frameworks'
139142 dep_js . nil? ? '' : LazyHighCharts . init_javascript ( dep_js )
140143 end
141144 end
@@ -214,7 +217,7 @@ def extract_export_code(
214217 js << "\n \t \t var chart = Highcharts.charts[Highcharts.attr(chartDom,"
215218 js << " 'data-highcharts-chart')]"
216219 js << "\n \t \t chart.exportChartLocal({"
217- js << "\n \t \t \t " + append_chart_type ( export_type )
220+ js << "\n \t \t \t #{ append_chart_type ( export_type ) } "
218221 js << "\n \t \t \t filename: '#{ file_name } '"
219222 js << "\n \t \t });\n \t };\n })();"
220223 js << "\n </script>"
@@ -236,7 +239,7 @@ def extract_export_code_iruby(
236239 js << "\n \t var chart = Highcharts.charts[Highcharts.attr(chartDom,"
237240 js << " 'data-highcharts-chart')]"
238241 js << "\n \t chart.exportChart({"
239- js << "\n \t \t " + append_chart_type ( export_type )
242+ js << "\n \t \t #{ append_chart_type ( export_type ) } "
240243 js << "\n \t \t filename: '#{ file_name } '"
241244 js << "\n \t });"
242245 js << "\n })();"
0 commit comments