List of usage examples for org.jfree.chart JFreeChart removeLegend
public void removeLegend()
From source file:org.jfree.chart.ChartFactory.java
public static <T extends Number> JFreeChart createScatterCategoryChart(Map<String, List<T>> dataset, String title, String xAxis, String yAxis, boolean showLegend) { // Make the PDB series and add it to the predicted strand locations CategoryDataset data = createMultiValueCategoryDataset(dataset); Range rangeBounds = DatasetUtilities.findRangeBounds(data); NumberAxis numberAxis = new NumberAxis(yAxis); numberAxis.setRangeWithMargins(rangeBounds); CategoryPlot plot = new CategoryPlot(data, new CategoryAxis(xAxis), numberAxis, new SR()); JFreeChart chart = new JFreeChart(title, plot); if (!showLegend) chart.removeLegend(); setCategoryStandardTooltips(chart);//from w ww . jav a2 s . c om ((CategoryPlot) chart.getPlot()).setDomainGridlinesVisible(false); ((CategoryPlot) chart.getPlot()).setRangeGridlinesVisible(false); ; chart.setBackgroundPaint(Color.white); chart.getPlot().setBackgroundPaint(Color.white); return chart; }
From source file:org.jfree.chart.ChartFactory.java
public static <T extends Number> JFreeChart create2DScatterCategoryChart(Map<String[], List<T>> dataset, String title, String xAxis, String yAxis, boolean showLegend) { // Make the PDB series and add it to the predicted strand locations CategoryDataset data = create2DMultiValueCategoryDataset(dataset); Range rangeBounds = DatasetUtilities.findRangeBounds(data); NumberAxis numberAxis = new NumberAxis(yAxis); numberAxis.setRangeWithMargins(rangeBounds); CategoryPlot plot = new CategoryPlot(data, new CategoryAxis(xAxis), numberAxis, new SR()); JFreeChart chart = new JFreeChart(title, plot); if (!showLegend) chart.removeLegend(); setCategoryStandardTooltips(chart);/*from w ww . j a v a2 s .c om*/ ((CategoryPlot) chart.getPlot()).setDomainGridlinesVisible(false); ((CategoryPlot) chart.getPlot()).setRangeGridlinesVisible(false); ; chart.setBackgroundPaint(Color.white); chart.getPlot().setBackgroundPaint(Color.white); return chart; }
From source file:org.jfree.chart.ChartFactory.java
/** * Creates a chart that displays multiple pie plots. The chart object * returned by this method uses a {@link MultiplePiePlot} instance as the * plot./*from www. j a v a2 s . co m*/ * * @param title the chart title ({@code null} permitted). * @param dataset the dataset ({@code null} permitted). * @param order the order that the data is extracted (by row or by column) * ({@code null} not permitted). * * @return A chart. */ public static JFreeChart createMultiplePieChart3D(String title, CategoryDataset dataset, TableOrder order) { ParamChecks.nullNotPermitted(order, "order"); MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPainter(null); plot.setBorderPainter(null); JFreeChart pieChart = new JFreeChart(new PiePlot3D(null)); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.removeLegend(); pieChart.setBackgroundPainter(null); plot.setPieChart(pieChart); PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); JFreeChart chart = new JFreeChart(title, plot); currentTheme.apply(chart); return chart; }