當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。