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

📄 multipleaxisdemo2.java

📁 能使报表生成图像的大全代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package demo;

import java.awt.Color;
import java.awt.Dimension;
import org.jfree.chart.*;
import org.jfree.chart.axis.AxisLocation;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.data.time.*;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.*;

public class MultipleAxisDemo2 extends ApplicationFrame
{

    public MultipleAxisDemo2(String s)
    {
        super(s);
        JFreeChart jfreechart = createChart();
        ChartPanel chartpanel = new ChartPanel(jfreechart);
        chartpanel.setPreferredSize(new Dimension(600, 270));
        setContentPane(chartpanel);
    }

    private JFreeChart createChart()
    {
        XYDataset xydataset = createDataset("Series 1", 100D, new Minute(), 200);
        JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 2", "Time of Day", "Primary Range Axis", xydataset, true, true, false);
        jfreechart.setBackgroundPaint(Color.white);
        XYPlot xyplot = jfreechart.getXYPlot();
        xyplot.setOrientation(PlotOrientation.VERTICAL);
        xyplot.setBackgroundPaint(Color.lightGray);
        xyplot.setDomainGridlinePaint(Color.white);
        xyplot.setRangeGridlinePaint(Color.white);
        xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
        XYItemRenderer xyitemrenderer = xyplot.getRenderer();
        xyitemrenderer.setPaint(Color.black);
        NumberAxis numberaxis = new NumberAxis("Domain Axis 2");
        numberaxis.setAutoRangeIncludesZero(false);
        xyplot.setDomainAxis(1, numberaxis);
        NumberAxis numberaxis1 = new NumberAxis("Range Axis 2");
        xyplot.setRangeAxis(1, numberaxis1);
        xyplot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
        XYDataset xydataset1 = createDataset("Series 2", 1000D, new Minute(), 170);
        xyplot.setDataset(1, xydataset1);
        xyplot.mapDatasetToDomainAxis(1, 1);
        xyplot.mapDatasetToRangeAxis(1, 1);
        return jfreechart;
    }

    private XYDataset createDataset(String s, double d, RegularTimePeriod regulartimeperiod, int i)
    {
        TimeSeries timeseries = new TimeSeries(s, regulartimeperiod.getClass());
        RegularTimePeriod regulartimeperiod1 = regulartimeperiod;
        double d1 = d;
        for(int j = 0; j < i; j++)
        {
            timeseries.add(regulartimeperiod1, d1);
            regulartimeperiod1 = regulartimeperiod1.next();
            d1 *= 1.0D + (Math.random() - 0.495D) / 10D;
        }

        TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
        timeseriescollection.addSeries(timeseries);
        return timeseriescollection;
    }

    public static void main(String args[])
    {
        MultipleAxisDemo2 multipleaxisdemo2 = new MultipleAxisDemo2("Multiple Axis Demo 2");
        multipleaxisdemo2.pack();
        RefineryUtilities.centerFrameOnScreen(multipleaxisdemo2);
        multipleaxisdemo2.setVisible(true);
    }
}

⌨️ 快捷键说明

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