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


Java XYTextAnnotation类代码示例

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


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

示例1: showSelection

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
private void showSelection() {    
thePlot.clearAnnotations();
if( selected_peaks.size()>0 ) {        
    double width = screenToDataX(6.);
    double height = screenToDataY(6.);
    double margin = screenToDataY(8.);
    for( Peak p : selected_peaks ) {
    // add annotation
    Shape shape = new Rectangle2D.Double(p.getMZ()-width/2.,p.getIntensity()-height/2.,width,height);
    if( p.equals(current_peak) ) {
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(2.f),Color.black) );    
        thePlot.addAnnotation( new XYTextAnnotation(new java.text.DecimalFormat("0.0000").format(p.getMZ()), p.getMZ(), p.getIntensity() + margin ) );    
    }
    else
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(1.f),Color.black) );    
    }
}
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:19,代码来源:PeakListChartPanel.java

示例2: showSelection

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
private void showSelection() {    
thePlot.clearAnnotations();
if( selected_peaks.size()>0 ) {        
    double width = screenToDataX(6.);
    double height = screenToDataY(6.);
    double margin = screenToDataY(8.);
    for( Peak p : selected_peaks ) {
    // add annotation
    Shape shape = new Rectangle2D.Double(p.getMZ()-width/2.,p.getIntensity()-height/2.,width,height);
    if( p.equals(current_peak) ) {
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(2.f),Color.blue) );    
        thePlot.addAnnotation( new XYTextAnnotation(new java.text.DecimalFormat("0.0000").format(p.getMZ()), p.getMZ(), p.getIntensity() + margin ) );    
    }
    else
        thePlot.addAnnotation( new XYShapeAnnotation(shape,new BasicStroke(1.f),Color.black) );    
    }
}
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:19,代码来源:SpectraPanel.java

示例3: makeDataLabels

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
private void makeDataLabels(String category, Set<Report> toolResults, XYPlot xyplot) {
    HashMap<Point2D, String> map = makePointList(category, toolResults);
    for (Entry<Point2D, String> e : map.entrySet()) {
        if (e.getValue() != null) {
            Point2D p = e.getKey();
            String label = sort(e.getValue());
            XYTextAnnotation annotation = new XYTextAnnotation(label, p.getX(), p.getY());
            annotation.setTextAnchor(p.getX() < 3 ? TextAnchor.TOP_LEFT : TextAnchor.TOP_CENTER);
            annotation.setBackgroundPaint(Color.white);
            if (label.toCharArray()[0] == averageLabel) {
                annotation.setPaint(Color.magenta);
            } else {
                annotation.setPaint(Color.blue);
            }
            annotation.setFont(theme.getRegularFont());
            xyplot.addAnnotation(annotation);
        }
    }
}
 
开发者ID:OWASP,项目名称:Benchmark,代码行数:20,代码来源:ScatterVulns.java

示例4: makeDataLabels

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
private void makeDataLabels(OverallResults or, XYPlot xyplot) {
	HashMap<Point2D, String> map = makePointList(or);
	for (Entry<Point2D, String> e : map.entrySet()) {
		if (e.getValue() != null) {
			Point2D p = e.getKey();
			String label = sort(e.getValue());
			XYTextAnnotation annotation = new XYTextAnnotation(label, p.getX(), p.getY());
			annotation.setTextAnchor(p.getX() < 3 ? TextAnchor.TOP_LEFT : TextAnchor.TOP_CENTER);
			annotation.setBackgroundPaint(Color.white);
			// set color of average to black and everything else to blue
			if(averageLabel==label.toCharArray()[0]){
				annotation.setPaint(Color.magenta);
			} else {
			    annotation.setPaint(Color.blue);
			}
			annotation.setFont(theme.getRegularFont());
			xyplot.addAnnotation(annotation);
		}
	}
}
 
开发者ID:OWASP,项目名称:Benchmark,代码行数:21,代码来源:ScatterTools.java

示例5: makeGuessingLine

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的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

示例6: makeDataLabels

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
private void makeDataLabels( Set<Report> toolResults, XYPlot xyplot ) {        
    HashMap<Point2D,String> map = makePointList( toolResults );
    for (Entry<Point2D,String> e : map.entrySet() ) {
        if ( e.getValue() != null ) {
            Point2D p = e.getKey();
            String label = sort( e.getValue() );
            XYTextAnnotation annotation = new XYTextAnnotation( label, p.getX(), p.getY());
            annotation.setTextAnchor( p.getX() < 3 ? TextAnchor.TOP_LEFT : TextAnchor.TOP_CENTER);
            annotation.setBackgroundPaint(Color.white);
            if (label.toCharArray()[0] == averageLabel)
            {
                annotation.setPaint(Color.magenta);
            } else {
                annotation.setPaint(Color.blue);
            }
            annotation.setFont(theme.getRegularFont());
            xyplot.addAnnotation(annotation);
        }
    }
}
 
