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


Java XYTextAnnotation.setPaint方法代码示例

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


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

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

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

示例8: 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) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (annotation instanceof XYTextAnnotation) {
        XYTextAnnotation xyta = (XYTextAnnotation) annotation;
        xyta.setFont(this.smallFont);
        xyta.setPaint(this.itemLabelPaint);
    }
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:16,代码来源:StandardChartTheme.java

示例9: addAnnotation

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
public void addAnnotation( String text, double x ) {
    XYPlot plot = (XYPlot) getChart().getPlot();
    Color color = new Color(0, 0, 0, 100);
    Marker updateMarker = new ValueMarker(x, color, new BasicStroke(2f));
    plot.addDomainMarker(updateMarker);
    if (text != null) {
        XYTextAnnotation updateLabel = new XYTextAnnotation(text, x, 0);
        updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
        updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
        updateLabel.setRotationAngle(-3.14 / 2);
        updateLabel.setPaint(Color.black);
        plot.addAnnotation(updateLabel);
    }
    setShapeLinesVisibility(plot);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:16,代码来源:Scatter.java

示例10: createVLineAnnotation

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
protected XYTextAnnotation createVLineAnnotation(long chartX, double chartHeight) {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
        double chartY = mainYAxis.getLowerBound()+ 35*mainYAxis.getRange().getLength() / (chartHeight*(CHARTS_TOTAL_WEIGHT-indicPlotWeight)/CHARTS_TOTAL_WEIGHT);

        XYTextAnnotation vLineLabel = new XYTextAnnotation(simpleDateFormat.format(chartX), chartX, chartY);
        vLineLabel.setFont(mainYAxis.getTickLabelFont().deriveFont(8f));
        vLineLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
        vLineLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
        vLineLabel.setRotationAngle(-3.14 / 2);
        vLineLabel.setPaint(Color.black);

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

示例11: display

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
private JFreeChart display(String title, int height, OverallResults or) {

		JFrame f = new JFrame(title);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		XYSeriesCollection dataset = new XYSeriesCollection();
		XYSeries series = new XYSeries("Scores");
		int totalTools = 0;
		double totalToolTPR = 0;
		double totalToolFPR = 0;
		for (OverallResult r : or.getResults()) {	
			series.add(r.falsePositiveRate * 100, r.truePositiveRate * 100);
			totalTools++;
			totalToolTPR += r.truePositiveRate;
			totalToolFPR += r.falsePositiveRate;
		}
		atpr = totalToolTPR / totalTools;
		afpr = totalToolFPR / totalTools;
		
		if ( or.getResults().size() > 1) {
		    series.add(afpr * 100, atpr * 100);
		}
		
		dataset.addSeries(series);

		chart = ChartFactory.createScatterPlot(title, "False Positive Rate", "True Positive Rate", dataset, PlotOrientation.VERTICAL, true, true, false);
        theme.apply(chart);

		XYPlot xyplot = chart.getXYPlot();
		
		initializePlot( xyplot );
		
		makeDataLabels(or, xyplot);
        makeLegend( or, 103, 93, dataset, xyplot );

		XYTextAnnotation time = new XYTextAnnotation("Tool run time: " + or.getTime(), 12, -5.6);
		time.setTextAnchor(TextAnchor.TOP_LEFT);
		time.setFont(theme.getRegularFont());
		time.setPaint(Color.red);
		xyplot.addAnnotation(time);

		ChartPanel cp = new ChartPanel(chart, height, height, 400, 400, 1200, 1200, false, false, false, false, false, false);
		f.add(cp);
		f.pack();
		f.setLocationRelativeTo(null);
		// f.setVisible(true);
		return chart;
	}
 
开发者ID:OWASP,项目名称:Benchmark,代码行数:49,代码来源:ScatterTools.java

示例12: saveCurrentChart

import org.jfree.chart.annotations.XYTextAnnotation; //导入方法依赖的package包/类
/**
 * Quick and dirty hack for saving the current chart -- because normally the chart parameters need
 * to be defined and modifiable by the user.
 */
private void saveCurrentChart() {
  String fileName = new SimpleDateFormat("yyyyMMddhhmmssSS'.png'").format(new Date());
  try {

    NumberAxis domain = (NumberAxis) this.timeseriesPlot.getDomainAxis();
    Range domainRange = domain.getRange();

    NumberAxis range = (NumberAxis) this.timeseriesPlot.getRangeAxis();
    Range rangeRange = range.getRange();

    String annotationString = "W:" + this.session.chartData.getSAXWindowSize() + ", P:"
        + this.session.chartData.getSAXPaaSize() + ", A:"
        + this.session.chartData.getSAXAlphabetSize();

    XYTextAnnotation a = new XYTextAnnotation(annotationString,
        domainRange.getLowerBound() + domainRange.getLength() / 100,
        rangeRange.getLowerBound() + rangeRange.getLength() / 5 * 3.5);

    a.setTextAnchor(TextAnchor.BOTTOM_LEFT);

    a.setPaint(Color.RED);
    a.setOutlinePaint(Color.BLACK);
    a.setOutlineVisible(true);

    a.setFont(new java.awt.Font("SansSerif", java.awt.Font.BOLD, 14));

    // XYPointerAnnotation a = new XYPointerAnnotation("Bam!", domainRange.getLowerBound()
    // + domainRange.getLength() / 10, rangeRange.getLowerBound() + rangeRange.getLength() / 5
    // * 4, 5 * Math.PI / 8);

    this.timeseriesPlot.addAnnotation(a);

    // this.paintTheChart();

    ChartUtilities.saveChartAsPNG(new File(fileName), this.chart, 900, 600);
  }
  catch (IOException e) {
    e.printStackTrace();
  }
}
 
开发者ID:GrammarViz2,项目名称:grammarviz2_src,代码行数:45,代码来源:GrammarvizChartPanel.java


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