Package com.macrofocus.high_d.parallelcoordinates.swing

# Class SwingParallelCoordinates<R,C>

java.lang.Object
com.macrofocus.high_d.parallelcoordinates.AbstractParallelCoordinates<JComponent,Color,R,C>
com.macrofocus.high_d.parallelcoordinates.swing.SwingParallelCoordinates<R,C>

All Implemented Interfaces:
  `com.macrofocus.crossplatform.CPComponent<JComponent>`, `ParallelCoordinates<JComponent,Color,R,C>`

public class SwingParallelCoordinates<R,C> extends AbstractParallelCoordinates<JComponent,Color,R,C>
A facade to the ParallelCoordinates model-view-controller (MVC) architecture. In brief, the controller collects user input, the model manipulates application data, and the view presents results to the user. This class wraps a `ParallelCoordinatesModel`, `ParallelCoordinatesView`, and `ParallelCoordinatesController` together. It allows easy loading of the data and customization of the most common settings.

Here is a simplistic example of how to get started with this class within minutes:

     import com.macrofocus.data.table.Row;
     import com.macrofocus.helper.TableHelper;
     import com.macrofocus.high_d.pcs.ParallelCoordinates;
     import com.macrofocus.high_d.pcs.ParallelCoordinatesModel;
     import com.macrofocus.high_d.pcs.axis.AxisModel;
     import com.macrofocus.high_d.pcs.colortheme.DarkColorTheme;
     import com.macrofocus.high_d.pcs.geometry.Geometry;

     import javax.swing.*;
     import javax.swing.table.TableModel;
     import java.awt.*;

     public class Hello {
        public static void main(String[] args) {
            final TableModel tableModel = TableHelper.createRandomDataFrame(4, 10000, 10);
            ParallelCoordinates parallelCoordinates = new ParallelCoordinates(tableModel);

            ParallelCoordinatesModel model = parallelCoordinates.getModel();

            // Tune the appearance
            model.getSettings().setGeometry(Geometry.Steps);
            parallelCoordinates.getView().setColorTheme(new DarkColorTheme());

            // Normalize all the scales between 0 and 1
            for(AxisModel axisModel: model.getAxisModels()) {
                axisModel.setMaximum(1);
                axisModel.setMinimum(0);
                axisModel.getInterval().setValue(0, 1);
            }

            // Filter out values that are not between 0.5 and 0.7
            model.getAxisModel(2).getInterval().setValue(0.5, 0.2);

            // Adjust the initial state
            model.getProbing().setSelected(model.getObject(16));
            model.getSelection().setSelected(model.getObject(10));
            model.getColoring().setColor(model.getObject(498), Color.green);

            final JFrame frame = new JFrame("Hello from the High-D World!");
            frame.setSize(800, 500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(parallelCoordinates);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
     }

The code above will produce the following output:

- ## Field Summary

  ### Fields inherited from class com.macrofocus.high_d.parallelcoordinates.AbstractParallelCoordinates

  `controller, licenseModel, view`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SwingParallelCoordinates()`
  Creates a ParallelCoordinates component with default settings and configuration.
  `SwingParallelCoordinates(ParallelCoordinatesModel model)`
  Creates a ParallelCoordinates component with the its native data model.
  `SwingParallelCoordinates(com.macrofocus.molap.dataframe.DataFrame dataFrame)`
  Creates a ParallelCoordinates component with the specified data frame.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected ParallelCoordinatesController`
  `createController(ParallelCoordinatesView view)`
  Creates a controller that can be used by the parallel coordinates component
  `protected ParallelCoordinatesModel<Color,R,C>`
  `createModel(com.macrofocus.molap.dataframe.DataFrame dataFrame)`
  Creates a model that can be used by the parallel coordinates component
  `protected ParallelCoordinatesView<JComponent,Color,R,C>`
  `createView()`
  Creates a view that can be used by the parallel coordinates component
  `JComponent`
  `getNativeComponent()`
  `static void`
  `main(String[] args)`
  Sort of a Hello World! application to demonstrate the most basic use of the ParallelCoordinates API
  `void`
  `setStyleClass(String... styleClasses)`
  `void`
  `setView(ParallelCoordinatesView<JComponent,Color,R,C> view)`
  Sets the view to be used by the parallel coordinates component and register the model currently in use.

  ### Methods inherited from class com.macrofocus.high_d.parallelcoordinates.AbstractParallelCoordinates

  `getController, getModel, getView, load, setController, setLicenseKey, setModel`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SwingParallelCoordinates

    public SwingParallelCoordinates()
    Creates a ParallelCoordinates component with default settings and configuration.

  - ### SwingParallelCoordinates

    public SwingParallelCoordinates(ParallelCoordinatesModel model)
    Creates a ParallelCoordinates component with the its native data model.
    Parameters:
      `model` - a ParallelCoordinatesModel

  - ### SwingParallelCoordinates

    public SwingParallelCoordinates(com.macrofocus.molap.dataframe.DataFrame dataFrame)
    Creates a ParallelCoordinates component with the specified data frame.
    Parameters:
      `dataFrame` - a data frame

- ## Method Details

  - ### setStyleClass

    public void setStyleClass(String... styleClasses)

  - ### setView

    public void setView(ParallelCoordinatesView<JComponent,Color,R,C> view)
    Description copied from interface: `ParallelCoordinates`
    Sets the view to be used by the parallel coordinates component and register the model currently in use. It will also register itself to the controller.
    Specified by:
      `setView` in interface `ParallelCoordinates<JComponent,Color,R,C>`
    Overrides:
      `setView` in class `AbstractParallelCoordinates<JComponent,Color,R,C>`
    Parameters:
      `view` - the view to be used

  - ### createModel

    protected ParallelCoordinatesModel<Color,R,C> createModel(com.macrofocus.molap.dataframe.DataFrame dataFrame)
    Description copied from class: `AbstractParallelCoordinates`
    Creates a model that can be used by the parallel coordinates component
    Specified by:
      `createModel` in class `AbstractParallelCoordinates<JComponent,Color,R,C>`
    Parameters:
      `dataFrame` - a Swing TableModel
    Returns:
      a ParallelCoordinatesModel instance

  - ### createView

    protected ParallelCoordinatesView<JComponent,Color,R,C> createView()
    Description copied from class: `AbstractParallelCoordinates`
    Creates a view that can be used by the parallel coordinates component
    Specified by:
      `createView` in class `AbstractParallelCoordinates<JComponent,Color,R,C>`
    Returns:
      a ParallelCoordinatesView instance

  - ### createController

    protected ParallelCoordinatesController createController(ParallelCoordinatesView view)
    Description copied from class: `AbstractParallelCoordinates`
    Creates a controller that can be used by the parallel coordinates component
    Specified by:
      `createController` in class `AbstractParallelCoordinates<JComponent,Color,R,C>`
    Parameters:
      `view` - the view that should be controlled
    Returns:
      a ParallelCoordinatesController instance

  - ### getNativeComponent

    public JComponent getNativeComponent()

  - ### main

    public static void main(String[] args)
    Sort of a Hello World! application to demonstrate the most basic use of the ParallelCoordinates API