List of usage examples for org.jfree.chart.title TextTitle setPosition
public void setPosition(RectangleEdge position)
From source file:org.openfaces.component.chart.impl.plots.MultiplePiePlotAdapter.java
private TextTitle getSeriesTitle(Chart chart) { StyleObjectModel cssChartViewModel = chart.getChartView().getStyleObjectModel(); TextTitle seriesTitle; Font f = CSSUtil.getFont(cssChartViewModel); if (f != null) { seriesTitle = new TextTitle("Series Title", f); } else {/* ww w.j a va 2 s .co m*/ seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); } if (cssChartViewModel.getColor() != null) { seriesTitle.setPaint(cssChartViewModel.getColor()); } seriesTitle.setPosition(RectangleEdge.BOTTOM); return seriesTitle; }
From source file:org.n52.io.measurement.img.ChartIoHandler.java
private void addNotice(JFreeChart chart) { TextTitle notice = new TextTitle(); String msg = i18n.get("msg.io.chart.notice"); if (msg != null && !msg.isEmpty()) { notice.setText(msg);/*from w w w. ja v a 2 s.co m*/ notice.setPaint(BLACK); notice.setFont(FONT_LABEL_SMALL); notice.setPosition(RectangleEdge.BOTTOM); notice.setHorizontalAlignment(HorizontalAlignment.RIGHT); notice.setVerticalAlignment(VerticalAlignment.BOTTOM); notice.setPadding(new RectangleInsets(0, 0, 20, 20)); chart.addSubtitle(notice); } }
From source file:unalcol.termites.boxplots.ECALMessages.java
/** * Creates a new demo.// ww w. j av a2 s. c o m * * @param title the frame title. * @param pf */ public ECALMessages(final String title, ArrayList<Double> pf) { super(title); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Messages Sent"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf, renderer); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Messages Sent " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); LegendTitle legend = chart.getLegend(); legend.setPadding(new RectangleInsets(UnitType.RELATIVE, 0, 0.1, 0, 0)); FileOutputStream output; try { output = new FileOutputStream("messagesECAL" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 670, 250, null); } catch (FileNotFoundException ex) { Logger.getLogger(ECALMessages.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ECALMessages.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.MessagesSent2.java
/** * Creates a new demo.// w w w. j av a 2 s.c om * * @param title the frame title. * @param pf */ public MessagesSent2(final String title, ArrayList<Double> pf) { super(title); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Messages Sent"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf, renderer); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Messages Sent " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); LegendTitle legend = chart.getLegend(); legend.setPadding(new RectangleInsets(UnitType.RELATIVE, 0, 0.1, 0, 0)); FileOutputStream output; try { output = new FileOutputStream("messagesnumber2" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 670, 250, null); } catch (FileNotFoundException ex) { Logger.getLogger(MessagesSent2.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(MessagesSent2.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.ECALinfoCollected.java
/** * Creates a new demo.//ww w. j ava2 s. c om * * @param title the frame title. * @param pf */ public ECALinfoCollected(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); final NumberAxis yAxis = new NumberAxis(""); //final NumberAxis yAxis = new NumberAxis("Information Collected"); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 16); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Information Collected " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("ECALinfoColl" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(ECALinfoCollected.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ECALinfoCollected.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.RoundNumberGlobal.java
/** * Creates a new demo./*w ww. j av a 2 s. c o m*/ * * @param title the frame title. * @param pf */ public RoundNumberGlobal(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Round number"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 16); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Round Number" + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("roundGlobalNumber" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(RoundNumberGlobal.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.ECALAgentsRight.java
/** * Creates a new demo.//from ww w . jav a 2 s . c o m * * @param title the frame title. * @param pf */ public ECALAgentsRight(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); // final NumberAxis yAxis = new NumberAxis("Round number"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Agents Right " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("ECALright" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.ECALRoundNumber.java
/** * Creates a new demo./*from w w w. j a v a2 s . c o m*/ * * @param title the frame title. * @param pf */ public ECALRoundNumber(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); // final NumberAxis yAxis = new NumberAxis("Round number"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Round Number " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("ECALround" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(ECALRoundNumber.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ECALRoundNumber.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.RoundNumber2.java
/** * Creates a new demo./*from w w w. ja v a 2 s .c o m*/ * * @param title the frame title. * @param pf */ public RoundNumber2(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); // final NumberAxis yAxis = new NumberAxis("Round number"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Round Number " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("roundnumber2" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 300, 250, null); } catch (FileNotFoundException ex) { Logger.getLogger(RoundNumber2.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(RoundNumber2.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:unalcol.termites.boxplots.InformationCollected2.java
/** * Creates a new demo.//from ww w . j av a 2 s . c o m * * @param title the frame title. * @param pf */ public InformationCollected2(final String title, ArrayList<Double> pf) { super(title); final BoxAndWhiskerCategoryDataset dataset = createSampleDataset(pf); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Information Collected"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Information Collected " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("informationcollected2" + pf + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 350, 350, null); } catch (FileNotFoundException ex) { Logger.getLogger(InformationCollected2.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(InformationCollected2.class.getName()).log(Level.SEVERE, null, ex); } }