Java Code Examples for org.jfree.data.xy.XYSeries#getKey()
The following examples show how to use
org.jfree.data.xy.XYSeries#getKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScatterPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
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; } }
Example 2
Source File: XYChartExpression.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected TableXYDataset convertToTable( final XYSeriesCollection xyDataset ) { final ExtCategoryTableXYDataset tableXYDataset = new ExtCategoryTableXYDataset(); final int count = xyDataset.getSeriesCount(); for ( int i = 0; i < count; i++ ) { final XYSeries timeSeries = xyDataset.getSeries( i ); final Comparable key = timeSeries.getKey(); final int itemCount = timeSeries.getItemCount(); for ( int ic = 0; ic < itemCount; ic++ ) { final XYDataItem seriesDataItem = timeSeries.getDataItem( ic ); tableXYDataset.add( seriesDataItem.getX(), seriesDataItem.getY(), key, false ); } } return tableXYDataset; }