Kjapp og trygg hosting for Wordpress

Legge data inn i sombra2eternity/inc.graph.php

solo

Medlem
Prøver meg på dette scriptet: https://github.com/sombra2eternity/inc.graph.php

Noen som vet hvordan man legger data inn i scriptet?
Har f.eks. en array "$weight" som ser slik ut med print_r:
Kode:
Array ( [0] => 87.4 [1] => 87.4 [2] => 87.4 )

Kode:
include_once('_pages/inc.graph.php');

$svg = graph_lines(array(
   'graph.height'=>240,
   'cell.width'=>40,
   'cell.marginx'=>8,
   'cell.marginy'=>12,
   'bar.indicator'=>true,
   'graph.background'=>'ccc',
   'graph'=>array(
     'first'=>array(1,2,3,4,5,6,7,8,9,10),
     'second'=>array(6,7,7,13,10,11,15,7,14,15),
     'third'=>array(21,22,22,28,25,26,30,22,29,30)
   ),
   'graph.colors'=>array(
     array('8cc277','6fa85b'),
     '00f',
     array('2980b9','216896'),
   ),
   'header.even.background'=>'eee',
   'header.odd.background'=>'aaa',
   'header'=>array(
     'enr','feb','mar','abr','may','jun','jul','ago','sep','oct'
   ),
   'graph.legend.width'=>100,
   'graph.legend.count'=>4,
   'graph.legend.line.color'=>'aaa',
   'table'=>true,
   'table.even.background'=>'eee',
   'table.odd.background'=>'ccc'
));
echo $svg;
 

xdex

Medlem
Hva er det egentlig du spør etter? Du linker til en side, som viser en haug av eksempler, hvor alt står godt beskrevet. Du har til og med en dump fra en array. Bruk arrayen din, og legg den inn under f.eks:

Kode:
'first'=>$myArray

da blir det slik,

Kode:
include_once('_pages/inc.graph.php');

$svg = graph_lines(array(
   'graph.height'=>240,
   'cell.width'=>40,
   'cell.marginx'=>8,
   'cell.marginy'=>12,
   'bar.indicator'=>true,
   'graph.background'=>'ccc',
   'graph'=>array(
     'first'=>$myArray,
     'second'=>array(6,7,7,13,10,11,15,7,14,15),
     'third'=>array(21,22,22,28,25,26,30,22,29,30)
   ),
   'graph.colors'=>array(
     array('8cc277','6fa85b'),
     '00f',
     array('2980b9','216896'),
   ),
   'header.even.background'=>'eee',
   'header.odd.background'=>'aaa',
   'header'=>array(
     'enr','feb','mar','abr','may','jun','jul','ago','sep','oct'
   ),
   'graph.legend.width'=>100,
   'graph.legend.count'=>4,
   'graph.legend.line.color'=>'aaa',
   'table'=>true,
   'table.even.background'=>'eee',
   'table.odd.background'=>'ccc'
));
echo $svg;

Så er det vel bare og putte inn riktige tall og informasjon, til riktig sted. Hvis du ikke skjønner noe så grunnleggende, har du nok gått litt for raskt frem. Les deg opp på hvordan 2d arrays o.l. fungerer.

http://php.net/manual/en/language.types.array.php
 
Topp