List of usage examples for org.jfree.ui RefineryUtilities centerFrameOnScreen
public static void centerFrameOnScreen(final Window frame)
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.XY_PlotFrame.java
/** * A time series plot of a single port counter. This is a multiple axis * plot, showing the actual value, and the delta value. Optionally two * additional data sets can be displayed for correlation purposes if the * "includeExtra" argument is set./*from w w w. j a va2s . c om*/ * * In the case of an Error counter, the xmit and rcv delta counts are * included. * * In the case of a Traffic counter, the rate and % utilization values are * included * * @see XYPlot * * @param vertex the parent node of the port * @param port the parent port of the counter * @param portCounter the specific counter to be plotted * @param includeExtra true if extra counter values should be plotted ***********************************************************/ public XY_PlotFrame(XY_PlotType type, Object userObject, Object userElement) { // type is the type of graph or plot to produce, and should contain enough info // // osm contains the data, or the initial data anyway // // userObject contains "type" specific data, like the PortCounterName, or MAD_Counter // if (type.isAdvanced()) thePanel = new AdvancedXY_PlotPanel(type, userObject, userElement); else thePanel = new SimpleXY_PlotPanel(type, userObject, userElement); this.setTitle(thePanel.getTitle()); this.getContentPane().add(thePanel); this.pack(); RefineryUtilities.centerFrameOnScreen(this); this.setVisible(true); }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PortCounterXYplot.java
/** * A time series plot of a single port counter. This is a multiple axis * plot, showing the actual value, and the delta value. Optionally two * additional data sets can be displayed for correlation purposes if the * "includeExtra" argument is set.//from w w w .j av a 2 s.co m * * In the case of an Error counter, the xmit and rcv delta counts are * included. * * In the case of a Traffic counter, the rate and % utilization values are * included * * @see XYPlot * * @param vertex the parent node of the port * @param port the parent port of the counter * @param portCounter the specific counter to be plotted * @param includeExtra true if extra counter values should be plotted ***********************************************************/ public PortCounterXYplot(IB_Vertex vertex, OSM_Port port, PortCounterName portCounter, boolean includeExtra) { // this is the normal constructor this(portCounter.getName() + " [" + vertex.getName() + " (" + port.getOSM_PortKey() + ")]"); thePanel = new PortCounterXYplotPanel(vertex, port, portCounter, includeExtra); this.getContentPane().add(thePanel); this.pack(); RefineryUtilities.centerFrameOnScreen(this); this.setVisible(true); }
From source file:org.jfree.chart.demo.PriceVolumeDemo2.java
public static void main(String args[]) { PriceVolumeDemo2 pricevolumedemo2 = new PriceVolumeDemo2("JFreeChart: PriceVolumeDemo2.java"); pricevolumedemo2.pack();/*from w w w . j a va2 s . co m*/ RefineryUtilities.centerFrameOnScreen(pricevolumedemo2); pricevolumedemo2.setVisible(true); }
From source file:com.deafgoat.ml.prognosticator.Charter.java
/** * Shows the given chart//from w w w.j av a 2 s .c o m * * @param name * The name to save the chart as * @param chart * The chart to draw */ private void drawChart(String name, JFreeChart chart) { _logger.info("Plotting p.d. chart for " + name); ChartFrame frame = new ChartFrame(name, chart); RefineryUtilities.centerFrameOnScreen(frame); frame.pack(); frame.setVisible(true); }
From source file:com.leonarduk.finance.analysis.BuyAndSellSignalsToChart.java
/** * Displays a chart in a frame.//from w ww . j a va 2s . co m * * @param chart * the chart to be displayed */ private static void displayChart(final JFreeChart chart) { // Chart panel final ChartPanel panel = new ChartPanel(chart); panel.setFillZoomRectangle(true); panel.setMouseWheelEnabled(true); panel.setPreferredSize(new Dimension(1024, 400)); // Application frame final ApplicationFrame frame = new ApplicationFrame("Ta4j example - Buy and sell signals to chart"); frame.setContentPane(panel); frame.pack(); RefineryUtilities.centerFrameOnScreen(frame); frame.setVisible(true); }
From source file:org.samjoey.graphing.GraphUtility.java
public static void createGraphs(LinkedList<Game> games) { HashMap<String, XYSeriesCollection> datasets = new HashMap<>(); for (Game game : games) { for (String key : game.getVarData().keySet()) { if (datasets.containsKey(key)) { try { datasets.get(key).addSeries(createSeries(game.getVar(key), "" + game.getId())); } catch (Exception e) { }// w ww . j a va2 s . com } else { datasets.put(key, new XYSeriesCollection()); datasets.get(key).addSeries(createSeries(game.getVar(key), "" + game.getId())); } } } for (String key : datasets.keySet()) { JFrame f = new JFrame(); JFreeChart chart = ChartFactory.createXYLineChart(key, // chart title "X", // x axis label "Y", // y axis label datasets.get(key), // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); XYPlot plot = chart.getXYPlot(); XYItemRenderer rend = plot.getRenderer(); for (int i = 0; i < games.size(); i++) { Game g = games.get(i); if (g.getWinner() == 1) { rend.setSeriesPaint(i, Color.RED); } if (g.getWinner() == 2) { rend.setSeriesPaint(i, Color.BLACK); } if (g.getWinner() == 0) { rend.setSeriesPaint(i, Color.PINK); } } ChartPanel chartPanel = new ChartPanel(chart); f.setContentPane(chartPanel); f.pack(); RefineryUtilities.centerFrameOnScreen(f); f.setVisible(true); } }
From source file:pisco.batch.visu.BatchingChartFactory.java
/** * Starting point for the demonstration application. * * @param args ignored./* ww w . j a va 2 s. c o m*/ */ public static void main(String[] args) { //data final BJob[] inst1 = new BJob[] { new BJob(1, 5, 2, 1, 7), new BJob(2, 6, 3, 1, 8), new BJob(3, 7, 4, 1, 12), new BJob(4, 4, 1, 1, 9), new BJob(5, 3, 2, 1, 15) }; Batch[] batches = new Batch[3]; batches[0] = new Batch(0); batches[0].parallelMerge(inst1[0]); batches[0].parallelMerge(inst1[1]); batches[1] = new Batch(1); batches[1].parallelMerge(inst1[2]); batches[1].parallelMerge(inst1[3]); batches[2] = new Batch(2); batches[2].parallelMerge(inst1[4]); //PDRScheduler.schedule1Lmax(batches); PDR1Scheduler.schedule1WFlow(batches); //frame ApplicationFrame demo = new ApplicationFrame("Batch Processing Demo"); //ChartPanel chartPanel = new ChartPanel( createLmaxChart(batches, "test", 10)); ChartPanel chartPanel = new ChartPanel(createWFlowChart(batches, "test", -1)); chartPanel.setPreferredSize(new java.awt.Dimension(500, 300)); demo.setContentPane(chartPanel); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); }
From source file:flexflux.analyses.result.ParetoAnalysisResult.java
public void plot() { XYSeriesCollection dataset = new XYSeriesCollection(); int i = 1;//ww w.j ava 2 s.c om for (Objective obj : oneDResults.keySet()) { XYSeries series = new XYSeries(obj.getName()); for (double val : oneDResults.get(obj)) { series.add(i, val); } dataset.addSeries(series); i++; } // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "Objectives", // x axis label "Values", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); ChartPanel chartPanel = new ChartPanel(chart); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinePaint(Color.GRAY); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setLinesVisible(false); renderer.setShapesVisible(true); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFrame frame = new JFrame("Pareto analysis one dimension results"); frame.add(chartPanel); frame.pack(); RefineryUtilities.centerFrameOnScreen(frame); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); for (PP2DResult r : twoDResults.keySet()) { r.plot(); } for (PP3DResult r : threeDResults.keySet()) { r.plot(); } }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PortHeatMapPlotPanel.java
/** * Starting point for the demonstration application. * * @param args/*from ww w . j ava 2s .com*/ * ignored. */ public static void main(String[] args) { JFrame demo = new JFrame("HeatMap"); JPanel content = new PortHeatMapPlotPanel(); demo.setContentPane(content); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); }