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


Java Function2D类代码示例

本文整理汇总了Java中org.jfree.data.function.Function2D的典型用法代码示例。如果您正苦于以下问题:Java Function2D类的具体用法?Java Function2D怎么用?Java Function2D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sampleFunction2DToSeries

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYSeries} by sampling the specified function over a
 * fixed range.
 *
 * @param f  the function (<code>null</code> not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be &gt; 1).
 * @param seriesKey  the key to give the resulting series
 *                   (<code>null</code> not permitted).
 *
 * @return A series.
 *
 * @since 1.0.13
 */
public static XYSeries sampleFunction2DToSeries(Function2D f,
        double start, double end, int samples, Comparable seriesKey) {

    ParamChecks.nullNotPermitted(f, "f");
    ParamChecks.nullNotPermitted(seriesKey, "seriesKey");
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesKey);
    double step = (end - start) / (samples - 1);
    for (int i = 0; i < samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    return series;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:36,代码来源:DatasetUtilities.java

示例2: sampleFunction2DToSeries

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYSeries} by sampling the specified function over a
 * fixed range.
 *
 * @param f  the function ({@code null} not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be &gt; 1).
 * @param seriesKey  the key to give the resulting series
 *                   ({@code null} not permitted).
 *
 * @return A series.
 *
 * @since 1.0.13
 */
public static XYSeries sampleFunction2DToSeries(Function2D f,
        double start, double end, int samples, Comparable seriesKey) {

    Args.nullNotPermitted(f, "f");
    Args.nullNotPermitted(seriesKey, "seriesKey");
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesKey);
    double step = (end - start) / (samples - 1);
    for (int i = 0; i < samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    return series;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:36,代码来源:DatasetUtils.java

示例3: createXYNDDataset

import org.jfree.data.function.Function2D; //导入依赖的package包/类
private XYDataset createXYNDDataset(){
 	String[][] x= new String[xyLength][no_series];
	double[][] y= new double[xyLength][no_series];


	for (int index=0; index<no_series; index++)
		for (int i = 0; i < xyLength; i++)
			x[i][index] = indepValues[i][index];

	for (int index=0; index<no_series; index++)
		for (int i = 0; i < xyLength; i++)
			y[i][index] = Double.parseDouble(depValues[i][index]);

	double mean = Double.parseDouble(x[0][0]) ;
	double stdDev = y[0][0];
	Function2D normal = new NormalDistributionFunction2D(mean, stdDev);
	XYDataset dataset = DatasetUtilities.sampleFunction2D(normal, -10.0,
              10.0, 100, "Normal");

      return dataset;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:22,代码来源:ChartGenerator_JTable.java

示例4: sampleFunction2D

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYDataset} by sampling the specified function over a
 * fixed range.
 *
 * @param f  the function (<code>null</code> not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be > 1).
 * @param seriesKey  the key to give the resulting series
 *                   (<code>null</code> not permitted).
 *
 * @return A dataset.
 */
public static XYDataset sampleFunction2D(Function2D f, double start,
        double end, int samples, Comparable seriesKey) {

    if (f == null) {
        throw new IllegalArgumentException("Null 'f' argument.");
    }
    if (seriesKey == null) {
        throw new IllegalArgumentException("Null 'seriesKey' argument.");
    }
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesKey);
    double step = (end - start) / (samples - 1);
    for (int i = 0; i < samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    XYSeriesCollection collection = new XYSeriesCollection(series);
    return collection;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:39,代码来源:DatasetUtilities.java

示例5: sampleFunction2DToSeries

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYSeries} by sampling the specified function over a
 * fixed range.
 *
 * @param f  the function (<code>null</code> not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be > 1).
 * @param seriesKey  the key to give the resulting series
 *                   (<code>null</code> not permitted).
 *
 * @return A series.
 *
 * @since 1.0.13
 */
public static XYSeries sampleFunction2DToSeries(Function2D f,
        double start, double end, int samples, Comparable seriesKey) {

    if (f == null) {
        throw new IllegalArgumentException("Null 'f' argument.");
    }
    if (seriesKey == null) {
        throw new IllegalArgumentException("Null 'seriesKey' argument.");
    }
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesKey);
    double step = (end - start) / (samples - 1);
    for (int i = 0; i < samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    return series;
}
 
开发者ID:lulab,项目名称:PI,代码行数:40,代码来源:DatasetUtilities.java

示例6: drawRegression

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/** Handles drawing of the regression line */
private void drawRegression(XYDataset scatterPlotData, XYPlot xyplot) {
	// compute regression function
	double regressionParams[] = Regression.getOLSRegression(
			scatterPlotData, 0);
	Function2D regression = new LineFunction2D(regressionParams[0],
			regressionParams[1]);

	// sample function values
	double lowerBound = xyplot.getDomainAxis().getLowerBound();
	double upperBound = xyplot.getDomainAxis().getUpperBound();
	XYDataset regressionDataset = DatasetUtilities.sampleFunction2D(
			regression, lowerBound, upperBound,
			REGRESSION_LINE_SAMPLE_COUNT, "Fitted Regression Line");
	xyplot.setDataset(1, regressionDataset);

	// render regression line into plot
	XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true,
			false);
	xyplot.setRenderer(1, renderer);
	renderer.setSeriesPaint(0, REGRESSION_LINE_COLOR);
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:23,代码来源:ScatterPlotCreator.java

示例7: sampleFunction2DToSeries

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYSeries} by sampling the specified function over a
 * fixed range.
 *
 * @param f  the function (<code>null</code> not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be > 1).
 * @param seriesKey  the key to give the resulting series
 *                   (<code>null</code> not permitted).
 *
 * @return A series.
 *
 * @since 1.0.13
 */
public static XYSeries sampleFunction2DToSeries(Function2D f,
        double start, double end, int samples, Comparable seriesKey) {

    ParamChecks.nullNotPermitted(f, "f");
    ParamChecks.nullNotPermitted(seriesKey, "seriesKey");
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesKey);
    double step = (end - start) / (samples - 1);
    for (int i = 0; i < samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    return series;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:36,代码来源:DatasetUtilities.java

示例8: computeRegressionData

import org.jfree.data.function.Function2D; //导入依赖的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

示例9: plotRel2dChartData

import org.jfree.data.function.Function2D; //导入依赖的package包/类
protected boolean plotRel2dChartData(String xAxisName, ArrayList<Double> xarr, String yAxisName, ArrayList<Double> yarr) {
    clear2dChartData();
    if (setXYSeries(runData, xarr, yarr)) {
        double[] ols = Regression.getOLSRegression(chartPanel.getChart().getXYPlot().getDataset(1), 0);
        Function2D curve = new LineFunction2D(ols[0], ols[1]);
        trendData.clear();
        trendData.add(runData.getMinX(), curve.getValue(runData.getMinX()));
        trendData.add(runData.getMaxX(), curve.getValue(runData.getMaxX()));
        double paddingX = runData.getMaxX() * 0.05;
        double paddingY = runData.getMaxY() * 0.05;
        XYPlot plot = chartPanel.getChart().getXYPlot();
        plot.getDomainAxis(0).setRange(runData.getMinX() - paddingX, runData.getMaxX() + paddingX);
        plot.getRangeAxis(0).setRange(runData.getMinY() - paddingY, runData.getMaxY() + paddingY);
        plot.getDomainAxis(0).setLabel(xAxisName);
        plot.getRangeAxis(0).setLabel(yAxisName);
        plot.getRenderer(0).setSeriesVisible(0, true);
        return true;
    }
    return false;
}
 
开发者ID:vimsh,项目名称:mafscaling,代码行数:21,代码来源:ACompCalc.java

示例10: sampleFunction2D

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYDataset} by sampling the specified function over a fixed range.
 *
 * @param f  the function (<code>null</code> not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be > 1).
 * @param seriesName  the name to give the resulting series (<code>null</code> not permitted).
 *
 * @return A dataset.
 */
