Java Code Examples for org.jfree.chart.StandardChartTheme#getExtraLargeFont()

The following examples show how to use org.jfree.chart.StandardChartTheme#getExtraLargeFont() . 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: GraphData.java    From iBioSim with Apache License 2.0 6 votes vote down vote up
public void applyChartTheme() {
	final StandardChartTheme chartTheme = (StandardChartTheme) org.jfree.chart.StandardChartTheme
			.createJFreeTheme();

	final Font oldExtraLargeFont = chartTheme.getExtraLargeFont();
	final Font oldLargeFont = chartTheme.getLargeFont();
	final Font oldRegularFont = chartTheme.getRegularFont();
	final Font oldSmallFont = chartTheme.getSmallFont();

	final Font extraLargeFont = new Font("Sans-serif", oldExtraLargeFont.getStyle(), oldExtraLargeFont.getSize());
	final Font largeFont = new Font("Sans-serif", oldLargeFont.getStyle(), oldLargeFont.getSize());
	final Font regularFont = new Font("Sans-serif", oldRegularFont.getStyle(), oldRegularFont.getSize());
	final Font smallFont = new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize());

	chartTheme.setExtraLargeFont(extraLargeFont);
	chartTheme.setLargeFont(largeFont);
	chartTheme.setRegularFont(regularFont);
	chartTheme.setSmallFont(smallFont);

	chartTheme.apply(chart);
}
 
Example 2
Source File: AbstractBeltColumnStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Changes the font of {@link JFreeChart}s to Sans Serif. This method uses a
 * {@link StandardChartTheme} to do so, so any changes to the look of the chart must be done
 * after calling this method.
 *
 * @param chart
 *            the chart to change fonts for
 */
static void setDefaultChartFonts(JFreeChart chart) {
	final ChartTheme chartTheme = StandardChartTheme.createJFreeTheme();

	if (StandardChartTheme.class.isAssignableFrom(chartTheme.getClass())) {
		StandardChartTheme standardTheme = (StandardChartTheme) chartTheme;
		// The default font used by JFreeChart cannot render japanese etc symbols
		final Font oldExtraLargeFont = standardTheme.getExtraLargeFont();
		final Font oldLargeFont = standardTheme.getLargeFont();
		final Font oldRegularFont = standardTheme.getRegularFont();
		final Font oldSmallFont = standardTheme.getSmallFont();

		final Font extraLargeFont = FontTools.getFont(Font.SANS_SERIF, oldExtraLargeFont.getStyle(),
				oldExtraLargeFont.getSize());
		final Font largeFont = FontTools.getFont(Font.SANS_SERIF, oldLargeFont.getStyle(), oldLargeFont.getSize());
		final Font regularFont = FontTools.getFont(Font.SANS_SERIF, oldRegularFont.getStyle(), oldRegularFont.getSize());
		final Font smallFont = FontTools.getFont(Font.SANS_SERIF, oldSmallFont.getStyle(), oldSmallFont.getSize());

		standardTheme.setExtraLargeFont(extraLargeFont);
		standardTheme.setLargeFont(largeFont);
		standardTheme.setRegularFont(regularFont);
		standardTheme.setSmallFont(smallFont);

		standardTheme.apply(chart);
	}
}
 
Example 3
Source File: AbstractAttributeStatisticsModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Changes the font of {@link JFreeChart}s to Sans Serif. This method uses a
 * {@link StandardChartTheme} to do so, so any changes to the look of the chart must be done
 * after calling this method.
 *
 * @param chart
 *            the chart to change fonts for
 */
protected static void setDefaultChartFonts(JFreeChart chart) {
	final ChartTheme chartTheme = StandardChartTheme.createJFreeTheme();

	if (StandardChartTheme.class.isAssignableFrom(chartTheme.getClass())) {
		StandardChartTheme standardTheme = (StandardChartTheme) chartTheme;
		// The default font used by JFreeChart cannot render japanese etc symbols
		final Font oldExtraLargeFont = standardTheme.getExtraLargeFont();
		final Font oldLargeFont = standardTheme.getLargeFont();
		final Font oldRegularFont = standardTheme.getRegularFont();
		final Font oldSmallFont = standardTheme.getSmallFont();

		final Font extraLargeFont = FontTools.getFont(Font.SANS_SERIF, oldExtraLargeFont.getStyle(),
				oldExtraLargeFont.getSize());
		final Font largeFont = FontTools.getFont(Font.SANS_SERIF, oldLargeFont.getStyle(), oldLargeFont.getSize());
		final Font regularFont = FontTools.getFont(Font.SANS_SERIF, oldRegularFont.getStyle(), oldRegularFont.getSize());
		final Font smallFont = FontTools.getFont(Font.SANS_SERIF, oldSmallFont.getStyle(), oldSmallFont.getSize());

		standardTheme.setExtraLargeFont(extraLargeFont);
		standardTheme.setLargeFont(largeFont);
		standardTheme.setRegularFont(regularFont);
		standardTheme.setSmallFont(smallFont);

		standardTheme.apply(chart);
	}
}