Avatar billede shjorth Nybegynder
26. april 2009 - 14:12 Der er 1 løsning

Jpgraph worldmap

Hejsa.

Jeg bruger jpgraph til at tegne en rute på det worldmap der medfølger.. Koden ser sådan her ud:

DEFINE('WORLDMAP','pics/worldmap1.jpg');

function markCallback($y,$x) {
    // Return array width
    // width,color,fill color, marker filename, imgscale
    // any value can be false, in that case the default value will
    // be used.
    // We only make one pushpin another color
    if( $x == 54 )
    return array(false,false,false,'red',0.8);
    else
    return array(false,false,false,'red',0.8);
}

// Data arrays
$datax = array(13,25); // (53 = DK)
$datay = array(25,13); // (81 = DK)

// Setup the graph
$graph = new Graph(400,270);

// We add a small 1pixel left,right,bottom margin so the plot area
// doesn't cover the frame around the graph.
$graph->img->SetMargin(1,1,1,1);
$graph->SetScale('linlin',0,100,0,100);

// We don't want any axis to be shown
$graph->xaxis->Hide();
$graph->yaxis->Hide();

// Use a worldmap as the background and let it fill the plot area
$graph->SetBackgroundImage(WORLDMAP,BGIMG_FILLPLOT);


// Finally create the lineplot
$lp = new LinePlot($datay,$datax);
$lp->SetColor('red');

// We want the markers to be an image
//$lp->mark->SetType(MARK_IMG_PUSHPIN,'blue',0.6);

// Install the Y-X callback for the markers
$lp->mark->SetCallbackYX('markCallback');

// ...  and add it to the graph
$graph->Add($lp);   

// .. and output to browser
$graph->Stroke();

Men hvis jeg nu vil tegne 2 ruter, som altså ikke hænger sammen, hvordan kan det så gøres?

Som det er nu vil stregen fortsætte hvis jeg sætter flere koordinater ind.
Håber der er nogen der kan hjælpe.. Kunne forestille mig det er ret besværligt
Avatar billede shjorth Nybegynder
27. maj 2009 - 15:13 #1
Lukker lige
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester