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

📄 contourplotdemo2.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.] * * --------------------- * ContourPlotDemo2.java * --------------------- * (C) Copyright 2003, 2004, by David M. O'Donnell and Contributors. * * Original Author:  David M. O'Donnell; * Contributor(s):   David Gilbert (for Object Refinery Limited); * * $Id: ContourPlotDemo2.java,v 1.18 2004/04/30 08:05:59 mungady Exp $ * * Changes * ------- * 22-Apr-2003 : Added standard header (DG); * */package org.jfree.chart.demo;import java.awt.Color;import java.awt.Font;import java.awt.GradientPaint;import java.util.Date;import org.jfree.chart.ChartPanel;import org.jfree.chart.ClipPath;import org.jfree.chart.JFreeChart;import org.jfree.chart.annotations.XYTextAnnotation;import org.jfree.chart.axis.ColorBar;import org.jfree.chart.axis.DateAxis;import org.jfree.chart.axis.LogarithmicAxis;import org.jfree.chart.axis.NumberAxis;import org.jfree.chart.axis.ValueAxis;import org.jfree.chart.plot.ContourPlot;import org.jfree.data.ContourDataset;import org.jfree.data.DefaultContourDataset;import org.jfree.data.NonGridContourDataset;import org.jfree.ui.ApplicationFrame;import org.jfree.ui.RefineryUtilities;/** * A demonstration application to illustrate ContourPlot. * Command line options exist to control different plot properties * such as colorbar orientation, etc.  List of options are available * by launching with the -? option, e.g., ContourPlotDemo -? * * @author DMO */public class ContourPlotDemo2 extends ApplicationFrame {    /** The x axis. */    private ValueAxis xAxis = null;    /** The y axis. */        private NumberAxis yAxis = null;        /** The z axis. */    private ColorBar zColorBar = null;    /** A flag controlling the orientation of the z axis. */    //private static boolean zIsVertical = false;    /** A flag indicating whether or not the x-values are dates. */    private static boolean xIsDate = false;        /** ??. */    private static boolean asPoints = false;    /** Logarithmic x-axis? */    private static boolean xIsLog = false;        /** Logarithmic y axis? */    private static boolean yIsLog = false;        /** Logarithmic z axis? */    private static boolean zIsLog = false;    /** Inverted x axis? */    private static boolean xIsInverted = true;        /** Inverted y axis? */    private static boolean yIsInverted = false;        /** Inverted z axis? */    private static boolean zIsInverted = false;    /** Annotate? */    private static boolean annotate = false;    /** Number of x intervals. */    private static int numX = 10;        /** Number of y intervals. */    private static int numY = 20;    /** The plot ratio. */    private static double ratio = 0.0;    /** Temp data storage. */    private double[] tmpDoubleY = null;        /** Temp data storage. */    private double[] tmpDoubleX = null;        /** Temp data storage. */    private double[] tmpDoubleZ = null;    /** X outline. */    private double[] xOutline = null;    /** Y outline. */    private double[] yOutline = null;    /** Draw the outline? */    static boolean drawOutline = false;        /** Fill the outline? */    static boolean fillOutline = false;        /** ??. */    static int power = 4;    /**     * Constructs a new demonstration application.     *     * @param title  the frame title.     */    public ContourPlotDemo2(final String title) {        super(title);        final JFreeChart chart = createContourPlot();        final ChartPanel panel = new ChartPanel(chart, true, true, true, true, true);        panel.setPreferredSize(new java.awt.Dimension(1000, 800));        panel.setMaximumDrawHeight(100000); //stop chartpanel from scaling        panel.setMaximumDrawWidth(100000); //stop chartpanel from scaling        panel.setHorizontalZoom(true);        panel.setVerticalZoom(true);        panel.setFillZoomRectangle(true);        setContentPane(panel);    }    /**     * Creates a ContourPlot chart.     *     * @return the ContourPlot chart.     */    private JFreeChart createContourPlot() {        final String title = "Contour Plot";        final String xAxisLabel = "X Values";        final String yAxisLabel = "Y Values";        final String zAxisLabel = "Color Values";        if (xIsDate) {            this.xAxis = new DateAxis(xAxisLabel);            xIsLog = false; // force axis to be linear when displaying dates        }        else {            if (xIsLog) {                this.xAxis = new LogarithmicAxis(xAxisLabel);            }            else {                this.xAxis = new NumberAxis(xAxisLabel);            }        }        if (yIsLog) {            this.yAxis = new LogarithmicAxis(yAxisLabel);        }        else {            this.yAxis = new NumberAxis(yAxisLabel);        }        if (zIsLog) {            this.zColorBar = new ColorBar(zAxisLabel);        }        else {            this.zColorBar = new ColorBar(zAxisLabel);        }        if (this.xAxis instanceof NumberAxis) {            ((NumberAxis) this.xAxis).setAutoRangeIncludesZero(false);            ((NumberAxis) this.xAxis).setInverted(xIsInverted);        }        this.yAxis.setAutoRangeIncludesZero(false);        this.yAxis.setInverted(yIsInverted);        if (!xIsDate) {            ((NumberAxis) this.xAxis).setLowerMargin(0.0);            ((NumberAxis) this.xAxis).setUpperMargin(0.0);

⌨️ 快捷键说明

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