Class: Axlsx::Pie3DChart

Inherits:
Chart
  • Object
show all
Defined in:
lib/axlsx/drawing/pie_3D_chart.rb

Overview

The Pie3DChart is a three dimensional pie chart (who would have guessed?) that you can add to your worksheet.

See Also:

Instance Attribute Summary

Attributes inherited from Chart

#bg_color, #display_blanks_as, #graphic_frame, #legend_position, #plot_visible_only, #rounded_corners, #series, #series_type, #show_legend, #style, #title, #vary_colors, #view_3D

Instance Method Summary collapse

Methods inherited from Chart

#add_series, #d_lbls, #end_at, #from, #index, #pn, #relationship, #start_at, #title_size=, #to

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(frame, options = {}) ⇒ Pie3DChart

Creates a new pie chart object

Parameters:

  • frame (GraphicFrame)

    The workbook that owns this chart.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • title (Cell, String)
  • show_legend (Boolean)
  • grouping (Symbol)
  • gap_depth (String)
  • rot_x (Integer)
  • h_percent (String)
  • rot_y (Integer)
  • depth_percent (String)
  • r_ang_ax (Boolean)
  • perspective (Integer)

See Also:



23
24
25
26
27
28
29
# File 'lib/axlsx/drawing/pie_3D_chart.rb', line 23

def initialize(frame, options = {})
  @vary_colors = true
  super(frame, options)
  @series_type = PieSeries
  @view_3D = View3D.new({ rot_x: 30, perspective: 30 }.merge(options))
  @d_lbls = nil
end

Instance Method Details

#to_xml_string(str = +'')) ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: +''))

Returns:

  • (String)


34
35
36
37
38
39
40
41
42
# File 'lib/axlsx/drawing/pie_3D_chart.rb', line 34

def to_xml_string(str = +'')
  super(str) do
    str << '<c:pie3DChart>'
    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
    str << '</c:pie3DChart>'
  end
end