lib/axlsx/drawing/area_chart.rb in caxlsx-3.4.1 vs lib/axlsx/drawing/area_chart.rb in caxlsx-4.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Axlsx # The AreaChart is a two dimentional line chart (who would have guessed?) that you can add to your worksheet. # @example Creating a chart # # This example creates a line in a single sheet. # require "rubygems" # if that is your preferred way to manage gems! @@ -59,38 +61,38 @@ # The node name to use in serialization. As AreaChart is used as the # base class for Liine3DChart we need to be sure to serialize the # chart based on the actual class type and not a fixed node name. # @return [String] def node_name - path = self.class.to_s + path = self.class.name if i = path.rindex('::') path = path[(i + 2)..-1] end path[0] = path[0].chr.downcase path end # Serializes the object # @param [String] str # @return [String] - def to_xml_string(str = '') + def to_xml_string(str = +'') super(str) do - str << ("<c:" << node_name << ">") - str << ('<c:grouping val="' << grouping.to_s << '"/>') - str << ('<c:varyColors val="' << vary_colors.to_s << '"/>') + str << "<c:" << node_name << ">" + str << '<c:grouping val="' << grouping.to_s << '"/>' + str << '<c:varyColors val="' << vary_colors.to_s << '"/>' @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls yield if block_given? - axes.to_xml_string(str, :ids => true) - str << ("</c:" << node_name << ">") + axes.to_xml_string(str, ids: true) + str << "</c:" << node_name << ">" axes.to_xml_string(str) end end # The axes for this chart. AreaCharts have a category and value # axis. # @return [Axes] def axes - @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) + @axes ||= Axes.new(cat_axis: CatAxis, val_axis: ValAxis) end end end