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


Java TextTitle.setFrame方法代码示例

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


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

示例1: setPlotMessage

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private void setPlotMessage(String messageText) {
    chart.getXYPlot().clearAnnotations();
    TextTitle tt = new TextTitle(messageText);
    tt.setTextAlignment(HorizontalAlignment.RIGHT);
    tt.setFont(chart.getLegend().getItemFont());
    tt.setBackgroundPaint(new Color(200, 200, 255, 50));
    tt.setFrame(new BlockBorder(Color.white));
    tt.setPosition(RectangleEdge.BOTTOM);
    XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER);
    chart.getXYPlot().addAnnotation(message);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:12,代码来源:SpectrumTopComponent.java

示例2: computeCoefficientOfDetermination

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private void computeCoefficientOfDetermination() {
    int numberOfItems = scatterpointsDataset.getSeries(0).getItemCount();
    double arithmeticMeanOfX = 0;  //arithmetic mean of X
    double arithmeticMeanOfY = 0;  //arithmetic mean of Y
    double varX = 0;    //variance of X
    double varY = 0;    //variance of Y
    double coVarXY = 0;  //covariance of X and Y;
    //compute arithmetic means
    for (int i = 0; i < numberOfItems; i++) {
        arithmeticMeanOfX += scatterpointsDataset.getXValue(0, i);
        arithmeticMeanOfY += scatterpointsDataset.getYValue(0, i);
    }
    arithmeticMeanOfX /= numberOfItems;
    arithmeticMeanOfY /= numberOfItems;
    //compute variances and covariance
    for (int i = 0; i < numberOfItems; i++) {
        varX += Math.pow(scatterpointsDataset.getXValue(0, i) - arithmeticMeanOfX, 2);
        varY += Math.pow(scatterpointsDataset.getYValue(0, i) - arithmeticMeanOfY, 2);
        coVarXY += (scatterpointsDataset.getXValue(0, i) - arithmeticMeanOfX) * (scatterpointsDataset.getYValue(0,
                                                                                                                i) -
                arithmeticMeanOfY);
    }
    //computation of coefficient of determination
    double r2 = Math.pow(coVarXY, 2) / (varX * varY);
    r2 = MathUtils.round(r2, Math.pow(10.0, 5));

    final double[] coefficients = Regression.getOLSRegression(scatterpointsDataset, 0);
    final double intercept = coefficients[0];
    final double slope = coefficients[1];
    final String linearEquation;
    if (intercept >= 0) {
        linearEquation = "y = " + (float) slope + "x + " + (float) intercept;
    } else {
        linearEquation = "y = " + (float) slope + "x - " + Math.abs((float) intercept);
    }

    TextTitle tt = new TextTitle(linearEquation + "\nR² = " + r2);
    tt.setTextAlignment(HorizontalAlignment.RIGHT);
    tt.setFont(chart.getLegend().getItemFont());
    tt.setBackgroundPaint(new Color(200, 200, 255, 100));
    tt.setFrame(new BlockBorder(Color.white));
    tt.setPosition(RectangleEdge.BOTTOM);

    r2Annotation = new XYTitleAnnotation(0.98, 0.02, tt,
                                         RectangleAnchor.BOTTOM_RIGHT);
    r2Annotation.setMaxWidth(0.48);
    getPlot().addAnnotation(r2Annotation);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:49,代码来源:ScatterPlotPanel.java


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