List of usage examples for org.jfree.chart.plot SpiderWebPlot setOutlinePaint
public void setOutlinePaint(Paint paint)
From source file:com.rapidminer.gui.plotter.charts.WebPlotter.java
@Override public void updatePlotter() { final int categoryCount = prepareData(); SwingUtilities.invokeLater(new Runnable() { @Override/* w ww . ja v a 2 s. co m*/ public void run() { scrollablePlotterPanel.remove(viewScrollBar); } }); if (categoryCount > MAX_CATEGORY_VIEW_COUNT && showScrollbar) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { viewScrollBar.setOrientation(Adjustable.HORIZONTAL); scrollablePlotterPanel.add(viewScrollBar, BorderLayout.SOUTH); } }); this.slidingCategoryDataSet = new SlidingCategoryDataset(categoryDataSet, 0, MAX_CATEGORY_VIEW_COUNT); viewScrollBar.setMaximum(categoryCount); viewScrollBar.setValue(0); } else { this.slidingCategoryDataSet = null; } if (categoryCount <= MAX_CATEGORIES) { SpiderWebPlot plot = new SpiderWebPlot(categoryDataSet); plot.setAxisLinePaint(Color.LIGHT_GRAY); plot.setOutlinePaint(Color.WHITE); plot.setLabelGenerator(new StandardCategoryItemLabelGenerator()); JFreeChart chart = new JFreeChart("", TextTitle.DEFAULT_FONT, plot, true); double[] colorValues = null; if (groupByColumn >= 0 && this.dataTable.isNominal(groupByColumn)) { colorValues = new double[this.dataTable.getNumberOfValues(groupByColumn)]; } else { colorValues = new double[categoryDataSet.getColumnCount()]; } for (int i = 0; i < colorValues.length; i++) { colorValues[i] = i; } if (panel != null) { panel.setChart(chart); } else { panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN); scrollablePlotterPanel.add(panel, BorderLayout.CENTER); final ChartPanelShiftController controller = new ChartPanelShiftController(panel); panel.addMouseListener(controller); panel.addMouseMotionListener(controller); } // set the background color for the chart... chart.setBackgroundPaint(Color.white); // 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); } if (groupByColumn < 0) { // no legend is needed when there is no group-by selection chart.removeLegend(); } // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); } else { LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.charts.BarChartPlotter.too_many_columns", new Object[] { categoryCount, MAX_CATEGORIES }); } }
From source file:org.squale.squaleweb.util.graph.KiviatMaker.java
/** * Create the JreeChart object/*from w ww . j a v a2 s . c o m*/ * * @param showLegend indicate if it should display the legend or not * @param showBackground indicate if we want showBackground * @return The JreeChart object */ public JFreeChart getChart(boolean showLegend, boolean showBackground) { JFreeChart retChart = super.getChart(); // Creation of the graph if it not already exist if (null == retChart) { // Creation of the plot SpiderWebPlot plot = new SpiderWebPlot(mDataset); // Creation of the picture. The plot is inside the picture retChart = new JFreeChart(mTitle, TextTitle.DEFAULT_FONT, plot, false); // Display of the legend if (showLegend) { LegendTitle legendtitle = new LegendTitle(plot); legendtitle.setPosition(RectangleEdge.BOTTOM); retChart.addSubtitle(legendtitle); } // Definition of the style of the three first draw in the spiderWEbPlot. // This three first draw represent the scale for the mark 1.0, 2.0 and 3.0 in the plot // First we define the style final float miterLimit = 10.0f; final float[] dashPattern = { 5.0f, 3.0f }; BasicStroke dash = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, // End cap BasicStroke.JOIN_MITER, // Join style miterLimit, // Miter limit dashPattern, // Dash pattern 0.0f); // We associate this style to the draw plot.setSeriesPaint(0, new Color(WebMessages.getInt("kiviat.color.1"))); plot.setSeriesOutlineStroke(0, dash); plot.setSeriesPaint(1, new Color(WebMessages.getInt("kiviat.color.2"))); plot.setSeriesOutlineStroke(1, dash); plot.setSeriesPaint(2, new Color(WebMessages.getInt("kiviat.color.3"))); plot.setSeriesOutlineStroke(2, dash); // Define the gap what is draw and the border of the plot plot.setInteriorGap(DEFAULT_GAP); // Define the style of the line stroke plot.setBaseSeriesOutlineStroke(new BasicStroke(2.0f)); // The max value put in the plot (for the scale) plot.setMaxValue(SCALE_MAX_VALUE); // Indicate if we want fill the inner of the draw plot.setWebFilled(FILL_RADAR); if (!showBackground) { // Set the background of the picture to white retChart.setBackgroundPaint(Color.WHITE); // Set the border of the plot to white plot.setOutlinePaint(Color.WHITE); } super.setChart(retChart); } return retChart; }