当前位置: 首页>>代码示例>>Java>>正文


Java LegendTitle.setItemFont方法代码示例

本文整理汇总了Java中org.jfree.chart.title.LegendTitle.setItemFont方法的典型用法代码示例。如果您正苦于以下问题:Java LegendTitle.setItemFont方法的具体用法?Java LegendTitle.setItemFont怎么用?Java LegendTitle.setItemFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.title.LegendTitle的用法示例。


在下文中一共展示了LegendTitle.setItemFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillChart

import org.jfree.chart.title.LegendTitle; //导入方法依赖的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) ) ); 		
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:23,代码来源:CommonPieChartAction.java

示例2: addLegend

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
protected final void addLegend() {
    if (chart == null) {
        throw new IllegalStateException("initChart() must be called first");
    }

    LegendTitle legend = new LegendTitle(chart.getPlot());
    legend.setItemFont(LEGEND_FONT);
    legend.setBorder(0, 0, 0, 0);
    legend.setBackgroundPaint(Color.WHITE);
    legend.setPosition(RectangleEdge.BOTTOM);

    RectangleInsets padding = new RectangleInsets(5, 5, 5, 5);
    legend.setItemLabelPadding(padding);

    chart.addLegend(legend);
}
 
开发者ID:nmonvisualizer,项目名称:nmonvisualizer,代码行数:17,代码来源:BaseChartBuilder.java

