LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT);
/** * Draws a chart into {@link JFreeChart}. */ public JFreeChart createChart() { final JFreeChart chart = ChartFactory.createLineChart(null, // chart title null, // unused null, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); chart.getLegend().setItemFont(CHART_FONT); final CategoryPlot plot = chart.getCategoryPlot(); configurePlot(plot); configureRangeAxis((NumberAxis) plot.getRangeAxis()); crop(plot); return chart; }
LegendTitle legend = new LegendTitle(lis); legend.setPosition(RectangleEdge.BOTTOM); return legend;
public static void setupTextTitle(TextTitle title) { if (title != null) { title.setFont(ChartDefaults.titleFont); title.setTextAlignment(HorizontalAlignment.LEFT); title.setPaint(ChartDefaults.titleTextColor); title.setBackgroundPaint(ChartDefaults.transparent); } }
public static void setupLegendTitle(LegendTitle legend) { if (legend != null) { legend.setBorder(0, 0, 0, 0); legend.setItemPaint(ChartDefaults.legendTextColor); legend.setMargin(2, 2, 2, 2); } } }
/** * Draws the title on a Java 2D graphics device (such as the screen or a * printer). * * @param g2 the graphics device. * @param area the available area for the title. */ @Override public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
/** * Returns a hash code for this object. * * @return A hash code. */ public int hashCode() { // FIXME: do better than this return this.title.hashCode(); }
/** * Draws the title on a Java 2D graphics device (such as the screen or a * printer). * * @param g2 the graphics device. * @param area the area allocated for the title. */ @Override public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
/** * Creates a new title. * * @param text the text ({@code null} not permitted). */ public ShortTextTitle(String text) { setText(text); }
/** * Returns a clone of this object. * * @return A clone. * * @throws CloneNotSupportedException never. */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); }
/** * Draws the legend within the specified area. * * @param g2 the graphics target ({@code null} not permitted). * @param area the drawing area ({@code null} not permitted). */ @Override public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
/** * Draws the title on a Java 2D graphics device (such as the screen or a * printer). * * @param g2 the graphics device. * @param area the area allocated for the title. */ @Override public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
public static void setupTextTitle(TextTitle title) { if (title != null) { title.setFont(ChartDefaults.titleFont); title.setTextAlignment(HorizontalAlignment.LEFT); title.setPaint(ChartDefaults.titleTextColor); title.setBackgroundPaint(ChartDefaults.transparent); } }
public static void setupLegendTitle(LegendTitle legend) { if (legend != null) { legend.setBorder(0, 0, 0, 0); legend.setItemPaint(ChartDefaults.legendTextColor); legend.setMargin(2,2,2,2); } } }
/** * Draws the title on a Java 2D graphics device (such as the screen or a * printer). * * @param g2 the graphics device. * @param area the area allocated for the title. */ public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
/** * Creates a new title. * * @param text the text (<code>null</code> not permitted). */ public ShortTextTitle(String text) { setText(text); }
/** * Returns a clone of this object. * * @return A clone. * * @throws CloneNotSupportedException never. */ public Object clone() throws CloneNotSupportedException { return super.clone(); }
/** * Draws the legend within the specified area. * * @param g2 the graphics target (<code>null</code> not permitted). * @param area the drawing area (<code>null</code> not permitted). */ public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }
/** * Draws the title on a Java 2D graphics device (such as the screen or a * printer). * * @param g2 the graphics device. * @param area the area allocated for the title. */ public void draw(Graphics2D g2, Rectangle2D area) { draw(g2, area, null); }