Skip to content

Commit

Permalink
Update #86bzuzn46 Fix empty name issue & Scaling issue for Bar chart
Browse files Browse the repository at this point in the history
  • Loading branch information
ldesignmedia-jan-choros committed Aug 9, 2024
1 parent 8ded58f commit e12caa7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions components/plot/bar/graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
$legendx = $width - $legendwidth - $padding;
$legendy = $padding;
$colnames = array_keys($series);
$firstcol = $colnames[0];
$graphx = $padding + (strlen($firstcol) * ($fontsize / 2));
$firstcol = $colnames[0] ?? "";
$graphx = $padding + (strlen((string)$firstcol) * ($fontsize / 2));
$graphy = $padding;
$graphwidth = $legendx - $padding;
$graphheight = $height - $labeloffset;
Expand All @@ -159,7 +159,14 @@
"LabelRotation" => 45,
"DrawSubTicks" => true,
];
$mypicture->drawScale($scalesettings);
try {
// If some fields are empty, pChart tries to scale 0/0 element, which ends in infinite length/height.
// This may throw an exception (with a typo) "pChart: Trying to draw outside of image dimentions.".
$mypicture->drawScale($scalesettings);
} catch (\Exception $exception) {
// Do nothing, image will follow already set rules for width and height.
}

$mypicture->setShadow(true, [
"X" => 1,
"Y" => 1,
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024051300;
$plugin->version = 2024080900;
$plugin->requires = 2017111300;
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '4.1.0';
$plugin->release = '4.1.1';
$plugin->supported = [400, 401];
$plugin->component = 'block_configurable_reports';
$plugin->cron = 86400;

0 comments on commit e12caa7

Please sign in to comment.