org.jfree.data.xy.XYSeries.updateByIndex()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(67)

本文整理了Java中org.jfree.data.xy.XYSeries.updateByIndex()方法的一些代码示例,展示了XYSeries.updateByIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XYSeries.updateByIndex()方法的具体详情如下:
包路径:org.jfree.data.xy.XYSeries
类名称:XYSeries
方法名:updateByIndex

XYSeries.updateByIndex介绍

[英]Updates the value of an item in the series and sends a SeriesChangeEvent to all registered listeners.
[中]更新序列中某个项的值,并向所有注册的侦听器发送SeriesChangeEvent。

代码示例

代码示例来源:origin: jfree/jfreechart

/**
 * Updates an item in the series.
 *
 * @param x  the x-value ({@code null} not permitted).
 * @param y  the y-value ({@code null} permitted).
 *
 * @throws SeriesException if there is no existing item with the specified
 *         x-value.
 */
public void update(Number x, Number y) {
  int index = indexOf(x);
  if (index < 0) {
    throw new SeriesException("No observation for x = " + x);
  }
  updateByIndex(index, y);
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Updates an item in the series.
 *
 * @param x  the x-value (<code>null</code> not permitted).
 * @param y  the y-value (<code>null</code> permitted).
 *
 * @throws SeriesException if there is no existing item with the specified
 *         x-value.
 */
public void update(Number x, Number y) {
  int index = indexOf(x);
  if (index < 0) {
    throw new SeriesException("No observation for x = " + x);
  }
  else {
    updateByIndex(index, y);
  }
}

代码示例来源:origin: stackoverflow.com

XYSeriesCollection data = new XYSeriesCollection();
XYSeries series = new XYSeries("Test");
data.addSeries(series);
series.add(1, 42);
System.out.println(data.getSeries(0).getY(0));
XYSeriesCollection dataCopy = (XYSeriesCollection) data.clone();
series.updateByIndex(0, 21.0);
System.out.println(data.getSeries(0).getY(0));
System.out.println(dataCopy.getSeries(0).getY(0));

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing

private void updateData0(int row0, int row1, int offset) {
  ChartModel model = this.model;
  XYSeriesCollection series = getCategory();
  int col0 = 0;
  int col1 = series.getSeriesCount() - 1;
  for (int col = col0; col <= col1; col++) {
    XYSeries xyseries = series.getSeries(col);
    for (int row = row0; row <= row1; row++) {
      double value = model.getValueAt(row + offset, col);
      xyseries.updateByIndex(row, value);
    }
  }
}

相关文章