false ); // urls chart.setBackgroundPaint( Color.white ); TextTitle title = new TextTitle( chartTitle );
/** * Adds a subtitle to the chart. * * @param subtitle the subtitle. */ public void addSubtitle(String subtitle) { this.chart.addSubtitle(new TextTitle(subtitle)); }
/** * Adds a subtitle to the chart. * * @param subtitle the subtitle. * @param font the subtitle font. */ public void addSubtitle(String subtitle, Font font) { this.chart.addSubtitle(new TextTitle(subtitle, font)); }
TextTitle legendText = new TextTitle("This is LEGEND: "); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText);
public void setSubTitle( String title ) { chart.addSubtitle(new TextTitle(title,new Font("SansSerif", Font.ITALIC, 12))); }
private void createChart(XYPlot plot, String fileName, String caption) throws IOException { JFreeChart chart = new JFreeChart(caption, plot); chart.addSubtitle(this.subtitle); if (plot.getRangeAxis() instanceof LogarithmicAxis) { chart.addSubtitle(1, new TextTitle("(logarithmische Skala)")); } File file = new File(fileName); file.delete(); ChartUtilities.saveChartAsPNG(file, chart, CHART_WIDTH, CHART_HEIGHT); }
public MemoryRelativeBarPlot( String title ) { chart = ChartFactory.createBarChart( title, // chart title "Operation", // domain axis label "Relative Memory", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); chart.addSubtitle(new TextTitle("(Smaller is Better)",new Font("SansSerif", Font.ITALIC, 12))); plot(); }
/** * @param chartConfig * @param barChart */ private static void addSubTitles(BarChart chartConfig, JFreeChart barChart) { Iterator<SubTitle> it; /* * Add subtitles. */ for (it = chartConfig.getSubTitleCollection().iterator(); it.hasNext();) { SubTitle subTitle = (SubTitle) it.next(); Title title = subTitle.getTitle(); String value = title.getValue(); barChart.addSubtitle(new TextTitle(value)); } }
/** * @param chartConfig * @param barChart */ private static void addSubTitles(BarChart chartConfig, JFreeChart barChart) { Iterator<SubTitle> it; /* * Add subtitles. */ for (it = chartConfig.getSubTitleCollection().iterator(); it.hasNext();) { SubTitle subTitle = (SubTitle) it.next(); Title title = subTitle.getTitle(); String value = title.getValue(); barChart.addSubtitle(new TextTitle(value)); } }
/** * Sets the chart title and sends a {@link ChartChangeEvent} to all * registered listeners. This is a convenience method that ends up calling * the {@link #setTitle(TextTitle)} method. If there is an existing title, * its text is updated, otherwise a new title using the default font is * added to the chart. If {@code text} is {@code null} the chart * title is set to {@code null}. * * @param text the title text ({@code null} permitted). * * @see #getTitle() */ public void setTitle(String text) { if (text != null) { if (this.title == null) { setTitle(new TextTitle(text, JFreeChart.DEFAULT_TITLE_FONT)); } else { this.title.setText(text); } } else { setTitle((TextTitle) null); } }
/** * Creates a new plot. * * @param dataset the dataset ({@code null} permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); setDataset(dataset); PiePlot piePlot = new PiePlot(null); piePlot.setIgnoreNullValues(true); this.pieChart = new JFreeChart(piePlot); this.pieChart.removeLegend(); this.dataExtractOrder = TableOrder.BY_COLUMN; this.pieChart.setBackgroundPaint(null); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); this.pieChart.setTitle(seriesTitle); this.aggregatedItemsKey = "Other"; this.aggregatedItemsPaint = Color.lightGray; this.sectionPaints = new HashMap(); this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0); }
/** * Creates a new plot. * * @param dataset the dataset (<code>null</code> permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); setDataset(dataset); PiePlot piePlot = new PiePlot(null); piePlot.setIgnoreNullValues(true); this.pieChart = new JFreeChart(piePlot); this.pieChart.removeLegend(); this.dataExtractOrder = TableOrder.BY_COLUMN; this.pieChart.setBackgroundPaint(null); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); this.pieChart.setTitle(seriesTitle); this.aggregatedItemsKey = "Other"; this.aggregatedItemsPaint = Color.lightGray; this.sectionPaints = new HashMap(); this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0); }
public JFreeChart createChart() { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart( title, "Matrix Libraries", "Relative Performance", dataSet, true); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); plot.setBackgroundPaint(new Color(230,230,230)); plot.setDomainGridlinePaint(new Color(50,50,50,50)); plot.setDomainGridlineStroke(new BasicStroke(78f)); chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24)); String foo = "( Higher is Better )"; if( subtitle != null ) foo += " ( "+subtitle+" )"; chart.addSubtitle(new TextTitle(foo,new Font("SansSerif", Font.ITALIC, 12))); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
private TextTitle getSubTitle( BaseChart chart ) { TextTitle textTitle = new TextTitle(); String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle(); textTitle.setFont( SUB_TITLE_FONT ); textTitle.setText( title ); return textTitle; }
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); notice.setPaint(Color.BLACK); notice.setFont(LabelConstants.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); } }
private void addNotice(JFreeChart chart) { TextTitle notice = new TextTitle(); String msg = i18n.get("notice"); if (msg != null && !msg.isEmpty()) { notice.setText(msg); 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); } }
private void setPlotMessage(String messageText) { chart.getXYPlot().clearAnnotations(); TextTitle tt = new TextTitle(messageText); tt.setTextAlignment(HorizontalAlignment.RIGHT); tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 50)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER); chart.getXYPlot().addAnnotation(message); }
private void setPlotMessage(String messageText) { chart.getXYPlot().clearAnnotations(); TextTitle tt = new TextTitle(messageText); tt.setTextAlignment(HorizontalAlignment.RIGHT); tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 50)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER); chart.getXYPlot().addAnnotation(message); }
/** * Sets the properties of the specified title to match the properties * defined on this panel. * * @param chart the chart whose title is to be modified. */ public void setTitleProperties(JFreeChart chart) { if (this.showTitle) { TextTitle title = chart.getTitle(); if (title == null) { title = new TextTitle(); chart.setTitle(title); } title.setText(getTitleText()); title.setFont(getTitleFont()); title.setPaint(getTitlePaint()); } else { chart.setTitle((TextTitle) null); } }
/** * Sets the properties of the specified title to match the properties * defined on this panel. * * @param chart the chart whose title is to be modified. */ public void setTitleProperties(JFreeChart chart) { if (this.showTitle) { TextTitle title = chart.getTitle(); if (title == null) { title = new TextTitle(); chart.setTitle(title); } title.setText(getTitleText()); title.setFont(getTitleFont()); title.setPaint(getTitlePaint()); } else { chart.setTitle((TextTitle) null); } }