Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: How to create a chart with data from database

by pvaldes (Chaplain)
on Jan 12, 2013 at 12:31 UTC ( #1013034=note: print w/replies, xml ) Need Help??

in reply to How to create a chart with data from database

I wonder why to use excel here.

The data are yet in the best place, a database.

You have the tool to retrieve the desired data from database to a perl "object". Easy to print and to manipulate.

And in cpan you will find many modules to make graphics without the need of excel.

If your goal is simply to create a lot of graphics you are using a lot of unnecesary extra space spend in (mostly unused) spreadsheets. Is this what you really want?.

Adapted from the documentation of the module Chart::Base:

use Chart::Bars; $g = Chart::Bars->new(600,500); # chart size $g->add_dataset ('Berlin', 'Paris', 'Rome', 'London', 'Munich'); # nam +e of the five items $g->add_dataset (10, 40, 60, 70, 12); # surface area $g->add_dataset (18, 20, 30, 30, 40); # population (Thousands) %hash = ('title' => 'Sold Cars in 2001', 'text_space' => 5, 'grey_background' => 'false', 'integer_ticks_only' => 'true', 'x_label' => 'City', 'y_label' => 'Number of Cars', 'legend' => 'bottom', 'legend_labels' => ['surface' , 'population'], 'min_val' => 0, 'max_val' => 70, 'grid_lines' =>'true', 'colors' => {'title' => 'red', 'x_label' => 'blue', 'y_label' => 'blue'} ); $g->set (%hash); $g->png ("bars.png"); # print chart to the file bars.png

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013034]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2017-04-28 06:05 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (519 votes). Check out past polls.