示例3: testEquals

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    XYPlot plot1 = new XYPlot();
    LegendTitle t1 = new LegendTitle(plot1);
    LegendTitle t2 = new LegendTitle(plot1);
    assertEquals(t1, t2);
    
    t1.setBackgroundPaint(
        new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)
    );
    assertFalse(t1.equals(t2));
    t2.setBackgroundPaint(
        new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)
    );
    assertTrue(t1.equals(t2));
    
    t1.setLegendItemGraphicEdge(RectangleEdge.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setLegendItemGraphicEdge(RectangleEdge.BOTTOM);
    assertTrue(t1.equals(t2));
    
    t1.setLegendItemGraphicAnchor(RectangleAnchor.BOTTOM_LEFT);
    assertFalse(t1.equals(t2));
    t2.setLegendItemGraphicAnchor(RectangleAnchor.BOTTOM_LEFT);
    assertTrue(t1.equals(t2));
    
    t1.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
    assertFalse(t1.equals(t2));
    t2.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
    assertTrue(t1.equals(t2));
    
    t1.setItemFont(new Font("Dialog", Font.PLAIN, 19));
    assertFalse(t1.equals(t2));
    t2.setItemFont(new Font("Dialog", Font.PLAIN, 19));
    assertTrue(t1.equals(t2));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:LegendTitleTests.java

示例4: applyToTitle

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
/**
 * Applies the attributes of this theme to the specified title.
 *
 * @param title  the title.
 */
protected void applyToTitle(Title title) {
    if (title instanceof TextTitle) {
        TextTitle tt = (TextTitle) title;
        tt.setFont(this.largeFont);
        tt.setPaint(this.subtitlePaint);
    }
    else if (title instanceof LegendTitle) {
        LegendTitle lt = (LegendTitle) title;
        if (lt.getBackgroundPaint() != null) {
            lt.setBackgroundPaint(this.legendBackgroundPaint);
        }
        lt.setItemFont(this.regularFont);
        lt.setItemPaint(this.legendItemPaint);
        if (lt.getWrapper() != null) {
            applyToBlockContainer(lt.getWrapper());
        }
    }
    else if (title instanceof PaintScaleLegend) {
        PaintScaleLegend psl = (PaintScaleLegend) title;
        psl.setBackgroundPaint(this.legendBackgroundPaint);
        ValueAxis axis = psl.getAxis();
        if (axis != null) {
            applyToValueAxis(axis);
        }
    }
    else if (title instanceof CompositeTitle) {
        CompositeTitle ct = (CompositeTitle) title;
        BlockContainer bc = ct.getContainer();
        List blocks = bc.getBlocks();
        Iterator iterator = blocks.iterator();
        while (iterator.hasNext()) {
            Block b = (Block) iterator.next();
            if (b instanceof Title) {
                applyToTitle((Title) b);
            }
        }
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:44,代码来源:StandardChartTheme.java

示例5: incluirLegenda

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
private void incluirLegenda(final XYPlot plot) {
    if (isLegenda()) {
        LegendTitle lt = new LegendTitle(plot);
        lt.setItemFont(new Font("Dialog", Font.PLAIN, 11));
        lt.setBackgroundPaint(new Color(255, 255, 255, 100));
        lt.setBorder(new BlockBorder(new Color(180, 180, 180)));
        lt.setPosition(RectangleEdge.TOP);
        XYTitleAnnotation ta = new XYTitleAnnotation(0.01, 0.98, lt,
                RectangleAnchor.TOP_LEFT);
        ta.setMaxWidth(0.48);
        plot.addAnnotation(ta);
    }
}
 
开发者ID:wrbraga,项目名称:JGrafix,代码行数:14,代码来源:Eixo.java

示例6: setLegend

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
private void setLegend(JFreeChart chart, Plot plot, Font font) {
	if(!showlegend) return;
		
		
	Color bg = backgroundcolor==null?databackgroundcolor:backgroundcolor;
	if(font==null)font=getFont();
	
	
	
	LegendTitle legend = legendMultiLine?
       		new LegendTitle(plot,new ColumnArrangement(), new ColumnArrangement()):
       		new LegendTitle(plot);
       legend.setBackgroundPaint(bg);
       legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
       legend.setFrame(new LineBorder());
       legend.setPosition(RectangleEdge.BOTTOM);
       legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
       
       legend.setWidth(chartwidth-20);// geht nicht
       legend.setItemFont(font);
	legend.setItemPaint(foregroundcolor);

	//RectangleInsets labelPadding;
	legend.setItemLabelPadding(new RectangleInsets(2,2,2,2));
	legend.setBorder(0,0,0,0); 
	legend.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
	legend.setLegendItemGraphicPadding(new RectangleInsets(8,10,0,0));
	chart.addLegend(legend);
	
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:31,代码来源:Chart.java

示例7: createChartImage

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
public BufferedImage createChartImage(MediaMatrix mat, Color bgColor, int width, int height) {
    final XYSplineRenderer renderer = new XYSplineRenderer();
    final NumberAxis xAxis = new NumberAxis("Time");
    final NumberAxis yAxis = new NumberAxis("Score");
    final XYPlot plot = new XYPlot(new MediaMatrixXYDataSetAdapter(mat), xAxis, yAxis, renderer);
    plot.setBackgroundPaint(bgColor);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
    final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    chart.setBackgroundPaint(Color.white);
    final LegendTitle legendTitle = chart.getLegend();
    legendTitle.setItemFont(new Font("SanSerif", Font.PLAIN, 14));
    return chart.createBufferedImage(width, height);
}
 
开发者ID:shuichi,项目名称:MediaMatrix,代码行数:16,代码来源:VisualizationEngine.java

示例8: testEquals

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    XYPlot plot1 = new XYPlot();
    LegendTitle t1 = new LegendTitle(plot1);
    LegendTitle t2 = new LegendTitle(plot1);
    assertEquals(t1, t2);

    t1.setBackgroundPaint(
        new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)
    );
    assertFalse(t1.equals(t2));
    t2.setBackgroundPaint(
        new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)
    );
    assertTrue(t1.equals(t2));

    t1.setLegendItemGraphicEdge(RectangleEdge.BOTTOM);
    assertFalse(t1.equals(t2));
    t2.setLegendItemGraphicEdge(RectangleEdge.BOTTOM);
    assertTrue(t1.equals(t2));

    t1.setLegendItemGraphicAnchor(RectangleAnchor.BOTTOM_LEFT);
    assertFalse(t1.equals(t2));
    t2.setLegendItemGraphicAnchor(RectangleAnchor.BOTTOM_LEFT);
    assertTrue(t1.equals(t2));

    t1.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
    assertFalse(t1.equals(t2));
    t2.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
    assertTrue(t1.equals(t2));

    t1.setItemFont(new Font("Dialog", Font.PLAIN, 19));
    assertFalse(t1.equals(t2));
    t2.setItemFont(new Font("Dialog", Font.PLAIN, 19));
    assertTrue(t1.equals(t2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:39,代码来源:LegendTitleTests.java

示例9: renderChartToFile

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
private Image renderChartToFile(TotalPaymentSummaryReportResponse response, File chartFile) throws IOException,
        BadElementException, MalformedURLException {
    // For generating pie chart for total payments(example for total deposits) perform following:
    // Create the dataset
    DefaultPieDataset dataset = new DefaultPieDataset();

    dataset.setValue("Pre 10/82 Deposit", response.getTotalDepositsPre1082());
    dataset.setValue("Pre 10/82 Redeposit", response.getTotalRedepositsPre1082());
    dataset.setValue("CSRS: Post 9/82 Deposit", response.getCsrsDepositsPost982());
    dataset.setValue("FERS Postal", response.getFersPostalDepositsPost982());
    dataset.setValue("FERS Non Postal", response.getFersNonPostalDepositsPost982());
    dataset.setValue("Post 9/82 Deposit", response.getTotalDepositsPost982());
    dataset.setValue("Post 9/82 Redeposit", response.getTotalRedepositsPost982());

    // Set following data
    // Create the chart
    JFreeChart chart = ChartFactory.createPieChart("Total Payments", dataset, true, true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("Helvetica", 0, 10));
    plot.setBackgroundPaint(Color.white);
    plot.setIgnoreZeroValues(false);
    plot.setOutlineVisible(false);

    chart.getTitle().setFont(new Font("Helvetica", 1, 14));

    LegendTitle legend = chart.getLegend();
    legend.setItemFont(new Font("Helvetica", 0, 10));
    legend.setPosition(RectangleEdge.RIGHT);

    ChartUtilities.saveChartAsPNG(chartFile, chart, chartWidth, chartHeight);
    Image image = Image.getInstance(chartFile.getAbsolutePath());
    return image;
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:35,代码来源:TotalPaymentSummaryReportService.java

示例10: renderChartToFile

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
private void renderChartToFile(Map<String, Set<String>> userAccounts, File chartFile) throws IOException {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (Map.Entry<String, Set<String>> item : userAccounts.entrySet()) {
        for (Map.Entry<String, Set<String>> item2 : userAccounts.entrySet()) {
            if (item == item2) {
                dataset.addValue(item.getValue().size(), item2.getKey(), item2.getKey());
            } else {
                dataset.addValue(0, item2.getKey(), item.getKey());
            }
        }
    }

    // Create the chart
    JFreeChart chart = ChartFactory.createStackedBarChart("", "", "Number of Modified Accounts", dataset,
        PlotOrientation.HORIZONTAL, true, true, false);
    Plot plot = chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setOutlineVisible(false);

    final CategoryPlot categoryPlot = chart.getCategoryPlot();
    categoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
    categoryPlot.setRangeGridlinePaint(Color.gray);

    LegendTitle legend = chart.getLegend();
    legend.setItemFont(new Font("Helvetica", 0, 10));
    legend.setPosition(RectangleEdge.RIGHT);

    ChartUtilities.saveChartAsPNG(chartFile, chart, 500, 300);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:32,代码来源:MonthlyAdjustmentReportService.java

示例11: renderChartImage

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
/**
 * Renders the chart image.
 * @param response
 * @param chartFile
 * @throws BadElementException
 * @throws MalformedURLException
 * @throws IOException
 */
private void renderChartImage(ResolvedSuspenseHistoryReportResponse response, File chartFile) 
    throws BadElementException, MalformedURLException, IOException {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    for (ResolvedSuspenseHistoryReportHistogramItem item : response.getHistogramItems()) {
        for (ResolvedSuspenseHistoryReportHistogramItem item2 : response.getHistogramItems()) {
            if (item == item2) {
                dataset.addValue(item.getCount(), item2.getName(), item.getName());
            } else {
                dataset.addValue(0, item2.getName(), item.getName());
            }
        }
    }

    // Create the chart
    JFreeChart chart = ChartFactory.createStackedBarChart("Count of Resolved Suspense Items", "", "", dataset,
        PlotOrientation.VERTICAL, true, true, false);
    Plot plot = chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setOutlineVisible(false);
    chart.getTitle().setFont(new Font("Helvetica", 1, 14));

    CategoryPlot cplot = (CategoryPlot) chart.getPlot();
    final CategoryAxis domainAxis = cplot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    LegendTitle legend = chart.getLegend();
    legend.setItemFont(new Font("Helvetica", 0, 10));
    legend.setPosition(RectangleEdge.RIGHT);
    ChartUtilities.saveChartAsPNG(chartFile, chart, chartWidth, chartHeight);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:40,代码来源:ResolvedSuspenseHistoryReportService.java

示例12: updatePlotter

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
@Override
protected void updatePlotter() {
	int categoryCount = prepareData();
	String maxClassesProperty = ParameterService
			.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
	int maxClasses = 20;
	try {
		if (maxClassesProperty != null) {
			maxClasses = Integer.parseInt(maxClassesProperty);
		}
	} catch (NumberFormatException e) {
		// LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.",
		// LogService.WARNING);
		LogService.getRoot().log(Level.WARNING,
				"com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
	}
	boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

	JFreeChart chart = createChart(this.dataset, createLegend);

	// set the background color for the chart...
	chart.setBackgroundPaint(Color.white);

	// domain axis
	if (axis[INDEX] >= 0) {
		if (!dataTable.isNominal(axis[INDEX])) {
			if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
				DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
				domainAxis.setTimeZone(Tools.getPreferredTimeZone());
				chart.getXYPlot().setDomainAxis(domainAxis);
				if (getRangeForDimension(axis[INDEX]) != null) {
					domainAxis.setRange(getRangeForDimension(axis[INDEX]));
				}
				domainAxis.setLabelFont(LABEL_FONT_BOLD);
				domainAxis.setTickLabelFont(LABEL_FONT);
				domainAxis.setVerticalTickLabels(isLabelRotating());
			}
		} else {
			LinkedHashSet<String> values = new LinkedHashSet<String>();
			for (DataTableRow row : dataTable) {
				String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
				if (stringValue.length() > 40) {
					stringValue = stringValue.substring(0, 40);
				}
				values.add(stringValue);
			}
			ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]),
					values.toArray(new String[values.size()]));
			categoryAxis.setLabelFont(LABEL_FONT_BOLD);
			categoryAxis.setTickLabelFont(LABEL_FONT);
			categoryAxis.setVerticalTickLabels(isLabelRotating());
			chart.getXYPlot().setDomainAxis(categoryAxis);
		}
	}

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(LABEL_FONT);
	}

	AbstractChartPanel panel = getPlotterPanel();
	if (panel == null) {
		panel = createPanel(chart);
	} else {
		panel.setChart(chart);
	}

	// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
	panel.getChartRenderingInfo().setEntityCollection(null);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:75,代码来源:SeriesChartPlotter.java

示例13: createChart

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
private JFreeChart createChart(XYDataset dataset) {
	// create the chart...
	JFreeChart chart = ChartFactory.createXYLineChart(null,      // chart title
			null,                      // x axis label
			null,                      // y axis label
			dataset,                  // data
			PlotOrientation.VERTICAL, true,                     // include legend
			true,                     // tooltips
			false                     // urls
			);

	chart.setBackgroundPaint(Color.white);

	// get a reference to the plot for further customisation...
	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setBackgroundPaint(Color.WHITE);
	plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
	plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
	plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

	ValueAxis valueAxis = plot.getRangeAxis();
	valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	ValueAxis domainAxis = plot.getDomainAxis();
	domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	DeviationRenderer renderer = new DeviationRenderer(true, false);
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	if (dataset.getSeriesCount() == 1) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);
	} else if (dataset.getSeriesCount() == 2) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);

		renderer.setSeriesStroke(1, stroke);
		renderer.setSeriesPaint(1, Color.BLUE);
		renderer.setSeriesFillPaint(1, Color.BLUE);
	} else {
		for (int i = 0; i < dataset.getSeriesCount(); i++) {
			renderer.setSeriesStroke(i, stroke);
			Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setAlpha(0.12f);
	plot.setRenderer(renderer);

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(PlotterAdapter.LABEL_FONT);
	}
	return chart;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:64,代码来源:ROCChartPlotter.java

示例14: createChart

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
public static JFreeChart createChart(XYDataset xydataset, String shou, String shu) {
	JFreeChart jfreechart = ChartFactory.createScatterPlot("Rating and Rating People Distribution", shou, shu,
			xydataset, PlotOrientation.VERTICAL, true, false, false);
	jfreechart.setBackgroundPaint(Color.white);
	jfreechart.setBorderPaint(Color.GREEN);

	XYPlot xyplot = (XYPlot) jfreechart.getPlot();
	xyplot.setNoDataMessage("no data");
	xyplot.setNoDataMessageFont(new Font("微软雅黑", Font.BOLD, 14));
	xyplot.setNoDataMessagePaint(Color.blue);
	xyplot.setBackgroundPaint(Color.lightGray);

	TextTitle textTitle = jfreechart.getTitle();
	textTitle.setFont(new Font("宋体", Font.BOLD, 20));
	LegendTitle legend = jfreechart.getLegend();
	if (legend != null) {
		legend.setItemFont(new Font("宋体", Font.BOLD, 20));
	}

	XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
	renderer.setBaseShapesVisible(true);
	renderer.setDrawOutlines(true);
	renderer.setSeriesOutlinePaint(0, Color.WHITE);  
	renderer.setUseOutlinePaint(true);  
	renderer.setSeriesOutlineStroke(1, new BasicStroke(0.5F));
	xyplot.setRenderer(renderer);

	NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis();
	numberaxis.setTickMarkInsideLength(3.0F);  
    numberaxis.setTickMarkOutsideLength(0.0F); 
	numberaxis.setUpperBound(280000);
	numberaxis.setLowerBound(50000);
	
	numberaxis.setAxisLineStroke(new BasicStroke(1.5f));  

	NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis();
	numberaxis1.setUpperBound(10.0);
	numberaxis1.setLowerBound(5.0);
	
	NumberTickUnit ntu1 = new NumberTickUnit(0.5);
	numberaxis1.setTickUnit(ntu1);
	
	return jfreechart;
}
 
开发者ID:metaotao,项目名称:doubanbook,代码行数:45,代码来源:ScatterPlotChart.java

示例15: createChart

import org.jfree.chart.title.LegendTitle; //导入方法依赖的package包/类
/**
 * Creates a chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "Legal & General Unit Trust Prices",  // title
        "Date",             // x-axis label
        "Price Per Unit",   // y-axis label
        dataset,            // data
        false,               // create legend?
        true,               // generate tooltips?
        false               // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    LegendTitle lt = new LegendTitle(plot);
    lt.setItemFont(new Font("Dialog", Font.PLAIN, 9));
    lt.setBackgroundPaint(new Color(200, 200, 255, 100));
    lt.setBorder(new BlockBorder(Color.white));
    lt.setPosition(RectangleEdge.BOTTOM);
    XYTitleAnnotation ta = new XYTitleAnnotation(0.98, 0.02, lt, 
            RectangleAnchor.BOTTOM_RIGHT);
    
    ta.setMaxWidth(0.48);
    plot.addAnnotation(ta);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }
    
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    
    ValueAxis yAxis = plot.getRangeAxis();
    yAxis.setLowerMargin(0.35);
    return chart;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:56,代码来源:XYTitleAnnotationDemo1.java


注:本文中的org.jfree.chart.title.LegendTitle.setItemFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。