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);
}
}
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);
}
}
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());
}
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);
}
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();
}
Aggregations