Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

PlotDataSource Class Reference

List of all members.

Detailed Description

The JetWeb 1D Histogram object. The jetweb implementation of the interface Rebinnable1DHistogramData.

Author:
Jon Butterworth
Version:
$date$ $revision$
See also:
jas.hist.Rebinnable1DHistogramData

jas.hist.Rebinnable2DHistogramData

Definition at line 27 of file PlotDataSource.java.


Public Member Functions

boolean isReal ()
double[][] rebin (int bins, double min, double max, boolean wantErrors, boolean hurry)
double getMin ()
double getMax ()
int getBins ()
boolean isRebinnable ()
int getAxisType ()
String getTitle ()
String[] getAxisLabels ()
 PlotDataSource (DataPlot plot, double scalef) throws JetWebException
JASHistStyle getStyle ()
void setStyleDefault ()

Protected Member Functions

void setTheData (double[][] td)
void setBins (int i)
void setMin (double d)
void setMax (double d)

Private Attributes

double[][] theData
double xmin = 0
double xmax = 0
int nbins
boolean isRealData
JASHist1DHistogramStyle myStyle

Constructor & Destructor Documentation

PlotDataSource DataPlot  plot,
double  scalef
throws JetWebException
 

Constructs plotDataSource from a dataplot. Each plot contains a Vector of DataPoint objects.

See also:
cedar.jetweb.model.plots.DataPoint DataPoint

Definition at line 134 of file PlotDataSource.java.

References DataPoint.getXMax(), DataPoint.getXMin(), DataPoint.getY(), DataPoint.getYDown(), DataPoint.getYUp(), PlotDataSource.isRealData, PlotDataSource.nbins, PlotDataSource.setStyleDefault(), PlotDataSource.theData, PlotDataSource.xmax, and PlotDataSource.xmin.

00134                                                                                {
00135     Vector dataPoints = plot.getDataPoints();
00136     nbins = dataPoints.size();
00137     theData = new double[4][nbins];
00138     for (int i=0;i<nbins;i++){
00139         DataPoint p = (DataPoint)dataPoints.elementAt(i);
00140         theData[0][i] = p.getY()*scalef;
00141         theData[1][i] = p.getYUp()*scalef;
00142         theData[2][i] = p.getYDown()*scalef;
00143     }
00144     
00145     DataPoint first = (DataPoint)dataPoints.firstElement();
00146     DataPoint last  = (DataPoint)dataPoints.lastElement();
00147     
00148     xmax = last.getXMax();
00149     xmin = first.getXMin();
00150 
00151     if (plot instanceof RealPlot) {
00152         isRealData=true;
00153     } else {
00154         isRealData=false;
00155     }
00156     setStyleDefault();
00157     }


Member Function Documentation

String [] getAxisLabels  ) 
 

Returns the axis labels. Only relevant if the axisType is STRING, otherwise can return null

Returns:
An array of bin labels to use on the X axis

Definition at line 125 of file PlotDataSource.java.

00125                                    {
00126     return null;
00127     };

int getAxisType  ) 
 

Returns one of DOUBLE,INTEGER,STRING,DATE or DELTATIME

Returns:
axis type

Definition at line 108 of file PlotDataSource.java.

00108                             {
00109     return DataSource.DOUBLE;
00110     };

int getBins  ) 
 

Returns the (suggested) number of bins to use

Returns:
nbins

Definition at line 88 of file PlotDataSource.java.

00088                         {
00089     return nbins;
00090     };

double getMax  ) 
 

Returns the (suggested) maximum value for the X axis

Returns:
xmax

Definition at line 80 of file PlotDataSource.java.

00080                           {
00081     return xmax;
00082     };

double getMin  ) 
 

Returns the (suggested) minimum value for the X axis

Returns:
xmin

Definition at line 72 of file PlotDataSource.java.

00072                           { 
00073     return xmin;
00074     };

JASHistStyle getStyle  ) 
 

get the style attributes for this histogram

Returns:
style attributes object

Definition at line 196 of file PlotDataSource.java.

00196 { return myStyle; }

String getTitle  ) 
 

NOT IMPLEMENTED

Returns:
empty string

Definition at line 116 of file PlotDataSource.java.

00116                             {
00117     return "";
00118     };

boolean isReal  ) 
 

Definition at line 34 of file PlotDataSource.java.

00034 {return isRealData;}

boolean isRebinnable  ) 
 

Returns true if the data source is capable of recalculating the bin contents, or false of the interface is not-capable of recalculating the bin contents. In the former case the values returned by getMin, getMax and getBins are just taken to be suggestions, in the latter case they are taken to be fixed in stone.

