Java Code Examples for org.jfree.chart.renderer.category.CategoryItemRenderer#setBaseItemLabelGenerator()
The following examples show how to use
org.jfree.chart.renderer.category.CategoryItemRenderer#setBaseItemLabelGenerator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScheduleReport.java From ezScrum with GNU General Public License v2.0 | 6 votes |
private void setAttribute(JFreeChart chart) { // 圖案與文字的間隔 LegendTitle legend = chart.getLegend(); legend.setBorder(1, 1, 1, 1); CategoryPlot plot = chart.getCategoryPlot(); // 設定WorkItem的屬性 CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); // 字體角度 domainAxis.setTickLabelFont(new Font("新細明體", Font.TRUETYPE_FONT, 12)); // 字體 // 設定Date的屬性 DateAxis da = (DateAxis) plot.getRangeAxis(0); setDateAxis(da); // 設定實體的顯示名稱 CategoryItemRenderer render = plot.getRenderer(0); DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); CategoryItemLabelGenerator generator = new IntervalCategoryItemLabelGenerator( "{3} ~ {4}", format); render.setBaseItemLabelGenerator(generator); render.setBaseItemLabelPaint(Color.BLUE); render.setBaseItemLabelsVisible(true); render.setBaseItemLabelFont(new Font("黑體", Font.TRUETYPE_FONT, 8)); render.setSeriesPaint(0, Color.RED); }
Example 2
Source File: AbstractCategoryItemRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the getSeriesItemLabelGenerator() method behaves as * expected. */ public void testGetSeriesItemLabelGenerator() { CategoryItemRenderer r = new BarRenderer(); assertNull(r.getSeriesItemLabelGenerator(2)); r.setSeriesItemLabelGenerator(2, new StandardCategoryItemLabelGenerator()); assertNotNull(r.getSeriesItemLabelGenerator(2)); r.setSeriesItemLabelGenerator(2, null); assertNull(r.getSeriesItemLabelGenerator(2)); r.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); assertNull(r.getSeriesItemLabelGenerator(2)); }
Example 3
Source File: AbstractCategoryItemRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the getSeriesItemLabelGenerator() method behaves as * expected. */ public void testGetSeriesItemLabelGenerator() { CategoryItemRenderer r = new BarRenderer(); assertNull(r.getSeriesItemLabelGenerator(2)); r.setSeriesItemLabelGenerator(2, new StandardCategoryItemLabelGenerator()); assertNotNull(r.getSeriesItemLabelGenerator(2)); r.setSeriesItemLabelGenerator(2, null); assertNull(r.getSeriesItemLabelGenerator(2)); r.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); assertNull(r.getSeriesItemLabelGenerator(2)); }