use of org.knime.base.node.viz.histogram.impl.AbstractHistogramProperties in project knime-core by knime.
the class InteractiveHistogramPlotter method setAggregationMethod.
/**
* {@inheritDoc}
*/
@Override
public boolean setAggregationMethod(final AggregationMethod aggrMethod) {
if (aggrMethod == null) {
throw new IllegalArgumentException("Aggregation method must not" + " be null");
}
final AbstractHistogramVizModel vizModel = getHistogramVizModel();
final Collection<? extends ColorColumn> oldAggrCols = vizModel.getAggrColumns();
if (oldAggrCols == null || oldAggrCols.size() < 1) {
// aggregation column
if (vizModel instanceof InteractiveHistogramVizModel) {
final InteractiveHistogramVizModel interactiveVizModel = (InteractiveHistogramVizModel) vizModel;
final AbstractHistogramProperties abstHistoProps = getHistogramPropertiesPanel();
if (abstHistoProps instanceof InteractiveHistogramProperties) {
final InteractiveHistogramProperties props = (InteractiveHistogramProperties) abstHistoProps;
final DataTableSpec spec = interactiveVizModel.getTableSpec();
final int numColumns = spec.getNumColumns();
boolean found = false;
for (int i = 0; i < numColumns; i++) {
final DataColumnSpec colSpec = spec.getColumnSpec(i);
if (AbstractHistogramPlotter.AGGREGATION_COLUMN_FILTER.includeColumn(colSpec)) {
final ColorColumn aggrColumn = new ColorColumn(Color.LIGHT_GRAY, colSpec.getName());
final ArrayList<ColorColumn> aggrCols = new ArrayList<ColorColumn>(1);
aggrCols.add(aggrColumn);
props.updateColumnSelection(spec, getXColName(), aggrCols, aggrMethod);
final List<ColorColumn> selectedAggrCols = props.getSelectedAggrColumns();
interactiveVizModel.setAggregationColumns(selectedAggrCols);
// set the current hilited keys in the new bins
vizModel.updateHiliteInfo(delegateGetHiLitKeys(), true);
found = true;
break;
}
}
if (!found) {
props.updateHistogramSettings(interactiveVizModel);
return false;
}
} else {
throw new IllegalStateException("ProeprtiesPanel should be of interactive type.");
}
} else {
throw new IllegalStateException("Visualization model should " + " be of interactive type.");
}
}
return super.setAggregationMethod(aggrMethod);
}
use of org.knime.base.node.viz.histogram.impl.AbstractHistogramProperties 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");
}
}
Aggregations