public static XYDataset sampleFunction2D(Function2D f, 
                                         double start, 
                                         double end, 
                                         int samples,
                                         String seriesName) {

    if (f == null) {
        throw new IllegalArgumentException("Null 'f' argument.");   
    }
    if (seriesName == null) {
        throw new IllegalArgumentException("Null 'seriesName' argument.");   
    }
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesName);
    double step = (end - start) / samples;
    for (int i = 0; i <= samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    XYSeriesCollection collection = new XYSeriesCollection(series);
    return collection;

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

示例11: sampleFunction2D

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Creates an {@link XYDataset} by sampling the specified function over a 
 * fixed range.
 *
 * @param f  the function (<code>null</code> not permitted).
 * @param start  the start value for the range.
 * @param end  the end value for the range.
 * @param samples  the number of sample points (must be > 1).
 * @param seriesKey  the key to give the resulting series 
 *                   (<code>null</code> not permitted).
 *
 * @return A dataset.
 */
public static XYDataset sampleFunction2D(Function2D f, 
                                         double start, 
                                         double end, 
                                         int samples,
                                         Comparable seriesKey) {

    if (f == null) {
        throw new IllegalArgumentException("Null 'f' argument.");   
    }
    if (seriesKey == null) {
        throw new IllegalArgumentException("Null 'seriesKey' argument.");
    }
    if (start >= end) {
        throw new IllegalArgumentException("Requires 'start' < 'end'.");
    }
    if (samples < 2) {
        throw new IllegalArgumentException("Requires 'samples' > 1");
    }

    XYSeries series = new XYSeries(seriesKey);
    double step = (end - start) / samples;
    for (int i = 0; i <= samples; i++) {
        double x = start + (step * i);
        series.add(x, f.getValue(x));
    }
    XYSeriesCollection collection = new XYSeriesCollection(series);
    return collection;

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

示例12: testSampleFunction2D

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Some checks for the sampleFunction2D() method.
 */
@Test
public void testSampleFunction2D() {
    Function2D f = new LineFunction2D(0, 1);
    XYDataset dataset = DatasetUtilities.sampleFunction2D(f, 0.0, 1.0, 2,
            "S1");
    assertEquals(1, dataset.getSeriesCount());
    assertEquals("S1", dataset.getSeriesKey(0));
    assertEquals(2, dataset.getItemCount(0));
    assertEquals(0.0, dataset.getXValue(0, 0), EPSILON);
    assertEquals(0.0, dataset.getYValue(0, 0), EPSILON);
    assertEquals(1.0, dataset.getXValue(0, 1), EPSILON);
    assertEquals(1.0, dataset.getYValue(0, 1), EPSILON);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:17,代码来源:DatasetUtilitiesTest.java

示例13: testSampleFunction2D

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Some checks for the sampleFunction2D() method.
 */
@Test
public void testSampleFunction2D() {
    Function2D f = new LineFunction2D(0, 1);
    XYDataset dataset = DatasetUtils.sampleFunction2D(f, 0.0, 1.0, 2,
            "S1");
    assertEquals(1, dataset.getSeriesCount());
    assertEquals("S1", dataset.getSeriesKey(0));
    assertEquals(2, dataset.getItemCount(0));
    assertEquals(0.0, dataset.getXValue(0, 0), EPSILON);
    assertEquals(0.0, dataset.getYValue(0, 0), EPSILON);
    assertEquals(1.0, dataset.getXValue(0, 1), EPSILON);
    assertEquals(1.0, dataset.getYValue(0, 1), EPSILON);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:17,代码来源:DatasetUtilsTest.java

示例14: testSampleFunction2D

import org.jfree.data.function.Function2D; //导入依赖的package包/类
/**
 * Some checks for the sampleFunction2D() method.
 */
public void testSampleFunction2D() {
    Function2D f = new LineFunction2D(0, 1);
    XYDataset dataset = DatasetUtilities.sampleFunction2D(f, 0.0, 1.0, 2,
            "S1");
    assertEquals(1, dataset.getSeriesCount());
    assertEquals("S1", dataset.getSeriesKey(0));
    assertEquals(2, dataset.getItemCount(0));
    assertEquals(0.0, dataset.getXValue(0, 0), EPSILON);
    assertEquals(0.0, dataset.getYValue(0, 0), EPSILON);
    assertEquals(1.0, dataset.getXValue(0, 1), EPSILON);
    assertEquals(1.0, dataset.getYValue(0, 1), EPSILON);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:DatasetUtilitiesTests.java

示例15: plotTrimRpmData

import org.jfree.data.function.Function2D; //导入依赖的package包/类
private boolean plotTrimRpmData() {
    if (setXYSeries(runData, rpmArray, trimArray)) {
        double[] ols = Regression.getOLSRegression(mafChartPanel.getChartPanel().getChart().getXYPlot().getDataset(1), 0);
        Function2D curve = new LineFunction2D(ols[0], ols[1]);
        currMafData.clear();
        currMafData.add(runData.getMinX(), curve.getValue(runData.getMinX()));
        currMafData.add(runData.getMaxX(), curve.getValue(runData.getMaxX()));
        return true;
    }
    return false;
}
 
开发者ID:vimsh,项目名称:mafscaling,代码行数:12,代码来源:ClosedLoop.java


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