org.jfree.chart.title.TextTitle Java Examples
The following examples show how to use
org.jfree.chart.title.TextTitle.
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: arja3_three_t.java From coming with MIT License | 6 votes |
/** * Creates a new plot. * * @param dataset the dataset (<code>null</code> permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); this.dataset = dataset; PiePlot piePlot = new PiePlot(null); this.pieChart = new JFreeChart(piePlot); this.pieChart.removeLegend(); setDataset(dataset); 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(); }
Example #2
Source File: XYTitleAnnotationTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { TextTitle t = new TextTitle("Title"); XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t); XYTitleAnnotation a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); a2 = (XYTitleAnnotation) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(a1, a2); }
Example #3
Source File: MultiplePiePlot.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Creates a new plot. * * @param dataset the dataset (<code>null</code> permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); this.dataset = dataset; PiePlot piePlot = new PiePlot(null); 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(); }
Example #4
Source File: EyeCandySixtiesChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException { super.configureChart(jfreeChart, jrPlot); TextTitle title = jfreeChart.getTitle(); if (title != null) { RectangleInsets padding = title.getPadding(); double bottomPadding = Math.max(padding.getBottom(), 15d); title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight()); } GradientPaint gp = (GradientPaint)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BACKGROUND_PAINT); jfreeChart.setBackgroundPaint(new GradientPaint(0f, 0f, gp.getColor1(), 0f, getChart().getHeight() * 0.7f, gp.getColor2(), false)); }
Example #5
Source File: Arja_00131_s.java From coming with MIT License | 6 votes |
/** * Creates a new plot. * * @param dataset the dataset (<code>null</code> permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); this.dataset = dataset; PiePlot piePlot = new PiePlot(null); 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(); }
Example #6
Source File: JFreeChart.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #7
Source File: Cardumen_0077_s.java From coming with MIT License | 5 votes |
/** * Clones the object, and takes care of listeners. * Note: caller shall register its own listeners on cloned graph. * * @return A clone. * * @throws CloneNotSupportedException if the chart is not cloneable. */ public Object clone() throws CloneNotSupportedException { JFreeChart chart = (JFreeChart) super.clone(); chart.renderingHints = (RenderingHints) this.renderingHints.clone(); // private boolean borderVisible; // private transient Stroke borderStroke; // private transient Paint borderPaint; if (this.title != null) { chart.title = (TextTitle) this.title.clone(); chart.title.addChangeListener(chart); } chart.subtitles = new ArrayList(); for (int i = 0; i < getSubtitleCount(); i++) { Title subtitle = (Title) getSubtitle(i).clone(); chart.subtitles.add(subtitle); subtitle.addChangeListener(chart); } if (this.plot != null) { chart.plot = (Plot) this.plot.clone(); chart.plot.addChangeListener(chart); } chart.progressListeners = new EventListenerList(); chart.changeListeners = new EventListenerList(); return chart; }
Example #8
Source File: XYTitleAnnotationTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Draws the chart with a <code>null</code> info object to make sure that * no exceptions are thrown. */ @Test public void testDrawWithNullInfo() { try { DefaultTableXYDataset dataset = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(5.0, 5.0); s1.add(10.0, 15.5); s1.add(15.0, 9.5); s1.add(20.0, 7.5); dataset.addSeries(s1); XYSeries s2 = new XYSeries("Series 2", true, false); s2.add(5.0, 5.0); s2.add(10.0, 15.5); s2.add(15.0, 9.5); s2.add(20.0, 3.5); dataset.addSeries(s2); XYPlot plot = new XYPlot(dataset, new NumberAxis("X"), new NumberAxis("Y"), new XYLineAndShapeRenderer()); plot.addAnnotation(new XYTitleAnnotation(5.0, 6.0, new TextTitle("Hello World!"))); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); } catch (NullPointerException e) { fail("There should be no exception."); } }
Example #9
Source File: JGenProg2017_00104_t.java From coming with MIT License | 5 votes |
/** * Clones the object, and takes care of listeners. * Note: caller shall register its own listeners on cloned graph. * * @return A clone. * * @throws CloneNotSupportedException if the chart is not cloneable. */ public Object clone() throws CloneNotSupportedException { JFreeChart chart = (JFreeChart) super.clone(); chart.renderingHints = (RenderingHints) this.renderingHints.clone(); // private boolean borderVisible; // private transient Stroke borderStroke; // private transient Paint borderPaint; if (this.title != null) { chart.title = (TextTitle) this.title.clone(); chart.title.addChangeListener(chart); } chart.subtitles = new ArrayList(); for (int i = 0; i < getSubtitleCount(); i++) { Title subtitle = (Title) getSubtitle(i).clone(); chart.subtitles.add(subtitle); subtitle.addChangeListener(chart); } if (this.plot != null) { chart.plot = (Plot) this.plot.clone(); chart.plot.addChangeListener(chart); } chart.progressListeners = new EventListenerList(); chart.changeListeners = new EventListenerList(); return chart; }
Example #10
Source File: JGenProg2017_003_s.java From coming with MIT License | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #11
Source File: JFreeChartTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the getSubtitles() method. */ public void testGetSubtitles() { DefaultPieDataset dataset = new DefaultPieDataset(); JFreeChart chart = ChartFactory.createPieChart("title", dataset, true); List subtitles = chart.getSubtitles(); assertEquals(1, chart.getSubtitleCount()); // adding something to the returned list should NOT change the chart subtitles.add(new TextTitle("T")); assertEquals(1, chart.getSubtitleCount()); }
Example #12
Source File: JFreeChartTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Some checks for title changes and event notification. */ @Test public void testTitleChangeEvent() { DefaultPieDataset dataset = new DefaultPieDataset(); JFreeChart chart = ChartFactory.createPieChart("title", dataset); chart.addChangeListener(this); this.lastChartChangeEvent = null; TextTitle t = chart.getTitle(); t.setFont(new Font("Dialog", Font.BOLD, 9)); assertNotNull(this.lastChartChangeEvent); this.lastChartChangeEvent = null; // now create a new title and replace the existing title, several // things should happen: // (1) Adding the new title should trigger an immediate // ChartChangeEvent; // (2) Modifying the new title should trigger a ChartChangeEvent; // (3) Modifying the old title should NOT trigger a ChartChangeEvent TextTitle t2 = new TextTitle("T2"); chart.setTitle(t2); assertNotNull(this.lastChartChangeEvent); this.lastChartChangeEvent = null; t2.setFont(new Font("Dialog", Font.BOLD, 9)); assertNotNull(this.lastChartChangeEvent); this.lastChartChangeEvent = null; t.setFont(new Font("Dialog", Font.BOLD, 9)); assertNull(this.lastChartChangeEvent); this.lastChartChangeEvent = null; }
Example #13
Source File: Cardumen_0077_t.java From coming with MIT License | 5 votes |
/** * Sets the main title for the chart and sends a {@link ChartChangeEvent} * to all registered listeners. If you do not want a title for the * chart, set it to <code>null</code>. If you want more than one title on * a chart, use the {@link #addSubtitle(Title)} method. * * @param title the title (<code>null</code> permitted). * * @see #getTitle() */ public void setTitle(TextTitle title) { if (this.title != null) { this.title.removeChangeListener(this); } this.title = title; if (title != null) { title.addChangeListener(this); } fireChartChanged(); }
Example #14
Source File: JGenProg2017_003_t.java From coming with MIT License | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #15
Source File: JGenProg2017_00127_t.java From coming with MIT License | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #16
Source File: CompositeTitleTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // frame t1.setFrame(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setFrame(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #17
Source File: ChartGesture.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
/** * The gesture entity type * * @param entity * @return */ public static Entity getGestureEntity(ChartEntity entity) { if (entity == null) return NONE; if (entity instanceof PlotEntity) return PLOT; if (entity instanceof AxisEntity) { AxisEntity e = (AxisEntity) entity; if (e.getAxis().getPlot() instanceof XYPlot) { XYPlot plot = ((XYPlot) e.getAxis().getPlot()); for (int i = 0; i < plot.getDomainAxisCount(); i++) if (plot.getDomainAxis(i).equals(e.getAxis())) return DOMAIN_AXIS; for (int i = 0; i < plot.getRangeAxisCount(); i++) if (plot.getRangeAxis(i).equals(e.getAxis())) return RANGE_AXIS; } // else return basic axis return AXIS; } if (entity instanceof LegendItemEntity) return LEGEND_ITEM; if (entity instanceof XYItemEntity) return XY_ITEM; if (entity instanceof XYAnnotationEntity) return XY_ANNOTATION; if (entity instanceof TitleEntity) { if (((TitleEntity) entity).getTitle() instanceof TextTitle) return TEXT_TITLE; else return NON_TEXT_TITLE; } if (entity instanceof JFreeChartEntity) return JFREECHART; if (entity instanceof CategoryItemEntity) return CATEGORY_ITEM; return GENERAL; }
Example #18
Source File: Cardumen_00241_s.java From coming with MIT License | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #19
Source File: CompositeTitleTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); t1.getContainer().add(new TextTitle("T1")); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); int h1 = t1.hashCode(); int h2 = t2.hashCode(); assertEquals(h1, h2); }
Example #20
Source File: JFreeChart.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Sets the main title for the chart and sends a {@link ChartChangeEvent} * to all registered listeners. If you do not want a title for the * chart, set it to <code>null</code>. If you want more than one title on * a chart, use the {@link #addSubtitle(Title)} method. * * @param title the title (<code>null</code> permitted). * * @see #getTitle() */ public void setTitle(TextTitle title) { if (this.title != null) { this.title.removeChangeListener(this); } this.title = title; if (title != null) { title.addChangeListener(this); } fireChartChanged(); }
Example #21
Source File: JFreeChartPlotEngine.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Sets all the format options on the given chart like fonts, chart title, legend, legend * position etc. */ private void formatChart(JFreeChart chart) { Plot plot = chart.getPlot(); PlotConfiguration currentPlotConfigurationClone = plotInstance.getCurrentPlotConfigurationClone(); // set plot background color plot.setBackgroundPaint(currentPlotConfigurationClone.getPlotBackgroundColor()); formatLegend(chart); // set chart background color chart.setBackgroundPaint(currentPlotConfigurationClone.getChartBackgroundColor()); // add title to chart String text = currentPlotConfigurationClone.getTitleText(); if (text == null) { chart.setTitle(text); } else { Font font = currentPlotConfigurationClone.getTitleFont(); if (font == null) { font = FontTools.getFont(Font.DIALOG, Font.PLAIN, 10); } TextTitle textTitle = new TextTitle(text, font); textTitle.setPaint(currentPlotConfigurationClone.getTitleColor()); chart.setTitle(textTitle); } }
Example #22
Source File: jKali_0052_s.java From coming with MIT License | 5 votes |
/** * Clones the object, and takes care of listeners. * Note: caller shall register its own listeners on cloned graph. * * @return A clone. * * @throws CloneNotSupportedException if the chart is not cloneable. */ public Object clone() throws CloneNotSupportedException { JFreeChart chart = (JFreeChart) super.clone(); chart.renderingHints = (RenderingHints) this.renderingHints.clone(); // private boolean borderVisible; // private transient Stroke borderStroke; // private transient Paint borderPaint; if (this.title != null) { chart.title = (TextTitle) this.title.clone(); chart.title.addChangeListener(chart); } chart.subtitles = new ArrayList(); for (int i = 0; i < getSubtitleCount(); i++) { Title subtitle = (Title) getSubtitle(i).clone(); chart.subtitles.add(subtitle); subtitle.addChangeListener(chart); } if (this.plot != null) { chart.plot = (Plot) this.plot.clone(); chart.plot.addChangeListener(chart); } chart.progressListeners = new EventListenerList(); chart.changeListeners = new EventListenerList(); return chart; }
Example #23
Source File: Cardumen_003_s.java From coming with MIT License | 5 votes |
/** * Sets the main title for the chart and sends a {@link ChartChangeEvent} * to all registered listeners. If you do not want a title for the * chart, set it to <code>null</code>. If you want more than one title on * a chart, use the {@link #addSubtitle(Title)} method. * * @param title the title (<code>null</code> permitted). * * @see #getTitle() */ public void setTitle(TextTitle title) { if (this.title != null) { this.title.removeChangeListener(this); } this.title = title; if (title != null) { title.addChangeListener(this); } fireChartChanged(); }
Example #24
Source File: Cardumen_00193_t.java From coming with MIT License | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #25
Source File: Cardumen_00141_t.java From coming with MIT License | 5 votes |
/** * Sets the main title for the chart and sends a {@link ChartChangeEvent} * to all registered listeners. If you do not want a title for the * chart, set it to <code>null</code>. If you want more than one title on * a chart, use the {@link #addSubtitle(Title)} method. * * @param title the title (<code>null</code> permitted). * * @see #getTitle() */ public void setTitle(TextTitle title) { if (this.title != null) { this.title.removeChangeListener(this); } this.title = title; if (title != null) { title.addChangeListener(this); } fireChartChanged(); }
Example #26
Source File: Cardumen_003_t.java From coming with MIT License | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }
Example #27
Source File: JGenProg2015_000_s.java From coming with MIT License | 5 votes |
/** * Sets the main title for the chart and sends a {@link ChartChangeEvent} * to all registered listeners. If you do not want a title for the * chart, set it to <code>null</code>. If you want more than one title on * a chart, use the {@link #addSubtitle(Title)} method. * * @param title the title (<code>null</code> permitted). * * @see #getTitle() */ public void setTitle(TextTitle title) { if (this.title != null) { this.title.removeChangeListener(this); } this.title = title; if (title != null) { title.addChangeListener(this); } fireChartChanged(); }
Example #28
Source File: JFreeChart.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Clones the object, and takes care of listeners. * Note: caller shall register its own listeners on cloned graph. * * @return A clone. * * @throws CloneNotSupportedException if the chart is not cloneable. */ public Object clone() throws CloneNotSupportedException { JFreeChart chart = (JFreeChart) super.clone(); chart.renderingHints = (RenderingHints) this.renderingHints.clone(); // private boolean borderVisible; // private transient Stroke borderStroke; // private transient Paint borderPaint; if (this.title != null) { chart.title = (TextTitle) this.title.clone(); chart.title.addChangeListener(chart); } chart.subtitles = new ArrayList(); for (int i = 0; i < getSubtitleCount(); i++) { Title subtitle = (Title) getSubtitle(i).clone(); chart.subtitles.add(subtitle); subtitle.addChangeListener(chart); } if (this.plot != null) { chart.plot = (Plot) this.plot.clone(); chart.plot.addChangeListener(chart); } chart.progressListeners = new EventListenerList(); chart.changeListeners = new EventListenerList(); return chart; }
Example #29
Source File: AbstractChartBuilder.java From livingdoc-confluence with GNU General Public License v3.0 | 5 votes |
protected void addSubTitle(JFreeChart chart, String subTitle, Font font) { if (StringUtils.isNotEmpty(subTitle)) { TextTitle chartSubTitle = new TextTitle(subTitle); customizeTitle(chartSubTitle, font); chart.addSubtitle(chartSubTitle); } }
Example #30
Source File: JFreeChart.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * 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</code> is <code>null</code> the chart * title is set to <code>null</code>. * * @param text the title text (<code>null</code> 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); } }