Returns:
True if the datasource is rebinnable

Definition at line 100 of file PlotDataSource.java.

00100                                   {
00101     return false;
00102     }

double [][] rebin int  bins,
double  min,
double  max,
boolean  wantErrors,
boolean  hurry
 

Called to request the binned data be returned. If the DataSource indicated it was not rebinnable then the bins, min and max arguments are guaranteed to be the same values as returned by getMin(), getMax() and getBins() methods.

The routine returns a two dimensional array where the first dimension has the following meaning:

  • [0] An array of data points (one entry per bin)
  • [1] An array of plus errors (one entry per bin)
  • [2] An array of minus errors (one entry per bin)
If the minus error is absent the errors are assumed to be symmetric, if the plus error is also absent the errors are assumed to be the square root of the data.

Parameters:
bin The number of bins requested
min The min of the range over which to bin
max The max of the range over which to bin
wantErrors If false indicates that the errors are not required and need not be calculated (most implementations will ignore this parameter)
hurry If true indicates the results should be provided as fast as possible, even if some approximation is needed (most implementations will ignore this parameter)
Returns:
An array representing the binned data and errors (see description above)

Definition at line 64 of file PlotDataSource.java.

00064                                                                                                 {
00065     return theData;
00066     }

void setBins int  i  )  [protected]
 

allows VariableDataSources to set nbins in each source

Parameters:
i - number of bins

Definition at line 171 of file PlotDataSource.java.

References PlotDataSource.nbins.

Referenced by VariableBinSource.VariableBinSource().

00171                                  {
00172     nbins = i;
00173     }

void setMax double  d  )  [protected]
 

allows VariableDataSources to set xmax in each source

Parameters:
d - xmax

Definition at line 187 of file PlotDataSource.java.

References PlotDataSource.xmax.

Referenced by VariableBinSource.VariableBinSource().

00187                                    {
00188     xmax = d;
00189     }

void setMin double  d  )  [protected]
 

allows VariableDataSources to set xmin in each source

Parameters:
d - xmin

Definition at line 179 of file PlotDataSource.java.

References PlotDataSource.xmin.

Referenced by VariableBinSource.VariableBinSource().

00179                                    {
00180     xmin = d;
00181     }

void setStyleDefault  ) 
 

set style attributes for this histogram as default

Definition at line 200 of file PlotDataSource.java.

References PlotDataSource.myStyle.

Referenced by PlotDataSource.PlotDataSource(), and VariableBinSource.VariableBinSource().

00200                                  {
00201     
00202     myStyle = new JASHist1DHistogramStyle(); 
00203     if (isRealData){ 
00204         myStyle.setErrorBarColor(Color.black); 
00205         myStyle.setLineColor(Color.black); 
00206         myStyle.setDataPointColor(Color.black); 
00207     }else{
00208         myStyle.setErrorBarColor(Color.red); 
00209         myStyle.setLineColor(Color.red); 
00210         myStyle.setDataPointColor(Color.red); 
00211     }
00212     myStyle.setShowHistogramBars(false);
00213     myStyle.setShowDataPoints(true);
00214     myStyle.setShowErrorBars(true);
00215         myStyle.setShowLinesBetweenPoints(false);
00216     myStyle.setDataPointStyle(JASHist1DHistogramStyle.SYMBOL_DOT);
00217     }

void setTheData double  td[][]  )  [protected]
 

allows VariableDataSources to set data in each source

Parameters:
td data array

Definition at line 163 of file PlotDataSource.java.

References PlotDataSource.theData.

Referenced by VariableBinSource.VariableBinSource().

00163                                             {
00164     theData = td;
00165     }


Member Data Documentation

boolean isRealData [private]
 

Definition at line 33 of file PlotDataSource.java.

Referenced by PlotDataSource.PlotDataSource().

JASHist1DHistogramStyle myStyle [private]
 

Definition at line 190 of file PlotDataSource.java.

Referenced by PlotDataSource.setStyleDefault().

int nbins [private]
 

Definition at line 31 of file PlotDataSource.java.

Referenced by PlotDataSource.PlotDataSource(), and PlotDataSource.setBins().

double [][] theData [private]
 

Definition at line 28 of file PlotDataSource.java.

Referenced by PlotDataSource.PlotDataSource(), and PlotDataSource.setTheData().

double xmax = 0 [private]
 

Definition at line 30 of file PlotDataSource.java.

Referenced by PlotDataSource.PlotDataSource(), and PlotDataSource.setMax().

double xmin = 0 [private]
 

Definition at line 29 of file PlotDataSource.java.

Referenced by PlotDataSource.PlotDataSource(), and PlotDataSource.setMin().


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007