List of usage examples for org.jfree.chart ChartPanel ChartPanel
public ChartPanel(JFreeChart chart)
From source file:GUI.MagasinStats.java
/** * Creates new form InterfaceEtatDesVehiculesDansUneAnne *//*from w w w .j a v a 2s . co m*/ public MagasinStats() { initComponents(); CarDAO carDao = new CarDAO(); DefaultPieDataset chartData = new DefaultPieDataset(); for (Car car : carDao.findAllCars()) { ArticleDAO articleDao = new ArticleDAO(); chartData.setValue(car.getImmatriculation(), articleDao.sumArticlesByCar(car)); } // This will create the dataset PieDataset dataset = (PieDataset) chartData; // based on the dataset we create the chart JFreeChart chart = createChart(dataset, "Cars stats"); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); // default size chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); // add it to our application setContentPane(chartPanel); }
From source file:com.jml.main.Graph.java
public void drawLineChart(String title, XYDataset xYDataset) { JFreeChart chart = ChartFactory.createXYLineChart(title, null, null, xYDataset, PlotOrientation.VERTICAL, true, true, false);/*from w w w .j a va2 s. co m*/ panel = new ChartPanel(chart); this.add(panel); this.pack(); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); }
From source file:com.philng.telemetrydisplay.GraphDisplay.java
/** * Build all the initial data/*w ww. j a v a 2 s .c o m*/ */ public GraphDisplay() { voltage = new TimeSeries("Voltage"); current = new TimeSeries("Current"); this.setLayout(new BorderLayout()); final JFreeChart chart = createChart(createDatasetVoltage()); final ChartPanel chartPanel = new ChartPanel(chart); add(chartPanel, BorderLayout.CENTER); chartPanel.setVisible(true); setVisible(true); // Add a mouse listener for when the user double clicks the mousse // on the graph, it will reset the zoome ChartMouseListener cml = new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent chartMouseEvent) { if (chartMouseEvent.getTrigger().getClickCount() == 2) { chartPanel.restoreAutoBounds(); } } @Override public void chartMouseMoved(ChartMouseEvent chartMouseEvent) { } }; chartPanel.addChartMouseListener(cml); }
From source file:de.dfki.owlsmx.gui.ShowResultVisualization.java
/** Creates new form AboutFrame */ public ShowResultVisualization(JFreeChart chart) { this.chart = chart; chartPanel = new ChartPanel(chart); initComponents();//from w w w .ja v a 2 s .c o m }
From source file:info.opencards.ui.ltmstats.AdvancedLtmStatsPanel.java
public void rebuildPanel(Collection<CardFile> currentFiles) { removeAll();/*w ww. ja v a 2 s . c o m*/ // setup the stacked bar chart dataset = new HistogramDataset(); // dataset.addSeries("test", new double[]{1,2,3},1); final JFreeChart chart = ChartFactory.createHistogram(null, // chart title Utils.getRB().getString("CardTableModel.stats.weekSchedule"), // domain axis label // "# cards", // range axis label null, // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation false, // legend true, // tooltips false // urls ); add(new ChartPanel(chart), BorderLayout.CENTER); // rebuildPanel(new HashSet<CardFile>()); if (currentFiles != null) this.currentFiles = currentFiles; // dataset.setGroup(null); if (this.currentFiles == null) return; List<Double> eValues = new ArrayList<Double>(); for (CardFile currentFile : currentFiles) { for (Item item : currentFile.getFlashCards().getLTMItems()) { LTMItem ltmItem = (LTMItem) item; eValues.add(ltmItem.getEFactor()); } } double[] eVals = new double[eValues.size()]; for (int i = 0; i < eValues.size(); i++) { eVals[i] = eValues.get(i); } if (eVals.length > 0) dataset.addSeries("test", eVals, 10); HistogramDataset dataset1 = new HistogramDataset(); dataset1.addSeries("test", eVals, 10); repaint(); // computeScheduleHist(this.currentFiles); // set2EDistribution(currentFiles); }
From source file:one.TimeLineChart.java
public TimeLineChart(final String title) { super(title); //this.title = title; hm = new HashMap<>(); tm = new TaskModel(); hm = tm.timeLineChart(101);//from ww w.ja v a 2 s .c o m task = new String[hm.size()]; time = new Date[hm.size()]; final IntervalCategoryDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); //this.add(chartPanel); setContentPane(chartPanel); }
From source file:edu.pdi2.visual.ViewSignature.java
public ViewSignature(String name, byte[] sign) { super();/* w w w. j av a2 s .c o m*/ XYSeries signature = new XYSeries("Signature"); for (int i = 0; i < sign.length; i++) { signature.add(i, sign[i]); } JFrame frame = new JFrame(); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(signature); JFreeChart signatureG = ChartFactory.createXYLineChart("Signature " + name, "Valorx", "Valory", dataset, PlotOrientation.VERTICAL, true, true, false); ChartPanel chartpanel = new ChartPanel(signatureG); chartpanel.setPreferredSize(new Dimension(390, 290)); frame.setContentPane(chartpanel); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.pack(); frame.setSize(400, 300); frame.setVisible(true); if (name == " RED") frame.setLocation(0, 300); else frame.setLocation(400, 300); }
From source file:uk.ac.lkl.cram.ui.chart.TLALearningTypeChartFactory.java
/** * Create a new instance of ChartPanel from the tla provided. * @param tla the tla that has learning types * @return a chart panel containing a pie chart on the learning types of the activity *///w ww . j av a 2 s. c o m static ChartPanel createChartPanel(TLActivity tla) { JFreeChart chart = createChart(tla); ChartPanel chartPanel = new ChartPanel(chart); return chartPanel; }
From source file:userInterface.ManufactureRole.DecisionChartJPanel.java
public DecisionChartJPanel(JPanel userProcessContainer, ManufactureOrganization o) { initComponents();//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. this.userProcessContainer = userProcessContainer; this.o = o;/*from w ww.ja v a2 s . c o m*/ JFreeChart jfreechart1 = createChart1(createDataset1()); ChartPanel chartpanel1 = new ChartPanel(jfreechart1); chartpanel1.setPreferredSize(new Dimension(1000, 540)); jPanel1.add(chartpanel1); CardLayout layout1 = (CardLayout) jPanel1.getLayout(); layout1.next(jPanel1); }
From source file:br.prof.salesfilho.oci.image.GraphicBuilder.java
public GraphicBuilder(final String title) { super(title); this.title = title; dataSet = collectionDataset = new XYSeriesCollection(); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel);/*from w w w . ja v a 2 s .c o m*/ }