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


Java LineFunction2D类代码示例

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


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

示例1: drawRegression

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

示例2: computeRegressionData

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

示例3: plotRel2dChartData

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

示例4: testSampleFunction2D

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

示例5: testSampleFunction2D

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

示例6: testSampleFunction2D

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

示例7: plotTrimRpmData

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

示例8: testConstructor

import org.jfree.data.function.LineFunction2D; //导入依赖的package包/类
/**
 * Some tests for the constructor.
 */
public void testConstructor() {
    LineFunction2D f = new LineFunction2D(1.0, 2.0);
    assertEquals(1.0, f.getIntercept(), EPSILON);
    assertEquals(2.0, f.getSlope(), EPSILON);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:LineFunction2DTests.java

示例9: testHashCode

import org.jfree.data.function.LineFunction2D; //导入依赖的package包/类
/**
 * Objects that are equal should have the same hash code otherwise FindBugs
 * will tell on us...
 */
public void testHashCode() {
    LineFunction2D f1 = new LineFunction2D(1.0, 2.0);
    LineFunction2D f2 = new LineFunction2D(1.0, 2.0);
    assertEquals(f1.hashCode(), f2.hashCode());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:LineFunction2DTests.java


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