lib/write_xlsx/chart.rb in write_xlsx-1.11.0 vs lib/write_xlsx/chart.rb in write_xlsx-1.11.1

- old
+ new

@@ -948,14 +948,40 @@ write_cat(series) # Write the c:val element. write_val(series) # Write the c:smooth element. write_c_smooth(series.smooth) if ptrue?(@smooth_allowed) + write_ext_lst(series.inverted_color) if series.inverted_color end @series_index += 1 end + def write_ext_lst(color) + uri = '{6F2FDCE9-48DA-4B69-8628-5D25D57E5C99}' + xmlns_c_14 = + 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart' + + attributes_1 = [ + ['uri', uri], + ['xmlns:c14', xmlns_c_14] + ] + + attributes_2 = [ + ['xmlns:c14', xmlns_c_14] + ] + + @writer.tag_elements('c:extLst') do + @writer.tag_elements('c:ext', attributes_1) do + @writer.tag_elements('c14:invertSolidFillFmt') do + @writer.tag_elements('c14:spPr', attributes_2) do + write_a_solid_fill(color: color) + end + end + end + end + end + def write_ser_base(series) # Write the c:idx element. write_idx(@series_index) # Write the c:order element. write_order(@series_index) @@ -2016,23 +2042,28 @@ width = (0.5 + (12700 * width)).to_i attributes << ['w', width] end - @writer.tag_elements('a:ln', attributes) do - # Write the line fill. - if ptrue?(line[:none]) - # Write the a:noFill element. - write_a_no_fill - elsif ptrue?(line[:color]) - # Write the a:solidFill element. - write_a_solid_fill(line) + if ptrue?(line[:none]) || ptrue?(line[:color]) || line[:dash_type] + @writer.tag_elements('a:ln', attributes) do + # Write the line fill. + if ptrue?(line[:none]) + # Write the a:noFill element. + write_a_no_fill + elsif ptrue?(line[:color]) + # Write the a:solidFill element. + write_a_solid_fill(line) + end + + # Write the line/dash type. + if line[:dash_type] + # Write the a:prstDash element. + write_a_prst_dash(line[:dash_type]) + end end - # Write the line/dash type. - if line[:dash_type] - # Write the a:prstDash element. - write_a_prst_dash(line[:dash_type]) - end + else + @writer.empty_tag('a:ln', attributes) end end # # Write the <a:noFill> element.