Logo
Distributed Genetic Programming Framework
print print

File org.jfree.experimental.chart.demo.LogAxisDemo1.java

Here you can find all the information about the file org.jfree.experimental.chart.demo.LogAxisDemo1.java. You may explore it here or download it onto your local disk.
/* -----------------
 * LogAxisDemo1.java
 * -----------------
 * (C) Copyright 2006, by Object Refinery Limited.
 */


package org.jfree.experimental.chart.demo;

import javax.swing.JPanel;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.experimental.chart.axis.LogAxis;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

/**
 * A simple demo showing the use of the {@link LogAxis} class.
 */

public class LogAxisDemo1 extends ApplicationFrame {

    /**
     * Creates a new instance of the demo.
     *
     * @param title  the frame title.
     */

    public LogAxisDemo1(String title) {
        super(title);
        JPanel chartPanel = createDemoPanel();
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
        setContentPane(chartPanel);
    }
    
    private static JFreeChart createChart(XYDataset dataset) {
        JFreeChart chart = ChartFactory.createScatterPlot(
            "Log Axis Demo 1",
            "X"
            "Y"
            dataset,
            PlotOrientation.VERTICAL,
            true,
            true,
            false
        );
        XYPlot plot = (XYPlot) chart.getPlot();
        LogAxis xAxis = new LogAxis("X");
        LogAxis yAxis = new LogAxis("Y");
        plot.setDomainAxis(xAxis);
        plot.setRangeAxis(yAxis);
        return chart;
    }
    
    /**
     * Creates a sample dataset.
     * 
     * @return A sample dataset.
     */

    private static XYDataset createDataset() {
        XYSeries series = new XYSeries("Random Data");
        series.add(1.0, 500.2);
        series.add(5.0, 694.1);
        series.add(4.0, 100.0);
        series.add(12.5, 734.4);
        series.add(17.3, 453.2);
        series.add(21.2, 500.2);
        series.add(21.9, 9005.5);
        series.add(25.6, 734.4);
        series.add(3000.0, 453.2);
        return new XYSeriesCollection(series);       
    }

    /**
     * Creates a panel for the demo (used by SuperDemo.java).
     * 
     * @return A panel.
     */

    public static JPanel createDemoPanel() {
        JFreeChart chart = createChart(createDataset());
        return new ChartPanel(chart);
    }
    
    /**
     * Starting point for the demonstration application.
     *
     * @param args  ignored.
     */

    public static void main(String[] args) {

        LogAxisDemo1 demo = new LogAxisDemo1("Log Axis Demo 1");
        demo.pack();
        RefineryUtilities.centerFrameOnScreen(demo);
        demo.setVisible(true);

    }

}

File Information:

file name:LogAxisDemo1.java
package:org.jfree.experimental.chart.demo
qualified name:org.jfree.experimental.chart.demo.LogAxisDemo1.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/jfree/experimental/chart/demo/LogAxisDemo1.java
size:2.806 KB (2874 B)
uploaded: 2018-01-07 12:03:36 GMT+0000
last update: 2006-08-25 12:16:46 GMT+0000
last access: 2018-04-24 03:10:56 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2018-01-07 12:03:34 GMT+0000 served at 2018-04-24 03:10:56 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo