modificați marja de margine pentru un jpgraph

I am trying to change the color of the margin on a jpgraph. I cannot seem to figure it out. I tried $graph->SetMarginColor("khaki:0.6"); but that seemed to do nothing. below is the code that generates an example chart as well as the sample output. I am using jpgraph 3.5 if that helps.

$datay1 = array(20,15,23,15);
$datay2 = array(12,9,42,8);
$datay3 = array(5,17,32,24);

// Setup the graph
$graph = new Graph(300,250);
$graph->SetScale("textlin");

$theme_class=new UniversalTheme;

$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Filled Y-grid');
$graph->SetBox(false);

$graph->img->SetAntiAliasing();

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->xgrid->SetColor('#E3E3E3');

// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Line 1');

// Create the second line
$p2 = new LinePlot($datay2);
$graph->Add($p2);
$p2->SetColor("#B22222");
$p2->SetLegend('Line 2');

// Create the third line
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p3->SetColor("#FF1493");
$p3->SetLegend('Line 3');

$graph->legend->SetFrameWeight(1);

// Output line
$graph->Stroke();

?>

enter image description here

0
@RMcLeod Sunt noul la jpgraph, dar după cum îl înțeleg, el emite o imagine, nu cod html.
adăugat autor Richard, sursa
Nu este folosit jpgraph înainte, dar nu puteți afla ce html de ieșire pentru grafic este și apoi modificați marja folosind css?
adăugat autor RMcLeod, sursa
Marginea imaginii nu este în linie cu linia verticală peste D? Dacă nu, atunci cred că spațiile libere pot fi considerate ca fundal, există o modalitate de a schimba asta?
adăugat autor RMcLeod, sursa

1 răspunsuri

SetMarginColor is one of two commands you need. You also need to use SetFrame

$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Filled Y-grid');
$graph->SetMarginColor('khaki:0.6'); 
$graph->SetFrame(true,'khaki:0.6',1);   //The '1' here seems to be irrelevant
                                        //I've tried much larger numbers with no
                                        //change. This is supposed to be frame
                                        //width (in pixels). 
$graph->SetBox(false);

Aceasta produce o imagine ca aceasta

enter image description here

0
adăugat
Mulțumesc lui Andy! care a făcut trucul.
adăugat autor Richard, sursa
PHP România, Moldova
PHP România, Moldova
173 participanți

Vorbim despre Yii, Laravel, Symphony, MySQL, PgSQL, WP, OpenCart... Pentru confort, opriți notificările. Parteneri: https://ciupacabra.com @js_ro @node_ro @python_ro @seo_ro @Romania_Bot Offtop: @holywars_ro Joburi: @php_job @Grupuri_IT