List of usage examples for org.jfree.chart.plot CategoryMarker setOutlinePaint
public void setOutlinePaint(Paint paint)
From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java
public static void prepareJFreeBarChart(JFreeChart jfchart, List<PropertyBook> listOfPropertties, CategoryDataset categoryModel) { CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot()); categoryPlot.getRangeAxis().resizeRange(1.2); categoryPlot.setBackgroundPaint(Color.WHITE); categoryPlot.setDomainGridlinePaint(Color.WHITE); categoryPlot.setRangeMinorGridlinePaint(Color.WHITE); categoryPlot.setRangeGridlinePaint(Color.BLACK); BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer(); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(false); for (int i = 0; i < listOfPropertties.size(); i++) { renderer.setSeriesStroke(i, new BasicStroke(1)); }//from w ww . ja va 2s .c o m for (int i = 0; i < categoryModel.getColumnKeys().size(); i++) { String label = (String) categoryModel.getColumnKey(i); CategoryMarker marker = new CategoryMarker(label); marker.setLabel(""); marker.setPaint(Color.cyan); marker.setOutlinePaint(Color.cyan); marker.setAlpha(0.1f); marker.setLabelAnchor(RectangleAnchor.TOP); marker.setLabelTextAnchor(TextAnchor.TOP_CENTER); marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT); categoryPlot.addDomainMarker(marker, Layer.BACKGROUND); } renderer.setDrawBarOutline(false); renderer.setShadowVisible(false); renderer.setItemMargin(.1); renderer.setBarPainter(new StandardBarPainter()); }
From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java
public static void preparePropertiesVsOwnAllPropertiesJFreeChart(JFreeChart jfchart, CategoryDataset categoryModel) { CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot()); categoryPlot.getRangeAxis().resizeRange(1.2); categoryPlot.setBackgroundPaint(Color.WHITE); categoryPlot.setDomainGridlinePaint(Color.WHITE); categoryPlot.setRangeMinorGridlinePaint(Color.WHITE); categoryPlot.setRangeGridlinePaint(Color.BLACK); BarRenderer renderer = (BarRenderer) categoryPlot.getRenderer(); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelFont(new Font("Serif", Font.PLAIN, 10)); renderer.setItemLabelAnchorOffset(15); renderer.setSeriesStroke(0, new BasicStroke(1)); renderer.setSeriesStroke(1, new BasicStroke(1)); renderer.setSeriesStroke(2, new BasicStroke(1)); renderer.setSeriesStroke(3, new BasicStroke(1)); renderer.setSeriesStroke(4, new BasicStroke(1)); renderer.setSeriesStroke(5, new BasicStroke(1)); renderer.setSeriesPaint(0, new Color(0x77, 0x77, 0xFF)); renderer.setSeriesPaint(1, new Color(0xCC, 0xCC, 0xFF)); renderer.setSeriesPaint(2, new Color(0x00, 0x00, 0xFF)); renderer.setSeriesPaint(3, new Color(0xFF, 0x77, 0x77)); renderer.setSeriesPaint(4, new Color(0xFF, 0xCC, 0xCC)); renderer.setSeriesPaint(5, new Color(0xFF, 0x00, 0x00)); for (int i = 0; i < categoryModel.getColumnKeys().size(); i++) { String label = (String) categoryModel.getColumnKey(i); CategoryMarker marker = new CategoryMarker(label); marker.setLabel(""); marker.setPaint(Color.cyan); marker.setOutlinePaint(Color.cyan); marker.setAlpha(0.1f);/* w ww. j a v a2 s . com*/ marker.setLabelAnchor(RectangleAnchor.TOP); marker.setLabelTextAnchor(TextAnchor.TOP_CENTER); marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT); categoryPlot.addDomainMarker(marker, Layer.BACKGROUND); } renderer.setDrawBarOutline(false); renderer.setShadowVisible(false); renderer.setItemMargin(.1); renderer.setBarPainter(new StandardBarPainter()); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_RIGHT)); renderer.setBaseNegativeItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.BOTTOM_RIGHT)); }