de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.OtherCityStats.java Source code

Java tutorial

Introduction

Here is the source code for de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.OtherCityStats.java

Source

/*******************************************************************************
 * FWDisp - https://github.com/rbs90/FWDisp
 *
 * Copyright (C) 2012 Robert Schoenherr
 *
 * FWDisp is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * FWDisp 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
 * General Public License for more details.
 ******************************************************************************/

package de.rbs90.fwdisp.settingsgui.gui.tabs.statistics;

import de.rbs90.fwdisp.settingsgui.gui.moduls.SecRowPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

import java.awt.*;

/**
 * @author rbs
 */
public class OtherCityStats extends SecRowPanel {

    public OtherCityStats() {
        setName("Region");

        setLayout(new BorderLayout());

        DefaultPieDataset data = new DefaultPieDataset();
        data.setValue("HOT", 110);
        data.setValue("Oberlungwitz", 60);
        data.setValue("Limbach", 80);
        data.setValue("Glauchau", 90);
        data.setValue("Meerane", 100);
        data.setValue("Lichtenstein", 90);

        JFreeChart chart = ChartFactory.createPieChart3D("Einsatztypen", data, false, false, false);

        chart.setBackgroundPaint(getBackground());

        ChartPanel panel = new ChartPanel(chart);

        panel.setPopupMenu(null);
        add(panel, BorderLayout.CENTER);
    }

}