当前位置: 首页>>代码示例>>Java>>正文


Java XYDataItem类代码示例

本文整理汇总了Java中org.jfree.data.xy.XYDataItem的典型用法代码示例。如果您正苦于以下问题:Java XYDataItem类的具体用法?Java XYDataItem怎么用?Java XYDataItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XYDataItem类属于org.jfree.data.xy包,在下文中一共展示了XYDataItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAddOrUpdate

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
/**
 * Some checks for the addOrUpdate() method.
 */
public void testAddOrUpdate() {
    XYSeries series = new XYSeries("S1");
    XYDataItem old = series.addOrUpdate(new Long(1), new Long(2));
    assertTrue(old == null);
    assertEquals(1, series.getItemCount());
    assertEquals(new Long(2), series.getY(0));
    
    old = series.addOrUpdate(new Long(2), new Long(3));
    assertTrue(old == null);
    assertEquals(2, series.getItemCount());
    assertEquals(new Long(3), series.getY(1));

    old = series.addOrUpdate(new Long(1), new Long(99));
    assertEquals(new XYDataItem(new Long(1), new Long(2)), old);
    assertEquals(2, series.getItemCount());
    assertEquals(new Long(99), series.getY(0));
    assertEquals(new Long(3), series.getY(1));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:XYSeriesTests.java

示例2: DatasetSpectrum

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
/**
 * Inits
 * @param fftBinSizeHz
 * @param freqStartMHz
 * @param freqStopMHz
 * @param spectrumInitPower 
 * @param peaks enable calculation of peaks
 * @param peakFallThreshold
 * @param peakFalloutMillis
 */
public DatasetSpectrum(float fftBinSizeHz, int freqStartMHz, int freqStopMHz, float spectrumInitPower)
{
	this.fftBinSizeHz = fftBinSizeHz;
	this.freqStartMHz = freqStartMHz;
	this.freqStartHz = freqStartMHz * 1000000l;
	this.freqStopMHz = freqStopMHz;
	this.spectrumInitPower = spectrumInitPower;
	int datapoints = (int) (Math.ceil(freqStopMHz - freqStartMHz) * 1000000d / fftBinSizeHz);
	spectrum = new float[datapoints];
	Arrays.fill(spectrum, spectrumInitPower);

	for (int j = 0; j < 5; j++) {
		ArrayList<XYDataItem> list	= new ArrayList<>();
		for (int i = 0; i < datapoints; i++) {
			double freq = (freqStartHz + fftBinSizeHz * i) / 1000000;
			list.add(new XYDataItem(freq, 0));
		}
		cachedDataItems.add(list);
	}
}
 
开发者ID:pavsa,项目名称:hackrf-spectrum-analyzer,代码行数:31,代码来源:DatasetSpectrum.java

示例3: fillToXYSeriesPriv

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
protected void fillToXYSeriesPriv(XYSeries series, float[] spectrum){
	series.clear();
	/**
	 * caching decreases GC usage
	 */
	boolean useCached	= false;
	if (!useCached){
		for (int i = 0; i < spectrum.length; i++)
		{
			double freq = (freqStartHz + fftBinSizeHz * i) / 1000000;
			series.add(freq, spectrum[i]);
		}
	}
	else{
		ArrayList<XYDataItem> items	= cachedDataItems.get(cachedDataItemsIndex);
		for (int i = 0; i < spectrum.length; i++)
		{
			XYDataItem item	= items.get(i);
			item.setY(spectrum[i]);
			series.add(item);
		}
		cachedDataItemsIndex	= (cachedDataItemsIndex+1)%cachedDataItems.size();
	}
}
 
开发者ID:pavsa,项目名称:hackrf-spectrum-analyzer,代码行数:25,代码来源:DatasetSpectrum.java

示例4: GenerateModel

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
public void GenerateModel() throws IOException {

        XYPointCollection points = new XYPointCollection();
        XYSeries series = new XYSeries("Peptide ions");
        XYSeriesCollection xySeriesCollection = new XYSeriesCollection();

        for (PepIonID pepA : LCMSA.GetPepIonList().values()) {
            if (LCMSB.GetPepIonList().containsKey(pepA.GetKey())) {
                PepIonID pepB = LCMSB.GetPepIonList().get(pepA.GetKey());
                points.AddPoint(pepA.GetRT(), pepB.GetRT());
                series.add(new XYDataItem(pepA.GetRT(), pepB.GetRT()));
            }
        }
        regression = new PiecewiseRegression(parameter.MaxCurveRTRange, parameter.MaxCurveRTRange);
        regression.SetData(points);
        float R2 = regression.GetR2();
        Logger.getRootLogger().info("Retention time prediction model:(" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName) + "-" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName) + ")..R2=" + R2 + "(No. of commonly identified peptide ions=" + points.PointCount() + ")");

        GenerateRTMapPNG(xySeriesCollection, series, R2);
    }
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:21,代码来源:RTAlignedPepIonMapping.java

