org.jfree.data.xy.IntervalXYDelegate Java Examples

The following examples show how to use org.jfree.data.xy.IntervalXYDelegate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtendedIsotopePatternDataSet.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * @param pattern ExtendedIsotopePattern to generate the dataset from
 * @param minIntensity minimum intensity (0.0-1.0) threshold for color differentiation
 * @param width Width of the datapoints to be displayed. Used for merging the peaks.
 */
public ExtendedIsotopePatternDataSet(ExtendedIsotopePattern pattern, double minIntensity,
    double width) {
  // super(pattern.getDescription(), pattern.getDataPoints());
  this.pattern = pattern;
  this.setMinIntensity(minIntensity);
  above = new XYSeries("Above minimum intensity");
  below = new XYSeries("Below minimum intensity");
  descrBelow = new ArrayList<String>();
  descrAbove = new ArrayList<String>();

  dp = pattern.getDataPoints();
  assignment = new Assignment[dp.length];
  for (int i = 0; i < assignment.length; i++)
    assignment[i] = new Assignment();

  for (int i = 0; i < dp.length; i++) {
    if (dp[i].getIntensity() < minIntensity) {
      assignment[i].ab = AB.BELOW;
      assignment[i].id = i;
      below.add(dp[i].getMZ(), dp[i].getIntensity());
      descrBelow.add(pattern.getIsotopeComposition(i));
    } else {
      assignment[i].ab = AB.ABOVE;
      assignment[i].id = i;
      above.add(dp[i].getMZ(), dp[i].getIntensity());
      descrAbove.add(pattern.getIsotopeComposition(i));
    }
  }

  this.intervalDelegate = new IntervalXYDelegate(this);
  this.intervalDelegate.setFixedIntervalWidth(width);
  super.addSeries(above);
  super.addSeries(below);
}
 
Example #2
Source File: ExtendedIsotopePatternDataSet.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * @param pattern ExtendedIsotopePattern to generate the dataset from
 * @param minIntensity minimum intensity (0.0-1.0) threshold for color differentiation
 * @param width Width of the datapoints to be displayed. Used for merging the peaks.
 */
public ExtendedIsotopePatternDataSet(ExtendedIsotopePattern pattern, double minIntensity,
    double width) {
  // super(pattern.getDescription(), pattern.getDataPoints());
  this.pattern = pattern;
  this.setMinIntensity(minIntensity);
  above = new XYSeries("Above minimum intensity");
  below = new XYSeries("Below minimum intensity");
  descrBelow = new ArrayList<String>();
  descrAbove = new ArrayList<String>();

  dp = pattern.getDataPoints();
  assignment = new Assignment[dp.length];
  for (int i = 0; i < assignment.length; i++)
    assignment[i] = new Assignment();

  for (int i = 0; i < dp.length; i++) {
    if (dp[i].getIntensity() < minIntensity) {
      assignment[i].ab = AB.BELOW;
      assignment[i].id = i;
      below.add(dp[i].getMZ(), dp[i].getIntensity());
      descrBelow.add(pattern.getIsotopeComposition(i));
    } else {
      assignment[i].ab = AB.ABOVE;
      assignment[i].id = i;
      above.add(dp[i].getMZ(), dp[i].getIntensity());
      descrAbove.add(pattern.getIsotopeComposition(i));
    }
  }

  this.intervalDelegate = new IntervalXYDelegate(this);
  this.intervalDelegate.setFixedIntervalWidth(width);
  super.addSeries(above);
  super.addSeries(below);
}
 
Example #3
Source File: IntervalXYDelegateTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
   XYSeries s1 = new XYSeries("Series");
   s1.add(1.2, 3.4);
   XYSeriesCollection c1 = new XYSeriesCollection();
   c1.addSeries(s1);
   IntervalXYDelegate d1 = new IntervalXYDelegate(c1);

   XYSeries s2 = new XYSeries("Series");
   XYSeriesCollection c2 = new XYSeriesCollection();
   s2.add(1.2, 3.4);
   c2.addSeries(s2);
   IntervalXYDelegate d2 = new IntervalXYDelegate(c2);

   assertTrue(d1.equals(d2));
   assertTrue(d2.equals(d1));

   d1.setAutoWidth(false);
   assertFalse(d1.equals(d2));
   d2.setAutoWidth(false);
   assertTrue(d1.equals(d2));

   d1.setIntervalPositionFactor(0.123);
   assertFalse(d1.equals(d2));
   d2.setIntervalPositionFactor(0.123);
   assertTrue(d1.equals(d2));

   d1.setFixedIntervalWidth(1.23);
   assertFalse(d1.equals(d2));
   d2.setFixedIntervalWidth(1.23);
   assertTrue(d1.equals(d2));
}
 
Example #4
Source File: IntervalXYDelegateTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
   XYSeries s1 = new XYSeries("Series");
   s1.add(1.2, 3.4);
   XYSeriesCollection c1 = new XYSeriesCollection();
   c1.addSeries(s1);
   IntervalXYDelegate d1 = new IntervalXYDelegate(c1);

   XYSeries s2 = new XYSeries("Series");
   XYSeriesCollection c2 = new XYSeriesCollection();
   s2.add(1.2, 3.4);
   c2.addSeries(s2);
   IntervalXYDelegate d2 = new IntervalXYDelegate(c2);
   
   assertTrue(d1.equals(d2));
   assertTrue(d2.equals(d1));
   
   d1.setAutoWidth(false);
   assertFalse(d1.equals(d2));
   d2.setAutoWidth(false);
   assertTrue(d1.equals(d2));
   
   d1.setIntervalPositionFactor(0.123);
   assertFalse(d1.equals(d2));
   d2.setIntervalPositionFactor(0.123);
   assertTrue(d1.equals(d2));
  
   d1.setFixedIntervalWidth(1.23);
   assertFalse(d1.equals(d2));
   d2.setFixedIntervalWidth(1.23);
   assertTrue(d1.equals(d2));
}
 
Example #5
Source File: ExtCategoryTableXYDataset.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Creates a new empty CategoryTableXYDataset.
 */
public ExtCategoryTableXYDataset() {
  this.values = new DefaultKeyedValues2D( true );
  this.intervalDelegate = new IntervalXYDelegate( this );
  addChangeListener( this.intervalDelegate );
}