-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed drawBarChart in case maxVal=1 (added the line x=1 to vertical g… #4
Conversation
src/tFPDF/GraphicReportPDF.php
Outdated
if ($i === 0) { | ||
$this->setDrawColor($red, $green, $blue); | ||
} else { | ||
$this->setDrawColor(200,200,200); | ||
} | ||
$xpos = $XDiag + $stepValue * $i; | ||
$this->Line($xpos, $YDiag - (($i === 0) ? 5 : 0), $xpos, $YDiag + $hDiag); | ||
$val = $i === 0 ? 0 : pow(10, $i); | ||
$val = $i === 0 ? 0 : pow(10, $i-1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/tFPDF/GraphicReportPDF.php
Outdated
@@ -606,21 +606,21 @@ private function setLegends($data) { | |||
private function barChartDrawScales($XDiag, $YDiag, $hDiag, $margin, $maxGrid, $stepValue) { | |||
list($red, $green, $blue) = self::COLOR_BLACK; | |||
$this->SetLineWidth(0.1); | |||
for ($i = 0; $i <= $maxGrid; $i++ ) { | |||
for ($i = 0; $i <= $maxGrid+1; $i++ ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/tFPDF/GraphicReportPDF.php
Outdated
$ypos = $YDiag + $hDiag - $margin + 5; | ||
$this->Text($xpos, $ypos, $val); | ||
} | ||
$this->SetLineWidth(0.2); | ||
$this->setDrawColor($red, $green, $blue); | ||
$this->Line($XDiag, $YDiag + $hDiag - $margin + 2, $XDiag + $stepValue * $maxGrid + 5, $YDiag + $hDiag - $margin + 2); | ||
$this->Line($XDiag, $YDiag + $hDiag - $margin + 2, $XDiag + $stepValue * ($maxGrid+1) + 5, $YDiag + $hDiag - $margin + 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/tFPDF/GraphicReportPDF.php
Outdated
@@ -968,7 +965,7 @@ private function calculateDataForBarDiagram($h, $barChartData, $maxVal, $nbDiv): | |||
$valIndRepere = ceil($maxVal / $nbDiv); | |||
$maxVal = $valIndRepere * $nbDiv; | |||
$lRepere = floor($lDiag / $nbDiv); | |||
$pxDecade = floor($lDiag / $maxGrid); | |||
$pxDecade = floor($lDiag / ($maxGrid+1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Added the line x=1 to vertical grid lines (x=0, x=10, x=100, ...).
Fixed drawBarChart in case maxVal=1: now maximum x on chart is 1 (it was 10).