本文整理汇总了Java中org.jfree.chart.title.TextTitle.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java TextTitle.setPadding方法的具体用法?Java TextTitle.setPadding怎么用?Java TextTitle.setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.title.TextTitle
的用法示例。
在下文中一共展示了TextTitle.setPadding方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
@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));
}
示例2: configureChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
@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());
}
}
示例3: getChartPanel
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
private ChartPanel getChartPanel() {
if (chartPanel == null) {
CombinedDomainXYPlot combinedDomainXYPlot = getCombinedDomainXYPlot();
JFreeChart jFreeChart = new JFreeChart(filename, JFreeChart.DEFAULT_TITLE_FONT, combinedDomainXYPlot,
false);
ChartUtilities.applyCurrentTheme(jFreeChart);
// customise the title position and font
TextTitle t = jFreeChart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.CENTER);
t.setPaint(Color.DARK_GRAY);
t.setFont(new Font("Arial", Font.BOLD, 12));
t.setPadding(10, 10, 5, 10);
chartPanel = new ChartPanel(jFreeChart);
chartPanel.setMinimumDrawWidth(0);
chartPanel.setMinimumDrawHeight(0);
chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
chartPanel.setMouseWheelEnabled(true);
LogTableModel logTableModel = (LogTableModel) logTable.getModel();
NavigationTableController<Integer> navigationTableController;
navigationTableController = new NavigationTableController<Integer>(logTableModel);
navigationTableController.addCustomJTable(logTable);
chartPanel.addChartMouseListener(
new CombinedDomainXYPlotMouseListener(chartPanel, logTableModel, navigationTableController));
chartPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
}
return chartPanel;
}
示例4: setChartSubtitles
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
protected void setChartSubtitles(JFreeChart jfreeChart, Integer baseFontSize) throws JRException
{
Boolean subtitleVisibility = (Boolean)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_VISIBLE);
if (subtitleVisibility != null && subtitleVisibility.booleanValue())
{
String subtitleText = evaluateTextExpression(getChart().getSubtitleExpression());
if (subtitleText != null)
{
TextTitle subtitle = new TextTitle(subtitleText);
Font themeSubtitleFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FONT), getChart().getSubtitleFont(), baseFontSize);
subtitle.setFont(themeSubtitleFont);
HorizontalAlignment defaultSubtitleHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_HORIZONTAL_ALIGNMENT);
if (defaultSubtitleHAlignment != null)
subtitle.setHorizontalAlignment(defaultSubtitleHAlignment);
VerticalAlignment defaultSubtitleVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_VERTICAL_ALIGNMENT);
if (defaultSubtitleVAlignment != null)
subtitle.setVerticalAlignment(defaultSubtitleVAlignment);
RectangleInsets defaultSubtitlePadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_PADDING);
RectangleInsets subtitlePadding = subtitle.getPadding() != null ? subtitle.getPadding() : defaultSubtitlePadding;
if (subtitlePadding != null)
subtitle.setPadding(subtitlePadding);
Color subtitleForecolor = getChart().getOwnSubtitleColor() != null ?
getChart().getOwnSubtitleColor() :
(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) != null ?
(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_FORECOLOR) :
getChart().getSubtitleColor());
if (subtitleForecolor != null)
subtitle.setPaint(subtitleForecolor);
Color subtitleBackcolor = getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) != null ?
(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_BACKCOLOR) :
null;
if (subtitleBackcolor != null)
subtitle.setBackgroundPaint(subtitleBackcolor);
RectangleEdge defaultSubtitlePosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SUBTITLE_POSITION);
//Subtitle has not its own position set, and by default this will be set the same as title position
RectangleEdge subtitleEdge = null;
if (defaultSubtitlePosition == null)
{
subtitleEdge = jfreeChart.getTitle().getPosition();
}
else
{
subtitleEdge = defaultSubtitlePosition;
}
if (subtitleEdge != null)
subtitle.setPosition(subtitleEdge);
jfreeChart.addSubtitle(subtitle);
}
}
}
示例5: createChart
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* Creates a Area chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
protected JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createAreaChart(
chartTitle, // chart title
domainLabel, // domain axis label
rangeLabel, // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
!legendPanelOn, // include legend
true, // tooltips
false // urls
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
chart.setBackgroundPaint(Color.white);
if(isDemo){
TextTitle subtitle = new TextTitle(
"An area chart demonstration. We use this subtitle as an "
+ "example of what happens when you get a really long title or "
+ "subtitle."
);
subtitle.setFont(new Font("SansSerif", Font.PLAIN, 12));
subtitle.setPosition(RectangleEdge.TOP);
subtitle.setPadding(
new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05, 0.05)
);
subtitle.setVerticalAlignment(VerticalAlignment.BOTTOM);
chart.addSubtitle(subtitle);
}
CategoryPlot plot = chart.getCategoryPlot();
plot.setForegroundAlpha(0.5f);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.white);
AreaRenderer renderer = (AreaRenderer)plot.getRenderer();
renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
if(isDemo){
domainAxis.addCategoryLabelToolTip("Type 1", "The first type.");
domainAxis.addCategoryLabelToolTip("Type 2", "The second type.");
domainAxis.addCategoryLabelToolTip("Type 3", "The third type.");
}
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
// OPTIONAL CUSTOMISATION COMPLETED.
setCategorySummary(dataset);
return chart;
}
示例6: getBoxAndWiskerPanel
import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
/**
* @return the boxAndWiskerPanel
*/
private ChartPanel getBoxAndWiskerPanel() {
if (boxAndWiskerPanel == null) {
CombinedDomainCategoryPlot combinedBoxAndWiskerCategoryPlot = getCombinedBoxAndWiskerCategoryPlot();
JFreeChart jFreeChart = new JFreeChart(" ", JFreeChart.DEFAULT_TITLE_FONT,
combinedBoxAndWiskerCategoryPlot, false);
ChartUtilities.applyCurrentTheme(jFreeChart);
TextTitle t = jFreeChart.getTitle();
t.setHorizontalAlignment(HorizontalAlignment.CENTER);
t.setPaint(Color.DARK_GRAY);
t.setFont(new Font("Arial", Font.BOLD, 12));
t.setPadding(10, 10, 5, 10);
boxAndWiskerPanel = new ChartPanel(jFreeChart);
Dimension preferredSize = new Dimension(140, 200);
boxAndWiskerPanel.setMinimumSize(preferredSize);
boxAndWiskerPanel.setPreferredSize(preferredSize);
boxAndWiskerPanel.setMinimumDrawWidth(0);
boxAndWiskerPanel.setMinimumDrawHeight(0);
boxAndWiskerPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
boxAndWiskerPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
boxAndWiskerPanel.setMouseWheelEnabled(true);
boxAndWiskerPanel.addChartMouseListener(new CombinedDomainCategoryPlotMouseListener(chartPanel, logTable));
boxAndWiskerPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
// TODO revert when functionality done
boxAndWiskerPanel.setVisible(true);
}
return boxAndWiskerPanel;
}