本文整理汇总了Java中org.jfree.chart.ChartFrame.pack方法的典型用法代码示例。如果您正苦于以下问题:Java ChartFrame.pack方法的具体用法?Java ChartFrame.pack怎么用?Java ChartFrame.pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.ChartFrame
的用法示例。
在下文中一共展示了ChartFrame.pack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 );
}
} );
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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 );
}
示例7: 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);
}
示例8: 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);//图形是否可见
}
示例9: 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);
}
示例10: 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
示例11: 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
示例12: ScatterPlotChart
import org.jfree.chart.ChartFrame; //导入方法依赖的package包/类
public ScatterPlotChart() {
List<RatingDisBean> list = ScatterDataAnalysis.getInstance().selectBookInfo();
XYDataset xydataset = createxydataset("Rating Distribution", list);
JFreeChart chart = createChart(xydataset, "Rating People", "Rating");
chart.getTitle().setFont(new Font("微软雅黑", Font.PLAIN, 25));
ChartFrame frame = new ChartFrame("distribution", chart);
frame.setSize(new Dimension(700,500));
frame.pack();
RefineryUtilities.centerFrameOnScreen(frame);
frame.setVisible(true);
}
示例13: display
import org.jfree.chart.ChartFrame; //导入方法依赖的package包/类
/**
* Wrap chart into a frame with specific title and display the frame at provided
* location.
*
* @param title frame title
* @param location frame location
*/
public void display (String title,
Point location)
{
ChartFrame frame = new ChartFrame(title, chart, true);
frame.pack();
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setLocation(location);
frame.setVisible(true);
}
示例14: drawChart
import org.jfree.chart.ChartFrame; //导入方法依赖的package包/类
private void drawChart(String title, JFreeChart chartObject) {
ChartFrame frame = new ChartFrame(title, chartObject);
ChartPanel chartPanel = frame.getChartPanel();
chartPanel.setMouseZoomable(true);
chartPanel.setMouseWheelEnabled(true);
frame.pack();
frame.setVisible(true);
frame.toFront();
alignChartFrame(frame);
numOpenedChartFrames++;
}
示例15: createChart
import org.jfree.chart.ChartFrame; //导入方法依赖的package包/类
private void createChart(){
JFreeChart chart = ChartFactory.createXYLineChart(
"plotting", // chart title
"X Axis", // x axis label
"Y Axis", // y axis label
createMultiple(datas.length), // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setBaseShapesVisible(false);
renderer.setBaseLinesVisible(true);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(renderer);
if(annotation != null){
for (int i = 1; i < annotation.length; i++) {
plot.addAnnotation(annotation[i]);
}
}
ChartFrame frame = new ChartFrame("Multiple Plot", chart);
// frame.getChartPanel().setRangeZoomable(false);
frame.setVisible(true);
frame.pack();
}