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


Java XYDataItem.setY方法代码示例

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


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

示例1: 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

示例2: 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

示例3: testEquals

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    final XYDataItem i1 = new XYDataItem(1.0, 1.1);
    final XYDataItem i2 = new XYDataItem(1.0, 1.1);
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));

    i1.setY(new Double(9.9));
    assertFalse(i1.equals(i2));

    i2.setY(new Double(9.9));
    assertTrue(i1.equals(i2));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:XYDataItemTests.java

示例4: testEquals

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    XYDataItem i1 = new XYDataItem(1.0, 1.1);
    XYDataItem i2 = new XYDataItem(1.0, 1.1);
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));

    i1.setY(new Double(9.9));
    assertFalse(i1.equals(i2));

    i2.setY(new Double(9.9));
    assertTrue(i1.equals(i2));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:XYDataItemTests.java

示例5: setEnglishUnits

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
public void setEnglishUnits( boolean englishUnits ) {
    if ( englishUnits != _englishUnits ) {
        _englishUnits = englishUnits;
        
        // change labels and ranges
        if ( englishUnits ) {
            _rangeAxis.setLabel( GlaciersStrings.AXIS_ELA_ENGLISH );
            _rangeAxis.setRange( ELEVATION_RANGE_ENGLISH );
        }
        else {
            _rangeAxis.setLabel( GlaciersStrings.AXIS_ELA_METRIC );
            _rangeAxis.setRange( ELEVATION_RANGE_METRIC );
        }
        
        // 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,代码行数:28,代码来源:ELAVersusTimeChart.java

示例6: checkValidity

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
/**
 * Checks validity of XYDataItem. We do NOT allow positive or negative
 * infinity on x-axis, on the y-axis we allow them but replace them by NaN.
 * Validity means this is a value we should store, otherwise we can discard it.
 * @param item The item to check, may be changed.
 * @return True if valid, false otherwise.
 */	
private boolean checkValidity(XYDataItem item)
{
	if (Double.isInfinite(item.getX().doubleValue()) ||
		Double.isNaN(item.getX().doubleValue()))
		return false;
		
	if (Double.isInfinite(item.getY().doubleValue()))
		item.setY(Double.NaN);
	
	return true;		
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:19,代码来源:PrismXYSeries.java

示例7: testEquals

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {

    XYDataItem i1 = new XYDataItem(1.0, 1.1);
    XYDataItem i2 = new XYDataItem(1.0, 1.1);
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));

    i1.setY(new Double(9.9));
    assertFalse(i1.equals(i2));

    i2.setY(new Double(9.9));
    assertTrue(i1.equals(i2));

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:XYDataItemTests.java


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