开发者ID:OWASP,项目名称:Benchmark,代码行数:21,代码来源:ScatterHome.java

示例7: removeDataPointAnnotations

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Remove the data point annotation in the fold change plot.
 */
private void removeDataPointAnnotations() {
    if (foldChangeplot != null && foldChangeplot.getAnnotations() != null) {

        Iterator iterator = foldChangeplot.getAnnotations().iterator();

        // store the keys in a list first to escape a ConcurrentModificationException
        ArrayList<XYTextAnnotation> tempAnnotations = new ArrayList<XYTextAnnotation>();

        while (iterator.hasNext()) {
            tempAnnotations.add((XYTextAnnotation) iterator.next());
        }

        for (int i = 0; i < tempAnnotations.size(); i++) {
            if (tempAnnotations.get(i).getText().startsWith("Current: ")) {
                foldChangeplot.removeAnnotation(tempAnnotations.get(i));
            }
        }
    }
}
 
开发者ID:compomics,项目名称:mitraq,代码行数:23,代码来源:MiTRAQ.java

示例8: FunctionPanel

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/** Creates a new instance of FunctionPanel */
public FunctionPanel(JFreeChart chart) {
   super(chart);
   //this.setFocusable(true);
   this.functionPanelListeners = new EventListenerList();
   this.renderer = (XYLineAndShapeRendererWithHighlight) chart.getXYPlot().getRenderer();
   this.enableEvents(AWTEvent.INPUT_METHOD_EVENT_MASK);
   this.enableEvents(AWTEvent.KEY_EVENT_MASK);
   this.addKeyListener(this);
   this.nodePopUpMenu = createNodePopupMenu();
   this.addNodePopUpMenu = createAddNodePopupMenu();
   this.crosshairAnnotation = new XYTextAnnotation("", 0, 0);
   this.crosshairAnnotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
   // Make sure the X and Y ranges are not zero, which messes up the display
   chart.getXYPlot().getDomainAxis().setAutoRangeMinimumSize(0.000001);
   chart.getXYPlot().getRangeAxis().setAutoRangeMinimumSize(0.000001);
   //chart.getXYPlot().getRangeAxis().setAutoRange(false);
   //chart.getXYPlot().getRangeAxis().setRangeWithMargins(0.0, 1.0);
   //chart.getXYPlot().getRangeAxis().addChangeListener(new EnforceExcitationRange());
}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:21,代码来源:FunctionPanel.java

示例9: ChartMain

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
public ChartMain(Date startDate, JFreeChartTimePeriod jFreeTimePeriod) {
    super();

    this.jFreeTimePeriod = jFreeTimePeriod;
    UIManager.put("ToolTip.background", new java.awt.Color(239, 203, 152, 255));
    UIManager.put("ToolTip.foreground", java.awt.Color.BLACK);

    //ToolTipManager.sharedInstance().setInitialDelay(100);
    ToolTipManager.sharedInstance().setInitialDelay(20);
    //ToolTipManager.sharedInstance().setReshowDelay(0);
    ToolTipManager.sharedInstance().setDismissDelay(120000);

    XYBarRenderer.setDefaultShadowsVisible(false);
    XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());

    barChartDisplayStrategy = new ChartBarSquare(this);

    lineAnnotations = new HashMap<Long, XYTextAnnotation>();

}
 
开发者ID:premiummarkets,项目名称:pm,代码行数:21,代码来源:ChartMain.java

示例10: createPlot

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedDomainXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    
    XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);
    
    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);
    
    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:CombinedDomainXYPlotTests.java

示例11: createPlot

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedRangeXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
     
    XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);
     
    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); 

    // parent plot...
    CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis("Range"));
    plot.setGap(10.0);
    
    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:CombinedRangeXYPlotTests.java

示例12: testEquals

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
    XYTextAnnotation a2 = new XYTextAnnotation("Text", 10.0, 20.0);
    assertTrue(a1.equals(a2));
  
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:XYTextAnnotationTests.java

示例13: createPlot

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedDomainXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    
    XYTextAnnotation annotation 
        = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);
    
    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    CombinedDomainXYPlot plot 
        = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);
    
    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:CombinedDomainXYPlotTests.java

示例14: createPlot

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedRangeXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
     
    XYTextAnnotation annotation 
        = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);
     
    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); 

    // parent plot...
    CombinedRangeXYPlot plot 
        = new CombinedRangeXYPlot(new NumberAxis("Range"));
    plot.setGap(10.0);
    
    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:CombinedRangeXYPlotTests.java

示例15: testHashCode

import org.jfree.chart.annotations.XYTextAnnotation; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
    XYTextAnnotation a2 = new XYTextAnnotation("Text", 10.0, 20.0);
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:XYTextAnnotationTests.java


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