Sha256: ff146ecb931793f6eca4aac3c28c629fd6e5b602b729ac52c3268f8378f82704

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Prawn
  module Graph
    module Extension
      
      # Plots one or more Prawn::Graph::Series on a chart. Expects an array-like object of
      # Prawn::Graph::Series objects and some options for positioning the sizing the
      # rendered graph
      #
      # @param series [Array] of Prawn::Graph::Series objects
      # @param options [Hash] of options, which can be:
      #    `:width`       - The overall width of the graph to be drawn. `<Integer>`
      #    `:height`      - The overall height of the graph to be drawn. `<Integer>`
      #    `:at`          - The point from where the graph will be drawn. `[<Integer>x, <Integer>y]`
      #    `:title`       - The title for this chart. Must be a string. `<String>`
      #    `:series_key`  - Should we render the key to series in this chart? `<Boolean>`
      #
      def graph(series, options = {}, &block)
        canvas = Prawn::Graph::ChartComponents::Canvas.new(series, self, options, &block)
        canvas.draw
        {warnings: [], width: self.bounds.width, height: self.bounds.height}
      end
      alias chart graph

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prawn-graph-1.0.4 lib/prawn/graph/extension.rb
prawn-graph-1.0.3 lib/prawn/graph/extension.rb
prawn-graph-1.0.2 lib/prawn/graph/extension.rb
prawn-graph-1.0.1 lib/prawn/graph/extension.rb