简体   繁体   中英

Setting plot area background color in JPGraph

It seems that $graph->SetColor('red'); doesnt't really do anything (from JPGraph's example0.html:

<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');

// Some data
$ydata = array(11,3,8,12,5,1,9,13,5,7);

// Create the graph. These two calls are always required
$graph = new Graph(350,250);
$graph->SetScale('textlin');
$graph->SetColor('red'); #        <---- this does nothing 
// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetColor('blue');

// Add the plot to the graph
$graph->Add($lineplot);

// Display the graph

$graph->Stroke();
?>

What am I missing?

I found out that I need to deactivate the display of the axis grid, it seems to take precedence over background color setting. After adding $graph->ygrid->Show(false, false); the color setting worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM