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


Java XYTextAnnotation.setFont方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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:mdzio,项目名称:ccu-historian,代码行数:39,代码来源:CombinedDomainXYPlotTest.java

示例10: 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 xAxis1 = new NumberAxis("X1");
    XYPlot subplot1 = new XYPlot(data1, xAxis1, null, 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 xAxis2 = new NumberAxis("X2");
    xAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, xAxis2, null, 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:mdzio,项目名称:ccu-historian,代码行数:39,代码来源:CombinedRangeXYPlotTest.java

示例11: applyToXYAnnotation

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
 * Applies the settings of this theme to the specified annotation.
 *
 * @param annotation  the annotation.
 */
protected void applyToXYAnnotation(XYAnnotation annotation) {
    ParamChecks.nullNotPermitted(annotation, "annotation");
    if (annotation instanceof XYTextAnnotation) {
        XYTextAnnotation xyta = (XYTextAnnotation) annotation;
        xyta.setFont(this.smallFont);
        xyta.setPaint(this.itemLabelPaint);
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:14,代码来源:StandardChartTheme.java

示例12: applyToXYAnnotation

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
 * Applies the settings of this theme to the specified annotation.
 *
 * @param annotation  the annotation.
 */
protected void applyToXYAnnotation(XYAnnotation annotation) {
    Args.nullNotPermitted(annotation, "annotation");
    if (annotation instanceof XYTextAnnotation) {
        XYTextAnnotation xyta = (XYTextAnnotation) annotation;
        xyta.setFont(this.smallFont);
        xyta.setPaint(this.itemLabelPaint);
    }
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:14,代码来源:StandardChartTheme.java

示例13: getAnnotations

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
 * Get annotated datapoints for a dataset
 * @param ID
 * @return
 */
public List<XYTextAnnotation> getAnnotations(int ID, double xshift,double yshift, TextAnchor anchor, int textSize, int style, Color c){
	List<XYTextAnnotation> annot = new ArrayList<XYTextAnnotation>();
	for(int i=0; i<data.get(ID).annotations.length; i++){
		XYTextAnnotation a = new XYTextAnnotation(data.get(ID).annotations[i], data.get(ID).annotationCoords.get(i,0)+xshift, data.get(ID).annotationCoords.get(i,0)+yshift);
		a.setFont(new Font("Tahoma", style, textSize));
		a.setTextAnchor(anchor);
		a.setPaint(c);
		annot.add(a);
	}
	return annot;
}
 
开发者ID:seqcode,项目名称:seqcode-core,代码行数:17,代码来源:ScatterData.java

示例14: createCombinedChart

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
 * Creates a combined chart.
 *
 * @return the combined chart.
 */
private static JFreeChart createCombinedChart() {

    // create subplot 1...
    final XYDataset data1 = createDataset1();
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
    final XYPlot subplot1 = new XYPlot( data1, null, rangeAxis1, renderer1 );
    subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );

    final 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...
    final XYDataset data2 = createDataset2();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
    rangeAxis2.setAutoRangeIncludesZero( false );
    final XYPlot subplot2 = new XYPlot( data2, null, rangeAxis2, renderer2 );
    subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );

    // parent plot...
    final 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 a new chart containing the overlaid plot...
    return new JFreeChart( "CombinedDomainXYPlot Demo",
                           JFreeChart.DEFAULT_TITLE_FONT, plot, true );

}
 
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:CombinedXYPlotDemo1.java

示例15: createCombinedChart

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
private static JFreeChart createCombinedChart() {

        // create subplot 1...
        final XYItemRenderer renderer1 = new StandardXYItemRenderer();
        final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
        final XYPlot subplot1 = new XYPlot( createDataset1(), null, rangeAxis1, renderer1 );
        subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );

        final 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...
        final XYItemRenderer renderer2 = new StandardXYItemRenderer();
        final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
        rangeAxis2.setAutoRangeIncludesZero( false );
        final XYPlot subplot2 = new XYPlot( createDataset2(), null, rangeAxis2, renderer2 );
        subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );

        // parent plot...
        final 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 a new chart containing the overlaid plot...
        return new JFreeChart( "CombinedDomainXYPlot Demo",
                               JFreeChart.DEFAULT_TITLE_FONT, plot, true );

    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:35,代码来源:TestCombinedChartNode.java


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