本文整理汇总了Java中org.jfree.chart.annotations.XYPointerAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java XYPointerAnnotation类的具体用法?Java XYPointerAnnotation怎么用?Java XYPointerAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XYPointerAnnotation类属于org.jfree.chart.annotations包,在下文中一共展示了XYPointerAnnotation类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeGuessingLine
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
public static void makeGuessingLine(XYPlot xyplot) {
// draw guessing line
XYLineAnnotation guessing = new XYLineAnnotation(-5, -5, 100, 100, dashed, Color.red);
xyplot.addAnnotation(guessing);
XYPointerAnnotation worse = makePointer(75, 0, "Worse than guessing", TextAnchor.TOP_CENTER, 90);
xyplot.addAnnotation(worse);
XYPointerAnnotation better = makePointer(25, 100, "Better than guessing", TextAnchor.BOTTOM_CENTER, 270);
xyplot.addAnnotation(better);
XYTextAnnotation stroketext = new XYTextAnnotation(" Random Guess", 88, 107);
stroketext.setTextAnchor(TextAnchor.CENTER_RIGHT);
stroketext.setBackgroundPaint(Color.white);
stroketext.setPaint(Color.red);
stroketext.setFont(theme.getRegularFont());
xyplot.addAnnotation(stroketext);
XYLineAnnotation strokekey = new XYLineAnnotation(58, 107, 68, 107, dashed, Color.red);
xyplot.setBackgroundPaint(Color.white);
xyplot.addAnnotation(strokekey);
}
开发者ID:OWASP,项目名称:Benchmark,代码行数:23,代码来源:ScatterPlot.java
示例2: makePointer
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
public static void makePointer(XYPlot plot, double x, double y, String msg, TextAnchor anchor, int angle ) {
// TextTitle textTitle = new TextTitle(msg, theme.getSmallFont(), Color.red, RectangleEdge.TOP, HorizontalAlignment.LEFT, VerticalAlignment.TOP, new RectangleInsets(2, 2, 2, 2));
// XYTitleAnnotation title = new XYTitleAnnotation(x/100, y/100, textTitle, RectangleAnchor.TOP_LEFT);
// plot.addAnnotation( title );
XYPointerAnnotation pointer = new XYPointerAnnotation(msg, x, y, Math.toRadians(angle));
pointer.setBackgroundPaint(Color.white);
pointer.setTextAnchor(anchor);
pointer.setArrowWidth(4);
pointer.setArrowLength(8);
pointer.setArrowPaint(Color.red);
pointer.setLabelOffset(2);
pointer.setPaint(Color.red);
pointer.setFont(theme.getRegularFont());
plot.addAnnotation(pointer);;
}
开发者ID:OWASP,项目名称:Benchmark,代码行数:17,代码来源:ScatterPlot.java
示例3: testHashCode
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0,
Math.PI);
XYPointerAnnotation a2 = new XYPointerAnnotation("Label", 10.0, 20.0,
Math.PI);
assertTrue(a1.equals(a2));
int h1 = a1.hashCode();
int h2 = a2.hashCode();
assertEquals(h1, h2);
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:XYPointerAnnotationTests.java
示例4: addAnnotation
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
/**
* Draws annotation on the chart.
*
* @param x pointer X position
* @param y pointer Y position
* @param annotation annotation text
* @param angle annotation line angle in degrees
*/
public void addAnnotation(double x, double y, String annotation, float angle) {
m_xyAnnotation = new XYPointerAnnotation(annotation,
x,
y,
-angle * Math.PI / 180);
m_xyAnnotation.setLabelOffset(m_xyAnnotation.getLabelOffset() * 2 + 10);
if (m_chart != null) {
XYPlot plot = m_chart.getXYPlot();
plot.addAnnotation(m_xyAnnotation);
}
}
开发者ID:scalalab,项目名称:scalalab,代码行数:21,代码来源:jPlot.java
示例5: testHashCode
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0,
Math.PI);
XYPointerAnnotation a2 = new XYPointerAnnotation("Label", 10.0, 20.0,
Math.PI);
assertTrue(a1.equals(a2));
int h1 = a1.hashCode();
int h2 = a2.hashCode();
assertEquals(h1, h2);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:XYPointerAnnotationTests.java
示例6: stylePointer
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
private void stylePointer(final XYPointerAnnotation pointer) {
pointer.setLabelOffset(15);
pointer.setBaseRadius(50.0);
pointer.setTipRadius(5);
pointer.setFont(new Font("SansSerif", Font.PLAIN, 12));
pointer.setPaint(Color.blue);
pointer.setTextAnchor(TextAnchor.HALF_ASCENT_CENTER);
}
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:9,代码来源:AngularAperture.java
示例7: testEquals
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI);
XYPointerAnnotation a2 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI);
assertTrue(a1.equals(a2));
//private double angle;
a1.setAngle(Math.PI / 4.0);
assertFalse(a1.equals(a2));
a2.setAngle(Math.PI / 4.0);
assertTrue(a1.equals(a2));
//private double tipRadius;
a1.setTipRadius(20.0);
assertFalse(a1.equals(a2));
a2.setTipRadius(20.0);
assertTrue(a1.equals(a2));
//private double baseRadius;
a1.setBaseRadius(5.0);
assertFalse(a1.equals(a2));
a2.setBaseRadius(5.0);
assertTrue(a1.equals(a2));
//private double arrowLength;
a1.setArrowLength(33.0);
assertFalse(a1.equals(a2));
a2.setArrowLength(33.0);
assertTrue(a1.equals(a2));
//private double arrowWidth;
a1.setArrowWidth(9.0);
assertFalse(a1.equals(a2));
a2.setArrowWidth(9.0);
assertTrue(a1.equals(a2));
//private Stroke arrowStroke;
Stroke stroke = new BasicStroke(1.5f);
a1.setArrowStroke(stroke);
assertFalse(a1.equals(a2));
a2.setArrowStroke(stroke);
assertTrue(a1.equals(a2));
//private Paint arrowPaint;
a1.setArrowPaint(Color.blue);
assertFalse(a1.equals(a2));
a2.setArrowPaint(Color.blue);
assertTrue(a1.equals(a2));
//private double labelOffset;
a1.setLabelOffset(10.0);
assertFalse(a1.equals(a2));
a2.setLabelOffset(10.0);
assertTrue(a1.equals(a2));
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:60,代码来源:XYPointerAnnotationTests.java
示例8: testPublicCloneable
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
/**
* Checks that this class implements PublicCloneable.
*/
public void testPublicCloneable() {
XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0,
Math.PI);
assertTrue(a1 instanceof PublicCloneable);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:XYPointerAnnotationTests.java
示例9: run
import org.jfree.chart.annotations.XYPointerAnnotation; //导入依赖的package包/类
@Override
public void run(final String arg0) {
// http://www.tutorialspoint.com/jfreechart/index.htm
final ApplicationFrame chart = new ApplicationFrame("Angular aperture");
final JFreeChart xyChart = ChartFactory.createXYLineChart(
"Angular aperture", "aperture diameter in µm", "delta in nm",
createDataset(), PlotOrientation.VERTICAL, true, true, false);
final ChartPanel chartPanel = new ChartPanel(xyChart);
chartPanel.setPreferredSize(new java.awt.Dimension(800, 600));
final XYPlot plot = xyChart.getXYPlot();
final ValueAxis axis = plot.getRangeAxis();
axis.setAutoRange(false);
axis.setUpperBound(2.0);
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, Color.GREEN);
renderer.setSeriesPaint(2, Color.BLUE);
renderer.setSeriesStroke(0, new BasicStroke(2f));
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesShapesVisible(1, false);
renderer.setSeriesShapesVisible(2, false);
plot.setRenderer(renderer);
final double x_opt = mrad2µm(alpha_opt);
final double y_opt = 0.9 * Math.pow(C_s * Math.pow(lambda, 3), 0.25) * 1e9;
final XYLineAnnotation line = new XYLineAnnotation(0, y_opt, mrad2µm(Math
.ceil(2 * alpha_opt)), y_opt);
plot.addAnnotation(line);
final XYPointerAnnotation pointer = new XYPointerAnnotation(String.format(
"Smallest error disc: %.2g nm @ %.1f µm", y_opt, x_opt), x_opt, y_opt,
5.0 * Math.PI / 4.0);
stylePointer(pointer);
plot.addAnnotation(pointer);
final double aperture_alpha = 0.5 * 20 * 1e-6 / fl;
final XYPointerAnnotation resolution = new XYPointerAnnotation(String
.format("Resolution with %.0f µm aperture: %.2f nm", mrad2µm(
aperture_alpha * 1e3), delta(aperture_alpha) * 1e9), mrad2µm(
aperture_alpha * 1e3), delta(aperture_alpha) * 1e9, 1.0 * Math.PI /
4.0);
stylePointer(resolution);
plot.addAnnotation(resolution);
chart.setContentPane(chartPanel);
chart.pack();
RefineryUtilities.centerFrameOnScreen(chart);
chart.setVisible(true);
}
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:49,代码来源:AngularAperture.java
注:本文中的org.jfree.chart.annotations.XYPointerAnnotation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论