List of usage examples for org.jfree.chart ChartPanel DEFAULT_HEIGHT
int DEFAULT_HEIGHT
To view the source code for org.jfree.chart ChartPanel DEFAULT_HEIGHT.
Click Source Link
From source file:org.cytoscape.dyn.internal.graphMetrics.SaveChartDialog.java
public SaveChartDialog(JFrame frame, JFreeChart chart) { super(frame, "Save Chart to File", false); this.chart = chart; JPanel sizePanel = new JPanel(new GridLayout(2, 3, 4, 4)); sizePanel.setBorder(BorderFactory.createTitledBorder("Image Size")); // Add a spinner for choosing width sizePanel.add(new JLabel("Width:", SwingConstants.RIGHT)); int width = ChartPanel.DEFAULT_WIDTH; int minWidth = ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH; int maxWidth = ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH; SpinnerModel widthSettings = new SpinnerNumberModel(width, minWidth, maxWidth, 1); sizePanel.add(widthSpinner = new JSpinner(widthSettings)); sizePanel.add(new JLabel("pixels")); // Add a spinner for choosing height sizePanel.add(new JLabel("Height:", SwingConstants.RIGHT)); int height = ChartPanel.DEFAULT_HEIGHT; int minHeight = ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT; int maxHeight = ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT; SpinnerModel heightSettings = new SpinnerNumberModel(height, minHeight, maxHeight, 1); sizePanel.add(heightSpinner = new JSpinner(heightSettings)); sizePanel.add(new JLabel("pixels")); JPanel buttonsPanel = new JPanel(new GridLayout(1, 2, 4, 0)); saveChartButton = new JButton("Save"); saveChartButton.setMaximumSize(new Dimension(Short.MAX_VALUE, saveChartButton.getHeight())); saveChartButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.setMaximumSize(new Dimension(Short.MAX_VALUE, cancelButton.getHeight())); cancelButton.addActionListener(this); buttonsPanel.add(saveChartButton);//from w w w . j a va 2 s.c om buttonsPanel.add(cancelButton); Box buttonsBox = Box.createHorizontalBox(); buttonsBox.add(Box.createHorizontalGlue()); buttonsBox.add(buttonsPanel); buttonsBox.add(Box.createHorizontalGlue()); Container contentPane = getContentPane(); contentPane.add(sizePanel, BorderLayout.NORTH); contentPane.add(Box.createVerticalStrut(3)); contentPane.add(buttonsBox, BorderLayout.PAGE_END); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getRootPane().setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); pack(); setModal(true); setResizable(false); setLocationRelativeTo(frame); }
From source file:org.uncommons.watchmaker.swing.evolutionmonitor.PopulationFitnessView.java
PopulationFitnessView(boolean islands) { super(new BorderLayout()); meanSeries = new XYSeries(islands ? "Global Mean Fitness" : "Population Mean Fitness"); dataSet.addSeries(bestSeries);//from w ww . j ava 2 s . c o m dataSet.addSeries(meanSeries); chart = ChartFactory.createXYLineChart(islands ? "Global Population Fitness" : "Population Fitness", islands ? "Epochs" : "Generations", "Fitness", dataSet, PlotOrientation.VERTICAL, true, // Legend. false, // Tooltips. false); this.domainAxis = chart.getXYPlot().getDomainAxis(); this.rangeAxis = chart.getXYPlot().getRangeAxis(); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setLowerMargin(0); domainAxis.setUpperMargin(0.05); domainAxis.setRangeWithMargins(0, SHOW_FIXED_GENERATIONS); rangeAxis.setRange(minY, maxY); ChartPanel chartPanel = new ChartPanel(chart, ChartPanel.DEFAULT_WIDTH, ChartPanel.DEFAULT_HEIGHT, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, false, // Buffered false, // Properties true, // Save true, // Print false, // Zoom false); // Tooltips add(chartPanel, BorderLayout.CENTER); add(createControls(islands), BorderLayout.SOUTH); }
From source file:org.uncommons.watchmaker.swing.evolutionmonitor.IslandsView.java
IslandsView() { super(new BorderLayout()); chart = ChartFactory.createBarChart("Island Population Fitness", "Island No.", "Candidate Fitness", bestDataSet, PlotOrientation.VERTICAL, true, // Legend false, // Tooltips false); // URLs CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getDomainAxis().setLowerMargin(0.02); plot.getDomainAxis().setUpperMargin(0.02); ((BarRenderer) plot.getRenderer()).setShadowVisible(false); plot.getRangeAxis().setAutoRange(false); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); meanRenderer.setBaseLinesVisible(false); ChartPanel chartPanel = new ChartPanel(chart, ChartPanel.DEFAULT_WIDTH, ChartPanel.DEFAULT_HEIGHT, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, false, // Buffered false, // Properties true, // Save true, // Print false, // Zoom false); // Tooltips add(chartPanel, BorderLayout.CENTER); add(createControls(), BorderLayout.SOUTH); }
From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.SaveChartDialog.java
/** * Creates and lays out the controls inside this dialog's content pane. * <p>/*from ww w .j a v a2 s . c o m*/ * This method is called upon initialization only. * </p> */ private void initControls() { JPanel sizePanel = new JPanel(new GridLayout(2, 3, 4, 4)); sizePanel.setBorder(BorderFactory.createTitledBorder(Messages.DI_IMAGESIZE)); // Add a spinner for choosing width sizePanel.add(new JLabel(Messages.DI_WIDTH, SwingConstants.RIGHT)); int width = ChartPanel.DEFAULT_WIDTH; int minWidth = ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH; int maxWidth = ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH; SpinnerModel widthSettings = new SpinnerNumberModel(width, minWidth, maxWidth, 1); sizePanel.add(widthSpinner = new JSpinner(widthSettings)); sizePanel.add(new JLabel(Messages.DI_PIXELS)); // Add a spinner for choosing height sizePanel.add(new JLabel(Messages.DI_HEIGHT, SwingConstants.RIGHT)); int height = ChartPanel.DEFAULT_HEIGHT; int minHeight = ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT; int maxHeight = ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT; SpinnerModel heightSettings = new SpinnerNumberModel(height, minHeight, maxHeight, 1); sizePanel.add(heightSpinner = new JSpinner(heightSettings)); sizePanel.add(new JLabel(Messages.DI_PIXELS)); // Add Save and Cancel buttons JPanel buttons = new JPanel(new GridLayout(1, 2, 4, 0)); buttons.add(btnSave = Utils.createButton(Messages.DI_SAVE, null, this)); buttons.add(btnCancel = Utils.createButton(Messages.DI_CANCEL, null, this)); Box buttonsBox = Box.createHorizontalBox(); buttonsBox.add(Box.createHorizontalGlue()); buttonsBox.add(buttons); buttonsBox.add(Box.createHorizontalGlue()); Container contentPane = getContentPane(); contentPane.add(sizePanel, BorderLayout.NORTH); contentPane.add(Box.createVerticalStrut(Utils.BORDER_SIZE / 2)); contentPane.add(buttonsBox, BorderLayout.PAGE_END); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Utils.setStandardBorder(getRootPane()); }