lib/write_xlsx/chart.rb in write_xlsx-0.72.2 vs lib/write_xlsx/chart.rb in write_xlsx-0.72.3.beta1

- old
+ new

@@ -29,11 +29,11 @@ end private def attributes - ['val', 1] + [ ['val', 1] ] end end class Chart include Writexlsx::Utility @@ -128,37 +128,27 @@ # # Assemble and write the XML file. # def assemble_xml_file # :nodoc: - @writer.xml_decl - - # Write the c:chartSpace element. - write_chart_space do - - # Write the c:lang element. - write_lang - - # Write the c:style element. - write_style - - # Write the c:protection element. - write_protection - - # Write the c:chart element. - write_chart - - # Write the c:spPr element for the chartarea formatting. - write_sp_pr(@chartarea) - - # Write the c:printSettings element. - write_print_settings if @embedded && @embedded != 0 + write_xml_declaration do + # Write the c:chartSpace element. + write_chart_space do + # Write the c:lang element. + write_lang + # Write the c:style element. + write_style + # Write the c:protection element. + write_protection + # Write the c:chart element. + write_chart + # Write the c:spPr element for the chartarea formatting. + write_sp_pr(@chartarea) + # Write the c:printSettings element. + write_print_settings if @embedded && @embedded != 0 + end end - - # Close the XML writer object and filehandle. - @writer.crlf - @writer.close end # # Add a series and it's properties to a chart. # @@ -414,42 +404,10 @@ font end # - # Convert user defined line properties to the structure required internally. - # - def line_properties(line) # :nodoc: - return { :_defined => 0 } unless line - - dash_types = { - :solid => 'solid', - :round_dot => 'sysDot', - :square_dot => 'sysDash', - :dash => 'dash', - :dash_dot => 'dashDot', - :long_dash => 'lgDash', - :long_dash_dot => 'lgDashDot', - :long_dash_dot_dot => 'lgDashDotDot', - :dot => 'dot', - :system_dash_dot => 'sysDashDot', - :system_dash_dot_dot => 'sysDashDotDot' - } - - # Check the dash type. - dash_type = line[:dash_type] - - if dash_type - line[:dash_type] = value_or_raise(dash_types, dash_type, 'dash type') - end - - line[:_defined] = 1 - - line - end - - # # Switch name and name_formula parameters if required. # def process_names(name = nil, name_formula = nil) # :nodoc: # Name looks like a formula, use it to set name_formula. if name && name =~ /^=[^!]+!\$/ @@ -671,15 +629,10 @@ area[:_fill] = fill return area end - def value_or_raise(hash, key, msg) - raise "Unknown #{msg} '#{key}'" unless hash[key.to_sym] - hash[key.to_sym] - end - # # Returns series which use the primary axes. # def get_primary_axes_series @series.reject {|s| s.y2_axis} @@ -720,29 +673,29 @@ # def get_font_style_attributes(font) return [] unless font attributes = [] - attributes << 'sz' << font[:_size] if ptrue?(font[:_size]) - attributes << 'b' << font[:_bold] if font[:_bold] - attributes << 'i' << font[:_italic] if font[:_italic] - attributes << 'u' << 'sng' if font[:_underline] + attributes << ['sz', font[:_size]] if ptrue?(font[:_size]) + attributes << ['b', font[:_bold]] if font[:_bold] + attributes << ['i', font[:_italic]] if font[:_italic] + attributes << ['u', 'sng'] if font[:_underline] - attributes << 'baseline' << font[:_baseline] + attributes << ['baseline', font[:_baseline]] attributes end # # Get the font latin attributes from a font hash. # def get_font_latin_attributes(font) return [] unless font attributes = [] - attributes << 'typeface' << font[:_name] if ptrue?(font[:_name]) - attributes << 'pitchFamily' << font[:_pitch_family] if font[:_pitch_family] - attributes << 'charset' << font[:_charset] if font[:_charset] + attributes << ['typeface', font[:_name]] if ptrue?(font[:_name]) + attributes << ['pitchFamily', font[:_pitch_family]] if font[:_pitch_family] + attributes << ['charset', font[:_charset]] if font[:_charset] attributes end # # Setup the default properties for a chart. @@ -778,56 +731,10 @@ set_x2_axis set_y2_axis end - def default_chartarea_property - { - :_visible => 0, - :_fg_color_index => 0x4E, - :_fg_color_rgb => 0xFFFFFF, - :_bg_color_index => 0x4D, - :_bg_color_rgb => 0x000000, - :_area_pattern => 0x0000, - :_area_options => 0x0000, - :_line_pattern => 0x0005, - :_line_weight => 0xFFFF, - :_line_color_index => 0x4D, - :_line_color_rgb => 0x000000, - :_line_options => 0x0008 - } - end - - def default_chartarea_property_for_embedded - default_chartarea_property. - merge( - :_visible => 1, - :_area_pattern => 0x0001, - :_area_options => 0x0001, - :_line_pattern => 0x0000, - :_line_weight => 0x0000, - :_line_options => 0x0009 - ) - end - - def default_plotarea_property - { - :_visible => 1, - :_fg_color_index => 0x16, - :_fg_color_rgb => 0xC0C0C0, - :_bg_color_index => 0x4F, - :_bg_color_rgb => 0x000000, - :_area_pattern => 0x0001, - :_area_options => 0x0000, - :_line_pattern => 0x0000, - :_line_weight => 0x0000, - :_line_color_index => 0x17, - :_line_color_rgb => 0x808080, - :_line_options => 0x0000 - } - end - # # Write the <c:chartSpace> element. # def write_chart_space # :nodoc: @writer.tag_elements('c:chartSpace', chart_space_attributes) do @@ -837,30 +744,30 @@ # for <c:chartSpace> element. def chart_space_attributes # :nodoc: schema = 'http://schemas.openxmlformats.org/' [ - 'xmlns:c', "#{schema}drawingml/2006/chart", - 'xmlns:a', "#{schema}drawingml/2006/main", - 'xmlns:r', "#{schema}officeDocument/2006/relationships" + ['xmlns:c', "#{schema}drawingml/2006/chart"], + ['xmlns:a', "#{schema}drawingml/2006/main"], + ['xmlns:r', "#{schema}officeDocument/2006/relationships"] ] end # # Write the <c:lang> element. # def write_lang # :nodoc: - @writer.empty_tag('c:lang', ['val', 'en-US']) + @writer.empty_tag('c:lang', [ ['val', 'en-US'] ]) end # # Write the <c:style> element. # def write_style # :nodoc: return if @style_id == 2 - @writer.empty_tag('c:style', ['val', @style_id]) + @writer.empty_tag('c:style', [ ['val', @style_id] ]) end # # Write the <c:chart> element. # @@ -889,11 +796,11 @@ # Write the <c:dispBlanksAs> element. # def write_disp_blanks_as return if @show_blanks == 'gap' - @writer.empty_tag('c:dispBlanksAs', ['val', @show_blanks]) + @writer.empty_tag('c:dispBlanksAs', [ ['val', @show_blanks] ]) end # # Write the <c:plotArea> element. # @@ -960,11 +867,11 @@ # # Write the <c:grouping> element. # def write_grouping(val) # :nodoc: - @writer.empty_tag('c:grouping', ['val', val]) + @writer.empty_tag('c:grouping', [ ['val', val] ]) end # # Write the series elements. # @@ -1011,18 +918,18 @@ # # Write the <c:idx> element. # def write_idx(val) # :nodoc: - @writer.empty_tag('c:idx', ['val', val]) + @writer.empty_tag('c:idx', [ ['val', val] ]) end # # Write the <c:order> element. # def write_order(val) # :nodoc: - @writer.empty_tag('c:order', ['val', val]) + @writer.empty_tag('c:order', [ ['val', val] ]) end # # Write the series name. # @@ -1141,11 +1048,11 @@ # # Write the <c:axId> element. # def write_axis_id(val) # :nodoc: - @writer.empty_tag('c:axId', ['val', val]) + @writer.empty_tag('c:axId', [ ['val', val] ]) end # # Write the <c:catAx> element. Usually the X axis. # @@ -1217,24 +1124,33 @@ # # Write the <c:valAx> element. Usually the Y axis. # # TODO. Maybe should have a _write_cat_val_axis method as well for scatter. # - def write_val_axis(params) # :nodoc: - x_axis = params[:x_axis] - y_axis = params[:y_axis] + def write_val_axis(params, cat = false) # :nodoc: axis_ids = params[:axis_ids] position = params[:position] || @val_axis_position horiz = @horiz_val_axis + if cat + x_axis = params[:y_axis] + y_axis = params[:x_axis] + axis_ids_0 = axis_ids[1] + axis_ids_1 = axis_ids[0] + else + x_axis = params[:x_axis] + y_axis = params[:y_axis] + axis_ids_0 = axis_ids[0] + axis_ids_1 = axis_ids[1] + end return unless axis_ids && !axis_ids.empty? # OVerwrite the default axis position with a user supplied value. position = y_axis.position || position @writer.tag_elements('c:valAx') do - write_axis_id(axis_ids[1]) + write_axis_id(axis_ids_1) # Write the c:scaling element. write_scaling_with_param(y_axis) write_delete(1) unless ptrue?(y_axis.visible) @@ -1266,11 +1182,11 @@ # Write the axis font elements. write_axis_font(y_axis.num_font) # Write the c:crossAx element. - write_cross_axis(axis_ids[0]) + write_cross_axis(axis_ids_0) write_crossing(x_axis.crossing) # Write the c:crossBetween element. write_cross_between @@ -1288,71 +1204,11 @@ # This is for the second valAx in scatter plots. # # Usually the X axis. # def write_cat_val_axis(params) # :nodoc: - x_axis = params[:x_axis] - y_axis = params[:y_axis] - axis_ids = params[:axis_ids] - position = params[:position] || @val_axis_position - horiz = @horiz_val_axis - - return unless axis_ids && !axis_ids.empty? - - # Overwrite the default axis position with a user supplied value. - position = x_axis.position || position - - @writer.tag_elements('c:valAx') do - write_axis_id(axis_ids[0]) - - # Write the c:scaling element. - write_scaling_with_param(x_axis) - - write_delete(1) unless ptrue?(x_axis.visible) - - # Write the c:axPos element. - write_axis_pos(position, y_axis.reverse) - - # Write the c:majorGridlines element. - write_major_gridlines(x_axis.major_gridlines) - - # Write the c:minorGridlines element. - write_minor_gridlines(x_axis.minor_gridlines) - - # Write the axis title elements. - if x_axis.formula - write_title_formula(x_axis, horiz) - elsif x_axis.name - write_title_rich(x_axis, horiz) - end - - # Write the c:numberFormat element. - write_number_format(x_axis) - - # Write the c:majorTickMark element. - write_major_tick_mark(x_axis.major_tick_mark) - - # Write the c:tickLblPos element. - write_tick_label_pos(x_axis.label_position) - - # Write the axis font elements. - write_axis_font(x_axis.num_font) - - # Write the c:crossAx element. - write_cross_axis(axis_ids[1]) - - write_crossing(y_axis.crossing) - - # Write the c:crossBetween element. - write_cross_between - - # Write the c:majorUnit element. - write_c_major_unit(x_axis.major_unit) - - # Write the c:minorunit element. - write_c_minor_unit(x_axis.minor_unit) - end + write_val_axis(params, true) end # # Write the <c:dateAx> element. Usually the X axis. # @@ -1464,38 +1320,38 @@ # Write the <c:logBase> element. # def write_c_log_base(val) # :nodoc: return unless ptrue?(val) - @writer.empty_tag('c:logBase', ['val', val]) + @writer.empty_tag('c:logBase', [ ['val', val] ]) end # # Write the <c:orientation> element. # def write_orientation(reverse = nil) # :nodoc: val = ptrue?(reverse) ? 'maxMin' : 'minMax' - @writer.empty_tag('c:orientation', ['val', val]) + @writer.empty_tag('c:orientation', [ ['val', val] ]) end # # Write the <c:max> element. # def write_c_max(max = nil) # :nodoc: return if max.nil? - @writer.empty_tag('c:max', ['val', max]) + @writer.empty_tag('c:max', [ ['val', max] ]) end # # Write the <c:min> element. # def write_c_min(min = nil) # :nodoc: return if min.nil? - @writer.empty_tag('c:min', ['val', min]) + @writer.empty_tag('c:min', [ ['val', min] ]) end # # Write the <c:axPos> element. # @@ -1503,11 +1359,11 @@ if reverse val = 'r' if val == 'l' val = 't' if val == 'b' end - @writer.empty_tag('c:axPos', ['val', val]) + @writer.empty_tag('c:axPos', [ ['val', val] ]) end # # Write the <c:numberFormat> element. Note: It is assumed that if a user # defined number format is supplied (i.e., non-default) then the sourceLinked @@ -1530,65 +1386,65 @@ # Write the <c:majorTickMark> element. # def write_major_tick_mark(val) return unless ptrue?(val) - @writer.empty_tag('c:majorTickMark', ['val', val]) + @writer.empty_tag('c:majorTickMark', [ ['val', val] ]) end # # Write the <c:tickLblPos> element. # def write_tick_label_pos(val) # :nodoc: val ||= 'nextTo' val = 'nextTo' if val == 'next_to' - @writer.empty_tag('c:tickLblPos', ['val', val]) + @writer.empty_tag('c:tickLblPos', [ ['val', val] ]) end # # Write the <c:crossAx> element. # def write_cross_axis(val = 'autoZero') # :nodoc: - @writer.empty_tag('c:crossAx', ['val', val]) + @writer.empty_tag('c:crossAx', [ ['val', val] ]) end # # Write the <c:crosses> element. # def write_crosses(val) # :nodoc: val ||= 'autoZero' - @writer.empty_tag('c:crosses', ['val', val]) + @writer.empty_tag('c:crosses', [ ['val', val] ]) end # # Write the <c:crossesAt> element. # def write_c_crosses_at(val) # :nodoc: - @writer.empty_tag('c:crossesAt', ['val', val]) + @writer.empty_tag('c:crossesAt', [ ['val', val] ]) end # # Write the <c:auto> element. # def write_auto(val) # :nodoc: - @writer.empty_tag('c:auto', ['val', val]) + @writer.empty_tag('c:auto', [ ['val', val] ]) end # # Write the <c:labelAlign> element. # def write_label_align(val) # :nodoc: - @writer.empty_tag('c:lblAlgn', ['val', val]) + @writer.empty_tag('c:lblAlgn', [ ['val', val] ]) end # # Write the <c:labelOffset> element. # def write_label_offset(val) # :nodoc: - @writer.empty_tag('c:lblOffset', ['val', val]) + @writer.empty_tag('c:lblOffset', [ ['val', val] ]) end # # Write the <c:majorGridlines> element. # @@ -1612,47 +1468,47 @@ # Write the <c:crossBetween> element. # def write_cross_between # :nodoc: val = @cross_between || 'between' - @writer.empty_tag('c:crossBetween', ['val', val]) + @writer.empty_tag('c:crossBetween', [ ['val', val] ]) end # # Write the <c:majorUnit> element. # def write_c_major_unit(val = nil) # :nodoc: return unless val - @writer.empty_tag('c:majorUnit', ['val', val]) + @writer.empty_tag('c:majorUnit', [ ['val', val] ]) end # # Write the <c:minorUnit> element. # def write_c_minor_unit(val = nil) # :nodoc: return unless val - @writer.empty_tag('c:minorUnit', ['val', val]) + @writer.empty_tag('c:minorUnit', [ ['val', val] ]) end # # Write the <c:majorTimeUnit> element. # def write_c_major_time_unit(val) # :nodoc: val ||= 'days' - @writer.empty_tag('c:majorTimeUnit', ['val', val]) + @writer.empty_tag('c:majorTimeUnit', [ ['val', val] ]) end # # Write the <c:minorTimeUnit> element. # def write_c_minor_time_unit(val) # :nodoc: val ||= 'days' - @writer.empty_tag('c:minorTimeUnit', ['val', val]) + @writer.empty_tag('c:minorTimeUnit', [ ['val', val] ]) end # # Write the <c:legend> element. # @@ -1698,11 +1554,11 @@ # # Write the <c:legendPos> element. # def write_legend_pos(val) # :nodoc: - @writer.empty_tag('c:legendPos', ['val', val]) + @writer.empty_tag('c:legendPos', [ ['val', val] ]) end # # Write the <c:legendEntry> element. # @@ -1729,11 +1585,11 @@ val = 1 # Ignore this element if we are plotting hidden data. return if @show_hidden_data - @writer.empty_tag('c:plotVisOnly', ['val', val]) + @writer.empty_tag('c:plotVisOnly', [ ['val', val] ]) end # # Write the <c:printSettings> element. # @@ -1765,16 +1621,16 @@ t = 0.75 header = 0.3 footer = 0.3 attributes = [ - 'b', b, - 'l', l, - 'r', r, - 't', t, - 'header', header, - 'footer', footer + ['b', b], + ['l', l], + ['r', r], + ['t', t], + ['header', header], + ['footer', footer] ] @writer.empty_tag('c:pageMargins', attributes) end @@ -1854,12 +1710,12 @@ def write_a_body_pr(horiz) # :nodoc: rot = -5400000 vert = 'horz' attributes = [ - 'rot', rot, - 'vert', vert + ['rot', rot], + ['vert', vert] ] attributes = [] unless ptrue?(horiz) @writer.empty_tag('a:bodyPr', attributes) @@ -1869,12 +1725,12 @@ # Write the <a:bodyPr> element for axis fonts. # def write_axis_body_pr(rot = nil, vert = nil) attributes = [] - attributes << 'rot' << rot if rot - attributes << 'vert' << vert if vert + attributes << ['rot', rot] if rot + attributes << ['vert', vert] if vert @writer.empty_tag('a:bodyPr', attributes) end # @@ -1934,11 +1790,11 @@ # # Write the <a:endParaRPr> element. # def write_a_end_para_rpr # :nodoc: - @writer.empty_tag('a:endParaRPr', ['lang', 'en-US']) + @writer.empty_tag('a:endParaRPr', [ ['lang', 'en-US'] ]) end # # Write the <a:r> element. # @@ -1953,15 +1809,15 @@ # # Write the <a:rPr> element. # def write_a_r_pr(font) # :nodoc: - write_def_rpr_r_pr_common( - font, - get_font_style_attributes(font).unshift('en-US').unshift('lang'), - 'a:rPr' - ) + attributes = [ ['lang', 'en-US'] ] + attr_font = get_font_style_attributes(font) + attributes += attr_font unless attr_font.empty? + + write_def_rpr_r_pr_common(font, attributes, 'a:rPr') end def write_def_rpr_r_pr_common(font, style_attributes, tag) # :nodoc: latin_attributes = get_font_latin_attributes(font) has_color = ptrue?(font) && ptrue?(font[:_color]) @@ -2025,25 +1881,25 @@ # Write the <c:marker> element without a sub-element. # def write_marker_value # :nodoc: return unless @default_marker - @writer.empty_tag('c:marker', ['val', 1]) + @writer.empty_tag('c:marker', [ ['val', 1] ]) end # # Write the <c:size> element. # def write_marker_size(val) # :nodoc: - @writer.empty_tag('c:size', ['val', val]) + @writer.empty_tag('c:size', [ ['val', val] ]) end # # Write the <c:symbol> element. # def write_symbol(val) # :nodoc: - @writer.empty_tag('c:symbol', ['val', val]) + @writer.empty_tag('c:symbol', [ ['val', val] ]) end # # Write the <c:spPr> element. # @@ -2082,11 +1938,11 @@ width = ((width + 0.125) * 4).to_i / 4.0 # Convert to internal units. width = (0.5 + (12700 * width)).to_i - attributes = ['w', width] + attributes << ['w', width] end @writer.tag_elements('a:ln', attributes) do # Write the line fill. if ptrue?(line[:none]) @@ -2127,18 +1983,18 @@ # # Write the <a:srgbClr> element. # def write_a_srgb_clr(val) # :nodoc: - @writer.empty_tag('a:srgbClr', ['val', val]) + @writer.empty_tag('a:srgbClr', [ ['val', val] ]) end # # Write the <a:prstDash> element. # def write_a_prst_dash(val) # :nodoc: - @writer.empty_tag('a:prstDash', ['val', val]) + @writer.empty_tag('a:prstDash', [ ['val', val] ]) end # # Write the <c:trendline> element. # @@ -2165,11 +2021,11 @@ # # Write the <c:trendlineType> element. # def write_trendline_type(val) # :nodoc: - @writer.empty_tag('c:trendlineType', ['val', val]) + @writer.empty_tag('c:trendlineType', [ ['val', val] ]) end # # Write the <c:name> element. # @@ -2181,36 +2037,36 @@ # # Write the <c:order> element. # def write_trendline_order(val = 2) # :nodoc: - @writer.empty_tag('c:order', ['val', val]) + @writer.empty_tag('c:order', [ ['val', val] ]) end # # Write the <c:period> element. # def write_period(val = 2) # :nodoc: - @writer.empty_tag('c:period', ['val', val]) + @writer.empty_tag('c:period', [ ['val', val] ]) end # # Write the <c:forward> element. # def write_forward(val) # :nodoc: return unless val - @writer.empty_tag('c:forward', ['val', val]) + @writer.empty_tag('c:forward', [ ['val', val] ]) end # # Write the <c:backward> element. # def write_backward(val) # :nodoc: return unless val - @writer.empty_tag('c:backward', ['val', val]) + @writer.empty_tag('c:backward', [ ['val', val] ]) end # # Write the <c:hiLowLines> element. # @@ -2242,11 +2098,11 @@ # Write the <c:overlap> element. # def write_overlap(val = nil) # :nodoc: return unless val - @writer.empty_tag('c:overlap', ['val', val]) + @writer.empty_tag('c:overlap', [ ['val', val] ]) end # # Write the <c:numCache> element. # @@ -2297,20 +2153,20 @@ # # Write the <c:ptCount> element. # def write_pt_count(val) # :nodoc: - @writer.empty_tag('c:ptCount', ['val', val]) + @writer.empty_tag('c:ptCount', [ ['val', val] ]) end # # Write the <c:pt> element. # def write_pt(idx, value) # :nodoc: return unless value - attributes = ['idx', idx] + attributes = [ ['idx', idx] ] @writer.tag_elements('c:pt', attributes) { write_v(value) } end # @@ -2379,62 +2235,62 @@ # # Write the <c:showVal> element. # def write_show_val # :nodoc: - @writer.empty_tag('c:showVal', ['val', 1]) + @writer.empty_tag('c:showVal', [ ['val', 1] ]) end # # Write the <c:showCatName> element. # def write_show_cat_name # :nodoc: - @writer.empty_tag('c:showCatName', ['val', 1]) + @writer.empty_tag('c:showCatName', [ ['val', 1] ]) end # # Write the <c:showSerName> element. # def write_show_ser_name # :nodoc: - @writer.empty_tag('c:showSerName', ['val', 1]) + @writer.empty_tag('c:showSerName', [ ['val', 1] ]) end # # Write the <c:showPercent> element. # def write_show_percent - @writer.empty_tag('c:showPercent', ['val', 1]) + @writer.empty_tag('c:showPercent', [ ['val', 1] ]) end # # Write the <c:showLeaderLines> element. # def write_show_leader_lines - @writer.empty_tag('c:showLeaderLines', ['val', 1]) + @writer.empty_tag('c:showLeaderLines', [ ['val', 1] ]) end # # Write the <c:dLblPos> element. # def write_d_lbl_pos(val) - @writer.empty_tag('c:dLblPos', ['val', val]) + @writer.empty_tag('c:dLblPos', [ ['val', val] ]) end # # Write the <c:delete> element. # def write_delete(val) # :nodoc: - @writer.empty_tag('c:delete', ['val', val]) + @writer.empty_tag('c:delete', [ ['val', val] ]) end # # Write the <c:invertIfNegative> element. # def write_c_invert_if_negative(invert = nil) # :nodoc: return unless ptrue?(invert) - @writer.empty_tag('c:invertIfNegative', ['val', 1]) + @writer.empty_tag('c:invertIfNegative', [ ['val', 1] ]) end # # Write the axis font elements. # @@ -2512,39 +2368,39 @@ # # Write the <c:errDir> element. # def write_err_dir(val) - @writer.empty_tag('c:errDir', ['val', val]) + @writer.empty_tag('c:errDir', [ ['val', val] ]) end # # Write the <c:errBarType> element. # def write_err_bar_type(val) - @writer.empty_tag('c:errBarType', ['val', val]) + @writer.empty_tag('c:errBarType', [ ['val', val] ]) end # # Write the <c:errValType> element. # def write_err_val_type(val) - @writer.empty_tag('c:errValType', ['val', val]) + @writer.empty_tag('c:errValType', [ ['val', val] ]) end # # Write the <c:noEndCap> element. # def write_no_end_cap - @writer.empty_tag('c:noEndCap', ['val', 1]) + @writer.empty_tag('c:noEndCap', [ ['val', 1] ]) end # # Write the <c:val> element. # def write_error_val(val) - @writer.empty_tag('c:val', ['val', val]) + @writer.empty_tag('c:val', [ ['val', val] ]) end # # Write the <c:upDownBars> element. # @@ -2567,11 +2423,11 @@ # Write the <c:gapWidth> element. # def write_gap_width(val = nil) return unless val - @writer.empty_tag('c:gapWidth', ['val', val]) + @writer.empty_tag('c:gapWidth', [ ['val', val] ]) end # # Write the <c:upBars> element. # @@ -2590,10 +2446,10 @@ # Write the <c:smooth> element. # def write_c_smooth(smooth) return unless ptrue?(smooth) - attributes = ['val', 1] + attributes = [ ['val', 1] ] @writer.empty_tag('c:smooth', attributes) end def write_bars_base(tag, format)