List of usage examples for org.jfree.chart ChartPanel ChartPanel
public ChartPanel(JFreeChart chart)
From source file:com.tencent.wstt.apt.chart.PieChart.java
public PieChart() { super(new BorderLayout()); chart = createChart();//from w ww .ja v a 2s . c o m final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); this.add(chartPanel); }
From source file:app.gui.ViewGraphic.java
public ViewGraphic(String title) { setSize(600, 400);/*from w ww . ja va 2 s. c o m*/ setLocationRelativeTo(this); setTitle(title); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { dispose(); } }); setLayout(new BorderLayout()); serieError = new XYSeries(title); dataset = new XYSeriesCollection(); dataset.addSeries(serieError); chart = ChartFactory.createXYLineChart(title, Translate.get("GUI_PERIODS"), Translate.get("GUI_ERROR"), dataset, PlotOrientation.VERTICAL, true, true, false); add(new ChartPanel(chart), BorderLayout.CENTER); JPanel south = new JPanel(new MigLayout()); lblError = new JLabel(""); lblError.setHorizontalTextPosition(SwingConstants.LEFT); lblError.setFont(new Font("ARIAL", Font.BOLD, 26)); JLabel lblErrorTitle = new JLabel(Translate.get("GUI_ERROR") + ": "); lblErrorTitle.setFont(new Font("ARIAL", Font.BOLD, 26)); south.add(lblErrorTitle); south.add(lblError, "wrap"); add(south, BorderLayout.SOUTH); setVisible(true); }
From source file:Graphing.graphXY.java
public JPanel getXYgraphPanel() { XYDataset dataSet = getDataSet();/* www . j a v a 2 s . c o m*/ JFreeChart graph = ChartFactory.createXYLineChart(this.name, this.xLabel, this.yLabel, dataSet, this.p, this.Legend, this.toolTips, false); return new ChartPanel(graph); }
From source file:edu.pdi2.visual.extradialogs.SignatureDialog.java
private void initGUI() { try {/* w w w.ja v a 2s . c om*/ { getContentPane().setLayout(null); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { thisWindowClosing(evt); } }); { chartpanel = new ChartPanel(signatureG); getContentPane().add(chartpanel); chartpanel.setBorder(BorderFactory.createTitledBorder("")); chartpanel.setBounds(6, 5, 386, 211); } } this.setSize(410, 254); } catch (Exception e) { e.printStackTrace(); } }
From source file:de.h_da.fbi.rfid.gui.UHF_GUI.java
/** * Creates new form UHF_GUI//from w ww . j a v a 2s . co m */ public UHF_GUI(String applicationTitle, String chartTitle) { super(applicationTitle); // This will create the dataset initComponents(); CategoryDataset dataset = createDataset(); // based on the dataset we create the chart JFreeChart chart = createChart(dataset, chartTitle); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); // default size chartPanel.setPreferredSize(new java.awt.Dimension(700, 370)); // add it to our application setContentPane(chartPanel); }
From source file:org.rhwlab.ace3d.SegmentationLinePlot.java
public void setTree(BHCTree tree) { XYSeriesCollection collect = new XYSeriesCollection(); XYSeries series = new XYSeries(""); collect.addSeries(series);/*from w w w. jav a 2 s .c o m*/ TreeMap<Integer, TreeSet<NucleusLogNode>> map = tree.allTreeCuts(500); for (Integer i : map.keySet()) { TreeSet<NucleusLogNode> nodes = map.get(i); double lnP = nodes.first().getLogPosterior(); series.add((double) i, Math.exp(lnP)); } int t = tree.getTime(); int nu = tree.getNu(); JFreeChart chart = ChartFactory.createXYLineChart( String.format("Time=%d,nu=%d,alpha=%e", tree.getTime(), tree.getNu(), tree.getAlpha()), "Index", "Probability", collect, PlotOrientation.VERTICAL, false, true, true); XYPlot plot = (XYPlot) chart.getPlot(); ChartPanel panel = new ChartPanel(chart); this.add(panel); }
From source file:com.javafxpert.neuralnetviz.scenario.PlotUtil.java
/**Plot the training data. Assume 2d input, classification output * @param features Training data features * @param labels Training data labels (one-hot representation) * @param backgroundIn sets of x,y points in input space, plotted in the background * @param backgroundOut results of network evaluation at points in x,y points in space * @param nDivisions Number of points (per axis, for the backgroundIn/backgroundOut arrays) *///from w w w. jav a2 s.co m public static void plotTrainingData(INDArray features, INDArray labels, INDArray backgroundIn, INDArray backgroundOut, int nDivisions) { double[] mins = backgroundIn.min(0).data().asDouble(); double[] maxs = backgroundIn.max(0).data().asDouble(); XYZDataset backgroundData = createBackgroundData(backgroundIn, backgroundOut); JPanel panel = new ChartPanel( createChart(backgroundData, mins, maxs, nDivisions, createDataSetTrain(features, labels))); JFrame f = new JFrame(); f.add(panel); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setTitle("Training Data"); f.setVisible(true); }
From source file:ch.zhaw.ias.dito.ui.util.SingleHistogramPanel.java
public SingleHistogramPanel(Matrix m) { super(new BorderLayout()); this.m = m;/*from w ww. j av a2 s.c o m*/ this.chart = createChart(); this.chartPanel = new ChartPanel(this.chart); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); this.chartPanel.setBorder(border); add(this.chartPanel, BorderLayout.CENTER); JPanel dashboard = new JPanel(new BorderLayout()); dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4)); this.spinner = new JSpinner(new SpinnerNumberModel(0, 0, m.getColCount() - 1, 1)); spinner.addChangeListener(this); this.slider = new JSlider(0, m.getColCount() - 1, 0); slider.setPaintLabels(true); slider.setMajorTickSpacing(Math.max(50, 10 * Math.round(m.getColCount() / 100))); slider.setPaintTicks(true); this.slider.addChangeListener(this); FormLayout layout = new FormLayout("fill:0:g, max(20dlu; pref)", "top:pref"); CellConstraints cc = new CellConstraints(); DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle()); fb.add(slider, cc.xy(1, 1)); fb.add(spinner, cc.xy(2, 1)); dashboard.add(fb.getPanel(), BorderLayout.CENTER); add(dashboard, BorderLayout.SOUTH); switchColumn(0); }
From source file:org.matsim.contrib.util.chart.ChartWindowUtils.java
private static JDialog newChartDialog(JFreeChart chart, String title, boolean modal) { chart.setTitle(title);//from w w w . j a v a 2 s . com JDialog dialog = new JDialog(); dialog.setTitle(title); dialog.setContentPane(new ChartPanel(chart)); dialog.setModal(modal); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); return dialog; }
From source file:de.hs.mannheim.modUro.reader.JCellCountDiagram.java
public JCellCountDiagram(List<String> cellTypes, List<CellCountEntry> cellcountList) { XYDataset dataset = createDataset(cellTypes, cellcountList); chart = createChart(dataset, cellTypes); add(new ChartPanel(chart)); }