jpgraph and mysql passing array

jpgraph and mysql passing array

am 23.03.2011 21:59:50 von Chris Stinemetz

Hello,



I hope you can help me. The Jpgraph forum seems to be pretty
uneventful with participation.

I am trying to pass arrays through the image tag to populate my
variables for my graph.

I keep getting an error that there is no input. Do you have any suggestions=
?

I would greatly appreciate it! I have been trying to figure this out
for several hours.



Below is my code:



I need some help with finding a solution. For some reason my graph is
not showing up when it evident that my arrays are being passed.



When I use:



echo "TEST DATA PRINT";

print_r($datay,false);



-------------------



I keep getting the error:

Empty input data array specified for plot.



-----------------------



My php script is as follows:

-----------------------



"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">







KCRF Dashboard


ini_set('display_errors', 1);

error_reporting(E_ALL);



$term=3D$_POST['term'];

$term2=3D$_POST['term2'];

$term3=3D$_POST['term3'];



//include ('err_reporting.php');

require ('PHP_Scripts/config.php');

require_once ('jpgraph/jpgraph.php');

require_once ('jpgraph/jpgraph_line.php');



   $sql =3D ("SELECT * FROM evdobanding WHERE Market like '%$term' and
Cell_Sect =3D '$term2' and Date =3D '$term3' ORDER BY distance asc");

   $result =3D mysql_query($sql);



   while($row =3D mysql_fetch_array($result))

   {

   $datay[] =3D $row["MBusage"];

   $datax[] =3D $row["Distance"];

   }

=A0 echo "TEST DATA PRINT";

=A0 print_r($datay,false);

?>














14pt;">EVDO PCMD BANDING


=A0


          =A0


  •       =A0


  •       =A0
  • =


  •       =A0


  •       =A0


  • =A0









echo "You Selected the following:
Market =3D $term
Cell_Sector =3D
$term2
Timestamp =3D $term3
"; ?>



ge"];">
// I think this is where I am having issues.









---------------------------



My graph script is:




require_once ('jpgraph/jpgraph.php');

require_once ('jpgraph/jpgraph_line.php');



   // Create the graph.

   $graph =3D new Graph(1024,450,"auto");



   $graph->SetScale("textlin");

   $graph->SetShadow();



   // Slightly adjust the legend from it's default position

=A0 =A0$graph->legend->Pos(0.03,0.5,"right","center");

   $graph->legend->SetFont(FF_FONT1,FS_BOLD);



   //Setup X-scale

     $graph->xaxis->SetTextTickInterval(10);

     $graph->xaxis->SetTickLabels($datax);

     //$graph->xtick_factor =3D 1;

  =A0 $graph->xaxis->SetLabelAngle(30);



   // Create the linear plot

   $lineplot=3D new LinePlot($datay);

   $p1 =3D new LinePlot($datay);

   $p1->mark->SetType(MARK_DIAMOND);

   $p1->mark->SetFillColor("blue");

   $p1->mark->SetWidth(;

   $p1->SetColor("blue");

   $p1->SetCenter();

   $p1->SetLegend("EVDO F1 Carrier");

   $graph->Add($p1);



   // Add the plot to the graph

   $graph->Add($lineplot);



   // Setup margin and titles

   $graph->img->SetMargin(40,40,50,60);

   $graph->title->SetMargin(10);

   $graph->title->Set("Distance in MIles");

   $graph->title->SetFont(FF_VERDANA,FS_BOLD,12);



   // set margin color

   $graph->SetMarginColor('#dcfade');

   // Use built in font

   $graph->title->SetFont(FF_ARIAL,FS_NORMAL,14);

   $graph->ygrid->SetFill(true,'#EFEFEF@0.6','#e5e5e5@0.6');



   $graph->xgrid->Show();

   $graph->SetBackgroundImageMix(15);

   $graph->legend->Pos(0.02,0.03,"right","top");

   $graph->legend->SetFont(FF_FONT1,FS_BOLD);







   $graph->xaxis->title->Set("Miles");

   $graph->yaxis->title->Set("MBusage");

   $graph->SetAlphaBlending();



   // Display the graph

   $graph->Stroke();

?>





Thank you,



Chris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: jpgraph and mysql passing array

am 24.03.2011 01:05:54 von David Robley

Chris Stinemetz wrote:

> Hello,
>
>
>
> I hope you can help me. The Jpgraph forum seems to be pretty
> uneventful with participation.
>
> I am trying to pass arrays through the image tag to populate my
> variables for my graph.
>
> I keep getting an error that there is no input. Do you have any
> suggestions?
>
> I would greatly appreciate it! I have been trying to figure this out
> for several hours.
>
> Below is my code:
>
> I need some help with finding a solution. For some reason my graph is
> not showing up when it evident that my arrays are being passed.
>
> When I use:
>
> echo "TEST DATA PRINT";
> print_r($datay,false);
>
> -------------------
>
> I keep getting the error:
>
> Empty input data array specified for plot.
>
> -----------------------
>
> My php script is as follows:
>
> -----------------------
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
> KCRF Dashboard
> > ini_set('display_errors', 1);
> error_reporting(E_ALL);
>
> $term=$_POST['term'];
> $term2=$_POST['term2'];
> $term3=$_POST['term3'];
>
> //include ('err_reporting.php');
> require ('PHP_Scripts/config.php');
> require_once ('jpgraph/jpgraph.php');
> require_once ('jpgraph/jpgraph_line.php');
>
> $sql = ("SELECT * FROM evdobanding WHERE Market like '%$term' and
> Cell_Sect = '$term2' and Date = '$term3' ORDER BY distance asc");
>
> $result = mysql_query($sql);
>
> while($row = mysql_fetch_array($result))
> {
> $datay[] = $row["MBusage"];
> $datax[] = $row["Distance"];
> }
>
> echo "TEST DATA PRINT";
>
> print_r($datay,false);
>
> ?>

> Thank you,
>
>
>
> Chris

If $datay shows as empty, my first step would be to check that your SQL
query doesn't return an empty set.


Cheers
--
David Robley

"This ocean is calm," said the sailors specifically.
Today is Pungenday, the 10th day of Discord in the YOLD 3177.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: jpgraph and mysql passing array

am 24.03.2011 10:41:07 von Simcha

On Wed, 23 Mar 2011 15:59:50 -0500
Chris Stinemetz wrote:

> Hello,

> >
> echo "You Selected the following:
Market = $term
Cell_Sector =
> $term2
Timestamp = $term3
"; ?>

note the closing PHP tag above, and now

this line here, is not in php, and does not echo the php variables.
>
>
> // I think this is where I am having issues.
>


try instead
echo '';
?>
--
Simcha Younger

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: jpgraph and mysql passing array

am 27.03.2011 04:44:52 von Brian Smither

Would you try an experiment?

In this line:
$sql =3D ("SELECT * FROM evdobanding WHERE Market like '%$term' and=
Cell_Sect =3D '$term2' and Date =3D '$term3' ORDER BY distance asc");

Change to:
$sql =3D "SELECT * FROM evdobanding WHERE Market like '%".$term."' and=
Cell_Sect =3D '".$term2."' and Date =3D '".$term3."' ORDER BY distance=
asc";

That is, remove the parenthesis and concatenate the variables into the=
string.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: jpgraph and mysql passing array

am 27.03.2011 14:59:10 von Chris Stinemetz

On Sat, Mar 26, 2011 at 9:44 PM, Brian Smither wrote:
> Would you try an experiment?

Thanks for for the suggestion but this didn't seem to work. I beleive
it is a header conflict based on what I have researched.
I just can't seem to find a solution.

>
> In this line:
> $sql = ("SELECT * FROM evdobanding WHERE Market like '%$term' and Cell_Sect = '$term2' and Date = '$term3' ORDER BY distance asc");
>
> Change to:
> $sql = "SELECT * FROM evdobanding WHERE Market like '%".$term."' and Cell_Sect = '".$term2."' and Date = '".$term3."' ORDER BY distance asc";
>
> That is, remove the parenthesis and concatenate the variables into the string.
>

The code in the PHP block:

echo "TEST DATA PRINT";
print_r($datay,false);

is passing all the values from the sql query because I can see them on
the page with the jpgraph error.

For example:

TEST DATA PRINTArray ( [0] => 665 [1] => 7093 [2] => 30000 [3] =>
45816 [4] => 70848 [5] => 41365 [6] => 35676 [7] => 22434 [8] => 5450
[9] => 29131 [10] => 35244 [11] => 48614 [12] => 51748 [13] => 55497
[14] => 79042 [15] => 732 [16] => 1375 [17] => 1094 [18] => 897 [19]
=> 1122 [20] => 3059 [21] => 5350 [22] => 5080 [23] => 3082 [24] =>
2737 [25] => 326 [26] => 1334 [27] => 736 [28] => 469 [29] => 127 [30]
=> 105 [31] => 111 [32] => 197 [33] => 208 [34] => 950 [35] => 9 [36]
=> 9 [37] => 19 [38] => 8 [39] => 17 [40] => 90 [41] => 1917 [42] =>
1289 [43] => 2051 [44] => 1534 [45] => 1 [46] => 2 [47] => 4 [48] => 4
[49] => 7 [50] => 8 [51] => 9 [52] => 18 [53] => 22 [54] => 5 [55] =>
3 [56] => 1 [57] => 1 [58] => 2 )

JpGraph ERROR 25121



From the research I have done so far using Jpgraph I have found this
link to a similar issue:

http://ubuntuincident.wordpress.com/tag/jpgraph/

but I am unable to get my arrays from the sql query to populate the graph.

Thank you in advance,

Chris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php