lib/write_xlsx/chart/stock.rb in write_xlsx-0.75.0 vs lib/write_xlsx/chart/stock.rb in write_xlsx-0.76.0

- old
+ new

@@ -24,12 +24,13 @@ class Stock < self include Writexlsx::Utility def initialize(subtype) super(subtype) - @show_crosses = false - @hi_low_lines = {} + @show_crosses = false + @hi_low_lines = Chartline.new({}) + @date_category = true # Override and reset the default axis values. @x_axis.defaults[:num_format] = 'dd/mm/yyyy' @x2_axis.defaults[:num_format] = 'dd/mm/yyyy' set_x_axis @@ -79,40 +80,27 @@ write_axis_ids(params) end end # - # Overridden to use write_date_axis() instead of write_cat_axis(). - # - def write_plot_area - write_plot_area_base(:stock) - end - - # # Add default formatting to the series data. # def modify_series_formatting - index = 0 array = [] - @series.each do |series| + @series.each_with_index do |series, index| if index % 4 != 3 - if series.line[:_defined].nil? || series.line[:_defined] == 0 - series.line = { - :width => 2.25, - :none => 1, - :_defined => 1 - } - end + series.line = { + :width => 2.25, + :none => 1, + :_defined => 1 + } unless series.line_defined? - if series.marker.nil? || series.marker == 0 - if index % 4 == 2 - series.marker = { :type => 'dot', :size => 3 } - else - series.marker = { :type => 'none' } - end - end + if index % 4 == 2 + series.marker = Marker.new(:type => 'dot', :size => 3) + else + series.marker = Marker.new(:type => 'none') + end unless ptrue?(series.marker) end - index += 1 array << series end @series = array end end