Work around jpgraph bug (#11425)

apparently GD now returns false when getting the bounding box of empty strings, this causes jpgraph to throw an incorrect error.  Work around that by setting all possible text to a single space character.
This commit is contained in:
Tony Murray
2020-04-16 09:18:44 -05:00
committed by GitHub
parent d67b34b934
commit e2eea17ee8
3 changed files with 24 additions and 0 deletions

View File

@@ -63,6 +63,14 @@ function YCallback($y)
$graph = new Graph($vars['width'], $vars['height'], $graph_data['graph_name']);
$graph->img->SetImgFormat('png');
// work around bug in jpgraph error handling
$graph->title->Set(' ');
$graph->subtitle->Set(' ');
$graph->subsubtitle->Set(' ');
$graph->footer->left->Set(' ');
$graph->footer->center->Set(' ');
$graph->footer->right->Set(' ');
$graph->SetScale('datlin', 0, 0, $graph_data['from'], $graph_data['to']);
$graph->SetMarginColor('white');
$graph->SetFrame(false);

View File

@@ -27,6 +27,14 @@ for ($i = 0; $i < count($graph_data['ticklabels']); $i++) {
$graph = new Graph($vars['width'], $vars['height'], $graph_data['graph_name']);
$graph->img->SetImgFormat('png');
// work around bug in jpgraph error handling
$graph->title->Set(' ');
$graph->subtitle->Set(' ');
$graph->subsubtitle->Set(' ');
$graph->footer->left->Set(' ');
$graph->footer->center->Set(' ');
$graph->footer->right->Set(' ');
$graph->SetScale('textlin');
// $graph->title->Set("$graph_name");
$graph->title->SetFont(FF_FONT2, FS_BOLD, 10);

View File

@@ -29,6 +29,14 @@ for ($i = 0; $i < count($graph_data['ticklabels']); $i++) {
$graph = new Graph($vars['width'], $vars['height'], $graph_data['graph_name']);
$graph->img->SetImgFormat('png');
// work around bug in jpgraph error handling
$graph->title->Set(' ');
$graph->subtitle->Set(' ');
$graph->subsubtitle->Set(' ');
$graph->footer->left->Set(' ');
$graph->footer->center->Set(' ');
$graph->footer->right->Set(' ');
$graph->SetScale('textlin');
$graph->title->SetFont(FF_FONT2, FS_BOLD, 10);
$graph->SetMarginColor('white');