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:pl.poid.bzdp.zadanieObrazy.ImageHistogram.java
private ImageHistogram(String title, XYSeriesCollection dataset, Color c) { super(title); this.categoryDataset = dataset; this.c = c;//from ww w .j a v a 2 s . c o m final JFreeChart chart = createChart(dataset, c); final ChartPanel chartPanel = new ChartPanel(chart); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); chartPanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartPanel); }
From source file:daylightchart.gui.LocationsTabbedPane.java
/** * Add a new tab for the location./*from w w w. j a v a 2s . c o m*/ * * @param daylightChartReport * Daylight Chart report */ public void addLocationTab(final DaylightChartReport daylightChartReport) { final Location location = daylightChartReport.getLocation(); final DaylightChart chart = daylightChartReport.getChart(); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setName(location.toString()); chartPanel.setPreferredSize(ChartConfiguration.chartDimension); addTab(location.toString(), new CloseTabIcon(), chartPanel, LocationFormatter.getToolTip(location)); setSelectedIndex(getTabCount() - 1); }
From source file:netplot.XYPlotPanel.java
public void init() { xySeriesList = new Vector<XYSeries>(); chart = createChart(null);//from w ww.ja v a2 s. co m ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); itemCountList = new Vector<Integer>(); add(chartPanel); }
From source file:org.azrul.langmera.LineChart.java
/** * Creates a new demo./*from w w w.jav a 2 s. c o m*/ * * @param title the frame title. */ public LineChart(final String title, Map<String, List<Double>> dataList) { super(title); final XYDataset dataset = createDataset(dataList); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }
From source file:etssi.Graphique.java
/** * Creates a new demo./*from ww w. ja va 2 s .c om*/ * * @param title the frame title. */ public Graphique(final String title, Dataset courbe1, Dataset courbe2, Dataset courbe3) { super(title); final XYDataset dataset = createDataset(courbe1, courbe2, courbe3); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(800, 540)); setContentPane(chartPanel); }
From source file:medic_hospital.GlucoseTrend.java
public void populateChart(int id) { int[] glucoseList; double[] dateList; try {/* w ww .ja v a 2 s . co m*/ Class.forName("com.mysql.jdbc.Driver"); con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/medic", "root", ""); //To get the number of rows in the result String sql = "Select Count(*) from patient_statistics where patient_id = ?"; pst = con.prepareStatement(sql); pst.setInt(1, id); rs = pst.executeQuery(); if (rs.next()) { glucoseList = new int[rs.getInt("Count(*)")]; dateList = new double[rs.getInt("Count(*)")]; } else { glucoseList = new int[1]; dateList = new double[1]; } //To get the statistic sql = "Select glucose_level, date_of_submission from patient_statistics where patient_id = ?"; pst = con.prepareStatement(sql); pst.setInt(1, id); rs = pst.executeQuery(); int li_item = 0; String date = ""; while (rs.next()) { date = ""; glucoseList[li_item] = rs.getInt("glucose_level"); date = rs.getString("date_of_submission"); date = date.replaceAll("/", ""); date = date.replaceAll(":", ""); date = date.replaceAll(" ", ""); dateList[li_item] = Double.parseDouble(date); li_item++; } JFreeChart chart; chart = ChartFactory.createLineChart("Glucose Levels Over Time", "Time", "Glucose Level", createDataset(glucoseList, dateList), PlotOrientation.VERTICAL, true, true, false); //Setting the window contents of the JFrame ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); f.setLayout(new BorderLayout(0, 5)); f.add(chartPanel, BorderLayout.CENTER); f.pack(); f.setVisible(true); } catch (SQLException | ClassNotFoundException ex) { Logger.getLogger(GlucoseTrend.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.twocents.test.ui.chart.MultipieChart.java
/** * Creates a new demo.//from w w w .j a va 2 s. c o m * * @param title the frame title. */ public MultipieChart(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); }
From source file:graphs.LimitsGraphs.java
/** * Creates a new demo instance./* ww w . ja v a 2 s .c o m*/ * * @param title the frame title. */ public LimitsGraphs(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:medic_hospital.CholesterolTrend.java
public void populateChart(int id) { int[] cholesterolList; double[] dateList; try {/*from w w w.j a v a 2 s . c o m*/ Class.forName("com.mysql.jdbc.Driver"); con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/medic", "root", ""); //To get the number of rows in the result String sql = "Select Count(*) from patient_statistics where patient_id = ?"; pst = con.prepareStatement(sql); pst.setInt(1, id); rs = pst.executeQuery(); if (rs.next()) { cholesterolList = new int[rs.getInt("Count(*)")]; dateList = new double[rs.getInt("Count(*)")]; } else { cholesterolList = new int[1]; dateList = new double[1]; } //To get the statistic sql = "Select cholesterol, date_of_submission from patient_statistics where patient_id = ?"; pst = con.prepareStatement(sql); pst.setInt(1, id); rs = pst.executeQuery(); int li_item = 0; String date = ""; while (rs.next()) { date = ""; cholesterolList[li_item] = rs.getInt("cholesterol"); date = rs.getString("date_of_submission"); date = date.replaceAll("/", ""); date = date.replaceAll(":", ""); date = date.replaceAll(" ", ""); dateList[li_item] = Double.parseDouble(date); li_item++; } JFreeChart chart; chart = ChartFactory.createLineChart("Cholesterol Levels Over Time", "Time", "Cholesterol Level", createDataset(cholesterolList, dateList), PlotOrientation.VERTICAL, true, true, false); //Setting the window contents of the JFrame ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); f.setLayout(new BorderLayout(0, 5)); f.add(chartPanel, BorderLayout.CENTER); f.pack(); f.setVisible(true); } catch (SQLException | ClassNotFoundException ex) { Logger.getLogger(GlucoseTrend.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:medic_hospital.WeightTrend.java
public void populateChart(int id) { int[] weightList; double[] dateList; try {// w w w . j a v a2s.c om Class.forName("com.mysql.jdbc.Driver"); con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/medic", "root", ""); //To get the number of rows in the result String sql = "Select Count(*) from patient_statistics where patient_id = ?"; pst = con.prepareStatement(sql); pst.setInt(1, id); rs = pst.executeQuery(); if (rs.next()) { weightList = new int[rs.getInt("Count(*)")]; dateList = new double[rs.getInt("Count(*)")]; } else { weightList = new int[1]; dateList = new double[1]; } //To get the statistic sql = "Select weight, date_of_submission from patient_statistics where patient_id = ?"; pst = con.prepareStatement(sql); pst.setInt(1, id); rs = pst.executeQuery(); int li_item = 0; String date = ""; while (rs.next()) { date = ""; weightList[li_item] = rs.getInt("weight"); date = rs.getString("date_of_submission"); date = date.replaceAll("/", ""); date = date.replaceAll(":", ""); date = date.replaceAll(" ", ""); dateList[li_item] = Double.parseDouble(date); li_item++; } JFreeChart chart; chart = ChartFactory.createLineChart("Weight Over Time", "Time", "Weight(kgs)", createDataset(weightList, dateList), PlotOrientation.VERTICAL, true, true, false); //Setting the window contents of the JFrame ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); f.setLayout(new BorderLayout(0, 5)); f.add(chartPanel, BorderLayout.CENTER); f.pack(); f.setVisible(true); } catch (SQLException | ClassNotFoundException ex) { Logger.getLogger(GlucoseTrend.class.getName()).log(Level.SEVERE, null, ex); } }