Search in sources :

Example 6 with AbstractHistogramVizModel

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

the class AbstractHistogramPlotter method unHiLite.

/**
 * {@inheritDoc}
 */
@Override
public void unHiLite(final KeyEvent event) {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null || !vizModel.supportsHiliting()) {
        LOGGER.debug("VizModel doesn't support hiliting or was null");
        return;
    }
    final Set<RowKey> hilited = event.keys();
    vizModel.updateHiliteInfo(hilited, false);
    repaint();
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) RowKey(org.knime.core.data.RowKey)

Example 7 with AbstractHistogramVizModel

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

the class AbstractHistogramPlotter method setNumberOfBins.

/**
 * @param noOfBins sets the number of bins which is used for binning of
 * none nominal attributes
 * @return <code>true</code> if the value has changed
 */
protected boolean setNumberOfBins(final int noOfBins) {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null) {
        LOGGER.debug("VizModel was null");
        throw new IllegalStateException("Exception in setNumberOfBins: " + "Viz model must not be null");
    }
    if (vizModel.setNoOfBins(noOfBins)) {
        setXCoordinates();
        setYCoordinates();
        if (vizModel.supportsHiliting()) {
            // set the current hilited keys in the new bins
            vizModel.updateHiliteInfo(delegateGetHiLitKeys(), true);
        }
        if (HistogramLayout.SIDE_BY_SIDE.equals(vizModel.getHistogramLayout()) && (vizModel.getAggrColumns() != null && vizModel.getAggrColumns().size() > 1)) {
            vizModel.setBinWidth(vizModel.getMaxBinWidth());
        }
        // update the details tab
        getHistogramPropertiesPanel().updateHTMLDetailsPanel(vizModel.getHTMLDetailData());
        return true;
    }
    return false;
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)

Example 8 with AbstractHistogramVizModel

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

the class AbstractHistogramPlotter method unHiLiteAll.

/**
 * {@inheritDoc}
 */
@Override
public void unHiLiteAll(final KeyEvent event) {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null || !vizModel.supportsHiliting()) {
        LOGGER.debug("VizModel doesn't support hiliting or was null");
        return;
    }
    vizModel.unHiliteAll();
    repaint();
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)

Example 9 with AbstractHistogramVizModel

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

the class AbstractHistogramPlotter method unHiLiteSelected.

/**
 * {@inheritDoc}
 */
@Override
public void unHiLiteSelected() {
    final AbstractHistogramVizModel vizModel = getHistogramVizModel();
    if (vizModel == null || !vizModel.supportsHiliting()) {
        LOGGER.debug("VizModel doesn't support hiliting or was null");
        return;
    }
    final Set<RowKey> selectedKeys = vizModel.getSelectedKeys();
    delegateUnHiLite(selectedKeys);
    repaint();
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) RowKey(org.knime.core.data.RowKey)

Example 10 with AbstractHistogramVizModel

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

the class HistogramNodeView method modelChanged.

/**
 * Whenever the model changes an update for the plotter is triggered and new
 * HiLiteHandler are set.
 */
@Override
public void modelChanged() {
    final AbstractHistogramNodeModel model = getNodeModel();
    if (model == null) {
        return;
    }
    if (m_plotter != null) {
        m_plotter.reset();
    }
    final DataTableSpec tableSpec = model.getTableSpec();
    AbstractHistogramVizModel vizModel = model.getHistogramVizModel();
    if (vizModel == null) {
        return;
    }
    if (m_plotter == null) {
        final InteractiveHistogramProperties props = new InteractiveHistogramProperties(tableSpec, vizModel);
        m_plotter = new InteractiveHistogramPlotter(props, model.getInHiLiteHandler(0));
        // add the hilite menu to the menu bar of the node view
        getJMenuBar().add(m_plotter.getHiLiteMenu());
    }
    m_plotter.setHiLiteHandler(model.getInHiLiteHandler(0));
    m_plotter.setHistogramVizModel(tableSpec, vizModel);
    m_plotter.updatePaintModel();
    if (m_plotter != null) {
        m_plotter.fitToScreen();
    }
    if (getComponent() != m_plotter) {
        setComponent(m_plotter);
    }
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) InteractiveHistogramProperties(org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramProperties) InteractiveHistogramPlotter(org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramPlotter)

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