<commit_before># -*- coding: utf-8 -*-
###############################################################################
#
# Chartsheet - A class for writing the Excel XLSX Chartsheet files.
#
# Used in conjunction with WriteXLSX
#
# Copyright 2000-2011, <NAME>, <EMAIL>
# Convert to ruby by <NAME>, <EMAIL>
#

require 'write_xlsx/worksheet'

module Writexlsx
  class Chartsheet < Worksheet
    include Writexlsx::Utility

    attr_writer :chart, :drawing

    def initialize(workbook, index, name)
      super
      @drawing = 1
      @is_chartsheet     = true
      @chart             = nil
      @charts            = [1]
      @zoom_scale_normal = 0
      @oriantation       = 0
    end

    #
    # Assemble and write the XML file.
    #
    def assemble_xml_file # :nodoc:
      return unless @writer
      @writer.xml_decl

      # Write the root chartsheet element.
      write_chartsheet

      # Write the worksheet properties.
      write_sheet_pr

      # Write the sheet view properties.
      write_sheet_views

      # Write the sheetProtection element.
      write_sheet_protection

      # Write the printOptions element.
      write_print_options

      # Write the worksheet page_margins.
      write_page_margins

      # Write the worksheet page setup.
      write_page_setup

      # Write the headerFooter element.
      write_header_footer

      # Write the drawing element.
      write_drawings

      # Close the worksheet tag.
      @writer.end_tag('chartsheet')

      # Close the XML writer object and filehandle.
      @writer.crlf
      @writer.close
    end

    def protect(password = '', options = {})
      @chart.protection = 1

      options[:sheet]     = 0
      options[:content]   = 1
      options[:scenarios] = 1

      super(password, options)
    end


    ###############################################################################
    #
    # Encapsulated Chart methods.
    #
    ###############################################################################

    def add_series(*args)
      @chart.add_series(*args)
    end

    def set_x_axis(*args)
      @chart.set_x_axis(*args)
    end

    def set_y_axis(*args)
      @chart.set_y_axis(*args)
    end

    def set_title(*args)
      @chart.set_title(*args)
    end

    def set_legend(*args)
      @chart.set_legend(*args)
    end

    def set_plotarea(*args)
      @chart.set_plotarea(*args)
    end

    def set_chartarea(*args)
      @chart.set_chartarea(*args)
    end

    def set_style(*args)
      @chart.set_style(*args)
    end

    def show_blanks_as(*args)
      @chart.set_blanks_as(*args)
    end<commit_msg>chartsheet.rb : bug (typo) fix.<commit_after># -*- coding: utf-8 -*-
###############################################################################
#
# Chartsheet - A class for writing the Excel XLSX Chartsheet files.
#
# Used in conjunction with WriteXLSX
#
# Copyright 2000-2011, <NAME>, <EMAIL>
# Convert to ruby by <NAME>, <EMAIL>
#

require 'write_xlsx/worksheet'

module Writexlsx
  class Chartsheet < Worksheet
    include Writexlsx::Utility

    attr_writer :chart, :drawing

    def initialize(workbook, index, name)
      super
      @drawing = 1
      @is_chartsheet     = true
      @chart             = nil
      @charts            = [1]
      @zoom_scale_normal = 0
      @oriantation       = 0
    end

    #
    # Assemble and write the XML file.
    #
    def assemble_xml_file # :nodoc:
      return unless @writer
      @writer.xml_decl

      # Write the root chartsheet element.
      write_chartsheet

      # Write the worksheet properties.
      write_sheet_pr

      # Write the sheet view properties.
      write_sheet_views

      # Write the sheetProtection element.
      write_sheet_protection

      # Write the printOptions element.
      write_print_options

      # Write the worksheet page_margins.
      write_page_margins

      # Write the worksheet page setup.
      write_page_setup

      # Write the headerFooter element.
      write_header_footer

      # Write the drawing element.
      write_drawings

      # Close the worksheet tag.
      @writer.end_tag('chartsheet')

      # Close the XML writer object and filehandle.
      @writer.crlf
      @writer.close
    end

    def protect(password = '', options = {})
      @chart.protection = 1

      options[:sheet]     = 0
      options[:content]   = 1
      options[:scenarios] = 1

      super(password, options)
    end


    ###############################################################################
    #
    # Encapsulated Chart methods.
    #
    ###############################################################################

    def add_series(*args)
      @chart.add_series(*args)
    end

    def set_x_axis(*args)
      @chart.set_x_axis(*args)
    end

    def set_y_axis(*args)
      @chart.set_y_axis(*args)
    end

    def set_title(*args)
      @chart.set_title(*args)
    end

    def set_legend(*args)
      @chart.set_legend(*args)
    end

    def set_plotarea(*args)
      @chart.set_plotarea(*args)
    end

    def set_chartarea(*args)
      @chart.set_chartarea(*args)
    end

    def set_style(*args)
      @chart.set_style(*args)
    end

    def show_blanks_as(*args)
      @chart.show_blanks_as(*args)
    end
{'fraction_non_alphanumeric': 0.16897401858524558, 'fraction_numerical': 0.006447942347809596, 'mean_word_length': 2.4904037061548645, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602237', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1532, 'n_words': 376}