Skip to content

Commit

Permalink
Fix issue broken images with empty results
Browse files Browse the repository at this point in the history
  • Loading branch information
luukverhoeven committed Jan 2, 2024
1 parent 43ef30e commit f37c25b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions components/plot/line/graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@
$test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$test->drawGraphArea(255, 255, 255, true);
$test->drawScale($dataset->GetData(), $dataset->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 2);

if (!empty($dataset->GetData())) {
$test->drawScale($dataset->GetData(), $dataset->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 2);
}

$test->drawGrid(4, true, 230, 230, 230, 50);

Expand All @@ -137,12 +140,15 @@
$test->drawTreshold(0, 143, 55, 72, true, true);

// Draw the line graph.
$test->drawLineGraph($dataset->GetData(), $dataset->GetDataDescription());
$test->drawPlotGraph($dataset->GetData(), $dataset->GetDataDescription(), 3, 2, 255, 255, 255);
if (!empty($dataset->GetData())) {
$test->drawLineGraph($dataset->GetData(), $dataset->GetDataDescription());
$test->drawPlotGraph($dataset->GetData(), $dataset->GetDataDescription(), 3, 2, 255, 255, 255);

// Finish the graph.
$test->setFontProperties($CFG->dirroot . "/blocks/configurable_reports/lib/Fonts/tahoma.ttf", 8);
$test->drawLegend(75, 35, $dataset->GetDataDescription(), 255, 255, 255);
}

// Finish the graph.
$test->setFontProperties($CFG->dirroot . "/blocks/configurable_reports/lib/Fonts/tahoma.ttf", 8);
$test->drawLegend(75, 35, $dataset->GetDataDescription(), 255, 255, 255);
ob_clean(); // Hack to clear output and send only IMAGE data to browser.
$test->Stroke();
}
Expand Down

0 comments on commit f37c25b

Please sign in to comment.