Giter VIP home page Giter VIP logo

vishal-jain / prawn-graph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hhry/prawn-graph

0.0 1.0 0.0 235 KB

Prawn::Graph adds straightforward native graph drawing to Prawn without the need to depend on anything else. All generated graphs are pure PDF Vector Images. It results in smaller document sizes and less complication.

Home Page: http://ryanstenhouse.eu

License: Other

Ruby 100.00%

prawn-graph's Introduction

Prawn::Graph - Easy Graphing for Prawn

Prawn::Graph copyrighted free software by Ryan Stenhouse [email protected] with contributions form the community.

It extends Prawn::Core to add the ability for people to natively draw graphs and charts in their PDFs.

Because Prawn::Graph only uses the native PDF drawing functions exposed by Prawn, it removes the need to depend on projects like Gruff to insert graphs in your documents. The results may not be as pretty (yet), but the file-size differences are dramatic.

By default, graphs are drawn in monochrome, as that's likely how they will be printed. You can pass an option to each of the graph methods which will draw them in colour.

Notice! Much like Prawn, this software should be considered to be in early alpha state at best. It's not recommended for use in a production environment unless you're happy to put up with bugs and are willing to help fix them!

Installing & Using through RubyGems

Installing and running prawn-graph is very easy:

  • gem install prawn-graph

Gem version 0.3 is compatible with the latest 0.8 stable release of prawn. If you're still using 0.7, then install version 0.2 of prawn-graph.

Using graphs in your PDF is as straightforward as:

  require 'rubygems'
  require 'prawn/core'
  require 'prawn/graph'

  data = [ ['A', 10], ['B', 11], ['C' 12] ]

  Prawn::Document.generate('test.pdf') do
    test 'Graph Example'
    bar_graph data at => [10,10]
  end

Documentation

Documentation for Prawn::Graph is available in available at its project page on my website and also on the project's wiki on github.

Using Themes

At the moment, work is underway on implementing 'Themes' within Prawn::Graph, which are hugely inspired by (and are indeed based on the actual themes from) Gruff.

To find the list of available themes, use:

Prawn::Chart::Themes.list 

The default theme which will be used for rendering is:

Prawn::Chart::Theme.monochrome

This in-line with the design decision of Prawn::Graph to render in monochrome by default, since most of our users are likely to be printing these documents!

prawn-graph's People

Contributors

hessammehr avatar

Watchers

vishal jain avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.