Search in sources :

Example 11 with DataArray

use of org.knime.base.node.util.DataArray in project knime-core by knime.

the class ScatterPlotNodeView method modelChanged.

/**
 * This is going to be called by the model if the model data has changed.
 *
 * @see NodeView#modelChanged()
 */
@Override
public synchronized void modelChanged() {
    ScatterPlotNodeModel model = (ScatterPlotNodeModel) getNodeModel();
    if (model != null) {
        // clear the plot
        m_plot.clear();
        // could be the property handler,
        m_plot.setHiLiteHandler(getNodeModel().getInHiLiteHandler(0));
        // or the data table.
        m_plot.modelDataChanged(model.getRowsContainer());
        // update the x/y col selectors, this should trigger
        DataArray rows = model.getRowsContainer();
        if (rows != null) {
            m_properties.setSelectables(rows.getDataTableSpec());
        } else {
            m_properties.setSelectables(null);
        }
    }
}
Also used : DataArray(org.knime.base.node.util.DataArray)

Example 12 with DataArray

use of org.knime.base.node.util.DataArray in project knime-core by knime.

the class ScatterPlotter method getXmin.

/**
 * @return the lower limit of the X scale
 */
public double getXmin() {
    if (getXColName() == null) {
        return 0.0;
    }
    DataArray rows = m_rowContainer;
    if ((rows == null) || (rows.size() == 0)) {
        return 0.0;
    }
    DataTableSpec tSpec = rows.getDataTableSpec();
    int idx = tSpec.findColumnIndex(getXColName());
    if (idx < 0) {
        return 0.0;
    }
    // 'getDoubleValue' returns the first valid double value
    return getDoubleValue(m_userXmin, tSpec.getColumnSpec(idx).getDomain().getLowerBound(), rows.getMinValue(idx), Double.NaN);
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataArray(org.knime.base.node.util.DataArray)

Example 13 with DataArray

use of org.knime.base.node.util.DataArray in project knime-core by knime.

the class ScatterPlotter method getYmax.

/**
 * @return the upper limit of the Y scale
 */
public double getYmax() {
    if (getYColName() == null) {
        return 0.0;
    }
    DataArray rows = m_rowContainer;
    if ((rows == null) || (rows.size() == 0)) {
        return 0.0;
    }
    DataTableSpec tSpec = rows.getDataTableSpec();
    int idx = tSpec.findColumnIndex(getYColName());
    if (idx < 0) {
        return 0.0;
    }
    // 'getDoubleValue' returns the first valid double value
    return getDoubleValue(m_userYmax, tSpec.getColumnSpec(idx).getDomain().getUpperBound(), rows.getMaxValue(idx), Double.NaN);
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataArray(org.knime.base.node.util.DataArray)

Example 14 with DataArray

use of org.knime.base.node.util.DataArray in project knime-core by knime.

the class ScatterPlotter method getXmax.

/**
 * @return the upper limit of the X scale
 */
public double getXmax() {
    if (getXColName() == null) {
        return 0.0;
    }
    DataArray rows = m_rowContainer;
    if ((rows == null) || (rows.size() == 0)) {
        return 0.0;
    }
    DataTableSpec tSpec = rows.getDataTableSpec();
    int idx = tSpec.findColumnIndex(getXColName());
    if (idx < 0) {
        return 0.0;
    }
    // 'getDoubleValue' returns the first valid double value
    return getDoubleValue(m_userXmax, tSpec.getColumnSpec(idx).getDomain().getUpperBound(), rows.getMaxValue(idx), Double.NaN);
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataArray(org.knime.base.node.util.DataArray)

Example 15 with DataArray

use of org.knime.base.node.util.DataArray in project knime-core by knime.

the class LiftChartNodeView method modelChanged.

/**
 * {@inheritDoc}
 */
@Override
protected void modelChanged() {
    final NodeModel model = getNodeModel();
    m_liftChart.setDataProvider((DataProvider) model);
    m_gainChart.setDataProvider(new DataProvider() {

        public DataArray getDataArray(final int index) {
            return ((LiftChartNodeModel) model).getDataArray(1);
        }
    });
    m_liftChart.updatePaintModel();
    m_gainChart.updatePaintModel();
}
Also used : DataProvider(org.knime.base.node.viz.plotter.DataProvider) NodeModel(org.knime.core.node.NodeModel) DataArray(org.knime.base.node.util.DataArray)

Aggregations

DataArray (org.knime.base.node.util.DataArray)23 DataTableSpec (org.knime.core.data.DataTableSpec)8 DataRow (org.knime.core.data.DataRow)7 DefaultDataArray (org.knime.base.node.util.DefaultDataArray)6 DataCell (org.knime.core.data.DataCell)6 Point (java.awt.Point)5 ArrayList (java.util.ArrayList)5 DataProvider (org.knime.base.node.viz.plotter.DataProvider)5 StringCell (org.knime.core.data.def.StringCell)5 BufferedDataTable (org.knime.core.node.BufferedDataTable)4 Color (java.awt.Color)3 ColorAttr (org.knime.core.data.property.ColorAttr)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 FilterColumnTable (org.knime.base.data.filter.column.FilterColumnTable)2 LinearRegressionContent (org.knime.base.node.mine.regression.linear.LinearRegressionContent)2 DotInfo (org.knime.base.node.viz.plotter.scatter.DotInfo)2