List of usage examples for org.jfree.chart ChartFactory createXYLineChart
public static JFreeChart createXYLineChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:com.marmoush.jann.chart.jframe.LineJf.java
@Override public void run() { JFreeChart chart = ChartFactory.createXYLineChart(getTitle(), getxAxisTitle(), getyAxisTitle(), getXySeriesCollection(), getOrientation(), isLegend(), isTooltips(), isUrls()); setChart(chart);//from w ww. j a v a2 s. com super.run(); }
From source file:at.ac.tuwien.dsg.utility.DesignChart.java
public void chart(LinkedList<String> xValue, LinkedList<String> yValue) throws Exception { XYSeries series = new XYSeries("Sensory Data"); final JFreeChart chart; //data assignment in the chart {//from w ww . j a va 2 s . co m for (int i = 0; i < xValue.size(); i++) { series.add(Double.parseDouble(xValue.get(i)), Double.parseDouble(yValue.get(i))); } final XYSeriesCollection data = new XYSeriesCollection(series); chart = ChartFactory.createXYLineChart("Graph Visualization", "collection_time", "collection_data", data, PlotOrientation.VERTICAL, true, true, false); } //design the plot of the chart { XYPlot xyPlot = chart.getXYPlot(); NumberAxis xAxis = (NumberAxis) xyPlot.getDomainAxis(); NumberAxis yAxis = (NumberAxis) xyPlot.getRangeAxis(); xAxis.setRange(20, 120); xAxis.setTickUnit(new NumberTickUnit(15)); yAxis.setRange(947, 950); yAxis.setTickUnit(new NumberTickUnit(0.5)); } //generation of the image { try { BufferedImage img = chart.createBufferedImage(300, 200); //File outputfile = new File("./example/Sample.png"); File outputfile = new File( "/Users/dsg/Documents/phd/Big Demo/CloudLyra/Utils/JBPMEngine/example/Sample.png"); ImageIO.write(img, "png", outputfile); } catch (Exception e) { System.out.println("exception occured in tomcat: " + e); } } }
From source file:richclient.EvolutionChart.java
/** * Creates a chart./* w w w . ja v a 2s . c om*/ * * @param dataset the data for the chart. * * @return a chart. */ public JFreeChart createChart(XYDataset dataset) { // create the chart final JFreeChart chart = ChartFactory.createXYLineChart("Market evolution", // chart title "Time", // x axis label "Value", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(1, true); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:statistics.distribution.ConstantDistribution.java
@Override public JFreeChart getChart() { JFreeChart chart = ChartFactory.createXYLineChart("Constant Distribution", "", "", getDataset(), PlotOrientation.VERTICAL, true, true, false); return chart; }
From source file:sentimentBarometer.view.Chart.java
/** * Creates the chart based on the @see#_dataset * @return ChartPanel that extends JPanel so it can be added directly into a JPanel in a Swing Interface *///w w w.jav a 2s. c om public ChartPanel createChart() { //create chart JFreeChart chart = ChartFactory.createXYLineChart("Rating", "Emotional Words", "Rating", _dataset, PlotOrientation.VERTICAL, true, true, false); //add chart to panel ChartPanel cp = new ChartPanel(chart); //return the panel return cp; }
From source file:view.FuzzySetView.java
/** * * @param fuzzySet// w w w.j a va 2s .c o m * @param tickUnit */ public FuzzySetView(FuzzySet fuzzySet, double tickUnit) { super(ChartFactory.createXYLineChart(fuzzySet.getName(), fuzzySet.getVariableName(), MICRO_SIGN + "(" + fuzzySet.getVariableName() + ")", fuzzySet, PlotOrientation.VERTICAL, true, true, false)); TICK_UNIT = tickUnit; setPreferredSize(new Dimension(450, 200)); initColors(); setupRenderer(); }
From source file:chart.XYChart.java
public XYChart(String applicationTitle, String chartTitle, double[] xData, double[] YDataAnalitic, double[] YDataNumerical1, double[] YDataNumerical2) { super(applicationTitle); JFreeChart xylineChart = ChartFactory.createXYLineChart(chartTitle, "", "", createDatasetForThree(xData, YDataAnalitic, YDataNumerical1, YDataNumerical2), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(xylineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); final XYPlot plot = xylineChart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesPaint(2, Color.YELLOW); renderer.setSeriesPaint(3, Color.BLUE); renderer.setSeriesStroke(0, new BasicStroke(1.0f)); renderer.setSeriesStroke(1, new BasicStroke(1.0f)); renderer.setSeriesStroke(2, new BasicStroke(1.0f)); renderer.setSeriesStroke(3, new BasicStroke(1.0f)); plot.setRenderer(renderer);/*from ww w . j a v a 2 s. c o m*/ setContentPane(chartPanel); // panel.removeAll(); // panel.add(chartPanel); // panel.validate(); }
From source file:Interfaz.XYLineChart.java
/** Constructor de clase * @param d Dimension/* ww w .ja v a 2s . co m*/ */ public XYLineChart(Dimension d, ArrayList<Restriccion> rest, ArrayList<Coordenada> cor) { //se declara el grafico XY Lineal XYDataset xydataset = xyDataset(rest, cor); JFreeChart jfreechart = ChartFactory.createXYLineChart("Graficas lineales", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); //personalizacin del grafico XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainGridlinePaint(Color.BLACK); xyplot.setRangeGridlinePaint(Color.BLACK); // -> Pinta Shapes en los puntos dados por el XYDataset // XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); // xylineandshaperenderer.setBaseShapesVisible(true); // //--> muestra los valores de cada punto XY // XYItemLabelGenerator xy = new StandardXYItemLabelGenerator(); // xylineandshaperenderer.setBaseItemLabelGenerator( xy ); // xylineandshaperenderer.setBaseItemLabelsVisible(true); // xylineandshaperenderer.setBaseLinesVisible(true); // xylineandshaperenderer.setBaseItemLabelsVisible(true); //fin de personalizacin //se crea la imagen y se asigna a la clase ImageIcon BufferedImage bufferedImage = jfreechart.createBufferedImage(d.width, d.height); this.setImage(bufferedImage); }
From source file:edu.wustl.cab2b.client.ui.visualization.charts.LineChart.java
protected JFreeChart createChart(Dataset dataset) { XYDataset xyDataset = (XYDataset) dataset; JFreeChart jfreechart = ChartFactory.createXYLineChart("Line Chart", "X", "Y", xyDataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setShapesVisible(true); xylineandshaperenderer.setShapesFilled(true); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return jfreechart; }
From source file:geneticonreinas.data.Grafica.java
public void mostrarGrafica() { // Crear la serie con los datos grafica = ChartFactory.createXYLineChart(this.tituloGrafica, this.axisXlabel, this.axisYlabel, coleccion, PlotOrientation.VERTICAL, true, false, false); ChartFrame panel = new ChartFrame(null, grafica); panel.pack();/* www .ja v a 2s . c o m*/ panel.setVisible(true); }