Search in sources :

Example 1 with InteractiveHistogramPlotter

use of org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramPlotter in project knime-core by knime.

the class HistogramNodeView method modelChanged.

/**
 * Whenever the model changes an update for the plotter is triggered and new
 * HiLiteHandler are set.
 */
@Override
public void modelChanged() {
    final AbstractHistogramNodeModel model = getNodeModel();
    if (model == null) {
        return;
    }
    if (m_plotter != null) {
        m_plotter.reset();
    }
    final DataTableSpec tableSpec = model.getTableSpec();
    AbstractHistogramVizModel vizModel = model.getHistogramVizModel();
    if (vizModel == null) {
        return;
    }
    if (m_plotter == null) {
        final InteractiveHistogramProperties props = new InteractiveHistogramProperties(tableSpec, vizModel);
        m_plotter = new InteractiveHistogramPlotter(props, model.getInHiLiteHandler(0));
        // add the hilite menu to the menu bar of the node view
        getJMenuBar().add(m_plotter.getHiLiteMenu());
    }
    m_plotter.setHiLiteHandler(model.getInHiLiteHandler(0));
    m_plotter.setHistogramVizModel(tableSpec, vizModel);
    m_plotter.updatePaintModel();
    if (m_plotter != null) {
        m_plotter.fitToScreen();
    }
    if (getComponent() != m_plotter) {
        setComponent(m_plotter);
    }
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) AbstractHistogramVizModel(org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel) InteractiveHistogramProperties(org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramProperties) InteractiveHistogramPlotter(org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramPlotter)

Aggregations

AbstractHistogramVizModel (org.knime.base.node.viz.histogram.datamodel.AbstractHistogramVizModel)1 InteractiveHistogramPlotter (org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramPlotter)1 InteractiveHistogramProperties (org.knime.base.node.viz.histogram.impl.interactive.InteractiveHistogramProperties)1 DataTableSpec (org.knime.core.data.DataTableSpec)1