Sha256: 41ebebef378e5de34026ee221b7a4a81e7b5a344873c88b796c35d4a6a66973e

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

module Prawn
  module Graph
    module Extension

      # Draws a bar graph into the PDF
      #
      # Example:
      #
      #  bar_graph [ ["A", 1], ["B", 2], ["C", 3] ], at: [10,10]
      #
      def bar_graph(data, options = {}, &block)
        graph = Prawn::Graph::Charts::Bar.new(data, self, options, &block)
        graph.draw
        {warnings: [], width: graph.prawn.bounds.width, height: graph.prawn.bounds.height}
      end
      alias bar_chart bar_graph

      # Draws a line graph into the PDF
      #
      # Example:
      #
      #  line_graph [ ["A", 1], ["B", 2], ["C", 3] ], at: [10,10]
      #
      def line_graph(data, options = {}, &block)
        graph = Prawn::Graph::Charts::Line.new(data, self, options, &block)
        graph.draw
        {warnings: [], width: graph.prawn.bounds.width, height: graph.prawn.bounds.height}
      end
      alias line_chart line_graph

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prawn-graph-1.0.0.pre1 lib/prawn/graph/extension.rb