Java Code Examples for org.jfree.chart.annotations.XYTextAnnotation#setBackgroundPaint()
The following examples show how to use
org.jfree.chart.annotations.XYTextAnnotation#setBackgroundPaint() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScatterVulns.java From Benchmark with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 2
Source File: ScatterTools.java From Benchmark with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 3
Source File: ScatterPlot.java From Benchmark with GNU General Public License v2.0 | 6 votes |
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(80, 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); }
Example 4
Source File: ScatterHome.java From Benchmark with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 5
Source File: ScatterPlot.java From Benchmark with GNU General Public License v2.0 | 5 votes |
public static void addGenerationDate(XYPlot xyplot) { //add scorecard generation date final String pattern = "dd MMM yyyy h:mm a"; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); String date = simpleDateFormat.format(new Date()); XYTextAnnotation gendate = new XYTextAnnotation("Scorecard Generated: " + date, 0.5, -7.5); gendate.setTextAnchor(TextAnchor.CENTER_LEFT); gendate.setBackgroundPaint(Color.white); gendate.setPaint(Color.red); gendate.setFont(theme.getRegularFont()); xyplot.addAnnotation( gendate ); }