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);
}
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();
}
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();
}
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;
}
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;
}
Aggregations