in reply to Getting mysql data into gd
Hello shanta,
Welcome to the Monastery. Well I am not sure why you want to export your data perldsc/ARRAYS OF ARRAYS when the module GD::Graph::Data loads the data directly into the plot.
Sample code from the GD::Graph::Data/EXAMPLES:
use DBI; # do DBI things, like connecting to the database, statement # preparation and execution use GD::Graph::Data; use GD::Graph::bars; my $data = GD::Graph::Data->new(); while (@row = $sth->fetchrow_array) { $data->add_point(@row); } my $chart = GD::Graph::bars->new(); my $gd = $chart->plot($data);
So in your case if you are sure the data that you exporting is the necessary data from the plot something like that should work out of the box (code untested):
use GD::Graph::Data; use GD::Graph::bars; my $data = GD::Graph::Data->new(); my $sth = $dbh->prepare("SELECT time, mastuntemp, LineTemp, spargtemp +FROM brew_temp_tb WHERE sitename = 'Brew' AND batchnumber = '$batchnu +mber' ORDER BY time";"); if (!$sth->execute()) { die "Error: ". $sth->errstr ."\n"; } my @row; while (@row = $sth->fetchrow_array) { $data->add_point(@row); }
We can not test your code, be we need a minimum working sample of code that replicates the table and some demo data to insert for experimentation purposes. Alternatively you can test it and let us know if it worked.
Looking forward to your update, BR.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting mysql data into gd
by shanta (Novice) on Aug 28, 2017 at 02:10 UTC | |
by marinersk (Priest) on Aug 28, 2017 at 06:42 UTC | |
by shanta (Novice) on Sep 03, 2017 at 17:31 UTC | |
by poj (Abbot) on Sep 03, 2017 at 19:28 UTC | |
by thanos1983 (Parson) on Aug 28, 2017 at 08:18 UTC | |
by shanta (Novice) on Sep 03, 2017 at 16:44 UTC | |
by afoken (Chancellor) on Aug 28, 2017 at 20:06 UTC | |
by shanta (Novice) on Sep 03, 2017 at 16:31 UTC | |
by shanta (Novice) on Sep 03, 2017 at 16:59 UTC | |
by roboticus (Chancellor) on Sep 03, 2017 at 19:04 UTC | |
by shanta (Novice) on Sep 03, 2017 at 19:31 UTC |