List of usage examples for org.jfree.chart JFreeChart removeLegend
public void removeLegend()
From source file:de.dfki.owlsmx.gui.ResultVisualization.java
private JFreeChart createAQRTChart() { XYSeriesCollection data = new XYSeriesCollection(); Map passedTime = PassedTimeContainer.getInstance().getStoredValues(); // System.err.println("Passed time: " + passedTime); passedTime.put(new Integer(0), new Long(0)); data.addSeries(createSeriesFromDataMap(passedTime)); JFreeChart chart = ChartFactory.createXYLineChart("Average query response time", "Services", "Time (ms)", data, org.jfree.chart.plot.PlotOrientation.VERTICAL, true, true, false); XYPlot plot = chart.getXYPlot();//from w ww . j a va 2 s . c o m XYItemRenderer renderer = (XYItemRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.red); chart.removeLegend(); return chart; }
From source file:org.gephi.statistics.plugin.Renumbering.java
public String getReport() { //distribution of values Map<Double, Integer> dist = new HashMap<Double, Integer>(); for (int i = 0; i < N; i++) { Double d = nodeClustering[i]; if (dist.containsKey(d)) { Integer v = dist.get(d); dist.put(d, v + 1);//from w w w .j a v a 2 s.c om } else { dist.put(d, 1); } } //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(dist, "Clustering Coefficient"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createScatterPlot("Clustering Coefficient Distribution", "Value", "Count", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, false); String imageFile = ChartUtils.renderChart(chart, "clustering-coefficient.png"); NumberFormat f = new DecimalFormat("#0.000"); if (isDirected) { return "<HTML> <BODY> <h1> Clustering Coefficient Metric Report </h1> " + "<hr>" + "<br />" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br />" + "<br>" + "<h2> Results: </h2>" + "Average Clustering Coefficient: " + f.format(avgClusteringCoeff) + "<br />" + "The Average Clustering Coefficient is the mean value of individual coefficients.<br /><br />" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Simple and slow brute force.<br />" + "</BODY> </HTML>"; } else { return "<HTML> <BODY> <h1> Clustering Coefficient Metric Report </h1> " + "<hr>" + "<br />" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br />" + "<br>" + "<h2> Results: </h2>" + "Average Clustering Coefficient: " + f.format(avgClusteringCoeff) + "<br />" + "Total triangles: " + totalTriangles + "<br />" + "The Average Clustering Coefficient is the mean value of individual coefficients.<br /><br />" + imageFile + "<br /><br />" + "<h2> Algorithm: </h2>" + "Matthieu Latapy, <i>Main-memory Triangle Computations for Very Large (Sparse (Power-Law)) Graphs</i>, in Theoretical Computer Science (TCS) 407 (1-3), pages 458-473, 2008<br />" + "</BODY> </HTML>"; } }
From source file:tdunnick.jphineas.console.queue.Charts.java
private JFreeChart createLineChart(String title, String constraint, XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(title, "Date/Time", // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/*from www . ja v a 2s. c om*/ XYPlot plot = chart.getXYPlot(); // X axis shows dates plot.setDomainAxis(new DateAxis()); // if data has a constraint, hide every thing else if (constraint != null) { chart.removeLegend(); XYDataset data = plot.getDataset(); Paint bg = plot.getBackgroundPaint(); for (int i = 0; i < data.getSeriesCount(); i++) { if (!constraint.equals(data.getSeriesKey(i))) plot.getRenderer().setSeriesPaint(i, bg); else { // get a color match... plot.getRenderer().setSeriesPaint(i, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[i]); // reset plot range for this maximum double d = 0; for (int j = 0; j < data.getItemCount(i); j++) { if (d < data.getYValue(i, j)) d = data.getYValue(i, j); } // add a bit for top margin d += d * 0.04; plot.getRangeAxis().setUpperBound(d); } } } return chart; }
From source file:lisong_mechlab.view.graphs.DpsGraph.java
JFreeChart makechart() { JFreeChart chart = ChartFactory.createStackedXYAreaChart("Max DPS over range for " + loadout, "range [m]", "damage / second", getSeries(), PlotOrientation.VERTICAL, true, true, false); chart.getPlot().setDrawingSupplier(colours); chart.getLegend().setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP); LegendTitle legendTitle = chart.getLegend(); XYTitleAnnotation titleAnnotation = new XYTitleAnnotation(0.98, 0.98, legendTitle, RectangleAnchor.TOP_RIGHT);//from w w w. j a v a2 s. c om titleAnnotation.setMaxWidth(0.4); ((XYPlot) (chart.getPlot())).addAnnotation(titleAnnotation); chart.removeLegend(); return chart; }
From source file:org.objectweb.proactive.extensions.timitspmd.util.charts.MatrixChart.java
private void buildMainChart(String title, String subTitle, String xAxisLabel, String yAxisLabel, String fileName) {/*from www.j a v a 2 s . c o m*/ final MatrixSeriesCollection dataset = new MatrixSeriesCollection(this.createMatrixDataSet()); final JFreeChart chart = ChartFactory.createBubbleChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false); chart.addSubtitle(new TextTitle(subTitle)); chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.WHITE)); chart.removeLegend(); // Perform customizations starts here ... final XYPlot plot1 = chart.getXYPlot(); plot1.setDomainGridlinesVisible(false); plot1.setRangeGridlinesVisible(false); plot1.setForegroundAlpha(0.5f); plot1.setDomainAxis(new CustomAxis(plot1.getDomainAxis().getLabel())); plot1.setRangeAxis(new CustomAxis(plot1.getRangeAxis().getLabel())); // Custumize the domain axis ( y ) final NumberAxis domainAxis = (NumberAxis) plot1.getDomainAxis(); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setRange(-1, this.array.length); // Custumize the range axis ( y ) final NumberAxis rangeAxis = (NumberAxis) plot1.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setRange(-1, this.array.length); // Create custom renderer StandardXYItemRenderer ren = new CustomRenderer(false); ren.setSeriesItemLabelPaint(0, Color.BLACK); plot1.setRenderer(ren); this.mainChart = chart; }
From source file:lisong_mechlab.view.graphs.SustainedDpsGraph.java
JFreeChart makechart() { JFreeChart chart = ChartFactory.createStackedXYAreaChart("Max Sustained DPS over range for " + loadout, "range [m]", "damage / second", getSeries(), PlotOrientation.VERTICAL, true, true, false); chart.getPlot().setDrawingSupplier(colours); chart.getLegend().setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP); LegendTitle legendTitle = chart.getLegend(); XYTitleAnnotation titleAnnotation = new XYTitleAnnotation(0.98, 0.98, legendTitle, RectangleAnchor.TOP_RIGHT);/*w ww . java 2s .c om*/ titleAnnotation.setMaxWidth(0.4); ((XYPlot) (chart.getPlot())).addAnnotation(titleAnnotation); chart.removeLegend(); return chart; }
From source file:net.sourceforge.processdash.ev.ui.ScheduleBalancingDialog.java
private void addChartToPanel(JPanel panel, int gridY) { // create a dataset for displaying schedule data chartData = new ChartData(); updateChart();/*from ww w .j a v a2s. c o m*/ // customize a renderer for displaying schedules XYBarRenderer renderer = new XYBarRenderer(); renderer.setUseYInterval(true); renderer.setBaseToolTipGenerator(chartData); renderer.setDrawBarOutline(true); // use an inverted, unadorned numeric Y-axis NumberAxis yAxis = new NumberAxis(); yAxis.setInverted(true); yAxis.setTickLabelsVisible(false); yAxis.setTickMarksVisible(false); yAxis.setUpperMargin(0); // use a Date-based X-axis DateAxis xAxis = new DateAxis(); // create an XY plot to display the data XYPlot plot = new XYPlot(chartData, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeGridlinesVisible(false); plot.setNoDataMessage(TaskScheduleDialog.resources.getString("Chart.No_Data_Message")); // create a chart and a chart panel JFreeChart chart = new JFreeChart(plot); chart.removeLegend(); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setInitialDelay(50); chartPanel.setDismissDelay(60000); chartPanel.setMinimumDrawHeight(40); chartPanel.setMinimumDrawWidth(40); chartPanel.setMaximumDrawHeight(3000); chartPanel.setMaximumDrawWidth(3000); chartPanel.setPreferredSize(new Dimension(300, gridY * 25)); // add the chart to the dialog content pane GridBagConstraints c = new GridBagConstraints(); c.gridy = gridY; c.gridwidth = 4; c.weightx = 2; c.weighty = 1; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10, 0, 0, 0); panel.add(chartPanel, c); // retrieve the colors used for each chart bar, and register those // colors with the schedule rows so they can act as a legend for (int i = scheduleRows.size(); i-- > 0;) { ScheduleTableRow oneRow = scheduleRows.get(i); oneRow.addColoredIcon(renderer.lookupSeriesPaint(i)); } }
From source file:diet.gridr.g5k.gui.GanttChart.java
/** * Method creating the chart/*w w w. j av a 2 s . com*/ * * @param dataset dataset containing the data for the chart * @return a chart */ private JFreeChart createChart(XYZDataset dataset) { DateAxis xAxis = new DateAxis("Date"); xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); xAxis.setDateFormatOverride(new SimpleDateFormat(durationsFormatterArray[this.visualizationDuration])); xAxis.setRange(Calendar.getInstance().getTime(), new Date(System.currentTimeMillis() + HistoryUtil.durationsTimesArray[visualizationDuration] - HistoryUtil.blockWidthsArray[visualizationDuration])); NumberAxis yAxis = new NumberAxis("Nodes"); yAxis.setAutoRangeIncludesZero(false); yAxis.setInverted(true); yAxis.setLowerMargin(0.0); yAxis.setUpperMargin(0.0); yAxis.setRange(1, numberOfNodes); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYBlockRenderer renderer = new XYBlockRenderer(); LookupPaintScale paintScale = new LookupPaintScale(); for (int i = 0; i < jobsList.get(visualizationDuration).size(); i++) { // String jobId = jobsList.get(visualizationDuration).get(i).getId().substring(0,jobsList.get(visualizationDuration).get(i).getId().indexOf(".")); String jobId = jobsList.get(visualizationDuration).get(i).getParameterValue(GridJob.KEY_GRID_JOB_ID); int seed = Integer.parseInt(jobId); Random rng = new Random(seed); Color tempColor = Color.red; int red = tempColor.getRed(); int green = tempColor.getGreen(); int blue = tempColor.getBlue(); int redRNG = rng.nextInt(255); int greenRNG = rng.nextInt(255); int blueRNG = rng.nextInt(255); if (red == redRNG && green == greenRNG && blue == blueRNG) { tempColor = new Color(rng.nextInt(255), rng.nextInt(255), rng.nextInt(255)); } else { tempColor = new Color(redRNG, greenRNG, blueRNG); } if (seed == 0) tempColor = Color.red; paintScale.add(new Double(i), tempColor); } renderer.setBlockWidth(HistoryUtil.blockWidthsArray[visualizationDuration]); renderer.setBlockAnchor(RectangleAnchor.TOP_LEFT); renderer.setPaintScale(paintScale); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); JFreeChart chart = new JFreeChart("Gantt Chart activity for cluster " + siteName, plot); chart.removeLegend(); chart.setBackgroundPaint(Color.white); LoggingManager.log(Level.CONFIG, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "createChart", "Chart created"); return chart; }
From source file:loci.slim2.process.interactive.ui.DefaultDecayGraph.java
/** * Creates the chart/*from w ww . j av a2 s. com*/ * * @param bins number of bins * @param timeInc time increment per bin * @return the chart */ JFreeChart createCombinedChart(final int bins, final double timeInc) { // create empty chart data sets decayDataset = new XYSeriesCollection(); residualDataset = new XYSeriesCollection(); // make a common horizontal axis for both sub-plots final NumberAxis timeAxis = new NumberAxis(TIME_AXIS_LABEL); timeAxis.setLabel(UNITS_LABEL); timeAxis.setRange(0.0, (bins - 1) * timeInc); // make a vertically combined plot final CombinedDomainXYPlot parent = new CombinedDomainXYPlot(timeAxis); // create decay sub-plot NumberAxis photonAxis; if (logarithmic) { photonAxis = new LogarithmicAxis(PHOTON_AXIS_LABEL); } else { photonAxis = new NumberAxis(PHOTON_AXIS_LABEL); } final XYSplineRenderer decayRenderer = new XYSplineRenderer(); decayRenderer.setSeriesShapesVisible(0, false); decayRenderer.setSeriesShapesVisible(1, false); decayRenderer.setSeriesLinesVisible(2, false); decayRenderer.setSeriesShape(2, new Ellipse2D.Float(-1.0f, -1.0f, 2.0f, 2.0f)); decayRenderer.setSeriesPaint(0, PROMPT_COLOR); decayRenderer.setSeriesPaint(1, FITTED_COLOR); decayRenderer.setSeriesPaint(2, DECAY_COLOR); decaySubPlot = new XYPlot(decayDataset, null, photonAxis, decayRenderer); decaySubPlot.setDomainCrosshairVisible(true); decaySubPlot.setRangeCrosshairVisible(true); // add decay sub-plot to parent parent.add(decaySubPlot, DECAY_WEIGHT); // create residual sub-plot final NumberAxis residualAxis = new NumberAxis(RESIDUAL_AXIS_LABEL); final XYSplineRenderer residualRenderer = new XYSplineRenderer(); residualRenderer.setSeriesPaint(0, RESIDUAL_COLOR); residualRenderer.setSeriesLinesVisible(0, false); residualRenderer.setSeriesShape(0, new Ellipse2D.Float(-1.0f, -1.0f, 2.0f, 2.0f)); final XYPlot residualSubPlot = new XYPlot(residualDataset, null, residualAxis, residualRenderer); residualSubPlot.setDomainCrosshairVisible(true); residualSubPlot.setRangeCrosshairVisible(true); residualSubPlot.setFixedLegendItems(null); // add residual sub-plot to parent parent.add(residualSubPlot, RESIDUAL_WEIGHT); // now make the top level JFreeChart final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, parent, true); chart.removeLegend(); return chart; }
From source file:gui.QTLResultsPanel.java
private JPanel getChart(Trait trait) { JFreeChart chart = ChartFactory.createXYLineChart(null, "Position (cM)", "LOD Score", null, PlotOrientation.VERTICAL, true, true, false); setChartData(chart, trait);/* www . j av a 2 s .c o m*/ RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); chart.setRenderingHints(rh); chart.removeLegend(); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(new Color(255, 255, 220)); plot.setDomainGridlinePaint(new Color(128, 128, 128)); plot.setRangeGridlinePaint(new Color(128, 128, 128)); ValueAxis axis = plot.getRangeAxis(); if (trait.maxLOD <= 3) { axis.setUpperBound(3); } PermResult result = trait.getPermResult(); if (result != null) { float[] dashPattern = { 5, 5 }; BasicStroke s1 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, dashPattern, 0); ValueMarker m1 = new ValueMarker(result.getSig90(), new Color(0, 0, 60), s1, null, null, 1.0f); ValueMarker m2 = new ValueMarker(result.getSig95(), new Color(0, 0, 60), s1, null, null, 1.0f); plot.addRangeMarker(m1); plot.addRangeMarker(m2); if (result.getSig95() > trait.maxLOD && result.getSig95() >= 3) { axis.setUpperBound(result.getSig95() * (1.05)); } } chartPanel = new ChartPanel(chart); chartPanel.setPopupMenu(null); return chartPanel; }