Patch #12730 » Fix-PDF-output-of-Gantt-diagram-for-small-tickets.patch
| lib/redmine/helpers/gantt.rb | ||
|---|---|---|
|
def pdf_task(params, coords, options={})
|
||
|
height = options[:height] || 2
|
||
|
# Renders the task bar, with progress and late
|
||
|
if coords[:bar_start] && coords[:bar_end]
|
||
|
params[:pdf].SetY(params[:top] + 1.5)
|
||
|
params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
|
||
|
top = params[:top] + 1.5
|
||
|
width = params[:subject_width] + coords[:bar_start]
|
||
|
length = coords[:bar_end] - coords[:bar_start]
|
||
|
if length <= 0
|
||
|
length = 1
|
||
|
end
|
||
|
params[:pdf].SetY(top)
|
||
|
params[:pdf].SetX(width)
|
||
|
params[:pdf].SetFillColor(200, 200, 200)
|
||
|
params[:pdf].RDMCell(coords[:bar_end] - coords[:bar_start], height, "", 0, 0, "", 1)
|
||
|
params[:pdf].RDMCell(length, height, "", 0, 0, "", 1)
|
||
|
if coords[:bar_late_end]
|
||
|
params[:pdf].SetY(params[:top] + 1.5)
|
||
|
params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
|
||
|
length = coords[:bar_late_end] - coords[:bar_start]
|
||
|
if length <= 0
|
||
|
length = 1
|
||
|
end
|
||
|
params[:pdf].SetY(top)
|
||
|
params[:pdf].SetX(width)
|
||
|
params[:pdf].SetFillColor(255, 100, 100)
|
||
|
params[:pdf].RDMCell(coords[:bar_late_end] - coords[:bar_start], height, "", 0, 0, "", 1)
|
||
|
params[:pdf].RDMCell(length, height, "", 0, 0, "", 1)
|
||
|
end
|
||
|
if coords[:bar_progress_end]
|
||
|
params[:pdf].SetY(params[:top] + 1.5)
|
||
|
params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
|
||
|
length = coords[:bar_progress_end] - coords[:bar_start]
|
||
|
if length <= 0
|
||
|
length = 1
|
||
|
end
|
||
|
params[:pdf].SetY(top)
|
||
|
params[:pdf].SetX(width)
|
||
|
params[:pdf].SetFillColor(90, 200, 90)
|
||
|
params[:pdf].RDMCell(coords[:bar_progress_end] - coords[:bar_start], height, "", 0, 0, "", 1)
|
||
|
params[:pdf].RDMCell(length, height, "", 0, 0, "", 1)
|
||
|
end
|
||
|
end
|
||
|
# Renders the markers
|
||
|
if options[:markers]
|
||
|
if coords[:start]
|
||
| ... | ... | |
|
params[:pdf].RDMCell(2, 2, "", 0, 0, "", 1)
|
||
|
end
|
||
|
end
|
||
|
# Renders the label on the right
|
||
|
if options[:label]
|
||
|
params[:pdf].SetX(params[:subject_width] + (coords[:bar_end] || 0) + 5)
|
||
| ... | ... | |
|
if coords[:bar_start] && coords[:bar_end]
|
||
|
params[:image].fill('#aaa')
|
||
|
params[:image].rectangle(params[:subject_width] + coords[:bar_start],
|
||
|
params[:top],
|
||
|
params[:subject_width] + coords[:bar_end],
|
||
|
params[:top] - height)
|
||
|
params[:top],
|
||
|
params[:subject_width] + coords[:bar_end],
|
||
|
params[:top] - height)
|
||
|
if coords[:bar_late_end]
|
||
|
params[:image].fill('#f66')
|
||
|
params[:image].rectangle(params[:subject_width] + coords[:bar_start],
|
||
|
params[:top],
|
||
|
params[:subject_width] + coords[:bar_late_end],
|
||
|
params[:top] - height)
|
||
|
params[:top],
|
||
|
params[:subject_width] + coords[:bar_late_end],
|
||
|
params[:top] - height)
|
||
|
end
|
||
|
if coords[:bar_progress_end]
|
||
|
params[:image].fill('#00c600')
|
||
|
params[:image].rectangle(params[:subject_width] + coords[:bar_start],
|
||
|
params[:top],
|
||
|
params[:subject_width] + coords[:bar_progress_end],
|
||
|
params[:top] - height)
|
||
|
params[:top],
|
||
|
params[:subject_width] + coords[:bar_progress_end],
|
||
|
params[:top] - height)
|
||
|
end
|
||
|
end
|
||
|
# Renders the markers
|
||
| ... | ... | |
|
if options[:label]
|
||
|
params[:image].fill('black')
|
||
|
params[:image].text(params[:subject_width] + (coords[:bar_end] || 0) + 5,
|
||
|
params[:top] + 1,
|
||
|
options[:label])
|
||
|
params[:top] + 1,
|
||
|
options[:label])
|
||
|
end
|
||
|
end
|
||
|
end
|
||