public static Element createElement(final Document document, final String tag, final SVGColor fillColor, final String... attributes) { return createElement(document, tag, prepend(attributes, "fill", fillColor.getName())); }
public static Element createPath(final Document document, final String fill, final double strokeWidth, final String stroke, final String path, final String... attributes) { checkPositiveValues("strokeWidth", strokeWidth); final Element el = createElement(document, "path", prepend(attributes, "fill", fill, "stroke-width", strokeWidth, "stroke", stroke, "d", path)); return el; }
public static Element createText(final Document document, final double x, final double y, final String text, final String... attributes) { if (text == null) { throw new IllegalArgumentException("text shouldn't be null."); } checkNonNegativeValues("x, y", x, y); if (log.isDebugEnabled() == true) { log.debug("createText: x=" + x + ", y=" + y + ", text=" + text); } final Element el = createElement(document, "text", prepend(attributes, "x", round(x), "y", round(y))); el.appendChild(document.createTextNode(text)); return el; }
public static Element createUse(final Document document, final String id, final double x, final double y, final String... attributes) { checkNonNegativeValues("x, y", x, y); final Element el = createElement(document, "use", prepend(attributes, "xlink:href", id, "x", round(x), "y", round(y))); return el; }
private void drawLabelBar(final Document doc, final Element el, final int row, final Date fromDate, final Date toDate, final GanttChartStyle style) { final Element g = SVGHelper.createElement(doc, "g", "transform", "translate(0," + (row * ROW_HEIGHT) + ")"); el.appendChild(g); final Element grid = SVGHelper.createElement(doc, "g", "stroke", "green", "stroke-width", "1", "stroke-dasharray", "5,5"); g.appendChild(grid); final Element g1 = SVGHelper.createElement(doc, "g", "text-anchor", "middle", "font-family", "Verdana", "font-size", "9pt"); g.appendChild(g1); final GanttChartXLabelBarRenderer renderer = new GanttChartXLabelBarRenderer(fromDate, toDate, style.getWidth(), style); renderer.draw(doc, g1, grid, 10); log.info("GanttChartXLabelBarRenderer: fromToDays=" + renderer.fromToDays + ", labelUnit=" + renderer.labelUnit + ", labelScale=" + renderer.labelScale + ", ticksUnit=" + renderer.ticksUnit + ", ticksScale=" + renderer.ticksScale); }
g1 = SVGHelper.createElement(doc, "g", "font-size", "9pt"); root.appendChild(g1); g1.appendChild(SVGHelper.createText(doc, 0, 0, "TO SMALL")); 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 + " 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 = SVGHelper.createElement(doc, "g", "transform", "translate(" + style.getTotalLabelWidth() + ",20)", "text-anchor", "middle",
public static Element createLine(final Document document, final double x1, final double y1, final double x2, final double y2, final String... attributes) { checkNonNegativeValues("x1, y1, x2, y2", x1, y1, x2, y2); if (log.isDebugEnabled() == true) { log.debug("createLine: x1=" + x1 + ", y1=" + y1 + ", x2=" + x2 + ", y2=" + y2 + ", attributes=" + StringHelper.listToString(",", attributes)); } final Element el = createElement(document, "line", prepend(attributes, "x1", round(x1), "y1", round(y1), "x2", round(x2), "y2", round(y2))); return el; }
public static Element createRect(final Document document, final double x, final double y, final double width, final double height, final String fill, final String... attributes) { checkPositiveValues("width, height", width, height); checkNonNegativeValues("x, y", x, y); if (log.isDebugEnabled() == true) { log.debug("createRect: x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + ", fill=" + fill + ", attributes=" + StringHelper.listToString(",", StringHelper.listToString(",", attributes))); } final Element el = createElement(document, "rect", prepend(attributes, "x", round(x), "y", round(y), "width", round(width), "height", round(height), "fill", fill)); return el; }
g1.appendChild(SVGHelper.createText(doc, diagramWidth / 2, 0, label)); final Element ticks = SVGHelper.createElement(doc, "g", "stroke", SVGColor.BLACK.getName(), "stroke-width", "1", "transform", "translate(0,10)"); g1.appendChild(ticks); final DayHolder day = new DayHolder(fromDate);