/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
Problemer med X aksen ifb. med JpGraph!
Fra : Thomas Løjmann Jørge~


Dato : 07-09-04 15:56

Hej alle!

Jeg har problemer med at få tegnet min X akse i flg. kode;

<?
include ("inc/jpgraph.php");
include ("inc/jpgraph_bar.php");

mysql_connect("localhost","user","pass") or die(mysql_error());
mysql_select_db("stats") or die(mysql_error());

$stat_y = mysql_query("SELECT COUNT(id) AS Antal FROM info GROUP BY
Dato ORDER BY Dato ASC") or die(mysql_error());
$array_y = mysql_fetch_array($stat_y);

$stat_x = mysql_query("SELECT DISTINCT Dato FROM info GROUP BY Dato
ORDER BY Dato ASC") or die(mysql_error());
$array_x = mysql_fetch_array($stat_x);

// New graph with a drop shadow
$graph = new Graph(600,400,'auto');
$graph->SetShadow();

// Use a "text" X-scale
$graph->SetScale("textlin");

// Specify X-labels
$graph->xaxis->SetTickLabels($array_x);

// Set title and subtitle
$graph->title->Set("Bla bla bla");

// Use built in font
$graph->title->SetFont(FF_FONT1,FS_BOLD);

// Create the bar plot
$b1 = new BarPlot($array_y);
$b1->SetLegend("");

// The order the plots are added determines who's ontop
$graph->Add($b1);

// Finally output the image
$graph->Stroke();
?>

I begge arrys er der 3 entry, f.eks. som flg.

array_y = 10,20,30
array_x = 2004-9-05, 2004-9-06, 2004-9-07

Den skriver 2004-9-05 korrekt og tegner søjlen op af y aksen. Den
næste skriver den bare "2" ud for og tegner intet. og nr. 3 kommer
slet ikke - nogle ideer?

/Thomas

 
 
Thomas Løjmann Jørge~ (08-09-2004)
Kommentar
Fra : Thomas Løjmann Jørge~


Dato : 08-09-04 13:14

Løsning fundet!

Fandt svaret her: http://www.phpfreaks.com/tutorials/115/0.php

/Thomas

Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408527
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste