本文整理了Java中org.jfree.chart.title.TextTitle.setFont()
方法的一些代码示例,展示了TextTitle.setFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextTitle.setFont()
方法的具体详情如下:
包路径:org.jfree.chart.title.TextTitle
类名称:TextTitle
方法名:setFont
[英]Sets the font used to display the title string. Registered listeners are notified that the title has been modified.
[中]设置用于显示标题字符串的字体。已注册的听众将收到标题已被修改的通知。
代码示例来源:origin: pentaho/pentaho-kettle
title.setFont( new java.awt.Font( "SansSerif", java.awt.Font.BOLD, 12 ) );
chart.setTitle( title );
CategoryPlot plot = (CategoryPlot) chart.getPlot();
代码示例来源:origin: fossasia/neurolab-desktop
lineChart.getTitle().setFont(new Font("Ubuntu", Font.PLAIN, 20));
lineChart.getPlot().setOutlineStroke(new BasicStroke(3));
lineChart.getCategoryPlot().getRenderer().setSeriesStroke(0, new BasicStroke(3));
代码示例来源:origin: com.atlassian.jira/jira-api
public static void setupTextTitle(TextTitle title)
{
if (title != null)
{
title.setFont(ChartDefaults.titleFont);
title.setTextAlignment(HorizontalAlignment.LEFT);
title.setPaint(ChartDefaults.titleTextColor);
title.setBackgroundPaint(ChartDefaults.transparent);
}
}
代码示例来源:origin: com.atlassian.confluence.extra.chart/chart-plugin
public static void setupTextTitle(TextTitle title)
{
if (title != null) {
title.setFont(ChartDefaults.titleFont);
title.setTextAlignment(HorizontalAlignment.LEFT);
title.setPaint(ChartDefaults.titleTextColor);
title.setBackgroundPaint(ChartDefaults.transparent);
}
}
代码示例来源:origin: afranken/jmeter-analysis-maven-plugin
public static JFreeChart createJFreeChart(String title, XYPlot result, int imageHeight) {
JFreeChart chart = new JFreeChart(title, result);
chart.getLegend().setPosition(RectangleEdge.TOP);
chart.getLegend().setHorizontalAlignment(HorizontalAlignment.LEFT);
chart.getLegend().setFrame(BlockBorder.NONE);
chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, imageHeight, new Color(229, 236, 246)));
chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN | Font.BOLD, 16));
chart.getTitle().setPaint(Color.GRAY);
return chart;
}
}
代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark
public JFreeChart createChart() {
JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(
title, "Matrix Libraries", "Relative Performance", dataSet,
true);
CategoryPlot plot = chart.getCategoryPlot();
plot.setDomainGridlinesVisible(true);
plot.setBackgroundPaint(new Color(230,230,230));
plot.setDomainGridlinePaint(new Color(50,50,50,50));
plot.setDomainGridlineStroke(new BasicStroke(78f));
chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24));
String foo = "( Higher is Better )";
if( subtitle != null )
foo += " ( "+subtitle+" )";
chart.addSubtitle(new TextTitle(foo,new Font("SansSerif", Font.ITALIC, 12)));
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
return chart;
}
代码示例来源:origin: dhis2/dhis2-core
private TextTitle getSubTitle( BaseChart chart )
{
TextTitle textTitle = new TextTitle();
String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle();
textTitle.setFont( SUB_TITLE_FONT );
textTitle.setText( title );
return textTitle;
}
代码示例来源:origin: org.n52.series-api/io
private void addNotice(JFreeChart chart) {
TextTitle notice = new TextTitle();
String msg = i18n.get("msg.io.chart.notice");
if (msg != null && !msg.isEmpty()) {
notice.setText(msg);
notice.setPaint(Color.BLACK);
notice.setFont(LabelConstants.FONT_LABEL_SMALL);
notice.setPosition(RectangleEdge.BOTTOM);
notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
notice.setPadding(new RectangleInsets(0, 0, 20, 20));
chart.addSubtitle(notice);
}
}
代码示例来源:origin: org.n52.sensorweb/timeseries-io
private void addNotice(JFreeChart chart) {
TextTitle notice = new TextTitle();
String msg = i18n.get("notice");
if (msg != null && !msg.isEmpty()) {
notice.setText(msg);
notice.setPaint(BLACK);
notice.setFont(FONT_LABEL_SMALL);
notice.setPosition(RectangleEdge.BOTTOM);
notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
notice.setPadding(new RectangleInsets(0, 0, 20, 20));
chart.addSubtitle(notice);
}
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Applies this theme to the supplied chart.
*
* @param chart the chart (<code>null</code> not permitted).
*/
public void apply(JFreeChart chart) {
if (chart == null) {
throw new IllegalArgumentException("Null 'chart' argument.");
}
TextTitle title = chart.getTitle();
if (title != null) {
title.setFont(this.extraLargeFont);
title.setPaint(this.titlePaint);
}
int subtitleCount = chart.getSubtitleCount();
for (int i = 0; i < subtitleCount; i++) {
applyToTitle(chart.getSubtitle(i));
}
chart.setBackgroundPaint(this.chartBackgroundPaint);
// now process the plot if there is one
Plot plot = chart.getPlot();
if (plot != null) {
applyToPlot(plot);
}
}
代码示例来源:origin: bcdev/beam
private void setPlotMessage(String messageText) {
chart.getXYPlot().clearAnnotations();
TextTitle tt = new TextTitle(messageText);
tt.setTextAlignment(HorizontalAlignment.RIGHT);
tt.setFont(chart.getLegend().getItemFont());
tt.setBackgroundPaint(new Color(200, 200, 255, 50));
tt.setFrame(new BlockBorder(Color.white));
tt.setPosition(RectangleEdge.BOTTOM);
XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER);
chart.getXYPlot().addAnnotation(message);
}
代码示例来源:origin: senbox-org/snap-desktop
private void setPlotMessage(String messageText) {
chart.getXYPlot().clearAnnotations();
TextTitle tt = new TextTitle(messageText);
tt.setTextAlignment(HorizontalAlignment.RIGHT);
tt.setFont(chart.getLegend().getItemFont());
tt.setBackgroundPaint(new Color(200, 200, 255, 50));
tt.setFrame(new BlockBorder(Color.white));
tt.setPosition(RectangleEdge.BOTTOM);
XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER);
chart.getXYPlot().addAnnotation(message);
}
代码示例来源:origin: dhis2/dhis2-core
/**
* Sets basic configuration including title font, subtitle, background paint and
* anti-alias on the given JFreeChart.
*/
private void setBasicConfig( JFreeChart jFreeChart, BaseChart chart)
{
jFreeChart.getTitle().setFont( TITLE_FONT );
jFreeChart.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR );
jFreeChart.setAntiAlias( true );
if ( !chart.isHideTitle() )
{
jFreeChart.addSubtitle( getSubTitle( chart ) );
}
Plot plot = jFreeChart.getPlot();
plot.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR );
plot.setOutlinePaint( DEFAULT_BACKGROUND_COLOR );
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
graph.getTitle().setFont(new Font("SansSerif", Font.BOLD, 26));
graph.getXYPlot().getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 20));
graph.getXYPlot().getRangeAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 20));
代码示例来源:origin: jfree/jfreechart
/**
* Sets the properties of the specified title to match the properties
* defined on this panel.
*
* @param chart the chart whose title is to be modified.
*/
public void setTitleProperties(JFreeChart chart) {
if (this.showTitle) {
TextTitle title = chart.getTitle();
if (title == null) {
title = new TextTitle();
chart.setTitle(title);
}
title.setText(getTitleText());
title.setFont(getTitleFont());
title.setPaint(getTitlePaint());
}
else {
chart.setTitle((TextTitle) null);
}
}
代码示例来源:origin: superad/pdf-kit
private void initDefaultPlot(JFreeChart chart,DefaultCategoryDataset dataSet){
//设置公共颜色
chart.getTitle().setFont(FontUtil.getFont(Font.PLAIN, 15)); // 设置标题字体
chart.getLegend().setItemFont(FontUtil.getFont(Font.PLAIN, 13));// 设置图例类别字体
chart.setBackgroundPaint(Color.white);// 设置背景色
CategoryPlot plot = chart.getCategoryPlot();
plot.setNoDataMessage("无对应的数据。");
plot.setNoDataMessageFont(FontUtil.getFont(Font.PLAIN, 13));//字体的大小
plot.setNoDataMessagePaint(Color.RED);//字体颜色
//设置自定义颜色
initPlot(chart,dataSet);
}
代码示例来源:origin: jfree/jfreechart
/**
* Applies this theme to the supplied chart.
*
* @param chart the chart ({@code null} not permitted).
*/
@Override
public void apply(JFreeChart chart) {
Args.nullNotPermitted(chart, "chart");
TextTitle title = chart.getTitle();
if (title != null) {
title.setFont(this.extraLargeFont);
title.setPaint(this.titlePaint);
}
int subtitleCount = chart.getSubtitleCount();
for (int i = 0; i < subtitleCount; i++) {
applyToTitle(chart.getSubtitle(i));
}
chart.setBackgroundPaint(this.chartBackgroundPaint);
// now process the plot if there is one
Plot plot = chart.getPlot();
if (plot != null) {
applyToPlot(plot);
}
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Sets the properties of the specified title to match the properties
* defined on this panel.
*
* @param chart the chart whose title is to be modified.
*/
public void setTitleProperties(JFreeChart chart) {
if (this.showTitle) {
TextTitle title = chart.getTitle();
if (title == null) {
title = new TextTitle();
chart.setTitle(title);
}
title.setText(getTitleText());
title.setFont(getTitleFont());
title.setPaint(getTitlePaint());
}
else {
chart.setTitle((TextTitle) null);
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public static void customizeTitle(TextTitle title, ChartParams params, String prefix)
title.setFont(params.getFont(prefix + ChartParams.TITLE_FONT_SUFFIX));
} else {
title.setFont(JFreeChart.DEFAULT_TITLE_FONT);
代码示例来源:origin: dhis2/dhis2-core
private JFreeChart getMultiplePieChart( BaseChart chart, CategoryDataset[] dataSets )
{
JFreeChart multiplePieChart = ChartFactory.createMultiplePieChart( chart.getName(), dataSets[0], TableOrder.BY_ROW,
!chart.isHideLegend(), false, false );
setBasicConfig( multiplePieChart, chart );
if ( multiplePieChart.getLegend() != null )
{
multiplePieChart.getLegend().setItemFont( SUB_TITLE_FONT );
}
MultiplePiePlot multiplePiePlot = (MultiplePiePlot) multiplePieChart.getPlot();
JFreeChart pieChart = multiplePiePlot.getPieChart();
pieChart.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR );
pieChart.getTitle().setFont( SUB_TITLE_FONT );
PiePlot piePlot = (PiePlot) pieChart.getPlot();
piePlot.setBackgroundPaint( DEFAULT_BACKGROUND_COLOR );
piePlot.setOutlinePaint( DEFAULT_BACKGROUND_COLOR );
piePlot.setLabelFont( LABEL_FONT );
piePlot.setLabelGenerator( new StandardPieSectionLabelGenerator( "{2}" ) );
piePlot.setSimpleLabels( true );
piePlot.setIgnoreZeroValues( true );
piePlot.setIgnoreNullValues( true );
piePlot.setShadowXOffset( 0d );
piePlot.setShadowYOffset( 0d );
for ( int i = 0; i < dataSets[0].getColumnCount(); i++ )
{
piePlot.setSectionPaint( dataSets[0].getColumnKey( i ), COLORS[(i % COLORS.length)] );
}
return multiplePieChart;
}
内容来源于网络,如有侵权,请联系作者删除!