List of usage examples for org.jfree.ui HorizontalAlignment CENTER
HorizontalAlignment CENTER
To view the source code for org.jfree.ui HorizontalAlignment CENTER.
Click Source Link
From source file:it.eng.spagobi.engines.chart.bo.ChartImpl.java
public TextTitle setStyleTitle(String title, StyleLabel titleLabel) { Font font = null;//from ww w .j av a 2 s .co m Color color = null; boolean definedFont = true; boolean definedColor = true; if (titleLabel != null) { if (titleLabel.getFont() != null) { font = titleLabel.getFont(); } else { definedFont = false; } if (titleLabel.getColor() != null) { color = titleLabel.getColor(); } else { definedColor = false; } } else { definedColor = false; definedFont = false; } if (!definedFont) font = new Font("Tahoma", Font.BOLD, 18); if (!definedColor) color = Color.BLACK; TextTitle titleText = new TextTitle(title, font, color, RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.TOP, RectangleInsets.ZERO_INSETS); return titleText; }
From source file:it.eng.spagobi.engines.chart.bo.ChartImpl.java
public void drawLegend(JFreeChart chart) { //remove ipotetical other legend chart.removeLegend();/* w w w . java 2s . com*/ BlockContainer wrapper = new BlockContainer(new BorderArrangement()); wrapper.setFrame(new BlockBorder(1.0, 1.0, 1.0, 1.0)); /*LabelBlock titleBlock = new LabelBlock("Legend Items:", new Font("SansSerif", Font.BOLD, 12)); titleBlock.setPadding(5, 5, 5, 5); wrapper.add(titleBlock, RectangleEdge.TOP);*/ LegendTitle legend = new LegendTitle(chart.getPlot()); BlockContainer items = legend.getItemContainer(); if (styleLegend != null && styleLegend.getFont() != null) { legend.setItemFont(new Font(styleLegend.getFontName(), Font.BOLD, styleLegend.getSize())); } items.setPadding(2, 5, 5, 2); wrapper.add(items); legend.setWrapper(wrapper); if (legendPosition.equalsIgnoreCase("bottom")) legend.setPosition(RectangleEdge.BOTTOM); else if (legendPosition.equalsIgnoreCase("left")) legend.setPosition(RectangleEdge.LEFT); else if (legendPosition.equalsIgnoreCase("right")) legend.setPosition(RectangleEdge.RIGHT); else if (legendPosition.equalsIgnoreCase("top")) legend.setPosition(RectangleEdge.TOP); else legend.setPosition(RectangleEdge.BOTTOM); legend.setHorizontalAlignment(HorizontalAlignment.CENTER); chart.addSubtitle(legend); }
From source file:ro.nextreports.engine.chart.JFreeChartExporter.java
private void setTitle(JFreeChart jfreechart) { TextTitle title = new TextTitle(StringUtil.getI18nString(replaceParameters(chart.getTitle().getTitle()), I18nUtil.getLanguageByName(chart, language))); title.setFont(chart.getTitle().getFont()); title.setPaint(chart.getTitle().getColor()); if (chart.getTitle().getAlignment() == ChartTitle.LEFT_ALIGNMENT) { title.setHorizontalAlignment(HorizontalAlignment.LEFT); } else if (chart.getTitle().getAlignment() == ChartTitle.RIGHT_ALIGNMENT) { title.setHorizontalAlignment(HorizontalAlignment.RIGHT); } else {//ww w . j a va2 s. c om title.setHorizontalAlignment(HorizontalAlignment.CENTER); } jfreechart.setTitle(title); }