Search in sources :

Example 1 with Axis

use of org.knime.base.node.viz.plotter.Axis in project knime-core by knime.

the class ParallelCoordinateDrawingPane method drawNominalAxis.

/**
 * Draws a nominal axis with the labels of all possible values.
 *
 * @param g the graphics object
 * @param axis the axis
 */
protected void drawNominalAxis(final Graphics g, final NominalParallelAxis axis) {
    // check whether the axis is on the right side of the center
    boolean right = getWidth() / 2.0 < axis.getXPosition();
    Axis paintAxis = new Axis(Axis.VERTICAL, axis.getHeight(), right);
    paintAxis.setCoordinate(axis.getCoordinate());
    int x = axis.getXPosition() - Axis.SIZE + 1;
    int y = TOP_SPACE;
    g.translate(x, y);
    paintAxis.paintComponent(g);
    g.translate(-x, -y);
}
Also used : Axis(org.knime.base.node.viz.plotter.Axis) Point(java.awt.Point)

Example 2 with Axis

use of org.knime.base.node.viz.plotter.Axis in project knime-core by knime.

the class AbstractHistogramPlotter method setXCoordinates.

/**
 * Sets the x coordinates for the current
 * {@link AbstractHistogramVizModel}.
 */
protected void setXCoordinates() {
    final DataColumnSpec colSpec = getXColumnSpec();
    // tell the headers to display the new column names
    final Coordinate xCoordinate = Coordinate.createCoordinate(colSpec);
    if (xCoordinate == null) {
        throw new IllegalStateException("Internal exception: " + " Unable to create x coordinates");
    }
    if (getXAxis() == null) {
        final Axis xAxis = new Axis(Axis.HORIZONTAL, getDrawingPaneDimension().width);
        setXAxis(xAxis);
    }
    getXAxis().setCoordinate(xCoordinate);
    getXAxis().setToolTipText(colSpec.getName());
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) Coordinate(org.knime.base.util.coordinate.Coordinate) NumericCoordinate(org.knime.base.util.coordinate.NumericCoordinate) Axis(org.knime.base.node.viz.plotter.Axis)

Example 3 with Axis

use of org.knime.base.node.viz.plotter.Axis in project knime-core by knime.

the class AbstractHistogramPlotter method getAggregationCoordinate.

/**
 * @return the {@link Coordinate} of the aggregation axis.
 */
private Coordinate getAggregationCoordinate() {
    final Axis aggrAxis = getYAxis();
    if (aggrAxis == null) {
        throw new IllegalStateException("Aggregation axis must not be null");
    }
    final Coordinate aggrCoordinate = aggrAxis.getCoordinate();
    if (aggrCoordinate == null) {
        throw new IllegalStateException("Aggregation coordinate must not be null");
    }
    return aggrCoordinate;
}
Also used : Coordinate(org.knime.base.util.coordinate.Coordinate) NumericCoordinate(org.knime.base.util.coordinate.NumericCoordinate) Axis(org.knime.base.node.viz.plotter.Axis)

Example 4 with Axis

use of org.knime.base.node.viz.plotter.Axis in project knime-core by knime.

the class AbstractHistogramPlotter method getXCoordinate.

/**
 * @return the {@link Coordinate} of the x axis.
 */
private Coordinate getXCoordinate() {
    final Axis xAxis = getXAxis();
    if (xAxis == null) {
        throw new IllegalStateException("X axis must not be null");
    }
    final Coordinate xCoordinate = xAxis.getCoordinate();
    if (xCoordinate == null) {
        throw new IllegalStateException("X coordinate must not be null");
    }
    return xCoordinate;
}
Also used : Coordinate(org.knime.base.util.coordinate.Coordinate) NumericCoordinate(org.knime.base.util.coordinate.NumericCoordinate) Axis(org.knime.base.node.viz.plotter.Axis)

Example 5 with Axis

use of org.knime.base.node.viz.plotter.Axis in project knime-core by knime.

the class AbstractHistogramPlotter method setYCoordinates.

/**
 * Sets the y coordinates for the current
 * {@link AbstractHistogramVizModel}.
 */
protected void setYCoordinates() {
    final DataColumnSpec aggrColSpec = getAggregationColSpec();
    // setYColName(aggrColSpec.getName());
    // tell the headers to display the new column names
    final Coordinate yCoordinate = Coordinate.createCoordinate(aggrColSpec);
    if (getYAxis() == null) {
        final Axis yAxis = new Axis(Axis.VERTICAL, getDrawingPaneDimension().height);
        setYAxis(yAxis);
    }
    getYAxis().setCoordinate(yCoordinate);
    getYAxis().setToolTipText(aggrColSpec.getName());
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) Coordinate(org.knime.base.util.coordinate.Coordinate) NumericCoordinate(org.knime.base.util.coordinate.NumericCoordinate) Axis(org.knime.base.node.viz.plotter.Axis)

Aggregations

Axis (org.knime.base.node.viz.plotter.Axis)7 Coordinate (org.knime.base.util.coordinate.Coordinate)4 NumericCoordinate (org.knime.base.util.coordinate.NumericCoordinate)4 DataColumnSpec (org.knime.core.data.DataColumnSpec)2 Point (java.awt.Point)1