本文整理汇总了Java中org.jfree.chart.ChartFrame.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java ChartFrame.setVisible方法的具体用法?Java ChartFrame.setVisible怎么用?Java ChartFrame.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.ChartFrame
的用法示例。
在下文中一共展示了ChartFrame.setVisible方法的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: 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 );
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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 );
}
示例8: 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);
}
示例9: 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);//图形是否可见
}
示例10: 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);
}
示例11: 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);
}
}
示例12: 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;
}
示例13: 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
示例14: main
import org.jfree.chart.ChartFrame; //导入方法依赖的package包/类
public static void main(String[] args){
RandomNumberGenerator.seed=0;
int numberOfInputs=2;
int numberOfNeurons=10;
int numberOfPoints=100;
double[][] rndDataSet = RandomNumberGenerator.GenerateMatrixBetween(numberOfPoints, numberOfInputs, -10.0, 10.0);
Kohonen kn0 = new Kohonen(numberOfInputs,numberOfNeurons,new UniformInitialization(-1.0,1.0),0);
NeuralDataSet neuralDataSet = new NeuralDataSet(rndDataSet,2);
CompetitiveLearning complrn=new CompetitiveLearning(kn0,neuralDataSet,LearningAlgorithm.LearningMode.ONLINE);
complrn.show2DData=true;
complrn.printTraining=true;
complrn.setLearningRate(0.003);
complrn.setMaxEpochs(10000);
complrn.setReferenceEpoch(3000);
try{
String[] seriesNames = {"Training Data"};
Paint[] seriesColor = {Color.WHITE};
Chart chart = new Chart("Training",rndDataSet,seriesNames,0,seriesColor);
ChartFrame frame = new ChartFrame("Training", chart.scatterPlot("X", "Y"));
frame.pack();
frame.setVisible(true);
//System.in.read();
complrn.setPlot2DFrame(frame);
complrn.showPlot2DData();
//System.in.read();
complrn.train();
}
catch(Exception ne){
}
}
开发者ID:PacktPublishing,项目名称:Neural-Network-Programming-with-Java-SecondEdition,代码行数:40,代码来源:Kohonen0DTest.java
示例15: main
import org.jfree.chart.ChartFrame; //导入方法依赖的package包/类
public static void main(String arg[]){
XYSeries series = new XYSeries("Average Weight");
series.add(20, 20);
series.add(40, 25);
series.add(55, 50);
series.add(70, 65);
// series.add(20.0, 20.0);
// series.add(40.0, 25.0);
// series.add(55.0, 50.0);
// series.add(70.0, 65.0);
XYDataset xyDataset = new XYSeriesCollection(series);
JFreeChart chart = ChartFactory.createXYLineChart
("XYLine Chart using JFreeChart", "Age", "Weight", xyDataset, PlotOrientation.VERTICAL, true, true, false);
ChartFrame frame1=new ChartFrame("XYLine Chart",chart);
frame1.setVisible(true);
frame1.setSize(300,300);
}