Search in sources :

Example 26 with AbstractHistogramVizModel

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

the class InteractiveHistogramPlotter method onAggrColChanged.

/**
 * Called whenever the user changes the aggregation column.
 */
protected void onAggrColChanged() {
    final AbstractHistogramVizModel abstractVizModel = getHistogramVizModel();
    if (abstractVizModel == null) {
        LOGGER.debug("VizModel was null");
        return;
    }
    final AbstractHistogramProperties abstractHistogramProperties = getHistogramPropertiesPanel();
    if (abstractHistogramProperties == null) {
        LOGGER.debug("ProeprtiesPanel was null");
        return;
    }
    if (abstractVizModel instanceof InteractiveHistogramVizModel) {
        final InteractiveHistogramVizModel vizModel = (InteractiveHistogramVizModel) abstractVizModel;
        if (abstractHistogramProperties instanceof InteractiveHistogramProperties) {
            final InteractiveHistogramProperties props = (InteractiveHistogramProperties) abstractHistogramProperties;
            final List<ColorColumn> aggrCols = props.getSelectedAggrColumns();
            if (vizModel.setAggregationColumns(aggrCols)) {
                // show the bar outline automatically depending on the
                // number of selected aggregation columns
                vizModel.setShowBarOutline(aggrCols != null && aggrCols.size() > 1);
                setYCoordinates();
                // set the current hilited keys in the new bins
                vizModel.updateHiliteInfo(delegateGetHiLitKeys(), true);
                if (vizModel.containsNotPresentableBin()) {
                    vizModel.setBinWidth(vizModel.getMaxBinWidth());
                }
                // update the details tab
                getHistogramPropertiesPanel().updateHTMLDetailsPanel(vizModel.getHTMLDetailData());
                updatePaintModel();
            }
        } else {
            throw new IllegalStateException(" PropertiesPanel should be of type interactive");
        }
    } else {
        throw new IllegalStateException("VizModel should be of type interactive");
    }
}
Also used : AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) ColorColumn(org.knime.base.node.viz.histogram.util.ColorColumn) AbstractHistogramProperties(org.knime.base.node.viz.histogram.impl.AbstractHistogramProperties) InteractiveHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.InteractiveHistogramVizModel)

Example 27 with AbstractHistogramVizModel

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

the class InteractiveHistogramPlotter method onXColChanged.

/**
 * Called whenever user changes the x column selection.
 *
 * @param xColName the new selected x column
 */
protected void onXColChanged(final String xColName) {
    if (xColName == null || xColName.trim().length() < 1) {
        return;
    }
    // if it's the same name we don't need to do anything
    if (getXColName() != null && getXColName().equals(xColName)) {
        return;
    }
    final AbstractHistogramVizModel abstractVizModel = getHistogramVizModel();
    if (abstractVizModel == null) {
        LOGGER.debug("VizModel was null");
        return;
    }
    if (abstractVizModel instanceof InteractiveHistogramVizModel) {
        final InteractiveHistogramVizModel vizModel = (InteractiveHistogramVizModel) abstractVizModel;
        final DataColumnSpec xColSpec = getDataTableSpec().getColumnSpec(xColName);
        if (vizModel.setXColumn(xColSpec)) {
            // set the current hilited keys in the new bins
            vizModel.updateHiliteInfo(delegateGetHiLitKeys(), true);
            // set the new axis
            setXCoordinates();
            setYCoordinates();
            // update the details tab
            getHistogramPropertiesPanel().updateHTMLDetailsPanel(vizModel.getHTMLDetailData());
            // repaint the plotter
            updatePaintModel();
        }
    } else {
        throw new IllegalStateException("VizModel should be of type interactive");
    }
// update the slider values and the select boxes
// getHistogramPropertiesPanel().updateHistogramSettings(this);
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) InteractiveHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.InteractiveHistogramVizModel)

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