Defect #19248

End markers in gantt PDF are misaligned

Added by Binhai Liu about 5 years ago. Updated 14 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Gantt
Target version:4.0.7
Resolution:Fixed Affected version:3.0.0

Description

the line end's mark appears between the end date -1 and the end day,
it's better to display it between the end day and the end date + 1.

by modify ../redmine/helpers/gantt.rb

def pdf_task

Environment:
Redmine version 3.0.0.stable

before.png (27.8 KB) Binhai Liu, 2015-03-03 08:52

after.png (13.3 KB) Binhai Liu, 2015-03-03 08:52

expect.png (260 KB) Yuichi HARADA, 2020-03-18 02:10

actual.png (251 KB) Yuichi HARADA, 2020-03-18 02:10

19248.patch Magnifier (1.31 KB) Yuichi HARADA, 2020-03-18 02:13

Associated revisions

Revision 19595
Added by Go MAEDA 14 days ago

Fix that end markers in gantt PDF are misaligned (#19248).

Patch by Yuichi HARADA.

Revision 19596
Added by Go MAEDA 14 days ago

Merged r19595 from trunk to 4.1-stable (#19248).

Revision 19597
Added by Go MAEDA 14 days ago

Merged r19595 from trunk to 4.0-stable (#19248).

History

#1 Updated by Yuichi HARADA 16 days ago

I confirmed that the display position of the end mark was shifted. In addition, the display position of the end mark of the PNG image was shifted similarly.

expect actual

Improved with the following patch.

diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 285eb66a0..406a818e1 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -631,7 +631,7 @@ module Redmine
             coords[:bar_start] = 0
           end
           if end_date < self.date_to
-            coords[:end] = end_date - self.date_from
+            coords[:end] = end_date - self.date_from + 1
             coords[:bar_end] = end_date - self.date_from + 1
           else
             coords[:bar_end] = self.date_to - self.date_from + 1
@@ -897,7 +897,7 @@ module Redmine
           if coords[:end]
             style = +"" 
             style << "top:#{params[:top]}px;" 
-            style << "left:#{coords[:end] + params[:zoom]}px;" 
+            style << "left:#{coords[:end]}px;" 
             style << "width:15px;" 
             output << view.content_tag(:div, '&nbsp;'.html_safe,
                                        :style => style,
@@ -1031,7 +1031,7 @@ module Redmine
             ])
           end
           if coords[:end]
-            x = params[:subject_width] + coords[:end] + params[:zoom]
+            x = params[:subject_width] + coords[:end]
             y = params[:top] - height / 2
             params[:image].fill('blue')
             params[:image].draw('polygon %d,%d %d,%d %d,%d %d,%d' % [

#2 Updated by Go MAEDA 14 days ago

  • Target version set to 4.1.1

Setting the target version to 4.1.1.

#3 Updated by Go MAEDA 14 days ago

  • Subject changed from gantt's pdf line end mark's position to End markers in gantt PDF are misaligned
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Priority changed from Low to Normal
  • Target version changed from 4.1.1 to 4.0.7
  • Resolution set to Fixed

Committed the fix. Thank you.

Also available in: Atom PDF