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:IHM.NewClass.java
/** * * @param title/* w w w.jav a 2s. c om*/ */ public NewClass(String title /*,*JInternalFrame jp*/) { super(title); // jp = new JInternalFrame("courbes"); JFreeChart chart = createChart(createDataset()); ChartPanel panel = new ChartPanel(chart); panel.setPreferredSize(new Dimension(500, 300)); setContentPane(panel); // jp.add(panel, BorderLayout.EAST); // jp.setVisible(true); panel.setVisible(true); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(renderer); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); // sets thickness for series (using strokes) renderer.setSeriesStroke(0, new BasicStroke(4.0f)); renderer.setSeriesStroke(1, new BasicStroke(3.0f)); renderer.setSeriesStroke(2, new BasicStroke(2.0f)); plot.setRenderer(renderer); plot.setOutlinePaint(Color.BLUE); plot.setOutlineStroke(new BasicStroke(2.0f)); plot.setBackgroundPaint(Color.DARK_GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.BLACK); }
From source file:org.jfree.chart.demo.MultipleAxisDemo3.java
/** * A demonstration application showing how to create a time series chart with muliple axes. * * @param title the frame title.// ww w . j ava 2s .co m */ public MultipleAxisDemo3(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:fitmon.Chart.java
/** * Creates a new demo instance.// w w w . j ava 2 s . c o m * * @param title the frame title. */ public Chart(final String title) { super(title); final CategoryDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo3.java
/** * Constructs a new demonstration application. * * @param title the frame title.//ww w . jav a 2 s . com */ public CombinedXYPlotDemo3(final String title) { super(title); final JFreeChart chart = createCombinedChart(); final ChartPanel panel = new ChartPanel(chart, true, true, true, false, true); panel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(panel); }
From source file:org.jfree.chart.demo.SurveyResultsDemo2.java
/** * Creates a new demo.//from w w w. j a va 2 s . c o m * * @param title the frame title. */ public SurveyResultsDemo2(final String title) { super(title); final CategoryDataset 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(300, 270)); setContentPane(chartPanel); }
From source file:bigdataproject.ScatterPlot.java
/** * Creates a new fast scatter plot.//from w ww . jav a 2 s.c om * * @param title the frame title. * @param samples the 2D matrix to plot. */ public ScatterPlot(final String title, double[][] samples, List<Cluster<DoublePoint>> list) { super(title); this.list = list; convertToFloat(samples); listToHashMap(); HashMap<Integer, float[][]> clusterData = HashMapDoubleToFloat(); final NumberAxis domainAxis = new NumberAxis("X1"); domainAxis.setAutoRangeIncludesZero(false); final NumberAxis rangeAxis = new NumberAxis("X2"); rangeAxis.setAutoRangeIncludesZero(false); final CustomFastScatterPlot plot = new CustomFastScatterPlot(this.data, domainAxis, rangeAxis, clusterData); final JFreeChart chart = new JFreeChart(title, plot); //chart.setLegend(null); // force aliasing of the rendered content.. chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final ChartPanel panel = new ChartPanel(chart, true); panel.setPreferredSize(new java.awt.Dimension(1000, 540)); panel.setMinimumDrawHeight(10); panel.setMaximumDrawHeight(2000); panel.setMinimumDrawWidth(20); panel.setMaximumDrawWidth(2000); setContentPane(panel); }
From source file:turtlekit.murmuration.HeadingChecker.java
@Override public void setupFrame(JFrame frame) { XYSeriesCollection dataset = new XYSeriesCollection(); final ChartPanel chartPanel = ChartsUtil.createChartPanel(dataset, "Average heading", null, null); chartPanel.setPreferredSize(new java.awt.Dimension(550, 250)); heading = new XYSeries("Average heading"); dataset.addSeries(heading);/*from www . j a va2s .com*/ frame.setContentPane(chartPanel); frame.setLocation(50, 0); // XYSeries s = dataset.getSeries("Total"); }
From source file:userinterface.patientRole.LineChart.java
public LineChart(String applicationTitle, String chartTitle, XYSeries bR, XYSeries pR, XYSeries bS, XYSeries bP, JFrame parent) {/*from ww w . jav a2 s. c om*/ // super(applicationTitle); this.bR = bR; this.pR = pR; this.bS = bS; this.bP = bP; this.parent = parent; dataset = createDataset(); JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "Category", "Vital Signs", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(xylineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); final XYPlot plot = xylineChart.getXYPlot(); plot.setBackgroundPaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); renderer.setSeriesPaint(3, Color.BLUE); renderer.setSeriesStroke(0, new BasicStroke(1.0f)); renderer.setSeriesStroke(1, new BasicStroke(1.0f)); renderer.setSeriesStroke(2, new BasicStroke(1.0f)); renderer.setSeriesStroke(3, new BasicStroke(1.0f)); plot.setRenderer(renderer); setContentPane(chartPanel); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); }
From source file:org.jfree.chart.demo.CompassFormatDemo.java
/** * Creates a new demo instance.//from w w w. j a v a 2s .co m * * @param title the frame title. */ public CompassFormatDemo(final String title) { super(title); final JFreeChart chart = createChart(); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.ItemLabelDemo1.java
/** * Creates a new demo instance.//from w w w . ja v a 2 s. co m * * @param title * the frame title. */ public ItemLabelDemo1(final String title) { super(title); final CategoryDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartPanel); }