本文整理汇总了Java中org.jfree.chart.title.TextTitle类的典型用法代码示例。如果您正苦于以下问题:Java TextTitle类的具体用法?Java TextTitle怎么用?Java TextTitle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextTitle类属于org.jfree.chart.title包,在下文中一共展示了TextTitle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private static JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
"Performance: JFreeSVG vs Batik", null /* x-axis label*/,
"Milliseconds" /* y-axis label */, dataset);
chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG "
+ "format (lower bars = better performance)"));
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
chart.getLegend().setFrame(BlockBorder.NONE);
return chart;
}
示例2: createChart
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private static JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
"Performance: JFreeSVG vs Batik", null /* x-axis label*/,
"Milliseconds" /* y-axis label */, dataset, PlotOrientation.HORIZONTAL,false,false,false);
chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG "
+ "format (lower bars = better performance)"));
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
// ******************************************************************
// More than 150 demo applications are included with the JFreeChart
// Developer Guide...for more information, see:
//
// > http://www.object-refinery.com/jfreechart/guide.html
//
// ******************************************************************
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
// chart.getLegend().setFrame(BlockBorder.NONE);
return chart;
}
示例3: setTitle
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Sets the chart title. This is a convenience method that ends up calling the
* {@link #setTitle(TextTitle)} method.
*
* @param title the new title (<code>null</code> permitted).
*/
public void setTitle(String title) {
if (title != null) {
if (this.title == null) {
setTitle(new TextTitle(title, JFreeChart.DEFAULT_TITLE_FONT));
}
else {
this.title.setText(title);
}
}
else {
setTitle((TextTitle) null);
}
}
示例4: testEquals
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Some checks for the equals() method.
*/
public void testEquals() {
// use the TextTitle class because it is a concrete subclass
Title t1 = new TextTitle();
Title t2 = new TextTitle();
assertEquals(t1, t2);
t1.setPosition(RectangleEdge.LEFT);
assertFalse(t1.equals(t2));
t2.setPosition(RectangleEdge.LEFT);
assertTrue(t1.equals(t2));
t1.setHorizontalAlignment(HorizontalAlignment.RIGHT);
assertFalse(t1.equals(t2));
t2.setHorizontalAlignment(HorizontalAlignment.RIGHT);
assertTrue(t1.equals(t2));
t1.setVerticalAlignment(VerticalAlignment.BOTTOM);
assertFalse(t1.equals(t2));
t2.setVerticalAlignment(VerticalAlignment.BOTTOM);
assertTrue(t1.equals(t2));
}
示例5: MultiplePiePlot
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Creates a new plot.
*
* @param dataset the dataset (<code>null</code> permitted).
*/
public MultiplePiePlot(CategoryDataset dataset) {
super();
this.dataset = dataset;
PiePlot piePlot = new PiePlot(null);
this.pieChart = new JFreeChart(piePlot);
this.pieChart.removeLegend();
this.dataExtractOrder = TableOrder.BY_COLUMN;
this.pieChart.setBackgroundPaint(null);
TextTitle seriesTitle = new TextTitle("Series Title",
new Font("SansSerif", Font.BOLD, 12));
seriesTitle.setPosition(RectangleEdge.BOTTOM);
this.pieChart.setTitle(seriesTitle);
this.aggregatedItemsKey = "Other";
this.aggregatedItemsPaint = Color.lightGray;
this.sectionPaints = new HashMap();
}
示例6: testEquals
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
@Test
public void testEquals() {
TextTitle t = new TextTitle("Title");
XYTitleAnnotation a1 = new XYTitleAnnotation(1.0, 2.0, t);
XYTitleAnnotation a2 = new XYTitleAnnotation(1.0, 2.0, t);
assertTrue(a1.equals(a2));
a1 = new XYTitleAnnotation(1.1, 2.0, t);
assertFalse(a1.equals(a2));
a2 = new XYTitleAnnotation(1.1, 2.0, t);
assertTrue(a1.equals(a2));
a1 = new XYTitleAnnotation(1.1, 2.2, t);
assertFalse(a1.equals(a2));
a2 = new XYTitleAnnotation(1.1, 2.2, t);
assertTrue(a1.equals(a2));
TextTitle t2 = new TextTitle("Title 2");
a1 = new XYTitleAnnotation(1.1, 2.2, t2);
assertFalse(a1.equals(a2));
a2 = new XYTitleAnnotation(1.1, 2.2, t2);
assertTrue(a1.equals(a2));
}
示例7: createChart
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private static JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
"Performance: JFreeSVG vs Batik", null /* x-axis label*/,
"Milliseconds" /* y-axis label */, dataset);
chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG "
+ "format (lower bars = better performance)"));
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
// ******************************************************************
// More than 150 demo applications are included with the JFreeChart
// Developer Guide...for more information, see:
//
// > http://www.object-refinery.com/jfreechart/guide.html
//
// ******************************************************************
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
chart.getLegend().setFrame(BlockBorder.NONE);
return chart;
}
示例8: MultiplePiePlot
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Creates a new plot.
*
* @param dataset the dataset (<code>null</code> permitted).
*/
public MultiplePiePlot(CategoryDataset dataset) {
super();
setDataset(dataset);
PiePlot piePlot = new PiePlot(null);
piePlot.setIgnoreNullValues(true);
this.pieChart = new JFreeChart(piePlot);
this.pieChart.removeLegend();
this.dataExtractOrder = TableOrder.BY_COLUMN;
this.pieChart.setBackgroundPaint(null);
TextTitle seriesTitle = new TextTitle("Series Title",
new Font("SansSerif", Font.BOLD, 12));
seriesTitle.setPosition(RectangleEdge.BOTTOM);
this.pieChart.setTitle(seriesTitle);
this.aggregatedItemsKey = "Other";
this.aggregatedItemsPaint = Color.lightGray;
this.sectionPaints = new HashMap();
this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0);
}
示例9: apply
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Applies this theme to the supplied chart.
*
* @param chart the chart (<code>null</code> not permitted).
*/
@Override
public void apply(JFreeChart chart) {
ParamChecks.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);
}
}
示例10: MultiplePiePlot
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* Creates a new plot.
*
* @param dataset the dataset ({@code null} permitted).
*/
public MultiplePiePlot(CategoryDataset dataset) {
super();
setDataset(dataset);
PiePlot piePlot = new PiePlot(null);
piePlot.setIgnoreNullValues(true);
this.pieChart = new JFreeChart(piePlot);
this.pieChart.removeLegend();
this.dataExtractOrder = TableOrder.BY_COLUMN;
this.pieChart.setBackgroundPaint(null);
TextTitle seriesTitle = new TextTitle("Series Title",
new Font("SansSerif", Font.BOLD, 12));
seriesTitle.setPosition(RectangleEdge.BOTTOM);
this.pieChart.setTitle(seriesTitle);
this.aggregatedItemsKey = "Other";
this.aggregatedItemsPaint = Color.lightGray;
this.sectionPaints = new HashMap();
this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0);
}
示例11: apply
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
/**
* 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);
}
}
示例12: 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));
}
示例13: setChartSubtitles
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
protected void setChartSubtitles(JFreeChart jfreeChart) throws JRException
{
TitleSettings subtitleSettings = getSubtitleSettings();
Boolean subtitleVisibility = subtitleSettings.getShowTitle();
if (subtitleVisibility == null || subtitleVisibility.booleanValue())
{
String subtitleText = evaluateTextExpression(getChart().getSubtitleExpression());
if (subtitleText != null)
{
TextTitle subtitle = new TextTitle(subtitleText);
Paint subtitleForecolor = getChart().getOwnSubtitleColor() != null
? getChart().getOwnSubtitleColor()
: subtitleSettings.getForegroundPaint() != null
? subtitleSettings.getForegroundPaint().getPaint()
: getChart().getSubtitleColor();
//Subtitle has not its own position set, and by default this will be set the same as title position
RectangleEdge subtitleEdge = getEdge(subtitleSettings.getPositionValue(), jfreeChart.getTitle() == null ? null : jfreeChart.getTitle().getPosition());
handleTitleSettings(subtitle, subtitleSettings, getChart().getSubtitleFont(), subtitleForecolor, subtitleEdge);
jfreeChart.addSubtitle(subtitle);
}
}
}
示例14: setChartTitle
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
private void setChartTitle() {
JFreeChart chart = getCurrentChart();
if (chart != null) {
String text = plotInstance.getCurrentPlotConfigurationClone().getTitleText();
if (text == null) {
chart.setTitle(text);
return;
}
Font font = plotInstance.getCurrentPlotConfigurationClone().getTitleFont();
if (font == null) {
font = FontTools.getFont(Font.DIALOG, Font.PLAIN, 10);
}
TextTitle textTitle = new TextTitle(text, font);
textTitle.setPaint(plotInstance.getCurrentPlotConfigurationClone().getTitleColor());
chart.setTitle(textTitle);
}
}
示例15: fillChart
import org.jfree.chart.title.TextTitle; //导入依赖的package包/类
private void fillChart(String title, List<String> names,
List<String> colors, List<Float> values) throws Exception {
DefaultPieDataset data=new DefaultPieDataset();
for (int ix=0; ix<names.size(); ix++) {
data.setValue( names.get(ix), values.get(ix) );
}
this.chart=ChartFactory.createPieChart3D(
title,
data,
true,
true,
false);
LegendTitle legend=this.chart.getLegend();
legend.setItemFont(new Font("", Font.TRUETYPE_FONT, 9) );
PiePlot plot=(PiePlot)this.chart.getPlot();
plot.setCircular(true);
plot.setBackgroundAlpha(0.9f);
plot.setForegroundAlpha(0.5f);
plot.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9) );
this.setPlotColor( plot, names, colors );
this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9) ) );
}