List of usage examples for org.jfree.chart ChartPanel setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:org.jfree.chart.demo.MultipleAxisDemo2.java
/** * A demonstration application showing how to create a time series chart with muliple axes. * * @param title the frame title./*from www . ja v a 2 s. c om*/ */ public MultipleAxisDemo2(final String title) { super(title); final JFreeChart chart = createChart(); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(600, 270)); setContentPane(chartPanel); }
From source file:graphview_components.GanttChart.java
/** * Creates a new chart.//from w w w. j ava 2s . c om * * @param title * the frame title. */ public GanttChart(final String title) { super(title); ArrayList<Activities> activities = DataResource.selectedProject.getActivityList(); final IntervalCategoryDataset dataset = createDataset(activities); final JFreeChart chart = createChart(dataset, DataResource.selectedProject.getProjectName()); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.InternalFrameDemo.java
/** * Creates an internal frame.// www . ja va 2s . c o m * * @return An internal frame. */ private JInternalFrame createFrame2() { final XYDataset dataset1 = createDataset("Series 1", 100.0, new Minute(), 200); final JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series Chart", "Time of Day", "Value", dataset1, true, true, false); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(200, 100)); final JInternalFrame frame = new JInternalFrame("Frame 2", true); frame.getContentPane().add(chartPanel); return frame; }
From source file:sanger.team16.gui.genevar.eqtl.gene.RegionalPlot.java
public RegionalPlot(String geneChromosome, int geneStart, int distance, double threshold, List<QTL> significances, List<QTL> insignificances) throws ArrayIndexOutOfBoundsException { XYDataset dataset = this.createDataset(significances, insignificances); JFreeChart chart = createChart(geneChromosome, geneStart, distance, threshold, dataset); chart.setBackgroundPaint(Color.white); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(680, 175)); this.add(chartPanel); }
From source file:ui.FitnessGraph.java
public FitnessGraph(final String title, ArrayList<Double> data) { super(title); JFreeChart chart = createChart(createDataset(data)); File imageFile = new File(ConfigFile.getInstance("config.txt").getString("outputFitness")); int width = 1280; int height = 960; try {//from w ww .j a v a2s . c o m ChartUtilities.saveChartAsPNG(imageFile, chart, width, height); // System.exit(0); } catch (IOException ex) { System.err.println(ex); } final ChartPanel panel = new ChartPanel(chart); panel.setPreferredSize(new java.awt.Dimension(1500, 800)); this.setContentPane(panel); }
From source file:cglabsample.ui.HistogramWindow.java
private void updateHistogram() { if (!image.isGrayscale()) { image.toGrayscale();//from w w w . jav a 2 s . c o m } ImageStatistics is = new ImageStatistics(image); Histogram h = is.getHistogramGray(); double[] hvalues = new double[256]; int[] hivalues = h.getValues(); for (int i = 0; i < hivalues.length; i++) { hvalues[i] = (double) hivalues[i]; } // HistogramDataset dataset = new HistogramDataset(); // dataset.setType(HistogramType.FREQUENCY); // dataset.addSeries("Histograma", hvalues, 256); // String plotTitle = "Histograma"; // String xaxis = "intensidade"; // String yaxis = "frequencia"; // PlotOrientation orientation = PlotOrientation.VERTICAL; // boolean show = false; // boolean toolTips = false; // boolean urls = false; // JFreeChart chart = ChartFactory.createHistogram(plotTitle, xaxis, yaxis, // dataset, orientation, show, toolTips, urls); // ChartPanel cp = new ChartPanel(chart); // setContentPane(cp); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < 256; i++) { dataset.addValue(hvalues[i], "Histograma", "Histograma" + i); } String plotTitle = "Histograma"; String xaxis = "intensidade"; String yaxis = "frequencia"; PlotOrientation orientation = PlotOrientation.VERTICAL; boolean show = false; boolean toolTips = false; boolean urls = false; JFreeChart chart = ChartFactory.createBarChart(plotTitle, xaxis, yaxis, dataset, orientation, show, toolTips, urls); ChartPanel cp = new ChartPanel(chart); cp.setPreferredSize(new Dimension(500, 270)); setContentPane(cp); }
From source file:turtlekit.murmuration.SpeedChecker.java
@Override public void setupFrame(JFrame frame) { XYSeriesCollection dataset = new XYSeriesCollection(); final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "Moyenne", null, null); chartPanel.setPreferredSize(new java.awt.Dimension(550, 250)); speed = new XYSeries("Speed"); dataset.addSeries(speed);/*from w w w .j av a2 s . c om*/ frame.setContentPane(chartPanel); frame.setLocation(50, 0); // XYSeries s = dataset.getSeries("Total"); }
From source file:com.sigueros.charts.LinearRegressionExample.java
public LinearRegressionExample(String applicationTitle, String chartTitle) { super(applicationTitle); fillinDataArray();/*from ww w. ja va 2 s . c o m*/ // based on the dataset we create the chart JFreeChart chart = createChart(chartTitle); // 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:one.TimeLineChart.java
public TimeLineChart(final String title) { super(title); //this.title = title; hm = new HashMap<>(); tm = new TaskModel(); hm = tm.timeLineChart(101);/*from www . java2 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:org.jfree.chart.demo.MultiplePieChartDemo2.java
/** * Creates a new demo.//from ww w .j ava2 s . c o m * * @param title the frame title. */ public MultiplePieChartDemo2(final String title) { super(title); final CategoryDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart, true, true, true, false, true); chartPanel.setPreferredSize(new java.awt.Dimension(600, 380)); setContentPane(chartPanel); }