Sha256: 4a9d5a09318f33bda99fd3aedbb84eec73c88694fee01e59a9cf8ffbde482ad0

Contents?: true

Size: 1.97 KB

Versions: 23

Compression:

Stored size: 1.97 KB

Contents

# -*- coding: utf-8 -*-
###############################################################################
#
# Area - A class for writing Excel Area charts.
#
# Used in conjunction with Chart.
#
# See formatting note in Chart.
#
# Copyright 2000-2011, John McNamara, jmcnamara@cpan.org
# Convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
#

require 'write_xlsx/package/xml_writer_simple'
require 'write_xlsx/chart'
require 'write_xlsx/utility'

module Writexlsx
  class Chart
    class Area < self
      include Writexlsx::Utility

      def initialize(subtype)
        super(subtype)
        @subtype = subtype || 'standard'
        @cross_between = 'midCat'
        @show_crosses  = false

        # Override and reset the default axis values.
        if @subtype == 'percent_stacked'
          @y_axis.defaults[:num_format] = '0%'
        end

        set_y_axis

        # Set the available data label positions for this chart type.
        @label_position_default = 'center'
        @label_positions = { 'center' => 'ctr' }
      end

      #
      # Override the virtual superclass method with a chart specific method.
      #
      def write_chart_type(params)
        # Write the c:areaChart element.
        write_area_chart(params)
      end

      #
      # Write the <c:areaChart> element.
      #
      def write_area_chart(params)
        series = axes_series(params)
        return if series.empty?

        if @subtype == 'percent_stacked'
          subtype = 'percentStacked'
        else
          subtype = @subtype
        end
        @writer.tag_elements('c:areaChart') do
          # Write the c:grouping element.
          write_grouping(subtype)
          # Write the series elements.
          series.each {|s| write_series(s)}

          # Write the c:dropLines element.
          write_drop_lines

          # Write the c:marker element.
          write_marker_value

          # Write the c:axId elements
          write_axis_ids(params)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
write_xlsx-1.00.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.99.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.97.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.90.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.89.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.88.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.87.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.86.0 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.11 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.10 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.9 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.8 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.7 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.6 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.5 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.4 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.3 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.2 lib/write_xlsx/chart/area.rb
write_xlsx-0.85.1 lib/write_xlsx/chart/area.rb
write_xlsx-0.83.0 lib/write_xlsx/chart/area.rb