Sha256: 9457a44a00a8db5d0eab1bc5f8c263519c877e61b55ff8a11d258f107e57f8f3
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true require 'goldendocx/charts' # It is weired because this will generate two parts of XMLs module Goldendocx module Components class Chart include Goldendocx::Document namespace :c tag :chartSpace concern_namespaces :c, :a, :r, :mc, :c14 embeds_one :rounded_corner, class_name: 'Goldendocx::Charts::Properties::RoundedCornerProperty', auto_build: true embeds_one :chart, class_name: 'Goldendocx::Charts::Properties::ChartProperty', auto_build: true attr_accessor :name attr_reader :id, :series def initialize(chart_id, relationship_id, attributes = {}) @id = chart_id @series = [] @paragraph = Goldendocx::Components::Paragraph.new inline_drawing = @paragraph.build_run.build_drawing.build_inline inline_drawing.build_non_visual_property(relationship_id:) inline_drawing.build_extents(width: attributes[:width], height: attributes[:height]) inline_drawing.build_graphic.build_data.build_chart(relationship_id:) end def add_series(name, categories, values) ser_id = series.size + 1 the_chart.build_series(categories:, values:, id: ser_id, name:) ser = Goldendocx::Charts::Series.new(categories:, values:, id: ser_id, name:) series << ser ser end def to_xml @paragraph.to_xml end def to_element(**context) @paragraph.to_element(**context) end def write_to(zos) entry_name = format(Goldendocx::Charts::RELATIONSHIP_NAME_PATTERN, id:) zos.put_next_entry "word/#{entry_name}" zos.write to_document_xml end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
goldendocx-0.3.0 | lib/goldendocx/components/chart.rb |