Sha256: 2b53320c59c7df71411ca5b65d3de99d68ed990ee7d3ae7ec724a11bbb788d2b

Contents?: true

Size: 2 KB

Versions: 9

Compression:

Stored size: 2 KB

Contents

# -*- coding: utf-8 -*-
###############################################################################
#
# Line - A class for writing Excel Line 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/utility'

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

      def initialize(subtype)
        super(subtype)
        @default_marker = {:type => 'none'}
        @smooth_allowed = 1
      end

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

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

        @writer.tag_elements('c:lineChart') do
          # Write the c:grouping element.
          write_grouping('standard')
          # Write the series elements.
          series.each {|s| write_series(s)}

          # Write the c:dropLines element.
          write_drop_lines

          # Write the c:hiLowLines element.
          write_hi_low_lines

          # Write the c:upDownBars element.
          write_up_down_bars

          # Write the c:marker element.
          write_marker_value

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

      #
      # Write an individual <c:dPt> element. Override the parent method to add
      # markers.
      #
      def write_d_pt_point(index, point)
        @writer.tag_elements('c:dPt') do
          # Write the c:idx element.
          write_idx(index)
          @writer.tag_elements('c:marker') do
            # Write the c:spPr element.
            write_sp_pr(point)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
write_xlsx-0.75.0 lib/write_xlsx/chart/line.rb
write_xlsx-0.74.0 lib/write_xlsx/chart/line.rb
write_xlsx-0.73.0 lib/write_xlsx/chart/line.rb
write_xlsx-0.72.3.beta1 lib/write_xlsx/chart/line.rb
write_xlsx-0.72.2 lib/write_xlsx/chart/line.rb
write_xlsx-0.72.1 lib/write_xlsx/chart/line.rb
write_xlsx-0.72.0 lib/write_xlsx/chart/line.rb
write_xlsx-0.71.0 lib/write_xlsx/chart/line.rb
write_xlsx-0.70.0 lib/write_xlsx/chart/line.rb