Search in sources :

Example 6 with CSSClass

use of de.lmu.ifi.dbs.elki.visualization.css.CSSClass in project elki by elki-project.

the class SVGButton method setTitle.

/**
 * Set the button title
 *
 * @param title Button title
 * @param textcolor Color
 */
public void setTitle(String title, String textcolor) {
    this.title = title;
    if (titlecss == null) {
        titlecss = new CSSClass(this, "text");
        titlecss.setStatement(SVGConstants.CSS_TEXT_ANCHOR_PROPERTY, SVGConstants.CSS_MIDDLE_VALUE);
        titlecss.setStatement(SVGConstants.CSS_FILL_PROPERTY, textcolor);
        titlecss.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, .6 * h);
    }
}
Also used : CSSClass(de.lmu.ifi.dbs.elki.visualization.css.CSSClass)

Example 7 with CSSClass

use of de.lmu.ifi.dbs.elki.visualization.css.CSSClass in project elki by elki-project.

the class SVGSimpleLinearAxis method setupCSSClasses.

/**
 * Register CSS classes with a {@link CSSClassManager}
 *
 * @param owner Owner of the CSS classes
 * @param manager Manager to register the classes with
 * @throws CSSNamingConflict when a name clash occurs
 */
private static void setupCSSClasses(Object owner, CSSClassManager manager, StyleLibrary style) throws CSSNamingConflict {
    if (!manager.contains(CSS_AXIS)) {
        CSSClass axis = new CSSClass(owner, CSS_AXIS);
        axis.setStatement(SVGConstants.CSS_STROKE_PROPERTY, style.getColor(StyleLibrary.AXIS));
        axis.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, style.getLineWidth(StyleLibrary.AXIS));
        manager.addClass(axis);
    }
    if (!manager.contains(CSS_AXIS_TICK)) {
        CSSClass tick = new CSSClass(owner, CSS_AXIS_TICK);
        tick.setStatement(SVGConstants.CSS_STROKE_PROPERTY, style.getColor(StyleLibrary.AXIS_TICK));
        tick.setStatement(SVGConstants.CSS_STROKE_WIDTH_PROPERTY, style.getLineWidth(StyleLibrary.AXIS_TICK));
        manager.addClass(tick);
    }
    if (!manager.contains(CSS_AXIS_LABEL)) {
        CSSClass label = new CSSClass(owner, CSS_AXIS_LABEL);
        label.setStatement(SVGConstants.CSS_FILL_PROPERTY, style.getTextColor(StyleLibrary.AXIS_LABEL));
        label.setStatement(SVGConstants.CSS_FONT_FAMILY_PROPERTY, style.getFontFamily(StyleLibrary.AXIS_LABEL));
        label.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, style.getTextSize(StyleLibrary.AXIS_LABEL));
        manager.addClass(label);
    }
}
Also used : CSSClass(de.lmu.ifi.dbs.elki.visualization.css.CSSClass)

Example 8 with CSSClass

use of de.lmu.ifi.dbs.elki.visualization.css.CSSClass in project elki by elki-project.

the class DragableArea method makeInvisible.

/**
 * Make the rectangle invisible.
 */
public void makeInvisible() {
    CSSClass cls = new CSSClass(this, "unused");
    cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, "0");
    cls.setStatement(SVGConstants.CSS_CURSOR_PROPERTY, SVGConstants.CSS_POINTER_VALUE);
    SVGUtil.setAtt(element, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS());
}
Also used : CSSClass(de.lmu.ifi.dbs.elki.visualization.css.CSSClass)

Example 9 with CSSClass

use of de.lmu.ifi.dbs.elki.visualization.css.CSSClass in project elki by elki-project.

the class LabelVisualization method makeVisualization.

