}
if (settings.getToDate() != null) {
toDate = settings.getToDate();
}
if (fromDate == null) {
fromDate = new DateHolder().setBeginOfDay().setHourOfDay(8).getDate();
}
if (toDate == null) {
toDate = new DateHolder().setBeginOfDay().setHourOfDay(8).add(Calendar.DAY_OF_MONTH, 30).getDate();
}
for (final GanttTask node : allVisibleGanttObjects) {
final ObjectInfo taskInfo = new ObjectInfo(node, row++);
objectMap.put(node, taskInfo);
}
height = style.getYScale() * row + GanttChartStyle.HEAD_HEIGHT;
final Document doc = SVGHelper.createDocument(style.getWidth(), height);
final Element root = doc.getDocumentElement();
Element e, g1, g2, g3;
if (getDiagramWidth() < 0) {
g1 = SVGHelper.createElement(doc, "g", "font-size", "9pt");
root.appendChild(g1);
g1.appendChild(SVGHelper.createText(doc, 0, 0, "TO SMALL"));
return doc;
}
// Defs
e = SVGHelper.createElement(doc, "defs");
root.appendChild(e);
e.appendChild(SVGHelper.createElement(doc, "path", SVGColor.DARK_RED, "d", "M 0 0 L "
+ GanttChartStyle.SUMMARY_ARROW_SIZE
+ " 0 L 0 "
+ GanttChartStyle.SUMMARY_ARROW_SIZE
+ " z", "id", "redLeftArrow"));
e.appendChild(SVGHelper.createElement(doc, "path", SVGColor.DARK_RED, "d", "M 0 0 L "
+ GanttChartStyle.SUMMARY_ARROW_SIZE
+ " 0 L "
+ GanttChartStyle.SUMMARY_ARROW_SIZE
+ " "
+ GanttChartStyle.SUMMARY_ARROW_SIZE
+ " z", "id", "redRightArrow"));
e.appendChild(SVGHelper.createElement(doc, "path", SVGColor.BLACK, "d", "M -5 0 L 0 5 L 5 0 L 0 -5 z", "id", "diamond"));
e = SVGHelper.createElement(doc, "defs");
root.appendChild(e);
g1 = SVGHelper.createElement(doc, "g", "transform", "translate(5,20)");
root.appendChild(g1);
if (fontFamily != null) {
g2 = SVGHelper.createElement(doc, "g", "font-family", fontFamily, "font-size", "9pt");
} else {
g2 = SVGHelper.createElement(doc, "g", "font-size", "9pt");
}
g1.appendChild(g2);
if (style.getWorkPackageLabelWidth() > 0) {
g2.appendChild(SVGHelper.createText(doc, 0, 0, "WP"));
g2.appendChild(SVGHelper.createText(doc, 0, 20, "Code"));
g2.appendChild(SVGHelper.createText(doc, style.getWorkPackageLabelWidth(), 10, settings.getTitle()));
} else {
g2.appendChild(SVGHelper.createText(doc, 0, 10, settings.getTitle()));
}
// labelbar
if (fontFamily != null) {
g1 = SVGHelper.createElement(doc, "g", "transform", "translate(" + style.getTotalLabelWidth() + ",20)", "text-anchor", "middle",
"font-family", fontFamily, "font-size", "9pt");
} else {
g1 = SVGHelper.createElement(doc, "g", "transform", "translate(" + style.getTotalLabelWidth() + ",20)", "text-anchor", "middle",
"font-size", "9pt");
}
root.appendChild(g1);
final Element diagram = SVGHelper.createElement(doc, "g", "transform", "translate("
+ style.getTotalLabelWidth()
+ ","
+ GanttChartStyle.HEAD_HEIGHT
+ ")");
root.appendChild(diagram);
final Element grid = SVGHelper.createElement(doc, "g", "stroke", "gray", "stroke-width", "1");// , "stroke-dasharray", "5,5");
diagram.appendChild(grid);
final GanttChartXLabelBarRenderer xLabelBarRenderer = new GanttChartXLabelBarRenderer(fromDate, toDate, getDiagramWidth(), style);
xLabelBarRenderer.draw(doc, g1, grid, getDiagramHeight());
// Show today line, if configured.
if (style.isShowToday() == true) {
final DateHolder today = new DateHolder();
if (today.isBetween(fromDate, toDate) == true) {
diagram.appendChild(SVGHelper.createLine(doc, getXValue(today.getDate()), 0, getXValue(today.getDate()), getDiagramHeight(),
SVGColor.RED, "stroke-width", "2"));
}
}
// Task descriptions: