Java Code Examples for org.jfree.chart.axis.ValueAxis#setFixedAutoRange()
The following examples show how to use
org.jfree.chart.axis.ValueAxis#setFixedAutoRange() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataPanel.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
/** * Creates a new self-contained demo panel. */ public DataPanel(String title) { //setTitle(title); setLayout(new BorderLayout()); positionSer = new XYSeries("True Position"); XYSeriesCollection dataset1 = new XYSeriesCollection(positionSer); JFreeChart chart = ChartFactory.createTimeSeriesChart("Position", "Time (seconds)", "Angle (degrees)", dataset1,true, true, false); plot = (XYPlot) chart.getPlot(); plot.setRenderer(1, new DefaultXYItemRenderer()); plot.mapDatasetToRangeAxis(1, 1); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(20000.0); // 20 seconds ChartUtilities.applyCurrentTheme(chart); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); exportXlsBtn.setActionCommand("EXPORT_XLS"); exportCsvBtn.setActionCommand("EXPORT_CSV"); exportXlsBtn.addActionListener(this); exportCsvBtn.addActionListener(this); JPanel exportPanel = new JPanel(); exportPanel.add(exportXlsBtn); exportPanel.add(exportCsvBtn); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(chartPanel); mainPanel.add(exportPanel, BorderLayout.SOUTH); add(mainPanel); }
Example 2
Source File: GraphView.java From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 | 4 votes |
private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createTimeSeriesChart( graphTitle, "Time", "Price", dataset, true, true, false ); plot = result.getXYPlot(); plot.setBackgroundPaint(new Color(0xffffe0)); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis xaxis = plot.getDomainAxis(); xaxis.setAutoRange(true); xaxis.setVisible(false); xaxis.setFixedAutoRange(16000.0); // 60 seconds xaxis.setVerticalTickLabels(true); ValueAxis yaxis = plot.getRangeAxis(); yaxis.setRange(0, 100.0); xaxis2 = new NumberAxis("Volume"); plot.setDataset(1, dataset2); plot.setRangeAxis(1, xaxis2); plot.mapDatasetToRangeAxis(1, 1); XYBarRenderer renderer2 = new XYBarRenderer(0.20); renderer2.setToolTipGenerator( new StandardXYToolTipGenerator( StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0,000.00") ) ); renderer2.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); plot.setRenderer(1, renderer2); plot.setDataset(2, dataset3); plot.mapDatasetToRangeAxis(2, 0); XYErrorRenderer renderer3 = new XYErrorRenderer(); plot.setRenderer(2, renderer3); plot.setDataset(3, dataset4); plot.mapDatasetToRangeAxis(3, 1); XYBarRenderer renderer4 = new XYBarRenderer(0.20); plot.setRenderer(3, renderer4); return result; }
Example 3
Source File: TileCacheMonitor.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
/** * Creates a new monitor panel. * * @return the monitor panel */ public JPanel createPanel() { JPanel mainPanel = new JPanel(new BorderLayout()); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[4]; this.datasets[0] = addSubPlot(plot, "#Tiles"); this.datasets[1] = addSubPlot(plot, "#Hits"); this.datasets[2] = addSubPlot(plot, "#Misses"); this.datasets[3] = addSubPlot(plot, "Mem (kB)"); JFreeChart chart = new JFreeChart(plot); LegendTitle legend = (LegendTitle) chart.getSubtitle(0); legend.setPosition(RectangleEdge.RIGHT); legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4)); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4)); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds textarea = new JTextArea(); tableModel = new TileCacheTableModel(); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 470)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tabbedPane = new JTabbedPane(); tabbedPane.add(CACHE_INFO_TAB, new JScrollPane(textarea)); tabbedPane.add(CACHE_CHART_TAB, chartPanel); tabbedPane.add(IMAGES_TAB, new JScrollPane(new JTable(tableModel))); tabbedPane.setSelectedIndex(0); mainPanel.add(tabbedPane); return mainPanel; }