lib/write_xlsx/chart.rb in write_xlsx-0.74.0 vs lib/write_xlsx/chart.rb in write_xlsx-0.75.0
- old
+ new
@@ -1193,10 +1193,12 @@
write_auto(1)
# Write the c:labelAlign element.
write_label_align('ctr')
# Write the c:labelOffset element.
write_label_offset(100)
+ # Write the c:tickLblSkip element.
+ write_tick_lbl_skip(x_axis.interval_unit)
end
end
#
# Write the <c:valAx> element. Usually the Y axis.
@@ -1341,10 +1343,12 @@
# Write the c:auto element.
write_auto(1)
# Write the c:labelOffset element.
write_label_offset(100)
+ # Write the c:tickLblSkip element.
+ write_tick_lbl_skip(x_axis.interval_unit)
# Write the c:majorUnit element.
write_c_major_unit(x_axis.major_unit)
# Write the c:majorTimeUnit element.
if !x_axis.major_unit.nil?
write_c_major_time_unit(x_axis.major_unit_type)
@@ -1521,10 +1525,19 @@
def write_label_offset(val) # :nodoc:
@writer.empty_tag('c:lblOffset', [ ['val', val] ])
end
#
+ # Write the <c:tickLblSkip> element.
+ #
+ def write_tick_lbl_skip(val) # :nodoc:
+ return unless val
+
+ @writer.empty_tag('c:tickLblSkip', [ ['val', val] ])
+ end
+
+ #
# Write the <c:majorGridlines> element.
#
def write_major_gridlines(gridlines) # :nodoc:
write_gridlines_base('c:majorGridlines', gridlines)
end
@@ -1786,46 +1799,33 @@
#
# Write the <c:rich> element.
#
def write_rich(title, horiz) # :nodoc:
+ rotation = nil
+ if title.name_font && title.name_font[:_rotation]
+ rotation = title.name_font[:_rotation]
+ end
@writer.tag_elements('c:rich') do
# Write the a:bodyPr element.
- write_a_body_pr(horiz)
+ write_a_body_pr(rotation, horiz)
# Write the a:lstStyle element.
write_a_lst_style
# Write the a:p element.
write_a_p_rich(title)
end
end
#
# Write the <a:bodyPr> element.
#
- def write_a_body_pr(horiz) # :nodoc:
- rot = -5400000
- vert = 'horz'
-
- attributes = [
- ['rot', rot],
- ['vert', vert]
- ]
-
- attributes = [] unless ptrue?(horiz)
-
- @writer.empty_tag('a:bodyPr', attributes)
- end
-
- #
- # Write the <a:bodyPr> element for axis fonts.
- #
- def write_axis_body_pr(rot = nil, vert = nil)
+ def write_a_body_pr(rot, horiz = nil) # :nodoc:
+ rot = -5400000 if !rot && ptrue?(horiz)
attributes = []
+ attributes << ['rot', rot] if rot
+ attributes << ['vert', 'horz'] if ptrue?(horiz)
- attributes << ['rot', rot] if rot
- attributes << ['vert', vert] if vert
-
@writer.empty_tag('a:bodyPr', attributes)
end
#
# Write the <a:lstStyle> element.
@@ -1939,13 +1939,17 @@
#
# Write the <c:txPr> element.
#
def write_tx_pr(horiz, font) # :nodoc:
+ rotation = nil
+ if font && font[:_rotation]
+ rotation = font[:_rotation]
+ end
@writer.tag_elements('c:txPr') do
# Write the a:bodyPr element.
- write_a_body_pr(horiz)
+ write_a_body_pr(rotation, horiz)
# Write the a:lstStyle element.
write_a_lst_style
# Write the a:p element.
write_a_p_formula(font)
end
@@ -2392,10 +2396,10 @@
#
def write_axis_font(font) # :nodoc:
return unless font
@writer.tag_elements('c:txPr') do
- write_axis_body_pr(font[:_rotation])
+ write_a_body_pr(font[:_rotation])
write_a_lst_style
@writer.tag_elements('a:p') do
write_a_p_pr_rich(font)
write_a_end_para_rpr
end