示例5: setEnglishUnits

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
public void setEnglishUnits( boolean englishUnits ) {
    if ( englishUnits != _englishUnits ) {
        _englishUnits = englishUnits;
        
        // change labels and ranges
        updateYAxis();
        
        // convert existing data to new units
        int itemCount = _series.getItemCount();
        for ( int i = 0; i < itemCount; i++ ) {
            XYDataItem item = (XYDataItem) _series.getDataItem( i );
            if ( _englishUnits ) {
                item.setY( UnitsConverter.metersToFeet( item.getY().doubleValue() ) );
            }
            else {
                item.setY( UnitsConverter.feetToMeters( item.getY().doubleValue() ) );
            }
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:GlacierLengthVersusTimeChart.java

示例6: doBestFit

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
private void doBestFit() {
    XYSeries dataset = betaChart.getMeanDataSet();
    final ArrayList dataCopy = new ArrayList();
    for ( int i = 0; i < dataset.getItemCount(); i++ ) {
        XYDataItem x = dataset.getDataItem( i );
        dataCopy.add( new Point2D.Double( x.getX().doubleValue(), x.getY().doubleValue() ) );
    }
    LinearRegression.Result result = LinearRegression.main( new LinearRegression.Input() {
        public boolean isEmpty() {
            return dataCopy.isEmpty();
        }

        public Point2D readPoint() {
            return (Point2D) dataCopy.remove( 0 );
        }
    } );
    double x0 = getMinX( dataset );
    double x1 = getMaxX( dataset );
    Point2D lhs = new Point2D.Double( x0, result.evaluate( x0 ) );
    Point2D rhs = new Point2D.Double( x1, result.evaluate( x1 ) );

    betaChart.showLine( lhs, rhs );
    DecimalFormat decimalFormat = new DecimalFormat( "0.00" );

    betaText.setText( "Critical Exponent = " + decimalFormat.format( result.getSlope() ) );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:PlotBeta240.java

示例7: updateLines

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
private void updateLines() {
    MyMultiMap multiMap = new MyMultiMap();
    for ( int i = 0; i < meanSeries.getItemCount(); i++ ) {
        XYDataItem item = meanSeries.getDataItem( i );
        multiMap.add( item.getX(), item.getY() );
    }
    Set keySet = multiMap.keySet();
    ArrayList lits = new ArrayList( keySet );
    Collections.sort( lits, new Comparator() {
        public int compare( Object o1, Object o2 ) {
            Number a = (Number) o1;
            Number b = (Number) o2;
            return Double.compare( a.doubleValue(), b.doubleValue() );
        }
    } );
    lineSeries.clear();
    for ( int i = 0; i < lits.size(); i++ ) {
        Number key = (Number) lits.get( i );
        int numValues = multiMap.numValues( key );
        if ( numValues > 14 ) {
            lineSeries.add( key.doubleValue(), average( multiMap.getList( key ) ) );
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:OrderParameterVsRandomnessChart.java

示例8: add

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
/**
 * This method is the one that implements some different
 * aspects to the XYSeries class.
 */
public void add(XYDataItem item, boolean notify) 
{
	if (checkValidity(item))
	{	
		if (checkDataItem(item))
		{	
			/* Check in discarded dataset. */
			if (discardedItems.indexOf(item.getX()) >= 0)
			{					
				throw new SeriesException("X-value already exists.");
			}
			super.add(item, notify);			
		}
		else
		{
			/* Check in main dataset. */
			if (super.indexOf(item.getX()) >= 0)
				throw new SeriesException("X-value already exists.");
			
			discardedItems.add(item);
		}
	}
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:28,代码来源:PrismXYSeries.java

示例9: updateByIndex

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
@Override
public void updateByIndex(int index, Number y) {
	XYDataItem existing = getDataItem(index);
	XYDataItem item = new XYDataItem(existing.getX(), y);
	
	if (checkValidity(item))
	{
		if (checkDataItem(item))
			super.update(index, y);
		else
		{
			super.remove(index);
			discardedItems.add(item);
		}				
	}
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:17,代码来源:PrismXYSeries.java

示例10: getItems

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
@Override
public List getItems() 
{
	List items = new LinkedList();
	
	for (int i = 0; i < getItemCount(); i++)
	{
		XYDataItem item = super.getDataItem(i);
		
		if (this.logYAxis && item.getY().doubleValue() <= 0)
			items.add(new XYDataItem(item.getX(), Double.NaN));
		else
			items.add(new XYDataItem(item.getX(), item.getY()));
	}
	
	return items;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:18,代码来源:PrismXYSeries.java

示例11: remove

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
@Override
public XYDataItem remove(Number x) 
{
	XYDataItem result = null;
	
	int indexD = discardedItems.indexOf(x);
	int indexS = super.indexOf(x);
	
	/* If in discarded items, then remove and return this. */ 
	if (indexD >= 0)
	{
		result = discardedItems.remove(indexD);			
	}
	
	/* If in main items, then remove and return this. (Should not be both in discarded and main items) */ 
	if (indexS >= 0)
	{
		result = super.remove(indexS);			
	}
	
	return result;
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:23,代码来源:PrismXYSeries.java

示例12: calculateAvg

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
/**
 * Calculate avg.
 */
// calculating an avg value that is used for identifying the top series
void calculateAvg() {
  long sum = 0;
  int count = 1;

  synchronized (stats) {
    boolean useMovingAvg = getMovingAvgFrame() > 0 && getMovingAvgFrame() < stats.size();

    for (ListIterator<XYDataItem> it = stats.listIterator(); it.hasNext();) {
      XYDataItem xy = it.next();
      sum += xy.getY().longValue();

      if (useMovingAvg && count % getMovingAvgFrame() == 0 || !it.hasNext()) {
        double thisAvg = (double) sum / count;
        if (thisAvg > avg) {
          avg = thisAvg;
        }
        sum = 0;
        count = 1;
      } else {
        count++;
      }
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:29,代码来源:MultipleSeriesProvider.java

示例13: populate

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
@Override
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection,
    HttpServletRequest request) {

  String seriesParam = ServletRequestUtils.getStringParameter(request, "sp", null);
  for (int i = 0; i < statNames.size(); i++) {
    String statName = statNames.get(i);
    if (seriesParam != null) {
      statName = MessageFormat.format(statName, seriesParam);
    }
    List<XYDataItem> stats = statsCollection.getStats(statName);
    if (stats != null) {
      String series =
          ServletRequestUtils.getStringParameter(request, "s" + (i + 1) + "l", "series" + i);
      dataset.addSeries(toSeries(series, stats));
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:StandardSeriesProvider.java

示例14: populate

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
@Override
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection,
    HttpServletRequest request) {

  // get Connector name from the request
  String connectorName = ServletRequestUtils.getStringParameter(request, "cn", null);

  // type of statistic to be displayed
  String statType = ServletRequestUtils.getStringParameter(request, "st", null);

  // Series legend
  String series1Legend = ServletRequestUtils.getStringParameter(request, "sl", "");

  if (connectorName != null && statType != null) {
    List<XYDataItem> stats =
        statsCollection.getStats("stat.connector." + connectorName + "." + statType);
    if (stats != null) {
      dataset.addSeries(toSeries(series1Legend, stats));
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:22,代码来源:ConnectorSeriesProvider.java

示例15: buildAbsoluteStats

import org.jfree.data.xy.XYDataItem; //导入依赖的package包/类
/**
 * Builds the absolute stats.
 *
 * @param name the name
 * @param value the value
 * @param time the time
 * @throws InterruptedException the interrupted exception
 */
protected void buildAbsoluteStats(String name, long value, long time)
    throws InterruptedException {

  List<XYDataItem> stats = statsCollection.getStats(name);
  if (stats == null) {
    statsCollection.newStats(name, maxSeries);
  } else {
    XYDataItem data = new XYDataItem(time, value);
    statsCollection.lockForUpdate();
    try {
      stats.add(data);
      houseKeepStats(stats);
    } finally {
      statsCollection.releaseLock();
    }
    if (listeners != null) {
      StatsCollectionEvent event = new StatsCollectionEvent(name, data);
      for (StatsCollectionListener listener : listeners) {
        if (listener.isEnabled()) {
          listener.statsCollected(event);
        }
      }
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:34,代码来源:AbstractStatsCollectorBean.java


注:本文中的org.jfree.data.xy.XYDataItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。