Search in sources :

Example 1 with SvgCell

use of org.knime.base.data.xml.SvgCell in project knime-core by knime.

the class HistogramColumn method createSvgImageCell.

/**
 * @param histogramData A {@link HistogramModel}.
 * @return The SVG image cell.
 */
private DataCell createSvgImageCell(final HistogramModel<?> histogramData, final boolean paintLabels) {
    DOMImplementation domImpl = new SVGDOMImplementation();
    String svgNS = "http://www.w3.org/2000/svg";
    Document myFactory = domImpl.createDocument(svgNS, "svg", null);
    SVGGraphics2D g = new SVGGraphics2D(myFactory);
    g.setSVGCanvasSize(new Dimension(m_width, m_height));
    paint(histogramData, paintLabels, g);
    myFactory.replaceChild(g.getRoot(), myFactory.getDocumentElement());
    DataCell dc = new SvgCell((SVGDocument) myFactory);
    return dc;
}
Also used : SVGDOMImplementation(org.apache.batik.dom.svg.SVGDOMImplementation) DOMImplementation(org.w3c.dom.DOMImplementation) SVGDOMImplementation(org.apache.batik.dom.svg.SVGDOMImplementation) SVGGraphics2D(org.apache.batik.svggen.SVGGraphics2D) DataCell(org.knime.core.data.DataCell) SvgCell(org.knime.base.data.xml.SvgCell) Dimension(java.awt.Dimension) Document(org.w3c.dom.Document) SVGDocument(org.w3c.dom.svg.SVGDocument)

Aggregations

Dimension (java.awt.Dimension)1 SVGDOMImplementation (org.apache.batik.dom.svg.SVGDOMImplementation)1 SVGGraphics2D (org.apache.batik.svggen.SVGGraphics2D)1 SvgCell (org.knime.base.data.xml.SvgCell)1 DataCell (org.knime.core.data.DataCell)1 DOMImplementation (org.w3c.dom.DOMImplementation)1 Document (org.w3c.dom.Document)1 SVGDocument (org.w3c.dom.svg.SVGDocument)1