@Override
public Visualization makeVisualization(VisualizerContext context, VisualizationTask task, VisualizationPlot plot, double width, double height, Projection proj) {
    CSSClass cls = new CSSClass(plot, "unmanaged");
    StyleLibrary style = context.getStyleLibrary();
    double fontsize = style.getTextSize("overview.labels") / StyleLibrary.SCALE;
    cls.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, SVGUtil.fmt(fontsize));
    cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, style.getTextColor("overview.labels"));
    cls.setStatement(SVGConstants.CSS_FONT_FAMILY_PROPERTY, style.getFontFamily("overview.labels"));
    Element layer;
    if (!rotated) {
        layer = plot.svgText(width * .5, height * .5 + .35 * fontsize, this.label);
        SVGUtil.setAtt(layer, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS());
        SVGUtil.setAtt(layer, SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, SVGConstants.SVG_MIDDLE_VALUE);
    } else {
        layer = plot.svgText(height * -.5, width * .5 + .35 * fontsize, this.label);
        SVGUtil.setAtt(layer, SVGConstants.SVG_STYLE_ATTRIBUTE, cls.inlineCSS());
        SVGUtil.setAtt(layer, SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, SVGConstants.SVG_MIDDLE_VALUE);
        SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, "rotate(-90)");
    }
    return new StaticVisualizationInstance(context, task, plot, width, height, layer);
}
Also used : Element(org.w3c.dom.Element) StyleLibrary(de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary) CSSClass(de.lmu.ifi.dbs.elki.visualization.css.CSSClass) StaticVisualizationInstance(de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualizationInstance)

Example 10 with CSSClass

use of de.lmu.ifi.dbs.elki.visualization.css.CSSClass in project elki by elki-project.

the class XYPlotVisualization method setupCSS.

/**
 * Setup the CSS classes for the plot.
 *
 * @param svgp Plot
 * @param plot Plot to render
 */
private void setupCSS(VisualizerContext context, SVGPlot svgp, XYPlot plot) {
    StyleLibrary style = context.getStyleLibrary();
    for (XYPlot.Curve curve : plot) {
        CSSClass csscls = new CSSClass(this, SERIESID + curve.getColor());
        // csscls.setStatement(SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE, "0.2%");
        csscls.setStatement(SVGConstants.SVG_FILL_ATTRIBUTE, SVGConstants.SVG_NONE_VALUE);
        style.lines().formatCSSClass(csscls, curve.getColor(), style.getLineWidth(StyleLibrary.XYCURVE));
        svgp.addCSSClassOrLogError(csscls);
    }
    // Axis label
    CSSClass label = new CSSClass(this, CSS_AXIS_LABEL);
    label.setStatement(SVGConstants.CSS_FILL_PROPERTY, style.getTextColor(StyleLibrary.XYCURVE));
    label.setStatement(SVGConstants.CSS_FONT_FAMILY_PROPERTY, style.getFontFamily(StyleLibrary.XYCURVE));
    label.setStatement(SVGConstants.CSS_FONT_SIZE_PROPERTY, style.getTextSize(StyleLibrary.XYCURVE));
    label.setStatement(SVGConstants.CSS_TEXT_ANCHOR_PROPERTY, SVGConstants.CSS_MIDDLE_VALUE);
    svgp.addCSSClassOrLogError(label);
    svgp.updateStyleElement();
}
Also used : XYPlot(de.lmu.ifi.dbs.elki.math.geometry.XYPlot) StyleLibrary(de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary) CSSClass(de.lmu.ifi.dbs.elki.visualization.css.CSSClass)

Aggregations

CSSClass (de.lmu.ifi.dbs.elki.visualization.css.CSSClass)10 StyleLibrary (de.lmu.ifi.dbs.elki.visualization.style.StyleLibrary)4 Element (org.w3c.dom.Element)4 StaticVisualizationInstance (de.lmu.ifi.dbs.elki.visualization.visualizers.StaticVisualizationInstance)2 DoubleMinMax (de.lmu.ifi.dbs.elki.math.DoubleMinMax)1 XYPlot (de.lmu.ifi.dbs.elki.math.geometry.XYPlot)1 LinearScale (de.lmu.ifi.dbs.elki.math.scales.LinearScale)1 HistogramResult (de.lmu.ifi.dbs.elki.result.HistogramResult)1 CSSHoverClass (de.lmu.ifi.dbs.elki.visualization.batikutil.CSSHoverClass)1 ColorLibrary (de.lmu.ifi.dbs.elki.visualization.colors.ColorLibrary)1 CSSNamingConflict (de.lmu.ifi.dbs.elki.visualization.css.CSSClassManager.CSSNamingConflict)1 VisualizationPlot (de.lmu.ifi.dbs.elki.visualization.gui.VisualizationPlot)1 SVGPath (de.lmu.ifi.dbs.elki.visualization.svg.SVGPath)1