use of org.knime.base.util.coordinate.Coordinate in project knime-core by knime.
the class ScatterPlotter method setXColumn.
/**
* Sets new x columns and recalculates/repaints.
*
* @param xColName name of the new x column to plot
*/
public void setXColumn(final String xColName) {
setXColName(xColName);
// tell the headers to display the new column names
getColHeader().setToolTipText(getXColName());
// check if the column names set so far are valid
// this check also checks the y axis
// if invalid a boolean flag is set in the method for later use
checkColumns();
if (m_rowContainer == null) {
return;
}
DataTableSpec tSpec = m_rowContainer.getDataTableSpec();
int idx = tSpec.findColumnIndex(getXColName());
if (idx >= 0) {
Coordinate xCoordinate = Coordinate.createCoordinate(tSpec.getColumnSpec(idx));
if (xCoordinate == null) {
m_xIndex = -1;
} else {
// check whether the bounds are set properly
if (!xCoordinate.isNominal()) {
if (!((NumericCoordinate) xCoordinate).isMinDomainValueSet()) {
((NumericCoordinate) xCoordinate).setMinDomainValue(getXmin());
}
if (!((NumericCoordinate) xCoordinate).isMaxDomainValueSet()) {
((NumericCoordinate) xCoordinate).setMaxDomainValue(getXmax());
}
}
getColHeader().setCoordinate(xCoordinate);
m_xIndex = idx;
}
} else {
// set -1 to indicate an invalid column index
m_xIndex = -1;
}
// redo everything if two columns are available
if (!m_invalidColumn) {
updateDotsAndPaint();
}
}
Aggregations