Created
January 1, 2013 15:36
-
-
Save nugraha16/4428153 to your computer and use it in GitHub Desktop.
Membuat Bar Chart di Java dengan JFreeChart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jfreechartDemo; | |
import javax.swing.UIManager; | |
import javax.swing.UnsupportedLookAndFeelException; | |
import org.jfree.chart.ChartFactory; | |
import org.jfree.chart.ChartFrame; | |
import org.jfree.chart.JFreeChart; | |
import org.jfree.chart.plot.PlotOrientation; | |
import org.jfree.data.category.DefaultCategoryDataset; | |
import com.jtattoo.plaf.acryl.*; | |
// Anugrah Bagus Susilo | |
public class demoBarChart { | |
public static void main(String[] args) throws UnsupportedLookAndFeelException { | |
UIManager.setLookAndFeel(new AcrylLookAndFeel()); | |
// TODO Auto-generated method stub | |
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); | |
dataset.addValue(10, "Java", ""); | |
dataset.addValue(20, "C+", ""); | |
dataset.addValue(30, "PHP", ""); | |
dataset.addValue(40, "Python", ""); | |
dataset.addValue(10, "Java", ""); | |
dataset.addValue(20, "C+", ""); | |
dataset.addValue(30, "PHP", ""); | |
dataset.addValue(40, "Python", ""); | |
JFreeChart chart = ChartFactory.createBarChart("Daftar Bahasa terPopuler", "Tahun", "Grafik Bar", dataset, PlotOrientation.VERTICAL, true, true, false); | |
ChartFrame frame = new ChartFrame("demo Bar Chart", chart); | |
frame.setSize(450,300); | |
frame.setVisible(true); | |
frame.setLocationRelativeTo(null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment