org.jfree.chart.ChartFrame Java Examples
The following examples show how to use
org.jfree.chart.ChartFrame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HomeAdmin.java From StudentGradesManageSystem with Apache License 2.0 | 6 votes |
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);//图形是否可见 }
Example #2
Source File: Grafico.java From cst with GNU Lesser General Public License v3.0 | 6 votes |
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); }
Example #3
Source File: VisualizePanelAttribute.java From KEEL with GNU General Public License v3.0 | 6 votes |
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); } }
Example #4
Source File: VisualizePanelCharts2D.java From KEEL with GNU General Public License v3.0 | 6 votes |
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); } }
Example #5
Source File: LearningAlgorithm.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
public void setFittingEvolution(DataSet _dataset, NeuralDataSet _fittingEvolution,int _outputColumn,int[] _filterColumns,double[][] _filters,ChartFrame ref){ this.showFittingPlot=true; this.fittingEvolution=_fittingEvolution; this.fittingEvolutionDataSet=_dataset; if(fittingEvolution.neuralNet!=this.neuralNet) fittingEvolution.neuralNet=this.neuralNet; this.fittingEvolutionsOutput=_outputColumn; this.fittingEvolutionFilterColumns=_filterColumns; this.fittingEvolutionFilters=_filters; this.plotFittingEvolution=ref; }
Example #6
Source File: TimeSeries.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
public ChartFrame getTimePlot(ChartFrame ref,String title,int[] cols,Paint[] color,double start,double end){ int[] cls; if(ArrayOperations.isInIntArray(cols, indexTimeColumn)){ cls=new int[cols.length-1]; int ii=0; for(int i=0;i<cols.length;i++){ if(cols[i]!=indexTimeColumn) cls[ii++]=cols[i]; } } else{ cls=new int[cols.length]; System.arraycopy(cols, 0, cls, 0, cols.length); } double[][][] seriesdata = new double[cls.length][][]; String[][] sns = new String[cls.length][1]; Paint[][] colorv = new Paint[cls.length][1]; for(int i=0;i<cls.length;i++){ sns[i][0]=columns.get(cls[i]); colorv[i][0]=color[i]; int[] clls = { indexTimeColumn,cls[i]}; seriesdata[i]=this.getData(clls,start,end); } Chart chart = new Chart(title,seriesdata[0],sns[0],0,colorv[0],Chart.SeriesType.LINES); for(int i=1;i<cls.length;i++){ chart.addSeries(seriesdata[i], sns[i], 0, colorv[i], Chart.SeriesType.LINES); } if(ref==null){ ChartFrame frame = new ChartFrame(title, chart.scatterPlot(columns.get(indexTimeColumn), "Data")); frame.pack(); return frame; } else{ ref.getChartPanel().setChart(chart.scatterPlot(columns.get(indexTimeColumn), "Data")); return ref; } }
Example #7
Source File: DataSet.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
public ChartFrame getScatterChart(String title,int colx,int coly,Paint color){ int[] cols = {colx,coly}; String[] sns = {"Records"}; Paint[] scl = {color}; double[][] chartdata = this.getData(cols); Chart chart = new Chart(title,chartdata,sns,0,scl,Chart.SeriesType.DOTS); ChartFrame frame = new ChartFrame(title, chart.scatterPlot(columns.get(colx), columns.get(coly))); frame.pack(); return frame; }
Example #8
Source File: Kohonen0DTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
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){ } }
Example #9
Source File: ChartTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
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); }
Example #10
Source File: LearningAlgorithm.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
public void setFittingEvolution(DataSet _dataset, NeuralDataSet _fittingEvolution,int _outputColumn,int[] _filterColumns,double[][] _filters,ChartFrame ref){ this.showFittingPlot=true; this.fittingEvolution=_fittingEvolution; this.fittingEvolutionDataSet=_dataset; if(fittingEvolution.neuralNet!=this.neuralNet) fittingEvolution.neuralNet=this.neuralNet; this.fittingEvolutionsOutput=_outputColumn; this.fittingEvolutionFilterColumns=_filterColumns; this.fittingEvolutionFilters=_filters; this.plotFittingEvolution=ref; }
Example #11
Source File: Kohonen0DTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
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){ } }
Example #12
Source File: ChartTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
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); }
Example #13
Source File: ChartTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
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); }
Example #14
Source File: Kohonen0DTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
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){ } }
Example #15
Source File: ChartPlotter.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
/** * 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); }
Example #16
Source File: DataSet.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
public ChartFrame getScatterChart(String title,int colx,int coly,Paint color){ int[] cols = {colx,coly}; String[] sns = {"Records"}; Paint[] scl = {color}; double[][] chartdata = this.getData(cols); Chart chart = new Chart(title,chartdata,sns,0,scl,Chart.SeriesType.DOTS); ChartFrame frame = new ChartFrame(title, chart.scatterPlot(columns.get(colx), columns.get(coly))); frame.pack(); return frame; }
Example #17
Source File: TimeSeries.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 5 votes |
public ChartFrame getTimePlot(ChartFrame ref,String title,int[] cols,Paint[] color,double start,double end){ int[] cls; if(ArrayOperations.isInIntArray(cols, indexTimeColumn)){ cls=new int[cols.length-1]; int ii=0; for(int i=0;i<cols.length;i++){ if(cols[i]!=indexTimeColumn) cls[ii++]=cols[i]; } } else{ cls=new int[cols.length]; System.arraycopy(cols, 0, cls, 0, cols.length); } double[][][] seriesdata = new double[cls.length][][]; String[][] sns = new String[cls.length][1]; Paint[][] colorv = new Paint[cls.length][1]; for(int i=0;i<cls.length;i++){ sns[i][0]=columns.get(cls[i]); colorv[i][0]=color[i]; int[] clls = { indexTimeColumn,cls[i]}; seriesdata[i]=this.getData(clls,start,end); } Chart chart = new Chart(title,seriesdata[0],sns[0],0,colorv[0],Chart.SeriesType.LINES); for(int i=1;i<cls.length;i++){ chart.addSeries(seriesdata[i], sns[i], 0, colorv[i], Chart.SeriesType.LINES); } if(ref==null){ ChartFrame frame = new ChartFrame(title, chart.scatterPlot(columns.get(indexTimeColumn), "Data")); frame.pack(); return frame; } else{ ref.getChartPanel().setChart(chart.scatterPlot(columns.get(indexTimeColumn), "Data")); return ref; } }
Example #18
Source File: Kohonen2DTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
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){ } }
Example #19
Source File: Kohonen1DTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
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){ } }
Example #20
Source File: Kohonen2DTest.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
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){ } }
Example #21
Source File: LearningAlgorithm.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public ChartFrame getPlot(){ return this.plotErrorEvolution; }
Example #22
Source File: LearningAlgorithm.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public void setPlot(ChartFrame frame){ this.plotErrorEvolution=frame; }
Example #23
Source File: CompetitiveLearning.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public ChartFrame getPlot2DFrame(){ return plot2DData; }
Example #24
Source File: CompetitiveLearning.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public void setPlot2DFrame(ChartFrame frame){ this.plot2DData=frame; }
Example #25
Source File: DataSet.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public ChartFrame getScatterChart(String title,String colx,String coly,Paint color){ return getScatterChart(title,getColumnIndex(colx),getColumnIndex(coly),color); }
Example #26
Source File: MotivationalViewer.java From cst with GNU Lesser General Public License v3.0 | 4 votes |
@Override public synchronized void run() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); final JFreeChart chart = ChartFactory.createBarChart( getTitle(), getEntity(), "Value", dataset, PlotOrientation.VERTICAL, true, true, false ); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); chart.setBackgroundPaint(Color.lightGray); ChartFrame frame= new ChartFrame(getTitle(), chart); frame.pack(); frame.setVisible(true); while (true) { ArrayList<Codelet> tempCodeletsList = new ArrayList<Codelet>(); tempCodeletsList.addAll(this.getListOfMotivationalEntities()); synchronized (tempCodeletsList) { for (Codelet co : tempCodeletsList) { dataset.addValue(co.getActivation(), co.getName(), "activation"); } try { Thread.currentThread().sleep(getRefreshPeriod()); } catch (InterruptedException e) { e.printStackTrace(); } } } }
Example #27
Source File: TimeSeries.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public ChartFrame getTimePlot(String title,int[] cols,Paint[] color,double start,double end){ return getTimePlot(null,title,cols,color,start,end); }
Example #28
Source File: ScaleBuilder.java From libreveris with GNU Lesser General Public License v3.0 | 4 votes |
public void plot (Point upperLeft) { // All values, quorum line & spread line plotValues(); plotQuorumLine(); plotSpreadLine("", peak); // Second peak spread line? if (secondPeak != null) { plotSpreadLine("Second", secondPeak); } // Chart // JFreeChart chartLines = ChartFactory.createXYLineChart( // sheet.getId() + " (" + name + " runs)", // Title // "Lengths " + ((scale != null) ? scale : "*no scale*"), // X-Axis label // "Counts", // Y-Axis label // dataset, // Dataset // PlotOrientation.VERTICAL, // orientation, // true, // Show legend // false, // Show tool tips // false // urls // ); // use a histogram so we can see the actual buckets values // rather than being left to interpolate for any given length JFreeChart chart = ChartFactory.createHistogram( sheet.getId() + " (" + name + " runs)", // Title "", // X-Axis label - already labeled in chartLines "", // Y-Axis label - already labeled in chartLines dataset, // Dataset PlotOrientation.VERTICAL, // orientation, true, // Show legend false, // Show tool tips false // urls ); // have the quorum and spread be lines rather than bars XYPlot xyPlot = (XYPlot) chart.getPlot(); xyPlot.setDataset(1, datasetLines); XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(); renderer1.setSeriesPaint(0, Color.GREEN); xyPlot.setRenderer(1, renderer1); // "FORWARD" causes the added dataset of // lines to be overlayed on histogram bars xyPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // Hosting frame ChartFrame frame = new ChartFrame( sheet.getId() + " - " + name + " runs", chart, true); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setLocation(upperLeft); frame.setVisible(true); }
Example #29
Source File: LearningAlgorithm.java From Neural-Network-Programming-with-Java-SecondEdition with MIT License | 4 votes |
public ChartFrame getPlot(){ return this.plotErrorEvolution; }
Example #30
Source File: NumberLineChart.java From EdgeSim with MIT License | 4 votes |
public NumberLineChart() { this.collection = this.getCollection(); initial(); this.chart = ChartFactory.createXYLineChart( null, "Request", "Hit Rate", collection, PlotOrientation.VERTICAL, true, true, false ); this.chart.getPlot().setBackgroundPaint(SystemColor.white); LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis numberAxisX = (NumberAxis) chart.getXYPlot().getDomainAxis(); numberAxisX.setTickUnit(new NumberTickUnit(500)); // numberAxisX.setAutoRangeMinimumSize(0.1); numberAxisX.setAutoRangeIncludesZero(true); numberAxisX.setAxisLineVisible(false); numberAxisX.setTickMarkInsideLength(4f); numberAxisX.setTickMarkOutsideLength(0); NumberAxis numberAxisY = (NumberAxis) chart.getXYPlot().getRangeAxis(); numberAxisY.setTickUnit(new NumberTickUnit(0.2)); numberAxisY.setRangeWithMargins(0,1); numberAxisY.setAutoRangeIncludesZero(true); numberAxisY.setAxisLineVisible(false); numberAxisY.setTickMarkInsideLength(4f); numberAxisY.setTickMarkOutsideLength(0); // ����Y������Ϊ�ٷֱ� numberAxisY.setNumberFormatOverride(NumberFormat.getPercentInstance()); XYItemRenderer xyitem = plot.getRenderer(); xyitem.setDefaultItemLabelsVisible(true); // ItemLabelsVisible(true); xyitem.setDefaultPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); // xyitem.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); // xyitem.setBaseItemLabelFont(new Font("Dialog", 1, 12)); xyitem.setDefaultItemLabelFont(new Font("Dialog", 1, 12)); plot.setRenderer(xyitem); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)plot.getRenderer(); renderer.setDefaultItemLabelsVisible(true); renderer.setDefaultShapesVisible(true); renderer.setDrawOutlines(true); renderer.setSeriesOutlineStroke(0, new BasicStroke(5F)); renderer.setSeriesOutlineStroke(1, new BasicStroke(5F)); renderer.setSeriesOutlineStroke(2, new BasicStroke(5F)); renderer.setSeriesOutlineStroke(3, new BasicStroke(5F)); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, new Color(53,101,253)); renderer.setSeriesPaint(2, new Color(0,161,59));//����ɫ renderer.setSeriesPaint(3, new Color(148,103,189));//��ɫ renderer.setSeriesStroke(0, new BasicStroke(4.0F)); renderer.setSeriesStroke(1, new BasicStroke(4.0F)); renderer.setSeriesStroke(2, new BasicStroke(4.0F)); renderer.setSeriesStroke(3, new BasicStroke(4.0F)); renderer.setSeriesStroke(4, new BasicStroke(2.0F)); renderer.setSeriesStroke(5, new BasicStroke(2.0F)); this.chartFrame = new ChartFrame("Line Chart", chart); chartFrame.pack(); chartFrame.setSize(1600,1200); chartFrame.setLocation(300,200); chartFrame.setVisible(true); }