lib/write_xlsx/chart/bar.rb in write_xlsx-1.09.4 vs lib/write_xlsx/chart/bar.rb in write_xlsx-1.09.5

- old
+ new

@@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- + ############################################################################### # # Bar - A class for writing Excel Bar charts. # # Used in conjunction with Chart. @@ -45,38 +46,33 @@ # # Override parent method to add an extra check that is required for Bar # charts to ensure that their combined chart is on a secondary axis. # def combine(chart) + raise 'Charts combined with Bar charts must be on a secondary axis' unless chart.is_secondary? - unless chart.is_secondary? - raise 'Charts combined with Bar charts must be on a secondary axis' - end - super end # # Override the virtual superclass method with a chart specific method. # def write_chart_type(params) if params[:primary_axes] != 0 # Reverse X and Y axes for Bar charts. @y_axis, @x_axis = @x_axis, @y_axis - if @y2_axis.position == 'r' - @y2_axis.position = 't' - end + @y2_axis.position = 't' if @y2_axis.position == 'r' end # Write the c:barChart element. write_bar_chart(params) end # # Write the <c:barDir> element. # def write_bar_dir - @writer.empty_tag('c:barDir', [ ['val', 'bar'] ]) + @writer.empty_tag('c:barDir', [%w[val bar]]) end # # Write the <c:errDir> element. Overridden from Chart class since it is not # used in Bar charts.