Java 类org.jfree.chart.ChartFrame 实例源码

项目:Proyecto-DASI    文件:xyLine.java   
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);
    }
项目:CPI    文件:Estadisticas.java   
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);
    }
项目:PhET    文件:TestJFreeStripChart.java   
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 );
            }
        } );
    }
项目:PhET    文件:JFreeChartIcon.java   
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 );
    }
项目:geoxygene    文件:DisplayChart.java   
/**
 * 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);
}
项目:geoxygene    文件:DisplayChart.java   
/**
 * 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);
}
项目:Keel3.0    文件:VisualizePanelCharts2D.java   
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);
    }
}
项目:Keel3.0    文件:VisualizePanelAttribute.java   
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);
    }
}
项目:KEEL    文件:VisualizePanelCharts2D.java   
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);
    }
}
项目:KEEL    文件:VisualizePanelAttribute.java   
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);
    }
}
项目:osdq-core    文件:ClusteringExample.java   
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 );
}
项目:scalalab    文件:jFigure.java   
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;

}
项目:cst    文件:Grafico.java   
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);
}
项目:StudentGradesManageSystem    文件:HomeAdmin.java   
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);//图形是否可见
}
项目:JCOP    文件:JFreeChartRender.java   
/**
 * 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);
}
项目:WBS-Project    文件:WBSChart.java   
/**
 * 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);
    }

}
项目:Memetic-Algorithm-for-TSP    文件:TSP_Algorithm.java   
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;
}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:ChartTest.java   
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);

}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:Kohonen0DTest.java   
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){

    }
}
项目:doubanbook    文件:ScatterPlotChart.java   
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);
}
项目:audiveris    文件:ChartPlotter.java   
/**
 * 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);
}
项目:jobjob    文件:Statistiques.java   
public void DessinerBar() {

    DefaultCategoryDataset dataset=new DefaultCategoryDataset();
    dataset.addValue(100, "score", "CULTURE GENERALE");
    dataset.addValue(45, "score", "TECHNIQUE JAVA");
    dataset.addValue(75, "score", "LANGAGE EXOTIQUE");
    dataset.addValue(18, "score", "QUESTION STRESS");
    JFreeChart chart=ChartFactory.createBarChart3D(null, null, null, dataset,PlotOrientation.VERTICAL, false, true, false);

     CategoryPlot p= chart.getCategoryPlot();
     p.setRangeGridlinePaint(Color.BLACK);
     ChartFrame frame=new ChartFrame("statistique test", chart);
     frame.setSize(800,500);
     frame.setVisible(true);
}
项目:jobjob    文件:Statistiques.java   
public void DessinerCam() {
     DefaultPieDataset data=new DefaultPieDataset();
     data.setValue("Culture G�n�rale 100%",100);
     data.setValue("Technique Java 27% ",27.9);
     data.setValue("Langage exotique 45%",45);
     data.setValue("Question stress 100%",100);

    JFreeChart chart=ChartFactory.createPieChart3D(null, data);
    ChartFrame frame=new ChartFrame("statistique test", chart);
    frame.setSize(600,450);
    frame.setVisible(true);
}
项目:JCL    文件:BarExample2.java   
public Boolean execute()
{
  DefaultCategoryDataset dataset = new DefaultCategoryDataset();
  dataset.setValue(6.0D, "Science", "Rahul");
  dataset.setValue(8.0D, "Maths", "Rahul");
  dataset.setValue(5.0D, "Science", "Deepak");
  dataset.setValue(3.0D, "Maths", "Deepak");
  dataset.setValue(6.0D, "Science", "Vinod");
  dataset.setValue(9.0D, "Maths", "Vinod");
  dataset.setValue(2.0D, "Science", "Chandan");
  dataset.setValue(4.0D, "Maths", "Chandan");
  JFreeChart chart = ChartFactory.createBarChart3D("Comparison between Students", "Students", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false);
  chart.setBackgroundPaint(Color.white);
  chart.getTitle().setPaint(Color.blue);
  CategoryPlot p = chart.getCategoryPlot();
  p.setRangeGridlinePaint(Color.red);
  ChartFrame frame1 = new ChartFrame("3D Bar Chart", chart);
  frame1.setVisible(true);
  frame1.setSize(300, 300);

  DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
  dataset1.setValue(6.0D, "Rahul", "Science");
  dataset1.setValue(8.0D, "Rahul", "Maths");
  dataset1.setValue(5.0D, "Deepak", "Science");
  dataset1.setValue(3.0D, "Deepak", "Maths");
  dataset1.setValue(6.0D, "Vinod", "Science");
  dataset1.setValue(9.0D, "Vinod", "Maths");
  dataset1.setValue(2.0D, "Chandan", "Science");
  dataset1.setValue(4.0D, "Chandan", "Maths");
  JFreeChart chart1 = ChartFactory.createBarChart3D("Comparison between Students - pivoted", "Discipline", "Marks", dataset1, PlotOrientation.VERTICAL, true, true, false);
  chart1.setBackgroundPaint(Color.white);
  chart1.getTitle().setPaint(Color.blue);
  CategoryPlot p1 = chart1.getCategoryPlot();
  p1.setRangeGridlinePaint(Color.red);
  ChartFrame frame2 = new ChartFrame("3D Bar Chart", chart1);
  frame2.setVisible(true);
  frame2.setSize(300, 300);

  return new Boolean(true);
}
项目:JCL    文件:BarExample2.java   
public Boolean execute()
{
  DefaultCategoryDataset dataset = new DefaultCategoryDataset();
  dataset.setValue(6.0D, "Science", "Rahul");
  dataset.setValue(8.0D, "Maths", "Rahul");
  dataset.setValue(5.0D, "Science", "Deepak");
  dataset.setValue(3.0D, "Maths", "Deepak");
  dataset.setValue(6.0D, "Science", "Vinod");
  dataset.setValue(9.0D, "Maths", "Vinod");
  dataset.setValue(2.0D, "Science", "Chandan");
  dataset.setValue(4.0D, "Maths", "Chandan");
  JFreeChart chart = ChartFactory.createBarChart3D("Comparison between Students", "Students", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false);
  chart.setBackgroundPaint(Color.white);
  chart.getTitle().setPaint(Color.blue);
  CategoryPlot p = chart.getCategoryPlot();
  p.setRangeGridlinePaint(Color.red);
  ChartFrame frame1 = new ChartFrame("3D Bar Chart", chart);
  frame1.setVisible(true);
  frame1.setSize(300, 300);

  DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
  dataset1.setValue(6.0D, "Rahul", "Science");
  dataset1.setValue(8.0D, "Rahul", "Maths");
  dataset1.setValue(5.0D, "Deepak", "Science");
  dataset1.setValue(3.0D, "Deepak", "Maths");
  dataset1.setValue(6.0D, "Vinod", "Science");
  dataset1.setValue(9.0D, "Vinod", "Maths");
  dataset1.setValue(2.0D, "Chandan", "Science");
  dataset1.setValue(4.0D, "Chandan", "Maths");
  JFreeChart chart1 = ChartFactory.createBarChart3D("Comparison between Students - pivoted", "Discipline", "Marks", dataset1, PlotOrientation.VERTICAL, true, true, false);
  chart1.setBackgroundPaint(Color.white);
  chart1.getTitle().setPaint(Color.blue);
  CategoryPlot p1 = chart1.getCategoryPlot();
  p1.setRangeGridlinePaint(Color.red);
  ChartFrame frame2 = new ChartFrame("3D Bar Chart", chart1);
  frame2.setVisible(true);
  frame2.setSize(300, 300);

  return new Boolean(true);
}
项目:jsdp    文件:CapacitatedStochasticLotSizing.java   
static void plotOptimalPolicyCost(int targetPeriod, BackwardRecursionImpl recursion){
   recursion.runBackwardRecursion(targetPeriod);
   XYSeries series = new XYSeries("Optimal policy");
   for(double i = StateImpl.getMinState(); i <= StateImpl.getMaxState(); i += StateImpl.getStepSize()){
      StateDescriptorImpl stateDescriptor = new StateDescriptorImpl(targetPeriod, i);
      series.add(i,recursion.getExpectedCost(stateDescriptor));
   }
   XYDataset xyDataset = new XYSeriesCollection(series);
   JFreeChart chart = ChartFactory.createXYLineChart("Optimal policy policy - period "+targetPeriod+" expected total cost", "Opening inventory level", "Expected total cost",
         xyDataset, PlotOrientation.VERTICAL, false, true, false);
   ChartFrame frame = new ChartFrame("Optimal policy",chart);
   frame.setVisible(true);
   frame.setSize(500,400);
}
项目:jsdp    文件:CapacitatedStochasticLotSizing.java   
static void plotOptimalPolicyAction(int targetPeriod, BackwardRecursionImpl recursion){
   XYSeries series = new XYSeries("Optimal policy");
   for(double i = StateImpl.getMinState(); i <= StateImpl.getMaxState(); i += StateImpl.getStepSize()){
      StateDescriptorImpl stateDescriptor = new StateDescriptorImpl(targetPeriod, i);
      series.add(i,recursion.getOptimalAction(stateDescriptor).getAction());
   }

   XYDataset xyDataset = new XYSeriesCollection(series);
   JFreeChart chart = ChartFactory.createXYLineChart("Optimal policy - period "+targetPeriod+" order quantity", "Opening inventory level", "Order quantity",
         xyDataset, PlotOrientation.VERTICAL, false, true, false);
   ChartFrame frame = new ChartFrame("Optimal policy",chart);
   frame.setVisible(true);
   frame.setSize(500,400);
}
项目:jsdp    文件:StochasticLotSizing.java   
static void plotOptimalPolicyCost(int targetPeriod, BackwardRecursionImpl recursion){
   recursion.runBackwardRecursionMonitoring(targetPeriod);
   XYSeries series = new XYSeries("Optimal policy");
   for(double i = StateImpl.getMinState(); i <= StateImpl.getMaxState(); i += StateImpl.getStepSize()){
      StateDescriptorImpl stateDescriptor = new StateDescriptorImpl(targetPeriod, i);
      series.add(i,recursion.getExpectedCost(stateDescriptor));
   }
   XYDataset xyDataset = new XYSeriesCollection(series);
   JFreeChart chart = ChartFactory.createXYLineChart("Optimal policy policy - period "+targetPeriod+" expected total cost", "Opening inventory level", "Expected total cost",
         xyDataset, PlotOrientation.VERTICAL, false, true, false);
   ChartFrame frame = new ChartFrame("Optimal policy",chart);
   frame.setVisible(true);
   frame.setSize(500,400);
}
项目:jsdp    文件:StochasticLotSizing.java   
static void plotOptimalPolicyAction(int targetPeriod, BackwardRecursionImpl recursion){
   XYSeries series = new XYSeries("Optimal policy");
   for(double i = StateImpl.getMinState(); i <= StateImpl.getMaxState(); i += StateImpl.getStepSize()){
      StateDescriptorImpl stateDescriptor = new StateDescriptorImpl(targetPeriod, i);
      series.add(i,recursion.getOptimalAction(stateDescriptor).getAction());
   }

   XYDataset xyDataset = new XYSeriesCollection(series);
   JFreeChart chart = ChartFactory.createXYLineChart("Optimal policy - period "+targetPeriod+" order quantity", "Opening inventory level", "Order quantity",
         xyDataset, PlotOrientation.VERTICAL, false, true, false);
   ChartFrame frame = new ChartFrame("Optimal policy",chart);
   frame.setVisible(true);
   frame.setSize(500,400);
}
项目:genotick    文件:GenoJFreeChart.java   
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++;
}
项目:genotick    文件:GenoJFreeChart.java   
private void alignChartFrame(ChartFrame frame) {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double pixels = 40.0 * numOpenedChartFrames;
    double widthPercent = pixels / screenSize.getWidth();
    double heightPercent = pixels / screenSize.getHeight();
    RefineryUtilities.positionFrameOnScreen(frame, widthPercent, heightPercent);
}
项目:MakamBox    文件:Plot.java   
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();
    }
项目:scalalab    文件:jPlot.java   
public ChartFrame jPieChart(String[] categories, double[] values, String chartTitle) {
    DefaultPieDataset data = new DefaultPieDataset();
    for (int k = 0; k < values.length; k++)
        data.setValue(categories[k], values[k]);
    m_chart = ChartFactory.createPieChart(chartTitle, data, true, true, true);

    ChartFrame cf = new ChartFrame("Pie Chart", m_chart);
    cf.setSize(defaultXSize, defaultYSize);
    cf.setVisible(true);
    return cf;

}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:Kohonen1DTest.java   
public static void main(String[] args){

    RandomNumberGenerator.seed=0;

    int numberOfInputs=2;
    int numberOfNeurons=20;
    int numberOfPoints=1000;

    double[][] rndDataSet = RandomNumberGenerator.GenerateMatrixBetween(numberOfPoints, numberOfInputs, -100.0, 100.0);

    for (int i=0;i<numberOfPoints;i++){
        rndDataSet[i][0]=i;            
        rndDataSet[i][0]+=RandomNumberGenerator.GenerateNext();
        rndDataSet[i][1]=Math.cos(i/100.0)*1000;            
        rndDataSet[i][1]+=RandomNumberGenerator.GenerateNext()*400;
    }

    Kohonen kn1 = new Kohonen(numberOfInputs,numberOfNeurons,new UniformInitialization(0.0,1000.0),1);

    NeuralDataSet neuralDataSet = new NeuralDataSet(rndDataSet,2);

    CompetitiveLearning complrn=new CompetitiveLearning(kn1,neuralDataSet,LearningAlgorithm.LearningMode.ONLINE);
    complrn.show2DData=true;
    complrn.printTraining=true;
    complrn.setLearningRate(0.3);
    complrn.setMaxEpochs(10000);
    complrn.setReferenceEpoch(3000);
    try{
        String[] seriesNames = {"Training Data"};
        Paint[] seriesColor = {Color.WHITE};

        Chart chart = new Chart("Training",rndDataSet,seriesNames,0,seriesColor,Chart.SeriesType.DOTS);
        ChartFrame frame = new ChartFrame("Training", chart.scatterPlot("X", "Y"));
        frame.pack();
        frame.setVisible(true);

        complrn.setPlot2DFrame(frame);
        complrn.showPlot2DData();
        System.in.read();

        complrn.train();
    }
    catch(Exception ne){

    }
}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:CompetitiveLearning.java   
public void setPlot2DFrame(ChartFrame frame){
    this.plot2DData=frame;
}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:CompetitiveLearning.java   
public ChartFrame getPlot2DFrame(){
    return plot2DData;
}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:Kohonen2DTest.java   
public static void main(String[] args){

        RandomNumberGenerator.seed=System.currentTimeMillis();

        int numberOfInputs=2;
        int neuronsGridX=12;
        int neuronsGridY=12;
        int numberOfPoints=1000;

        double[][] rndDataSet;
        rndDataSet = RandomNumberGenerator.GenerateMatrixGaussian(numberOfPoints, numberOfInputs, 100.0, 1.0);
        //rndDataSet = RandomNumberGenerator.GenerateMatrixBetween(numberOfPoints, numberOfInputs, 100.0, 110.0);

        for (int i=0;i<numberOfPoints;i++){
            rndDataSet[i][0]*=Math.sin(i);            
            rndDataSet[i][0]+=RandomNumberGenerator.GenerateNext()*50;
            rndDataSet[i][1]*=Math.cos(i);            
            rndDataSet[i][1]+=RandomNumberGenerator.GenerateNext()*50;
        }

//        for (int i=0;i<numberOfPoints;i++){
//            rndDataSet[i][0]=i;            
//            rndDataSet[i][0]+=RandomNumberGenerator.GenerateNext();
//            rndDataSet[i][1]=Math.cos(i/100.0);            
//            rndDataSet[i][1]+=RandomNumberGenerator.GenerateNext()*5;
//        }        

        Kohonen kn2 = new Kohonen(numberOfInputs,neuronsGridX,neuronsGridY,new GaussianInitialization(500.0,20.0));

        NeuralDataSet neuralDataSet = new NeuralDataSet(rndDataSet,2);

        CompetitiveLearning complrn=new 
            CompetitiveLearning(kn2,neuralDataSet
                    ,LearningAlgorithm.LearningMode.ONLINE);
        complrn.show2DData=true;
        complrn.printTraining=true;
        complrn.setLearningRate(0.5);
        complrn.setMaxEpochs(1000);
        complrn.setReferenceEpoch(300);
        complrn.sleep=-1;

        try{
            String[] seriesNames = {"Training Data"};
            Paint[] seriesColor = {Color.WHITE};

            Chart chart = new Chart("Training",rndDataSet,seriesNames,0,seriesColor,Chart.SeriesType.DOTS);
            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){

        }
    }
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:LearningAlgorithm.java   
public void setPlot(ChartFrame frame){
    this.plotErrorEvolution=frame;
}
项目:Neural-Network-Programming-with-Java-SecondEdition    文件:LearningAlgorithm.java   
public ChartFrame getPlot(){
    return this.plotErrorEvolution;
}
项目:CPI    文件:Estadisticas.java   
public void graficarCategoria() {

        // este es el que anda "bien"
        int TProf = 0;
        String TProf2 = txtTotalProf.getText();
        int TId = 0;
        String TId2 = txtTotalIdoneo.getText();
        int TAInf = 0;
        String TAInf2 = txtTotalAInfor.getText();

        DefaultPieDataset pieDataset = new DefaultPieDataset();

        if (txtTotalProf.getText().equals("")) {
            TProf = 0;
            txtTotalProf.setText(String.valueOf(TId));
            pieDataset.setValue("Profesional", new Integer(TProf));
        } else {
            pieDataset.setValue("Profesional", new Integer(TProf2));
        }
        if (txtTotalIdoneo.getText().equals("")) {
            TId = 0;
            txtTotalIdoneo.setText(String.valueOf(TId));
            pieDataset.setValue("Idoneo", new Integer(TId));
        } else {
            pieDataset.setValue("Idoneo", new Integer(TId2));
        }
        if (txtTotalAInfor.getText().equals("")) {
            TAInf = 0;
            txtTotalAInfor.setText(String.valueOf(TAInf));
            pieDataset.setValue("Auxiliar Informatico", new Integer(TAInf));
        } else {
            pieDataset.setValue("Auxiliar Informatico", new Integer(TAInf2));
        }

        JFreeChart chart = ChartFactory.createPieChart3D("Categoria 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);
    }