本文整理汇总了Java中org.jfree.chart.StandardChartTheme.apply方法的典型用法代码示例。如果您正苦于以下问题:Java StandardChartTheme.apply方法的具体用法?Java StandardChartTheme.apply怎么用?Java StandardChartTheme.apply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.StandardChartTheme
的用法示例。
在下文中一共展示了StandardChartTheme.apply方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDefaultChartFonts
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
/**
* 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 = new Font(Font.SANS_SERIF, oldExtraLargeFont.getStyle(), oldExtraLargeFont.getSize());
final Font largeFont = new Font(Font.SANS_SERIF, oldLargeFont.getStyle(), oldLargeFont.getSize());
final Font regularFont = new Font(Font.SANS_SERIF, oldRegularFont.getStyle(), oldRegularFont.getSize());
final Font smallFont = new Font(Font.SANS_SERIF, oldSmallFont.getStyle(), oldSmallFont.getSize());
standardTheme.setExtraLargeFont(extraLargeFont);
standardTheme.setLargeFont(largeFont);
standardTheme.setRegularFont(regularFont);
standardTheme.setSmallFont(smallFont);
standardTheme.apply(chart);
}
}
示例2: applyChartTheme
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
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);
}
示例3: setDefaultChartFonts
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
/**
* 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);
}
}
示例4: notSoUglyPlease
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
private static void notSoUglyPlease(JFreeChart chart) {
String fontName = "Lucida Sans";
StandardChartTheme theme = (StandardChartTheme)org.jfree.chart.StandardChartTheme.createJFreeTheme();
theme.setTitlePaint( Color.decode("#4572a7") );
theme.setExtraLargeFont(new Font(fontName, Font.BOLD, 14)); //title
theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title
theme.setRegularFont(new Font(fontName, Font.PLAIN, 11));
theme.setRangeGridlinePaint(Color.decode("#C0C0C0"));
theme.setPlotBackgroundPaint(Color.white);
theme.setChartBackgroundPaint(Color.white);
theme.setGridBandPaint(Color.red);
theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
theme.setBarPainter(new StandardBarPainter());
theme.setAxisLabelPaint(Color.decode("#666666"));
theme.apply(chart);
chart.getCategoryPlot().setOutlineVisible(false);
chart.getCategoryPlot().getRangeAxis().setAxisLineVisible(false);
chart.getCategoryPlot().getRangeAxis().setTickMarksVisible(false);
chart.getCategoryPlot().setRangeGridlineStroke(new BasicStroke());
chart.getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.decode("#666666"));
chart.getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.decode("#666666"));
chart.setTextAntiAlias(true);
chart.setAntiAlias(true);
BarRenderer rend = (BarRenderer) chart.getCategoryPlot().getRenderer();
rend.setShadowVisible(true);
rend.setShadowXOffset(2);
rend.setShadowYOffset(0);
rend.setShadowPaint(Color.decode("#C0C0C0"));
rend.setMaximumBarWidth(0.1);
}
示例5: changeFontSize
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
/**
* convenience method to make the value marker labels larger or smaller
*
* @param up
*/
private void changeFontSize(final Boolean up)
{
// are we making a change?
final float change;
if (up != null)
{
// sort out which direction we're changing
if (up)
{
change = MARKER_STEP_SIZE;
}
else
{
change = -MARKER_STEP_SIZE;
}
}
else
{
change = 0;
}
// do we have a default?
final float curSize =
Activator.getDefault().getPreferenceStore().getFloat(
TimeBarPlot.CHART_FONT_SIZE_NODE);
// trim to reasonable size
final float sizeToUse = Math.max(9, curSize);
// produce new size
final float newVal = sizeToUse + change;
// store the new size
Activator.getDefault().getPreferenceStore().setValue(
TimeBarPlot.CHART_FONT_SIZE_NODE, newVal);
final float base = newVal;
final StandardChartTheme theme =
(StandardChartTheme) StandardChartTheme.createJFreeTheme();
theme.setRegularFont(theme.getRegularFont().deriveFont(base * 1.0f));
theme.setExtraLargeFont(theme.getExtraLargeFont().deriveFont(base * 1.4f));
theme.setLargeFont(theme.getLargeFont().deriveFont(base * 1.2f));
theme.setSmallFont(theme.getSmallFont().deriveFont(base * 0.8f));
theme.setChartBackgroundPaint(Color.white);
theme.setPlotBackgroundPaint(Color.white);
theme.setGridBandPaint(Color.lightGray);
theme.setDomainGridlinePaint(Color.lightGray);
theme.setRangeGridlinePaint(Color.lightGray);
theme.apply(jFreeChart);
}