diff --git a/lib/daru/view/adapters/googlecharts.rb b/lib/daru/view/adapters/googlecharts.rb index e56a54b..e21dd0f 100644 --- a/lib/daru/view/adapters/googlecharts.rb +++ b/lib/daru/view/adapters/googlecharts.rb @@ -59,9 +59,9 @@ module GooglechartsAdapter # chart = Daru::View::Plot.new(data, options) # # @example Multiple Charts in a row - # Draw the Daru::View::Plot object with the data as an array of + # Draw the Daru::View::PlotList object with the data as an array of # Daru::View::Plots(s) or Daru::View::Table(s) or both - # combined = Daru::View::Plot([line_chart, bar_chart]) + # combined = Daru::View::PlotList([line_chart, bar_chart]) def init(data=[], options={}) # When multiple charts are shown in a row, @chart will contain the # instance of GoogleVisular::BaseChart so that its data can contain diff --git a/lib/daru/view/plot_list.rb b/lib/daru/view/plot_list.rb index d7a7165..972ba2c 100644 --- a/lib/daru/view/plot_list.rb +++ b/lib/daru/view/plot_list.rb @@ -52,19 +52,6 @@ def show_in_iruby @adapter.show_in_iruby @charts end - # dependent js file, to include in head tag using the plot object. - # @example: - # plot_obj.init_script - # - # Note : - # User can directly put the dependent script file into the head tag - # using `Daru::View.dependent_script(:highcharts), by default it loads - # Nyaplot JS files. - # - def init_script - @adapter.init_script - end - # generat html code, to include in body tag def div @adapter.generate_body(@charts) @@ -75,13 +62,6 @@ def export_html_file(path='./plot.html') @adapter.export_html_file(@charts, path) end - # load the corresponding JS files in IRuby notebook. - # This is done automatically when plotting library is set using - # Daru::View.plotting_library = :new_library - def init_iruby - @adapter.init_iruby - end - private def plot_data(data) diff --git a/lib/daru/view/templates/googlecharts/static_html.erb b/lib/daru/view/templates/googlecharts/static_html.erb index b79a3ad..19ed77c 100644 --- a/lib/daru/view/templates/googlecharts/static_html.erb +++ b/lib/daru/view/templates/googlecharts/static_html.erb @@ -1,7 +1,12 @@
+ <% if plot.data.is_a?(Array) && (plot.data[0].is_a?(Daru::View::Plot) || + plot.data[0].is_a?(Daru::View::Table)) %> +/i)
+ expect(content).to match(/Multiple Charts/i)
+ expect(content).to match(/google.visualization.DataTable\(\);/i)
+ expect(content).to match(/google.visualization.LineChart/)
+ expect(content).to match(/google.visualization.BarChart/)
+ expect(content).to match(/google.visualization.Table/)
+ expect(content).to match(/chart.draw\(data_table, \{\}/i)
+ end
+ end
+end
\ No newline at end of file
diff --git a/spec/plot_spec.rb b/spec/plot_spec.rb
index ddbed39..2c363d3 100644
--- a/spec/plot_spec.rb
+++ b/spec/plot_spec.rb
@@ -13,7 +13,7 @@
let(:plot_df) { Daru::View::Plot.new(df, type: :line, x: :a, y: :c) }
let(:plot_dv) { Daru::View::Plot.new(dv, type: :line) }
context 'initialize' do
- # before { Daru::View.plotting_library = :nyaplot }
+ before { Daru::View.plotting_library = :nyaplot }
context 'Default plotting_library is nyaplot' do
it { expect(Daru::View.plotting_library).to eq(:nyaplot)}
end
|