Project

General

Profile

Actions

Defect #19248

closed

End markers in gantt PDF are misaligned

Added by Binhai Liu about 9 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gantt
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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


Files

before.png (27.8 KB) before.png Binhai Liu, 2015-03-03 08:52
after.png (13.3 KB) after.png Binhai Liu, 2015-03-03 08:52
expect.png (260 KB) expect.png Yuichi HARADA, 2020-03-18 02:10
actual.png (251 KB) actual.png Yuichi HARADA, 2020-03-18 02:10
19248.patch (1.31 KB) 19248.patch Yuichi HARADA, 2020-03-18 02:13
Actions #1

Updated by Yuichi HARADA about 4 years 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' % [
Actions #2

Updated by Go MAEDA almost 4 years ago

  • Target version set to 4.1.1

Setting the target version to 4.1.1.

Actions #3

Updated by Go MAEDA almost 4 years 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.

Actions

Also available in: Atom PDF