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


Java XYDataItem.getYValue方法代码示例

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


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

示例1: computeRegressionData

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
private XYIntervalSeries computeRegressionData(double xStart, double xEnd) {
    if (scatterpointsDataset.getItemCount(0) > 1) {
        final double[] coefficients = Regression.getOLSRegression(scatterpointsDataset, 0);
        final Function2D curve = new LineFunction2D(coefficients[0], coefficients[1]);
        final XYSeries regressionData = DatasetUtilities.sampleFunction2DToSeries(curve, xStart, xEnd, 100, "regression line");
        final XYIntervalSeries xyIntervalRegression = new XYIntervalSeries(regressionData.getKey());
        for (int i = 0; i < regressionData.getItemCount(); i++) {
            XYDataItem item = regressionData.getDataItem(i);
            final double x = item.getXValue();
            final double y = item.getYValue();
            xyIntervalRegression.add(x, x, x, y, y, y);
        }
        return xyIntervalRegression;
    } else {
        Dialogs.showInformation("Unable to compute regression line.\n" +
                                        "At least 2 values are needed to compute regression coefficients.");
        return null;
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:ScatterPlotPanel.java

示例2: getValueAt

import org.jfree.data.xy.XYDataItem; //导入方法依赖的package包/类
@Override
public Double getValueAt(final Dataset dataset, final int index,
    final double tNow, NumberAxis rangeA)
{
  final XYSeriesCollection tsc = (XYSeriesCollection) dataset;
  final XYSeries series = tsc.getSeries(index);

  @SuppressWarnings("unchecked")
  final List<XYDataItem> items = series.getItems();

  // ok, get ready to interpolate the value
  Double previousY = null;
  Double nextY = null;
  Double previousX = null;
  Double nextX = null;

  // loop through the data
  for (final XYDataItem thisItem : items)
  {
    // does this class as a previous value?
    if (thisItem.getX().doubleValue() < tNow)
    {
      // ok, it's before use the previous
      previousY = thisItem.getYValue();
      previousX = thisItem.getXValue();
    }
    else
    {
      // ok, we've passed it. stop
      nextY = thisItem.getYValue();
      nextX = thisItem.getXValue();
      break;
    }
  }

  // have we found values?
  final Double interpolated;
  if (previousY != null && nextY != null)
  {
    // ok, interpolate the time (X)
    final double proportion = (tNow - previousX) / (nextX - previousX);

    // ok, now generate interpolate the value to use
    interpolated = previousY + proportion * (nextY - previousY);
  }
  else
  {
    interpolated = null;
  }

  return interpolated;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:53,代码来源:TimeBarPlot.java


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