⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pricevolumedemo.java

📁 这是一个segy数据显示程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors. * * Project Info:  http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc.  * in the United States and other countries.] * * -------------------- * PriceVolumeDemo.java * -------------------- * (C) Copyright 2002-2004, by Object Refinery Limited. * * Original Author:  David Gilbert (for Object Refinery Limited). * Contributor(s):   -; * * $Id: PriceVolumeDemo.java,v 1.20 2004/05/11 14:56:17 mungady Exp $ * * Changes * ------- * 28-Mar-2002 : Version 1 (DG); * 23-Apr-2002 : Modified to use new CombinedXYPlot class (DG); * 25-Jun-2002 : Removed unnecessary imports (DG); * 11-Oct-2002 : Fixed errors reported by Checkstyle (DG); * 21-Nov-2002 : Implemented with dual axes, and used sample data from Chicago Mercantile *               Exchange (http://www.cme.com) (DG); * */package org.jfree.chart.demo;import java.text.DecimalFormat;import java.text.SimpleDateFormat;import org.jfree.chart.ChartFactory;import org.jfree.chart.ChartPanel;import org.jfree.chart.JFreeChart;import org.jfree.chart.axis.NumberAxis;import org.jfree.chart.labels.StandardXYToolTipGenerator;import org.jfree.chart.plot.XYPlot;import org.jfree.chart.renderer.XYBarRenderer;import org.jfree.chart.renderer.XYItemRenderer;import org.jfree.data.IntervalXYDataset;import org.jfree.data.XYDataset;import org.jfree.data.time.Day;import org.jfree.data.time.TimeSeries;import org.jfree.data.time.TimeSeriesCollection;import org.jfree.date.MonthConstants;import org.jfree.ui.ApplicationFrame;import org.jfree.ui.RefineryUtilities;/** * A demonstration application showing how to create a price-volume chart. * */public class PriceVolumeDemo extends ApplicationFrame {    /**     * Constructs a new demonstration application.     *     * @param title  the frame title.     */    public PriceVolumeDemo(final String title) {        super(title);        final JFreeChart chart = createChart();        final ChartPanel panel = new ChartPanel(chart, true, true, true, false, true);        panel.setPreferredSize(new java.awt.Dimension(500, 270));        setContentPane(panel);    }    /**     * Creates a chart.     *     * @return a chart.     */    private JFreeChart createChart() {        final XYDataset priceData = createPriceDataset();        final String title = "Eurodollar Futures Contract (MAR03)";        final JFreeChart chart = ChartFactory.createTimeSeriesChart(            title,             "Date",             "Price",            priceData,             true,            true,            false        );        final XYPlot plot = chart.getXYPlot();        final NumberAxis rangeAxis1 = (NumberAxis) plot.getRangeAxis();        rangeAxis1.setLowerMargin(0.40);  // to leave room for volume bars        final DecimalFormat format = new DecimalFormat("00.00");        rangeAxis1.setNumberFormatOverride(format);        final XYItemRenderer renderer1 = plot.getRenderer();        renderer1.setToolTipGenerator(            new StandardXYToolTipGenerator(                StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,                new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")            )        );        final NumberAxis rangeAxis2 = new NumberAxis("Volume");        rangeAxis2.setUpperMargin(1.00);  // to leave room for price line        plot.setRangeAxis(1, rangeAxis2);        plot.setDataset(1, createVolumeDataset());        plot.setRangeAxis(1, rangeAxis2);        plot.mapDatasetToRangeAxis(1, 1);        final 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")            )        );        plot.setRenderer(1, renderer2);        return chart;    }    /**     * Creates a sample dataset.     *     * @return A sample dataset.     */    private XYDataset createPriceDataset() {        // create dataset 1...        final TimeSeries series1 = new TimeSeries("Price", Day.class);        series1.add(new Day(2, MonthConstants.JANUARY, 2002), 95.565);        series1.add(new Day(3, MonthConstants.JANUARY, 2002), 95.640);        series1.add(new Day(4, MonthConstants.JANUARY, 2002), 95.710);        series1.add(new Day(7, MonthConstants.JANUARY, 2002), 95.930);        series1.add(new Day(8, MonthConstants.JANUARY, 2002), 95.930);        series1.add(new Day(9, MonthConstants.JANUARY, 2002), 95.960);        series1.add(new Day(10, MonthConstants.JANUARY, 2002), 96.055);        series1.add(new Day(11, MonthConstants.JANUARY, 2002), 96.335);        series1.add(new Day(14, MonthConstants.JANUARY, 2002), 96.290);        series1.add(new Day(15, MonthConstants.JANUARY, 2002), 96.275);        series1.add(new Day(16, MonthConstants.JANUARY, 2002), 96.240);        series1.add(new Day(17, MonthConstants.JANUARY, 2002), 96.080);        series1.add(new Day(18, MonthConstants.JANUARY, 2002), 96.145);        series1.add(new Day(22, MonthConstants.JANUARY, 2002), 96.120);        series1.add(new Day(23, MonthConstants.JANUARY, 2002), 96.015);        series1.add(new Day(24, MonthConstants.JANUARY, 2002), 95.890);        series1.add(new Day(25, MonthConstants.JANUARY, 2002), 95.8650);        series1.add(new Day(28, MonthConstants.JANUARY, 2002), 95.880);        series1.add(new Day(29, MonthConstants.JANUARY, 2002), 96.050);        series1.add(new Day(30, MonthConstants.JANUARY, 2002), 96.065);        series1.add(new Day(31, MonthConstants.JANUARY, 2002), 95.910);        series1.add(new Day(1, MonthConstants.FEBRUARY, 2002), 96.015);        series1.add(new Day(4, MonthConstants.FEBRUARY, 2002), 96.140);        series1.add(new Day(5, MonthConstants.FEBRUARY, 2002), 96.195);        series1.add(new Day(6, MonthConstants.FEBRUARY, 2002), 96.245);        series1.add(new Day(7, MonthConstants.FEBRUARY, 2002), 96.220);        series1.add(new Day(8, MonthConstants.FEBRUARY, 2002), 96.280);        series1.add(new Day(11, MonthConstants.FEBRUARY, 2002), 96.265);        series1.add(new Day(12, MonthConstants.FEBRUARY, 2002), 96.160);        series1.add(new Day(13, MonthConstants.FEBRUARY, 2002), 96.120);        series1.add(new Day(14, MonthConstants.FEBRUARY, 2002), 96.125);        series1.add(new Day(15, MonthConstants.FEBRUARY, 2002), 96.265);        series1.add(new Day(19, MonthConstants.FEBRUARY, 2002), 96.290);        series1.add(new Day(20, MonthConstants.FEBRUARY, 2002), 96.275);        series1.add(new Day(21, MonthConstants.FEBRUARY, 2002), 96.280);        series1.add(new Day(22, MonthConstants.FEBRUARY, 2002), 96.305);        series1.add(new Day(25, MonthConstants.FEBRUARY, 2002), 96.265);        series1.add(new Day(26, MonthConstants.FEBRUARY, 2002), 96.185);        series1.add(new Day(27, MonthConstants.FEBRUARY, 2002), 96.305);        series1.add(new Day(28, MonthConstants.FEBRUARY, 2002), 96.215);        series1.add(new Day(1, MonthConstants.MARCH, 2002), 96.015);        series1.add(new Day(4, MonthConstants.MARCH, 2002), 95.970);        series1.add(new Day(5, MonthConstants.MARCH, 2002), 95.935);        series1.add(new Day(6, MonthConstants.MARCH, 2002), 95.935);        series1.add(new Day(7, MonthConstants.MARCH, 2002), 95.705);        series1.add(new Day(8, MonthConstants.MARCH, 2002), 95.4850);        series1.add(new Day(11, MonthConstants.MARCH, 2002), 95.505);        series1.add(new Day(12, MonthConstants.MARCH, 2002), 95.540);        series1.add(new Day(13, MonthConstants.MARCH, 2002), 95.675);        series1.add(new Day(14, MonthConstants.MARCH, 2002), 95.510);        series1.add(new Day(15, MonthConstants.MARCH, 2002), 95.500);        series1.add(new Day(18, MonthConstants.MARCH, 2002), 95.500);        series1.add(new Day(19, MonthConstants.MARCH, 2002), 95.535);        series1.add(new Day(20, MonthConstants.MARCH, 2002), 95.420);        series1.add(new Day(21, MonthConstants.MARCH, 2002), 95.400);        series1.add(new Day(22, MonthConstants.MARCH, 2002), 95.375);        series1.add(new Day(25, MonthConstants.MARCH, 2002), 95.350);        series1.add(new Day(26, MonthConstants.MARCH, 2002), 95.505);        series1.add(new Day(27, MonthConstants.MARCH, 2002), 95.550);        series1.add(new Day(28, MonthConstants.MARCH, 2002), 95.485);        series1.add(new Day(1, MonthConstants.APRIL, 2002), 95.485);        series1.add(new Day(2, MonthConstants.APRIL, 2002), 95.630);        series1.add(new Day(3, MonthConstants.APRIL, 2002), 95.735);        series1.add(new Day(4, MonthConstants.APRIL, 2002), 95.695);        series1.add(new Day(5, MonthConstants.APRIL, 2002), 95.810);        series1.add(new Day(8, MonthConstants.APRIL, 2002), 95.810);        series1.add(new Day(9, MonthConstants.APRIL, 2002), 95.865);        series1.add(new Day(10, MonthConstants.APRIL, 2002), 95.885);        series1.add(new Day(11, MonthConstants.APRIL, 2002), 95.900);        series1.add(new Day(12, MonthConstants.APRIL, 2002), 95.980);        series1.add(new Day(15, MonthConstants.APRIL, 2002), 96.035);        series1.add(new Day(16, MonthConstants.APRIL, 2002), 96.000);        series1.add(new Day(17, MonthConstants.APRIL, 2002), 96.035);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -