The data model

The following fields are specified in the GJDataModel class:
  • GJDataVectorInterface<?> xData
  • GJDataVectorInterface<?> yData
These represent the data for the x,y pairs to be plotted. Note that a GJDataVectorInterface instance contains a reference to the host plot. It follows that both it, and the is GJDataModel that wraps it, are specific to a plot. Each plot must therefore have its own GJDataModel instance but all properties except xData and yData may be shared with other instances. The data buffer contained within a GJDataVectorInterface may also be shared.

GJDataVectorInterface<?> specifies a generic interface used to wrap the data. Waterloo provides several concrete classes that implement this interface. [By default, a java.lang.Double array is currently used to store the underlying data. This may change as more detailed profiling of the code is done.]

In addition, four fields use a primitive double[]:
  • double[] extraData0
  • double[] extraData1
  • double[] extraData2
  • double[] extraData3
  • Object extraObject;
is a custom object specific to a particular plot type. For a bar plot, for example, the custom object is used to set whether the bars should be vertical or horizontal, grouped or stacked. For most plots, the extraObject is not used and is set to null.

The custom object may be added to the model during construction or may require explicit creation and addition by calling the setExtraObject method on the data model.