List of usage examples for org.jfree.chart JFreeChart removeLegend
public void removeLegend()
From source file:org.gdms.usm.view.ProgressFrame.java
private ChartPanel createChartPanel(String valueName, XYSeries data) { XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(data);//from w w w . j a va 2s .c om JFreeChart chart = ChartFactory.createXYLineChart(null, "Step", valueName, dataset, PlotOrientation.VERTICAL, true, true, false); chart.removeLegend(); return new ChartPanel(chart); }
From source file:arduinoserialread.SerialRead.java
private void initGUI() { // init the frame frame.setTitle("Arduino Serial Read"); frame.setBounds(100, 100, 600, 500); frame.setMinimumSize(new Dimension(600, 500)); frame.setLocationRelativeTo(null);/*w w w. j a v a2 s . co m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // init control panel JPanel ctrlPanel = new JPanel(); ctrlPanel.setLayout(new FlowLayout()); // init the serial connection panel serialCOM = new SerialConnectionPanel(); ctrlPanel.add(serialCOM); frame.getContentPane().add(ctrlPanel, BorderLayout.SOUTH); // init the connection status ConnectionStatus connectionStatus = new ConnectionStatus(); ctrlPanel.add(connectionStatus); // init connect and disconnect button connect = new JButton("connect"); ctrlPanel.add(connect); disconnect = new JButton("disconnect"); ctrlPanel.add(disconnect); // init real time chart TimeSeries series = new TimeSeries("DATA"); DateAxis timeAxis = new DateAxis("Time"); dataset = new TimeSeriesCollection(series); NumberAxis rangeAxis = new NumberAxis("Data"); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setAutoRange(true); XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis, new StandardXYItemRenderer()); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.getRenderer().setSeriesPaint(0, new Color(0, 142, 192)); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setAutoRange(true); domainAxis.setFixedAutoRange(30000.0); // 30 seconds // init the JFreeChart JFreeChart chart = new JFreeChart("Real-Time Data Chart", plot); chart.setBorderPaint(Color.lightGray); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); chart.removeLegend(); // add real time chart to the frame ChartPanel chartPanel = new ChartPanel(chart); frame.getContentPane().add(chartPanel, BorderLayout.CENTER); }
From source file:org.gephi.statistics.plugin.WeightedDegree.java
public String getReport() { String report = ""; if (isDirected) { report = getDirectedReport();/* ww w . j a va2s . com*/ } else { //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(degreeDist, "Degree Distribution"); XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(dSeries); JFreeChart chart1 = ChartFactory.createXYLineChart("Degree Distribution", "Value", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false); chart1.removeLegend(); ChartUtils.decorateChart(chart1); ChartUtils.scaleChart(chart1, dSeries, false); String degreeImageFile = ChartUtils.renderChart(chart1, "w-degree-distribution.png"); NumberFormat f = new DecimalFormat("#0.000"); report = "<HTML> <BODY> <h1>Weighted Degree Report </h1> " + "<hr>" + "<br> <h2> Results: </h2>" + "Average Weighted Degree: " + f.format(avgWDegree) + "<br /><br />" + degreeImageFile + "</BODY></HTML>"; } return report; }
From source file:edu.uic.cs.compbio.DyNSPK.DynamicEntropy.java
public String makeChart(Map<Double, Double> data, String filename, String Title, String XAxis, String YAxis) { //Time series XYSeries dSeries = ChartUtils.createXYSeries(data, Title); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries);//from w w w . j a v a 2s .c o m JFreeChart chart = ChartFactory.createXYLineChart(Title, XAxis, YAxis, dataset, PlotOrientation.HORIZONTAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, false); String degreeImageFile = ChartUtils.renderChart(chart, filename); return degreeImageFile; }
From source file:org.sonar.api.charts.AbstractChart.java
private void improveChart(JFreeChart jfrechart, ChartParameters params) { Color background = Color .decode("#" + params.getValue(ChartParameters.PARAM_BACKGROUND_COLOR, "FFFFFF", false)); jfrechart.setBackgroundPaint(background); jfrechart.setBorderVisible(false);// w ww. j a v a 2 s . c om jfrechart.setAntiAlias(true); jfrechart.setTextAntiAlias(true); jfrechart.removeLegend(); }
From source file:io.jcml.gephi.plugins.abcd.ABCD.java
@Override public String getReport() { String report = ""; //Distribution series XYSeries cSeries = ChartUtils.createXYSeries(countsDist, "Friendship Scores Distribution"); XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(cSeries);/*from w w w . java 2s . co m*/ JFreeChart chart1 = ChartFactory.createXYLineChart("Friendship Scores Distribution", "Value", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false); chart1.removeLegend(); ChartUtils.decorateChart(chart1); ChartUtils.scaleChart(chart1, cSeries, false); String countsImageFile = ChartUtils.renderChart(chart1, "scores-distribution.png"); NumberFormat f = new DecimalFormat("#0.000"); report = "<HTML> <BODY> <h1>ABCD Report </h1> " + "<hr>" + "<br> <h2> Results: </h2>" + "Average score: " + f.format(avgFriendship) + "<br /><br />" + countsImageFile + "</BODY></HTML>"; return report; }
From source file:org.rdv.viz.dial.DialPanel.java
/** * Creates the panel containing the dial. * // ww w. java 2 s. c om * @return the dial panel */ private JPanel createDialPanel() { plot = new DialPlot(dataset); plot.setDialFrame(new StandardDialFrame()); engineeringFormat = new EngineeringFormat(); engineeringFormatWithUnit = new EngineeringFormat(); dialValueIndicator = new DialValueIndicator(); dialValueIndicator.setOutlinePaint(Color.black); dialValueIndicator.setRadius(0.7); dialValueIndicator.setVisible(false); dialValueIndicator.setNumberFormat(engineeringFormatWithUnit); plot.addLayer(dialValueIndicator); dialTextAnnotation = new DialTextAnnotation(""); dialTextAnnotation.setRadius(0.8); plot.addLayer(dialTextAnnotation); DialPointer dialPointer = new DialPointer.Pointer(); dialPointer.setRadius(0.9); plot.addPointer(dialPointer); plot.setCap(new DialCap()); dialScale = new BoundedDialScale(); dialScale.setStartAngle(-120); dialScale.setExtent(-300); dialScale.setMinorTickCount(5); dialScale.setTickLabelFormatter(engineeringFormat); dialScale.setTickRadius(0.9); JFreeChart chart = new JFreeChart(plot); chart.removeLegend(); return new ChartPanel(chart); }
From source file:projects.upc.exec.HrDiagram.java
/** * Update the {@link HrDiagram#chartPanel}. *///w w w . j a v a2 s . com private void updateChart() { XYSeries series = new XYSeries("UPC HR diagram"); for (Entry<UpcStar, SsaCrossMatch> xm : starsToPlot.entrySet()) { UpcStar upcStar = xm.getKey(); SsaCrossMatch ssa = xm.getValue(); // Get the SSA colours of the UPC star double b = ssa.ssaB; double r2 = ssa.ssaR2; // double i = ssa.ssaI; // Use the parallax to correct the apparent magnitude to absolute magnitude. // Extract the parallax and error to use double p = (useHip && upcStar.isHipparcosStar()) ? upcStar.srcPi : upcStar.absPi; double sigma_p = (useHip && upcStar.isHipparcosStar()) ? upcStar.srcPiErr : upcStar.absPiErr; // Filter on the fractional parallax error double f = sigma_p / p; if (f > fMax) { continue; } // Correct to arcseconds p /= 1000; sigma_p /= 1000; // Get the distance double d = DistanceFromParallax.getDistance(p, sigma_p, method); // Filter & convert to absolute magnitude if (d > 0 && !Double.isInfinite(d)) { double B = MagnitudeUtils.getAbsoluteMagnitude(d, b); series.add(b - r2, B); } } XYSeriesCollection data = new XYSeriesCollection(); data.addSeries(series); // Set up the renderer XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesShape(0, new Ellipse2D.Double(-0.5, -0.5, 1, 1)); // Configure axes NumberAxis xAxis = new NumberAxis("B - R [mag]"); xAxis.setRange(-1.0, 3.5); NumberAxis yAxis = new NumberAxis("B [mag]"); yAxis.setInverted(true); yAxis.setRange(-5, 15); // Configure plot XYPlot xyplot = new XYPlot(data, xAxis, yAxis, renderer); xyplot.setBackgroundPaint(Color.white); JFreeChart chart = new JFreeChart("HR diagram of UPC stars with SSA cross-matches", xyplot); chart.removeLegend(); chart.setBackgroundPaint(Color.white); if (chartPanel == null) { // Branch is used on initialisation chartPanel = new ChartPanel(chart); } else { chartPanel.setChart(chart); } }
From source file:org.gephi.statistics.plugin.EigenvectorCentrality.java
/** * /*from w ww.j a v a 2s . c o m*/ * @return */ public String getReport() { //distribution of values Map<Double, Integer> dist = new HashMap<Double, Integer>(); for (int i = 0; i < centralities.length; i++) { Double d = centralities[i]; if (dist.containsKey(d)) { Integer v = dist.get(d); dist.put(d, v + 1); } else { dist.put(d, 1); } } //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(dist, "Eigenvector Centralities"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createScatterPlot("Eigenvector Centrality Distribution", "Score", "Count", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, true); String imageFile = ChartUtils.renderChart(chart, "eigenvector-centralities.png"); String report = "<HTML> <BODY> <h1>Eigenvector Centrality Report</h1> " + "<hr>" + "<h2> Parameters: </h2>" + "Network Interpretation: " + (isDirected ? "directed" : "undirected") + "<br>" + "Number of iterations: " + numRuns + "<br>" + "Sum change: " + sumChange + "<br> <h2> Results: </h2>" + imageFile + "</BODY></HTML>"; return report; }
From source file:org.gephi.statistics.plugin.Degree.java
/** * * @return// w ww .j ava2 s .c om */ public String getReport() { String report = ""; if (isDirected) { report = getDirectedReport(); } else { //Distribution series XYSeries dSeries = ChartUtils.createXYSeries(degreeDist, "Degree Distribution"); XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(dSeries); JFreeChart chart1 = ChartFactory.createXYLineChart("Degree Distribution", "Value", "Count", dataset1, PlotOrientation.VERTICAL, true, false, false); chart1.removeLegend(); ChartUtils.decorateChart(chart1); ChartUtils.scaleChart(chart1, dSeries, false); String degreeImageFile = ChartUtils.renderChart(chart1, "degree-distribution.png"); NumberFormat f = new DecimalFormat("#0.000"); report = "<HTML> <BODY> <h1>Degree Report </h1> " + "<hr>" + "<br> <h2> Results: </h2>" + "Average Degree: " + f.format(avgDegree) + "<br /><br />" + degreeImageFile + "</BODY></HTML>"; } return report; }