Example usage for org.jfree.chart JFreeChart INFO

List of usage examples for org.jfree.chart JFreeChart INFO

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart INFO.

Prototype

ProjectInfo INFO

To view the source code for org.jfree.chart JFreeChart INFO.

Click Source Link

Document

Information about the project.

Usage

From source file:org.jfree.chart.demo.PlotOrientationDemo.java

/**
 * Creates a new demo instance.//w ww. j av a 2  s. c  o m
 * 
 * @param title  the frame title.
 */
public PlotOrientationDemo(String title) {

    super(title);
    JPanel panel = new JPanel(new GridLayout(2, 4));
    for (int i = 0; i < CHART_COUNT; i++) {
        this.datasets[i] = createDataset(i);
        this.charts[i] = createChart(i, this.datasets[i]);
        XYPlot plot = this.charts[i].getXYPlot();
        XYShapeAnnotation a1 = new XYShapeAnnotation(new Rectangle2D.Double(1.0, 2.0, 2.0, 3.0),
                new BasicStroke(1.0f), Color.blue);
        XYLineAnnotation a2 = new XYLineAnnotation(0.0, -5.0, 10.0, -5.0);
        XYImageAnnotation a3 = new XYImageAnnotation(5.0, 2.0, JFreeChart.INFO.getLogo());
        plot.addAnnotation(a1);
        plot.addAnnotation(a2);
        plot.addAnnotation(a3);
        plot.setQuadrantPaint(0, new Color(230, 230, 255));
        plot.setQuadrantPaint(1, new Color(230, 255, 230));
        plot.setQuadrantPaint(2, new Color(255, 230, 230));
        plot.setQuadrantPaint(3, new Color(255, 230, 255));
        this.panels[i] = new ChartPanel(this.charts[i]);
    }
    this.charts[1].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[2].getXYPlot().getRangeAxis().setInverted(true);
    this.charts[3].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[3].getXYPlot().getRangeAxis().setInverted(true);

    this.charts[5].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[6].getXYPlot().getRangeAxis().setInverted(true);
    this.charts[4].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[4].getXYPlot().getRangeAxis().setInverted(true);

    this.charts[4].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);
    this.charts[5].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);
    this.charts[6].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);
    this.charts[7].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);

    panel.add(this.panels[0]);
    panel.add(this.panels[1]);
    panel.add(this.panels[4]);
    panel.add(this.panels[5]);
    panel.add(this.panels[2]);
    panel.add(this.panels[3]);
    panel.add(this.panels[6]);
    panel.add(this.panels[7]);

    panel.setPreferredSize(new Dimension(800, 600));
    setContentPane(panel);

}

From source file:org.jfree.chart.demo.TimeSeriesDemo4.java

/**
 * A demonstration application showing a quarterly time series containing a null value.
 *
 * @param title  the frame title./*from   w w  w.  j a v a2s .c  o m*/
 */
public TimeSeriesDemo4(final String title) {

    super(title);
    final TimeSeries series = new TimeSeries("Random Data", Hour.class);
    final Day today = new Day();
    series.add(new Hour(1, today), 500.2);
    series.add(new Hour(2, today), 694.1);
    series.add(new Hour(3, today), 734.4);
    series.add(new Hour(4, today), 453.2);
    series.add(new Hour(7, today), 500.2);
    series.add(new Hour(8, today), null);
    series.add(new Hour(12, today), 734.4);
    series.add(new Hour(16, today), 453.2);
    final TimeSeriesCollection dataset = new TimeSeriesCollection(series);

    // create a title with Unicode characters (currency symbols in this case)...
    final String chartTitle = "\u20A2\u20A2\u20A3\u20A4\u20A5\u20A6\u20A7\u20A8\u20A9\u20AA";
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, "Time", "Value", dataset, true,
            true, false);

    final XYPlot plot = chart.getXYPlot();
    //      plot.setInsets(new Insets(0, 0, 0, 20));
    final Marker marker = new ValueMarker(700.0);
    marker.setPaint(Color.blue);
    marker.setAlpha(0.8f);
    plot.addRangeMarker(marker);
    plot.setBackgroundPaint(null);
    plot.setBackgroundImage(JFreeChart.INFO.getLogo());
    final XYItemRenderer renderer = plot.getRenderer();
    if (renderer instanceof StandardXYItemRenderer) {
        final StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
        r.setPlotShapes(true);
        r.setShapesFilled(true);
    }
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    chartPanel.setMouseZoomable(true, false);
    setContentPane(chartPanel);

}

From source file:org.jfree.chart.demo.JFreeChartDemo.java

/**
 * Constructs a demonstration application for the JFreeChart Class Library.
 *///from  w w w. ja  va  2 s . c  o  m
public JFreeChartDemo() {
    super(JFreeChart.INFO.getName() + " " + JFreeChart.INFO.getVersion() + " Demo");
    addWindowListener(new WindowAdapter() {
        public void windowClosing(final WindowEvent e) {
            dispose();
            System.exit(0);
        }
    });
    this.resources = DEMO.getResources();
    // set up the menu
    final JMenuBar menuBar = createMenuBar(this.resources);
    setJMenuBar(menuBar);

    final JPanel content = new JPanel(new BorderLayout());
    content.add(createTabbedPane(this.resources));
    setContentPane(content);

}

From source file:org.jfree.chart.demo.JFreeChartDemo.java

/**
 * Displays information about the application.
 *///from   w  w  w. j a v  a 2 s  .  co  m
private void about() {

    final String title = this.resources.getString("about.title");
    //String versionLabel = this.resources.getString("about.version.label");
    if (this.aboutFrame == null) {
        this.aboutFrame = new AboutFrame(title, JFreeChart.INFO);
        this.aboutFrame.pack();
        RefineryUtilities.centerFrameOnScreen(this.aboutFrame);
    }
    this.aboutFrame.setVisible(true);
    this.aboutFrame.requestFocus();

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample pie chart.
 *
 * @return a sample pie chart.//from w w w. j ava2 s  .  com
 */
public JFreeChart createPieChartTwo() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("pie.pie2.title");
    final CategoryDataset data = DemoDatasetFactory.createCategoryDataset();
    final Comparable category = (Comparable) data.getColumnKeys().get(1);
    final PieDataset extracted = DatasetUtilities.createPieDatasetForColumn(data, category);
    final JFreeChart chart = ChartFactory.createPieChart(title, extracted, true, true, false);

    // then customise it a little...
    chart.setBackgroundPaint(Color.lightGray);
    final PiePlot pie = (PiePlot) chart.getPlot();
    pie.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(),
            NumberFormat.getPercentInstance()));
    pie.setBackgroundImage(JFreeChart.INFO.getLogo());
    pie.setBackgroundPaint(Color.white);
    pie.setBackgroundAlpha(0.6f);
    pie.setForegroundAlpha(0.75f);
    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample line chart.
 *
 * @return a line chart.//from ww  w.  jav  a  2  s  .co  m
 */
public JFreeChart createLineChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("other.line.title");
    final String domain = this.resources.getString("other.line.domain");
    final String range = this.resources.getString("other.line.range");
    final CategoryDataset data = DemoDatasetFactory.createCategoryDataset();
    final JFreeChart chart = ChartFactory.createLineChart(title, domain, range, data, PlotOrientation.VERTICAL,
            true, true, false);

    // then customise it a little...
    chart.setBackgroundImage(JFreeChart.INFO.getLogo());
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.green));

    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundAlpha(0.65f);
    return chart;
}