List of usage examples for org.jfree.chart ChartPanel DEFAULT_MINIMUM_DRAW_WIDTH
int DEFAULT_MINIMUM_DRAW_WIDTH
To view the source code for org.jfree.chart ChartPanel DEFAULT_MINIMUM_DRAW_WIDTH.
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 www. j av a 2s .c o m 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:com.att.aro.ui.view.overviewtab.TraceBenchmarkChartPanel.java
/** * //from w w w . ja va2 s . c om * @return */ public JPanel layoutDataPanel() { setLayout(new BorderLayout()); JFreeChart chart = initializeChart(); ChartPanel chartPanel = new ChartPanel(chart, WIDTH, HEIGHT, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH + 100, 100, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, USER_BUFFER, PROPERTIES, COPY, SAVE, PRINT, ZOOM, TOOL_TIPS); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); add(chartPanel, BorderLayout.CENTER); return this; }
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 av a 2 s . co 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:com.att.aro.ui.view.overviewtab.ConnectionStatisticsChartPanel.java
public JPanel layoutDataPanel() { setLayout(new BorderLayout()); JFreeChart chart = initializeChart(); ChartPanel chartPanel = new ChartPanel(chart, WIDTH, HEIGHT, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH + 100, 100, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, USER_BUFFER, PROPERTIES, COPY, SAVE, PRINT, ZOOM, TOOL_TIPS); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false);/* w ww . ja va2s .c o m*/ add(chartPanel, BorderLayout.CENTER); return this; }
From source file:com.att.aro.main.TraceOverviewPanel.java
/** * Initializes the Main panel and its various components. *///from ww w .ja v a 2 s. c o m private void initialize() { JFreeChart chart = ChartFactory.createBarChart(rb.getString("overview.traceoverview.title"), null, null, createDataset(null), PlotOrientation.HORIZONTAL, false, true, false); chart.setBackgroundPaint(this.getBackground()); chart.getTitle().setFont(AROUIManager.HEADER_FONT); this.plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); CategoryAxis valueRangeAxis = plot.getDomainAxis(); valueRangeAxis.setMaximumCategoryLabelWidthRatio(1.0f); valueRangeAxis.setMaximumCategoryLabelLines(2); valueRangeAxis.setLabelFont(AROUIManager.LABEL_FONT); valueRangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabel(rb.getString("analysisresults.percentile")); rangeAxis.setRange(0.0, 100.0); rangeAxis.setTickUnit(new NumberTickUnit(10)); rangeAxis.setLabelFont(AROUIManager.LABEL_FONT); rangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT); BarRenderer renderer = new StackedBarRenderer(); renderer.setBasePaint(AROUIManager.CHART_BAR_COLOR); renderer.setAutoPopulateSeriesPaint(false); renderer.setBaseItemLabelGenerator(new PercentLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelPaint(Color.black); // Make second bar in stack invisible renderer.setSeriesItemLabelsVisible(1, false); renderer.setSeriesPaint(1, new Color(0, 0, 0, 0)); ItemLabelPosition insideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT); renderer.setBasePositiveItemLabelPosition(insideItemlabelposition); ItemLabelPosition outsideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT); renderer.setPositiveItemLabelPositionFallback(outsideItemlabelposition); renderer.setBarPainter(new StandardBarPainter()); renderer.setShadowVisible(false); renderer.setMaximumBarWidth(BAR_WIDTH_PERCENT); renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() { @Override public String generateToolTip(CategoryDataset arg0, int arg1, int arg2) { String traceInfo = ""; switch (arg2) { case TRACE_AVERAGE: traceInfo = rb.getString("tooltip.traceAnalysis.avg"); break; case TRACE_ENERGY: traceInfo = rb.getString("tooltip.traceAnalysis.engy"); break; case TRACE_OVERHEAD: traceInfo = rb.getString("tooltip.traceAnalysis.ovrhd"); break; } return traceInfo; } }); plot.setRenderer(renderer); plot.getDomainAxis().setMaximumCategoryLabelLines(2); ChartPanel chartPanel = new ChartPanel(chart, WIDTH, HEIGHT, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH + 100, 100, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, USER_BUFFER, PROPERTIES, COPY, SAVE, PRINT, ZOOM, TOOL_TIPS); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); this.add(chartPanel, BorderLayout.CENTER); }
From source file:com.att.aro.main.ProperSessionTerminationPanel.java
/** * Initializes the Panel for Proper Session Termination plot. *//* ww w. j av a 2 s . c o m*/ private void initialize() { JFreeChart chart = ChartFactory.createBarChart(rb.getString("overview.sessionoverview.title"), null, null, createDataset(null), PlotOrientation.HORIZONTAL, false, false, false); chart.setBackgroundPaint(this.getBackground()); chart.getTitle().setFont(AROUIManager.HEADER_FONT); this.plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setMaximumCategoryLabelWidthRatio(1.0f); domainAxis.setMaximumCategoryLabelLines(2); domainAxis.setLabelFont(AROUIManager.LABEL_FONT); domainAxis.setTickLabelFont(AROUIManager.LABEL_FONT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabel(rb.getString("analysisresults.percentage")); rangeAxis.setRange(0.0, 100.0); rangeAxis.setTickUnit(new NumberTickUnit(10)); rangeAxis.setLabelFont(AROUIManager.LABEL_FONT); rangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT); BarRenderer renderer = new StackedBarRenderer(); renderer.setBasePaint(AROUIManager.CHART_BAR_COLOR); renderer.setAutoPopulateSeriesPaint(false); renderer.setBaseItemLabelGenerator(new PercentLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelPaint(Color.black); // Make second bar in stack invisible renderer.setSeriesItemLabelsVisible(1, false); renderer.setSeriesPaint(1, new Color(0, 0, 0, 0)); ItemLabelPosition insideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT); renderer.setBasePositiveItemLabelPosition(insideItemlabelposition); ItemLabelPosition outsideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT); renderer.setPositiveItemLabelPositionFallback(outsideItemlabelposition); renderer.setBarPainter(new StandardBarPainter()); renderer.setShadowVisible(false); renderer.setMaximumBarWidth(BAR_WIDTH_PERCENT); renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() { @Override public String generateToolTip(CategoryDataset arg0, int arg1, int arg2) { String sessionInfo = ""; switch (arg2) { case SESSION_TERMINATION: sessionInfo = rb.getString("tooltip.sessionTermination"); break; case SESSION_TIGHT_CONN: sessionInfo = rb.getString("tooltip.sessionTightConn"); break; case SESSION_BURST: sessionInfo = rb.getString("tooltip.sessionBurst"); break; case SESSION_LONG_BURST: sessionInfo = rb.getString("tooltip.sessionLongBurst"); break; } return sessionInfo; } }); plot.setRenderer(renderer); plot.getDomainAxis().setMaximumCategoryLabelLines(2); ChartPanel chartPanel = new ChartPanel(chart, WIDTH, HEIGHT, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH + 100, 100, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, USER_BUFFER, PROPERTIES, COPY, SAVE, PRINT, ZOOM, TOOL_TIPS); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); this.add(chartPanel, BorderLayout.CENTER); }
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 www .j a v a 2 s . co 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()); }
From source file:beadAnalyzer.DrawPoints.java
public static JFrame display(final JFreeChart chart, final Dimension d) { final JPanel panel = new JPanel(); final ChartPanel chartPanel = new ChartPanel(chart, d.width - 10, d.height - 35, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_BUFFER_USED, true, // properties true, // save true, // print true, // zoom true // tooltips );/* w w w . j a v a 2 s . c om*/ panel.add(chartPanel); final JFrame frame = new JFrame(); frame.setContentPane(panel); frame.validate(); frame.setSize(d); frame.setVisible(true); return frame; }
From source file:org.forester.archaeopteryx.TreePanel.java
final private void showBranchDataPopup(final MouseEvent e, final PhylogenyNode node) { try {//w w w . ja v a 2s .c o m String[] histdata = null; short lines = 10; // show inserted species on branch if (!(((Annotation) node.getNodeData().getSequences().get(0).getAnnotation(0)).getDesc() .length() < 10)) { // as long as there are no branch names longer than 9 characters, this is going to work lines++; _popup_buffer.delete(0, _popup_buffer.length()); histdata = ((Annotation) node.getNodeData().getSequences().get(0).getAnnotation(0)).getDesc() .split(","); _popup_buffer .append("RAxml Weights Histogram " + node.getNodeData().getSequence(0).getName() + "\n"); String branch_data = ""; // parse the histogram Pattern p = Pattern.compile("\\s*\\d\\.\\d\\s-\\s\\d\\.\\d:\\s[\\|\\.]*\\s*\\d+"); for (int i = 0; i < histdata.length; i++) { //################################## // Parse Node Description a[i] here! Matcher m = p.matcher(histdata[i]); if (m.matches()) { branch_data = branch_data + histdata[i] + "\n"; // System.out.println(a[i]); } } _popup_buffer.append(branch_data); //_popup_buffer.append(((Annotation)node.getNodeData().getSequence().getAnnotation(0)).getDesc()); } else if (node.getNodeData().isHasSequence()) { _popup_buffer.delete(0, _popup_buffer.length()); _popup_buffer.append(node.getNodeData().getSequence(0).getName()); } if (_popup_buffer.length() > 0) { if (!getConfiguration().isUseNativeUI()) { _rollover_popup.setBorder(BorderFactory.createLineBorder(getTreeColorSet().getBranchColor())); _rollover_popup.setBackground(getTreeColorSet().getBackgroundColor()); if (isInFoundNodes(node)) { _rollover_popup.setForeground(getTreeColorSet().getFoundColor()); } else if (getControlPanel().isColorAccordingToTaxonomy()) { _rollover_popup.setForeground(getTaxonomyBasedColor(node)); } else { _rollover_popup.setForeground(getTreeColorSet().getSequenceColor()); } } else { _rollover_popup.setBorder(BorderFactory.createLineBorder(Color.BLACK)); } CategoryDataset data = createDataset(histdata); JFreeChart histogram = createChart(data, node.getNodeData().getSequence(0).getName()); _chart_panel = new ChartPanel(histogram, 300, 200, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_BUFFER_USED, false, false, false, false, true); _rollover_popup.setText(_popup_buffer.toString());//_popup_buffer.toString() ); _node_desc_popup = PopupFactory.getSharedInstance().getPopup(null, _chart_panel, e.getLocationOnScreen().x + 10, e.getLocationOnScreen().y - (10)); _node_desc_popup.show(); } } catch (final Exception ex) { // Do nothing. } }