本文整理汇总了Java中org.jfree.chart.ChartFrame类的典型用法代码示例。如果您正苦于以下问题:Java ChartFrame类的具体用法?Java ChartFrame怎么用?Java ChartFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChartFrame类属于org.jfree.chart包,在下文中一共展示了ChartFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: graficarEstado
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public void graficarEstado() {
String TAct = txtTotalActivo.getText();
// String TAsp = txtTotalAspirante.getText();
String TMor = txtTotalMoroso.getText();
DefaultPieDataset pieDataset = new DefaultPieDataset();
// pieDataset.setValue("Aspirante", new Integer(TAsp));
pieDataset.setValue("Activo", new Integer(TAct));
pieDataset.setValue("Moroso", new Integer(TMor));
JFreeChart chart = ChartFactory.createPieChart3D("Estado de los Socios", pieDataset, true, true, true);
PiePlot3D p = (PiePlot3D) chart.getPlot();
ChartFrame frame = new ChartFrame("Grafico de Torta", chart);
frame.setVisible(true);
frame.setSize(700, 500);
}
示例2: TestJFreeStripChart
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public TestJFreeStripChart() {
XYSeriesCollection xyDataset = new XYSeriesCollection();
series = new XYSeries( "0" );
xyDataset.addSeries( series );
for( int i = 0; i < 100; i++ ) {
series.add( i, Math.sin( i / 100.0 * Math.PI * 2 ) );
}
// categoryDataset.
jFreeChart = createChart( xyDataset );
chartFrame = new ChartFrame( "ChartFrame", jFreeChart, false );
chartFrame.pack();
timer = new Timer( 30, new ActionListener() {
public void actionPerformed( ActionEvent e ) {
series.add( i, Math.sin( i / 100.0 * Math.PI * 2 ) );
i++;
series.remove( 0 );
}
} );
}
示例3: JFreeChartIcon
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public JFreeChartIcon() {
XYSeries series = new XYSeries( "" );
for ( int i = 0; i < 100; i++ ) {
series.add( i, Math.sin( i / 10.0 ) );
}
dataset = new XYSeriesCollection( series );
JFreeChart jFreeChart = ChartFactory.createXYLineChart( WIStrings.getString( "chart.chart" ), "", "", dataset, PlotOrientation.VERTICAL, false, false, false );
// jFreeChart.getXYPlot().getRangeAxis().setTickLabelsVisible( false );
// jFreeChart.getXYPlot().getDomainAxis().setTickLabelsVisible( false );
BasicStroke stroke = new BasicStroke( 4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, new float[] { 5, 1 }, 0 );
// BasicStroke stroke = new BasicStroke( 5 );
jFreeChart.getXYPlot().setRangeGridlineStroke( stroke );
jFreeChart.getXYPlot().setRangeGridlinePaint( Color.black );
jFreeChart.getXYPlot().setDomainGridlineStroke( stroke );
jFreeChart.getXYPlot().setDomainGridlinePaint( Color.black );
jFreeChart.setAntiAlias( true );
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer( true, false );
renderer.setPaint( Color.blue );
renderer.setStroke( new BasicStroke( 10 ) );
// renderer.set
jFreeChart.getXYPlot().setRenderer( renderer );
ChartFrame chartFrame = new ChartFrame( "", jFreeChart );
chartFrame.setSize( 200, 200 );
chartFrame.setVisible( true );
chartFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
示例4: histogramChart
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
/**
* Création et affichage d'un histogramme avec JFreeChart
* @param listIn
*/
public static void histogramChart(List<Double> listIn, String listName) {
double tabIn[] = new double[listIn.size()];
for (int i = 0; i < listIn.size(); i++) {
tabIn[i] = listIn.get(i);
}
// Création des datasets
HistogramDataset dataset = new HistogramDataset();
dataset.setType(HistogramType.RELATIVE_FREQUENCY);
dataset.addSeries(listName, tabIn, 200);
// Création de l'histogramme
JFreeChart chart = ChartFactory.createHistogram("", null, null, dataset,
PlotOrientation.VERTICAL, true, true, false);
ChartFrame frame = new ChartFrame("Spatial Data Quality", chart);
frame.pack();
frame.setVisible(true);
}
示例5: xySerieChart
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
/**
* Création et affichage d'un nuage de points
* @param listXIn
* @param listYIn
*/
public static void xySerieChart(List<Double> listXIn, String listXName,
List<Double> listYIn, String listYName) {
// Création des datasets
XYSeries serie = new XYSeries(listXName + " / " + listYName);
for (int i = 0; i < listXIn.size(); i++) {
serie.add(listXIn.get(i), listYIn.get(i));
}
// Création du graphique
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(serie);
JFreeChart chart = ChartFactory.createScatterPlot("", listXName, listYName,
dataset, PlotOrientation.VERTICAL, true, true, true);
ChartFrame frame = new ChartFrame("Spatial Data Quality", chart);
frame.pack();
frame.setVisible(true);
}
示例6: imagejLabelMouseClicked
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
private void imagejLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imagejLabelMouseClicked
if (this.chart2 != null) {
ChartFrame frame = new ChartFrame("Attribute comparison", chart2,
true);
frame.pack();
frame.setBackground(new Color(225, 225, 225));
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/keel/GraphInterKeel/resources/ico/logo/logo.gif")));
frame.setVisible(true);
}
}
示例7: imagejLabelMouseClicked
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
private void imagejLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imagejLabelMouseClicked
if (this.chart != null) {
this.chart.setTitle(((VisualizePanel) this.getParent().getParent()).getData().getAttributeIndex(
this.tableInfojTable.getSelectedRow()));
ChartFrame frame = new ChartFrame("Attribute chart", chart, true);
frame.pack();
frame.setBackground(new Color(225, 225, 225));
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/keel/GraphInterKeel/resources/ico/logo/logo.gif")));
frame.setVisible(true);
}
}
示例8: main
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public static void main( String[] args ) {
KMeansAlgorithm algorithm = new KMeansAlgorithm();
ChartGenerator chartGenerator = new ChartGenerator();
ClusteringInputData inputData = new ExampleClusteringInputData();
inputData.setNumberOfClusters( 3 );
ClusteringDataMiningModel dataMiningModel
= (ClusteringDataMiningModel) algorithm.analyze( inputData );
JFreeChart xyChart = chartGenerator.generateXYChart(
dataMiningModel.getClusters(), 0, "first", 1, "second" );
ChartFrame chartFrame = new ChartFrame( "Clustering example", xyChart );
chartFrame.pack();
chartFrame.setVisible( true );
JFreeChart pieChart = chartGenerator.generatePieChart(
dataMiningModel.getClusters() );
ChartFrame anotherChartFrame
= new ChartFrame( "Clustering example", pieChart );
anotherChartFrame.pack();
anotherChartFrame.setVisible( true );
}
示例9: jplot
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public static JFrame jplot(String pieChartName, String[] categories, double[] values) {
DefaultPieDataset data = new DefaultPieDataset();
for (int k = 0; k < categories.length; k++)
data.setValue(categories[k], new Double(values[k]));
JFreeChart pieChart = ChartFactory.createPieChart(pieChartName, data, false, false, false);
pieChart.setTitle("Category Plot " + pieChartName);
JFrame pieFrame = new ChartFrame(pieChartName, pieChart);
pieFrame.pack();
pieFrame.setVisible(true);
if (currentPlot != null) {
currentPlot.m_chart = pieChart;
}
return pieFrame;
}
示例10: Grafico
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public Grafico(String frametitle, String charttitle, String xlabel, String ylabel, XYSeriesCollection dataset){
JFreeChart chart = ChartFactory.createXYLineChart(charttitle, xlabel, ylabel, dataset, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
renderer.setShapesVisible(true);
renderer.setShapesFilled(true);
setXyplot(plot);
setChart(chart);
ChartFrame frame= new ChartFrame(frametitle,chart);
frame.pack();
frame.setVisible(true);
}
示例11: makeChartByMap
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public void makeChartByMap(Map<String, Object> map,String title) {
DefaultPieDataset dpd = new DefaultPieDataset(); //建立一个默认的饼图
System.out.println(map);
dpd.setValue("优", Integer.parseInt(map.get("优").toString()));
dpd.setValue("良", Integer.parseInt(map.get("良").toString()));
dpd.setValue("中", Integer.parseInt(map.get("中").toString()));
dpd.setValue("差", Integer.parseInt(map.get("差").toString()));
dpd.setValue("不及格", Integer.parseInt(map.get("不及格").toString()));
JFreeChart chart = ChartFactory.createPieChart(title, dpd, true, true, false);
PiePlot piePlot = (PiePlot) chart.getPlot();
piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator(("{0}:({2})"), NumberFormat.getNumberInstance(), new DecimalFormat("0.00%")));
//可以查具体的API文档,第一个参数是标题,第二个参数是一个数据集,第三个参数表示是否显示Legend,第四个参数表示是否显示提示,第五个参数表示图中是否存在URL
ChartFrame chartFrame = new ChartFrame(title, chart);
//chart要放在Java容器组件中,ChartFrame继承自java的Jframe类。该第一个参数的数据是放在窗口左上角的,不是正中间的标题。
chartFrame.pack(); //以合适的大小展现图形
chartFrame.setVisible(true);//图形是否可见
}
示例12: JFreeChartRender
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
/**
* Creates new JFreeChartRender with given title.
*
* @param title title of the chart
*/
public JFreeChartRender(String title) {
dataSet = new XYSeriesCollection();
chart = ChartFactory.createXYLineChart(
title, // chart title
"Optimization counter", // x axis label
"Fitness", // y axis label
dataSet, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
ChartFrame frame = new ChartFrame(title, chart);
frame.pack();
frame.setVisible(true);
}
示例13: WBSChart
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
/**
* Konstruktor
*
*
* @param dataSet vorbereitete Daten
* @param parent zur mittigen Positinierung auf dem Bildschirm
*/
public WBSChart(TimeSeriesCollection dataSet, JFrame parent) {
if (dataSet == null || dataSet.getSeries().isEmpty()) {
Controller.showMessage("Es sind zuwenig Daten vorhanden oder die Laufzeit des AP ist nicht lang genug");
} else {
charty = createChart(dataSet);
frame = new ChartFrame(LocalizedStrings.getChart().diagramView(), charty);
frame.setSize(new Dimension(1024, 700));
frame.setResizable(true);
frame.getChartPanel().setPopupMenu(null);
frame.getChartPanel().setRangeZoomable(false);
Controller.centerComponent(parent, frame);
frame.setVisible(true);
}
}
示例14: drawDiagram
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
protected JFreeChart drawDiagram(String s, List<Double> values) {
XYSeries graph = new XYSeries(s);
XYDataset xyDataset = new XYSeriesCollection(graph);
int i = 0;
for (double d:values) {
i++;
graph.add(i, d);
}
JFreeChart chart = ChartFactory.createXYLineChart(
"Quality of Solutions", "Number of Iteration", "deviation from optimal solution in %",
xyDataset, PlotOrientation.VERTICAL, true, true, false);
ChartFrame graphFrame = new ChartFrame("Quality of Solutions vs. Number of Iterations", chart);
graphFrame.setVisible(true);
graphFrame.setSize(300, 300);
return chart;
}
示例15: main
import org.jfree.chart.ChartFrame; //导入依赖的package包/类
public static void main(String[] args) {
ArrayList<Double> dados1 = new ArrayList<Double>();
dados1.add(1.0);
dados1.add(2.0);
dados1.add(4.0);
dados1.add(8.0);
dados1.add(16.0);
dados1.add(32.0);
dados1.add(64.0);
dados1.add(128.0);
Chart c = new Chart();
c.plot(dados1, "Line plot", "X axis", "Y axis");
int numberOfInputs=2;
int numberOfNeurons=10;
int numberOfPoints=100;
double[][] rndDataSet = RandomNumberGenerator.GenerateMatrixBetween(numberOfPoints, numberOfInputs, -10.0, 10.0);
String[] seriesNames = {"Scatter Plot"};
Paint[] seriesColor = {Color.WHITE};
Chart chart = new Chart("Scatter Plot",rndDataSet,seriesNames,0,seriesColor,Chart.SeriesType.DOTS);
ChartFrame frame = new ChartFrame("Scatter Plot", chart.scatterPlot("X Axis", "Y Axis"));
frame.pack();
frame.setVisible(true);
}
开发者ID:PacktPublishing,项目名称:Neural-Network-Programming-with-Java-SecondEdition,代码行数:31,代码来源:ChartTest.java