Search in sources :

Example 16 with AbstractHistogramVizModel

use of org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel in project knime-core by knime.

the class AbstractHistogramPlotter method updatePaintModel.

/**
 * {@inheritDoc}
 */
@Override
public void updatePaintModel() {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null) {
        LOGGER.debug("VizModel was null");
        return;
    }
    final Coordinate xCoordinates = getXCoordinate();
    final Coordinate yCoordinates = getAggregationCoordinate();
    final HistogramDrawingPane drawingPane = getHistogramDrawingPane();
    final Dimension drawingSpace = vizModel.getDrawingSpace();
    setHistogramBinRectangle(vizModel, xCoordinates, yCoordinates);
    final double drawingHeight = drawingSpace.getHeight();
    if (!yCoordinates.isNominal() && ((NumericCoordinate) yCoordinates).getMinDomainValue() < 0) {
        final int baseLine = (int) (drawingHeight - yCoordinates.calculateMappedValue(new DoubleCell(0), drawingHeight));
        drawingPane.setBaseLine(Integer.valueOf(baseLine));
    } else {
        drawingPane.setBaseLine(null);
    }
    if (vizModel.isShowGridLines()) {
        final int[] gridLines = getGridLineCoordinates(yCoordinates, drawingHeight);
        drawingPane.setGridLines(gridLines);
    } else {
        drawingPane.setGridLines(null);
    }
    // update the properties panel as well since something could have changed
    drawingPane.setHistogramVizModel(vizModel, true);
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) Coordinate(org.knime.base.util.coordinate.Coordinate) NumericCoordinate(org.knime.base.util.coordinate.NumericCoordinate) DoubleCell(org.knime.core.data.def.DoubleCell) NumericCoordinate(org.knime.base.util.coordinate.NumericCoordinate) Dimension(java.awt.Dimension) Point(java.awt.Point)

Example 17 with AbstractHistogramVizModel

use of org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel in project knime-core by knime.

the class AbstractHistogramPlotter method clearSelection.

/**
 * {@inheritDoc}
 */
@Override
public void clearSelection() {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null) {
        return;
    }
    vizModel.clearSelection();
    repaint();
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)

Example 18 with AbstractHistogramVizModel

use of org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel in project knime-core by knime.

the class AbstractHistogramPlotter method selectClickedElement.

/**
 * {@inheritDoc}
 */
@Override
public void selectClickedElement(final Point clicked) {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null) {
        LOGGER.debug("VizModel was null");
        return;
    }
    vizModel.selectElement(clicked);
    m_histoProps.updateHTMLDetailsPanel(vizModel.getHTMLDetailData());
    repaint();
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)

Example 19 with AbstractHistogramVizModel

use of org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel in project knime-core by knime.

the class AbstractHistogramPlotter method setAggregationMethod.

/**
 * Sets new aggregation columns and recalculates/repaints.
 *
 * @param aggrMethod The aggregation method
 * @return <code>true</code> if the method has change otherwise
 * <code>false</code>.
 */
public boolean setAggregationMethod(final AggregationMethod aggrMethod) {
    if (aggrMethod == null) {
        throw new IllegalArgumentException("Aggregation method must not" + " be null");
    }
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null) {
        LOGGER.debug("VizModel was null");
        throw new IllegalStateException("Exception in setAggregationMethod: " + "Visualization model must not be null");
    }
    if (!vizModel.setAggregationMethod(aggrMethod)) {
        return false;
    }
    // if the method has changed we have to update the y coordinates
    setYCoordinates();
    return true;
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)

Example 20 with AbstractHistogramVizModel

use of org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel in project knime-core by knime.

the class AbstractHistogramPlotter method setShowMissingValBin.

/**
 * @param showMissingValBin the showMissingvalBar to set
 * @return <code>true</code> if the value has changed
 */
public boolean setShowMissingValBin(final boolean showMissingValBin) {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null) {
        LOGGER.debug("VizModel was null");
        throw new IllegalStateException("Exception in setShowMissingValBin: " + "Viz model must not be null");
    }
    if (vizModel.setShowMissingValBin(showMissingValBin)) {
        // set the coordinates to the new boundaries
        setXCoordinates();
        setYCoordinates();
        if (HistogramLayout.SIDE_BY_SIDE.equals(vizModel.getHistogramLayout()) && vizModel.containsNotPresentableBin() && (vizModel.getAggrColumns() != null && vizModel.getAggrColumns().size() > 1)) {
            vizModel.setBinWidth(vizModel.getMaxBinWidth());
        }
        return true;
    }
    return false;
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)

Aggregations

AbstractHistogramVizModel (org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)27 ColorColumn (org.knime.base.node.viz.histogram.util.ColorColumn)4 DataColumnSpec (org.knime.core.data.DataColumnSpec)4 RowKey (org.knime.core.data.RowKey)4 Dimension (java.awt.Dimension)3 Point (java.awt.Point)3 AggregationMethod (org.knime.base.node.viz.aggregation.AggregationMethod)3 InteractiveHistogramVizModel (org.knime.base.node.viz.histogram.datamodel.InteractiveHistogramVizModel)3 Coordinate (org.knime.base.util.coordinate.Coordinate)3 NumericCoordinate (org.knime.base.util.coordinate.NumericCoordinate)3 DataTableSpec (org.knime.core.data.DataTableSpec)3 BinDataModel (org.knime.base.node.viz.histogram.datamodel.BinDataModel)2 AbstractHistogramProperties (org.knime.base.node.viz.histogram.impl.AbstractHistogramProperties)2 DataCell (org.knime.core.data.DataCell)2 DoubleCell (org.knime.core.data.def.DoubleCell)2 Color (java.awt.Color)1 Graphics2D (java.awt.Graphics2D)1 Paint (java.awt.Paint)1 TexturePaint (java.awt.TexturePaint)1 ActionEvent (java.awt.event.ActionEvent)1