Project

General

Profile

Actions

Defect #18792

open

wrong bar length in PDF gantt chart

Added by Kazmi Iwasa about 9 years ago.

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

0%

Estimated time:
Resolution:
Affected version:

Description

In my pdf gantt chart, some task bars which have small progress percentage are painted with wrong length.
They must have short green rectangle, but the results is long green rectangle.

In lib/redmine/helpers/gantt.rb, the green rectangle is painted here:

if coords[:bar_progress_end]
  params[:pdf].SetY(params[:top] + 1.5)
  params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
  params[:pdf].SetFillColor(90, 200, 90)
  params[:pdf].RDMCell(coords[:bar_progress_end] - coords[:bar_start], height, "", 0, 0, "", 1)
end

If a task have small progress, coords[:bar_progress_end] and coords[:bar_start] may have the same value because they are rounded by this code.

# Transforms dates into pixels witdh
coords.keys.each do |key|
  coords[key] = (coords[key] * zoom).floor
end

If coords[:bar_progress_end] - coords[:bar_start] was zero, RDMCell() paints long rectangle stretched to the most right side.

Environment:
Redmine version 2.5.2.stable
Ruby version 1.9.3-p484 (2013-11-22) [x86_64-linux]
Rails version 3.2.19
Environment production
Database adapter Mysql2

No data to display

Actions

Also available in: Atom PDF