本文整理汇总了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();
}
}
示例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() ) );
}
}
}
}
示例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));
}
示例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));
}
示例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() ) );
}
}
}
}
示例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;
}
示例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));
}