List of usage examples for org.jfree.chart ChartFactory createXYAreaChart
public static JFreeChart createXYAreaChart(String title, String xAxisLabel, String yAxisLabel, XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:net.nosleep.superanalyzer.analysis.views.GrowthView.java
private void createChart() { _chart = ChartFactory.createXYAreaChart(Misc.getString("LIBRARY_GROWTH"), Misc.getString("DATE"), Misc.getString("SONGS_IN_LIBRARY"), _dataset, PlotOrientation.VERTICAL, false, // legend true, // tool tips false // URLs );//ww w .j a v a2 s . c o m XYPlot plot = (XYPlot) _chart.getPlot(); plot.setDomainPannable(true); ValueAxis domainAxis = new DateAxis(Misc.getString("TIME")); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.75f); XYItemRenderer renderer = plot.getRenderer(); renderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("#,##0.00"))); _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("LIBRARY_GROWTH_SUBTITLE"))); ChartUtilities.applyCurrentTheme(_chart); Misc.formatChart(plot); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); renderer.setSeriesPaint(0, Theme.getColorSet()[1]); }
From source file:net.bioclipse.seneca.views.BestStructureView.java
public void createPartControl(Composite parent) { SashForm sash = new SashForm(parent, SWT.VERTICAL); jcpwidget = new JChemPaintEditorWidget(sash, SWT.PUSH); Composite contChartcomposite = new Composite(sash, SWT.EMBEDDED); FillLayout layout = new FillLayout(SWT.VERTICAL); contChartcomposite.setLayout(layout); fileTableFrame = SWT_AWT.new_Frame(contChartcomposite); String xAxisLabel = "Steps"; String yAxisLabel = "Temperature/Score"; String title = "Annealing progress"; XYSeries series = new XYSeries("Signal"); for (int i = 0; i < (maxSteps != 0 ? maxSteps : temps.size()); i++) { if (i < temps.size()) series.add(i, temps.get(i)); else//from w w w . j a v a 2s. c om series.add(i, 0); } XYDataset xyDataset = new XYSeriesCollection(series); continuousChart = ChartFactory.createXYAreaChart(title, xAxisLabel, yAxisLabel, xyDataset, PlotOrientation.VERTICAL, false, true, false); continuousChart.setAntiAlias(false); XYPlot continuousPlot = continuousChart.getXYPlot(); continuousPlot.setRenderer(new StandardXYItemRenderer()); ChartPanel chart = new ChartPanel(continuousChart); fileTableFrame.add(chart); //fileTableFrame.validate(); //fileTableFrame.repaint(); }
From source file:org.jfree.chart.demo.XYAreaChartDemo.java
/** * Creates a chart.// w w w. j av a 2s.c o m * * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createXYAreaChart("XY Area Chart Demo", "Domain (X)", "Range (Y)", dataset, PlotOrientation.VERTICAL, true, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); //plot.setOutlinePaint(Color.black); plot.setBackgroundPaint(Color.lightGray); plot.setForegroundAlpha(0.65f); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); return chart; }
From source file:org.jfree.chart.demo.XYAreaChartTest.java
/** * Creates a chart./*w ww .j a v a 2s . c o m*/ * * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createXYAreaChart("XY Area Chart Test", "Domain (X)", "Range (Y)", dataset, PlotOrientation.VERTICAL, true, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); //plot.setOutlinePaint(Color.black); plot.setBackgroundPaint(Color.lightGray); plot.setForegroundAlpha(0.65f); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setRenderer(new XYAreaRenderer2()); final ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); return chart; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.XYAreaChartExpression.java
protected JFreeChart computeXYChart(final XYDataset xyDataset) { final JFreeChart chart; if (xyDataset instanceof TimeSeriesCollection) { if (isStacked()) { final ExtTimeTableXYDataset tableXYDataset = convertToTable(xyDataset); chart = createTimeSeriesChart(computeTitle(), getDomainTitle(), getRangeTitle(), tableXYDataset, isShowLegend(), false, false, isStacked()); } else {//from www. ja v a 2 s . c om chart = createTimeSeriesChart(computeTitle(), getDomainTitle(), getRangeTitle(), xyDataset, isShowLegend(), false, false, isStacked()); } } else { final PlotOrientation orientation = computePlotOrientation(); if (isStacked()) { chart = createStackedXYAreaChart(computeTitle(), getDomainTitle(), getRangeTitle(), xyDataset, orientation, isShowLegend(), false, false); } else { chart = ChartFactory.createXYAreaChart(computeTitle(), getDomainTitle(), getRangeTitle(), xyDataset, orientation, isShowLegend(), false, false); } } configureLogarithmicAxis(chart.getXYPlot()); return chart; }
From source file:org.jfree.chart.demo.XYAreaChartDemo2.java
/** * Creates a chart.//from w w w . jav a 2s. c o m * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createXYAreaChart("XY Area Chart Demo 2", "Time", "Value", dataset, PlotOrientation.VERTICAL, true, // legend true, // tool tips false // URLs ); final XYPlot plot = chart.getXYPlot(); final ValueAxis domainAxis = new DateAxis("Time"); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); plot.setDomainAxis(domainAxis); plot.setForegroundAlpha(0.5f); final XYItemRenderer renderer = plot.getRenderer(); renderer.setToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("#,##0.00"))); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.XYAreaChartDemo1.java
/** * Creates a chart.//from ww w . j a v a 2 s . c o m * * @param dataset the dataset. * * @return A chart. */ protected JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYAreaChart(chartTitle, "Domain (X)", "Range (Y)", dataset, PlotOrientation.VERTICAL, !legendPanelOn, // legend true, // tool tips false // URLs ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setForegroundAlpha(0.65f); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); /* XYPointerAnnotation pointer = new XYPointerAnnotation( "Test", 5.0, -500.0, 3.0 * Math.PI / 4.0 ); pointer.setTipRadius(0.0); pointer.setBaseRadius(35.0); pointer.setFont(new Font("SansSerif", Font.PLAIN, 9)); pointer.setPaint(Color.blue); pointer.setTextAnchor(TextAnchor.HALF_ASCENT_RIGHT); plot.addAnnotation(pointer);*/ XYItemRenderer renderer = plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); setXSummary(dataset); return chart; }
From source file:org.squale.squaleweb.util.graph.AreaMaker.java
/** * @return le diagramme JFreeChart/* w w w . j av a2 s . co m*/ */ protected JFreeChart getChart() { JFreeChart retChart = super.getChart(); if (null == retChart) { retChart = ChartFactory.createXYAreaChart(mTitle, mXLabel, mYLabel, mDataSet, PlotOrientation.VERTICAL, false, false, false); final XYPlot plot = retChart.getXYPlot(); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setNumberFormatOverride(new DecimalFormat("########0.0")); // rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); // Format de l'axe des dates final ValueAxis domainAxis = new DateAxis(mXLabel); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); ((DateAxis) domainAxis).setDateFormatOverride(mDateFormat); plot.setDomainAxis(domainAxis); super.setChart(retChart); } return retChart; }
From source file:com.sdk.connector.chart.FrequencyDomainRenderer.java
/** * Creates a new demo application.// ww w.j a va2s . c o m * * @param title the frame title. */ public FrequencyDomainRenderer(String title, JPanel panel, String side, String type) { this.side = side; this.type = type; serie.setKey(side); dataset.addSeries(serie); JFreeChart chart = ChartFactory.createXYAreaChart(title, java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.xlabel"), java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.ylabel2"), dataset, PlotOrientation.VERTICAL, true, true, false); // TextTitle t1 = new TextTitle( "Espectro de Frequncia Estimado (PSD)", new Font("SansSerif", Font.BOLD, 14) ); // //TextTitle t2 = new TextTitle( "valores atualizados a cada potncia de 2", new Font("SansSerif", Font.PLAIN, 11) ); // chart.addSubtitle(t1); chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); chart.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); chart.getRenderingHints().put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); chart.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); chart.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); chart.getRenderingHints().put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); chart.getRenderingHints().put(RenderingHints.KEY_TEXT_LCD_CONTRAST, 100); //chart.addSubtitle(t2); plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLUE); plot.setRangeGridlinePaint(Color.CYAN); plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f)); //plot.setRangePannable(true); plot.setForegroundAlpha(0.65f); //XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer = plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.BLACK); if (side.startsWith( java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("side.left"))) { renderer.setSeriesPaint(0, Color.BLUE); } else { renderer.setSeriesPaint(0, Color.RED); } // renderer.setSeriesLinesVisible(0, true); // renderer.setSeriesShapesVisible(0, false); // renderer.setSeriesLinesVisible(1, true); // renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); plot.setForegroundAlpha(0.5f); Color color1 = new Color(0, 0, 0, 24); Color color2 = new Color(255, 255, 255, 24); GradientPaint gp = new GradientPaint(0, 0, color1, 0, 0, color2); plot.setBackgroundPaint(gp); final ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); NumberAxis numDomainAxis = (NumberAxis) plot.getDomainAxis(); numDomainAxis.setAutoRangeIncludesZero(true); // // final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); // // plot.setRangeAxis(rangeAxis); final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); numRangeAxis = (NumberAxis) plot.getRangeAxis(); numRangeAxis.setAutoRangeIncludesZero(true); vlfTarget.setLabel("VLF"); vlfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); vlfTarget.setLabelAnchor(RectangleAnchor.CENTER); vlfTarget.setLabelTextAnchor(TextAnchor.CENTER); vlfTarget.setPaint(new Color(0, 100, 255, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(vlfTarget, Layer.BACKGROUND); lfTarget.setLabel("LF"); lfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); lfTarget.setLabelAnchor(RectangleAnchor.CENTER); lfTarget.setLabelTextAnchor(TextAnchor.CENTER); lfTarget.setPaint(new Color(255, 255, 0, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(lfTarget, Layer.BACKGROUND); hfTarget.setLabel("HF"); hfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); hfTarget.setLabelAnchor(RectangleAnchor.CENTER); hfTarget.setLabelTextAnchor(TextAnchor.CENTER); hfTarget.setPaint(new Color(255, 0, 255, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(hfTarget, Layer.BACKGROUND); plot.setNoDataMessage( java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("message.wait")); chartPanel = new ChartPanel(chart); panel.setLayout(new GridLayout(0, 1)); panel.add(chartPanel); panel.repaint(); panel.revalidate(); }
From source file:slash.navigation.converter.gui.profileview.ProfileView.java
private JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYAreaChart(null, null, null, dataset, VERTICAL, false, true, false); chart.setBackgroundPaint(new JPanel().getBackground()); return chart; }