Squid

 
 

Open Source Ruby Library to Plot Charts in PDF 

Free Ruby API that  gives software developers the ability to draw charts in PDF files with just a couple of lines of Ruby code. It supports different kinds of chart types, such as line, point, and more.

Squid is an open source Ruby library that makes developers job easy by helping them to create their own application to draw charts in PDF file with just a couple of lines of Ruby code. The library is very easy to use and provides all the basic functionality for creating charts. It enables developers to draw plot view or unique of a websites, adding names of the series, inserting names of the categories, adjusting border, setting height, editing labels and much more. The library supports different kind of chart types, such as line, point and more.

The Squid library allows developers to expand Prawn providing method to easily draw graphs in PDF files. Prawn is also a very useful Ruby library that supports generating PDF documents and managing it but lacking high-level components for drawing graphs. Squid just add a single method to Prawn library Document class which can be used by developers to plot graph inside a PDF page. You can add data by plotting as a hash, with each key/value representing a series. The library is open source and is available as MIT license for public use..

Previous Next

Getting Started with Squid

You easily download the Squid library and use it. The recommended way for the installation is by using Rubygem. Please use the following command. 

Install Squid via RubyGems

gem install squid 

Create Charts in PDF using Ruby

The open source Ruby library Squid enables software developers to create charts inside a PDF document with a couple of lines of Ruby code. The library makes it very easy to generate graphics in a PDF by using the <code>chart</code> method.  You can easily provide a hash containing the data of the series and plot it using a one-liner code.  You can easily identify the format of the axis values and add labels for the chart.

Miscellaneous Graphic Plotting Feature

The Plotter class wraps a Prawn::Document object to provide a new useful method for o plotting graph elements. The Squid library has included a very useful set of features for handling graphics and images inside Ruby applications.   The library supports features like adding a border around charts, plotting a baseline at the bottom of the graph, drawing a bounding box of the given height, set the format of the axis values, customize the height of charts, write value labels on the chart, adds a legend in the top-right corner, adding background color, draws a horizontal line and many more.