You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: graph.rb
    path of file: ./repos/squid/lib/squid
    
    the code of the file until where you have to start completion: require 'active_support'
require 'active_support/core_ext/string/inflections' # for singularize

require 'squid/axis'
require 'squid/axis_label'
require 'squid/gridline'
require 'squid/plotter'
require 'squid/point'
require 'squid/settings'

module Squid
  # @private
  class Graph
    extend Settings
    has_settings :baseline, :border, :chart, :colors, :every, :formats, :height
    has_settings :legend, :line_widths, :steps, :ticks, :type, :labels

    def initialize(document, data = {}, settings = {})
      @data, @settings = data, settings
      @plot = Plotter.new document, bottom: bottom
      @plot.paddings = {left: left.width, right: right.width} if @data.any?
    end

    def draw
      @plot.box(h: height, border: border) { draw_graph if @data.any? }
    end

  private

    def draw_graph
      draw_legend if legend
      draw_gridlines
      draw_axis_labels
      draw_charts if chart
      draw_categories if baseline
    end

    def draw_legend
      labels = @data.keys.reverse.map{|key| key.to_s}
      right = legend.is_a?(Hash) ? legend.fetch(:right, 0) : 0
      @plot.legend labels, right: right, colors: colors, height: legend_height
    end

    def draw_gridlines
      options = {height: grid_height, 
    
    def initialize(document, data = {}, settings = {})
      @data, @settings = data, settings
      @plot = Plotter.new document, bottom: bottom
      @plot.paddings = {left: left.width, right: right.width} if @data.any?
    end

    def draw
      @plot.box(h: height, border: border) { draw_graph if @data.any? }
    end

  private

    def draw_graph
      draw_legend if legend
      draw_gridlines
      draw_axis_labels
      draw_charts if chart
      draw_categories if baseline
    end

    def draw_legend
      labels = @data.keys.reverse.map{|key| key.to_s}
      right = legend.is_a?(Hash) ? legend.fetch(:right, 0) : 0
      @plot.legend labels, right: right, colors: colors, height: legend_height
    end

    def draw_gridlines
      options = {height: grid_height, count: steps, skip_baseline: baseline}
      Gridline.for(**options).each do |line|
        @plot.horizontal_line line.y, line_width: 0.5, transparency: 0.25
      end
    end

    def draw_axis_labels
      @plot.axis_labels AxisLabel.for(left, align: :right, height: grid_height)
      @plot.axis_labels AxisLabel.for(right, align: :left, height: grid_height)
    end

    def draw_categories
      labels = @data.values.first.keys.map{|key| key.to_s}
      @plot.categories labels, every: every, ticks: ticks
      @plot.horizontal_line 0.0
    end

    def draw_charts
      draw_chart right, second_axis: true
      draw_chart left
    end

    def draw_chart(axis, second_axis: false)
      args = {minmax: axis.minmax, height: grid_height, stack: stack?}
      args[:labels] = items_of labels, skip_first_if: second_axis
      args[:formats] = items_of formats, skip_first_if: second_axis
      points = Point.for axis.data, **args
      options = {colors: colors, starting_at: (second_axis ? 1: 0)}
      case (second_axis ? :column : type)
        when :point then @plot.points points, options
        when :line, :two_axis then @plot.lines points, options.merge(line_widths: line_widths)
        when :column then @plot.columns points, options
        when :stack then @plot.stacks points, options
      end
    end