本文整理汇总了Java中org.jfree.chart.StandardChartTheme.setSmallFont方法的典型用法代码示例。如果您正苦于以下问题:Java StandardChartTheme.setSmallFont方法的具体用法?Java StandardChartTheme.setSmallFont怎么用?Java StandardChartTheme.setSmallFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.StandardChartTheme
的用法示例。
在下文中一共展示了StandardChartTheme.setSmallFont方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initializeTheme
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
public static StandardChartTheme initializeTheme() {
String fontName = "Arial";
StandardChartTheme theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme();
theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 24)); // title
theme.setLargeFont(new Font(fontName, Font.PLAIN, 20)); // axis-title
theme.setRegularFont(new Font(fontName, Font.PLAIN, 16));
theme.setSmallFont(new Font(fontName, Font.PLAIN, 12));
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"));
return theme;
}
示例5: setChartTheme
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
public static void setChartTheme() {
StandardChartTheme chartTheme = new StandardChartTheme("CN");
chartTheme.setExtraLargeFont(FONT);
chartTheme.setRegularFont(FONT);
chartTheme.setLargeFont(FONT);
chartTheme.setSmallFont(FONT);
chartTheme.setTitlePaint(new Color(51, 51, 51));
chartTheme.setSubtitlePaint(new Color(85, 85, 85));
chartTheme.setLegendBackgroundPaint(Color.WHITE);
chartTheme.setLegendItemPaint(Color.BLACK);//
chartTheme.setChartBackgroundPaint(Color.WHITE);
Paint[] OUTLINE_PAINT_SEQUENCE = new Paint[]{Color.WHITE};
DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier(CHART_COLORS, CHART_COLORS, OUTLINE_PAINT_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
chartTheme.setDrawingSupplier(drawingSupplier);
chartTheme.setPlotBackgroundPaint(Color.WHITE);
chartTheme.setPlotOutlinePaint(Color.WHITE);
chartTheme.setLabelLinkPaint(new Color(8, 55, 114));
chartTheme.setLabelLinkStyle(PieLabelLinkStyle.CUBIC_CURVE);
chartTheme.setAxisOffset(new RectangleInsets(5, 12, 5, 12));
chartTheme.setDomainGridlinePaint(new Color(192, 208, 224));
chartTheme.setRangeGridlinePaint(new Color(192, 192, 192));
chartTheme.setBaselinePaint(Color.WHITE);
chartTheme.setCrosshairPaint(Color.BLUE);
chartTheme.setAxisLabelPaint(new Color(51, 51, 51));
chartTheme.setTickLabelPaint(new Color(67, 67, 72));
chartTheme.setBarPainter(new StandardBarPainter());
chartTheme.setXYBarPainter(new StandardXYBarPainter());
chartTheme.setItemLabelPaint(Color.black);
chartTheme.setThermometerPaint(Color.white);
ChartFactory.setChartTheme(chartTheme);
}
示例6: createChart
import org.jfree.chart.StandardChartTheme; //导入方法依赖的package包/类
private JFreeChart createChart(String chartContent, String title, String yaxisName){
//创建时序图对象
XYSeries = new XYSeries(chartContent);
XYSeriesCollection xySeriesCollection=new XYSeriesCollection(XYSeries);
// 设置中文主题样式 解决乱码
StandardChartTheme chartTheme = new StandardChartTheme("CN");
// 设置标题字体
chartTheme.setExtraLargeFont(font);
// 设置图例的字体
chartTheme.setRegularFont(font);
// 设置轴向的字体
chartTheme.setLargeFont(font);
chartTheme.setSmallFont(font);
ChartFactory.setChartTheme(chartTheme);
JFreeChart jfreechart = ChartFactory.createXYLineChart(title,"帧数",yaxisName,xySeriesCollection);
XYPlot xyplot = jfreechart.getXYPlot();
//纵坐标设定
ValueAxis valueaxis = xyplot.getDomainAxis();
//自动设置数据轴数据范围
valueaxis.setAutoRange(true);
//数据轴固定数据范围 30s
//valueaxis.setFixedAutoRange(100);
valueaxis = xyplot.getRangeAxis();
return jfreechart;
}
示例7: 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);
}