List of usage examples for org.jfree.chart.plot CombinedDomainXYPlot setOrientation
@Override public void setOrientation(PlotOrientation orientation)
From source file:org.codehaus.mojo.chronos.chart.ChartUtil.java
static CombinedDomainXYPlot createCombinedPlot(DateAxis timeAxis, XYPlot xyplot1, XYPlot xyplot2) { CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(timeAxis); combineddomainxyplot.setGap(GAP);/*from w w w . jav a2 s . com*/ combineddomainxyplot.add(xyplot1, 2); combineddomainxyplot.add(xyplot2, 1); combineddomainxyplot.setOrientation(PlotOrientation.VERTICAL); return combineddomainxyplot; }
From source file:de.cebitec.readXplorer.plotting.CreatePlots.java
private synchronized static JFreeChart createCombinedChart(XYSeriesCollection normal, XYSeriesCollection posInf, XYSeriesCollection negInf, String xName, String yName, XYToolTipGenerator toolTip) { final NumberAxis domainAxis = new NumberAxis(xName); // create subplot 1... final XYDataset data1 = normal; final XYItemRenderer renderer1 = new XYShapeRenderer(); renderer1.setBaseToolTipGenerator(toolTip); final NumberAxis rangeAxis1 = new NumberAxis(yName); final XYPlot subplot1 = new XYPlot(data1, domainAxis, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // create subplot 2... final XYDataset data2 = negInf; final XYItemRenderer renderer2 = new XYShapeRenderer(); renderer2.setBaseToolTipGenerator(toolTip); final NumberAxis rangeAxis2 = new NumberAxis() { @Override//from w w w . j a va2 s. c o m public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) { List myTicks = new ArrayList(); myTicks.add(new NumberTick(0, "-Inf", TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, 0.0)); return myTicks; } }; rangeAxis2.setAutoRangeIncludesZero(false); final XYPlot subplot2 = new XYPlot(data2, domainAxis, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // create subplot 3... final XYDataset data3 = posInf; final XYItemRenderer renderer3 = new XYShapeRenderer(); renderer3.setBaseToolTipGenerator(toolTip); final NumberAxis rangeAxis3 = new NumberAxis() { @Override public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) { List myTicks = new ArrayList(); myTicks.add(new NumberTick(0, "Inf", TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, 0.0)); return myTicks; } }; rangeAxis3.setAutoRangeIncludesZero(false); final XYPlot subplot3 = new XYPlot(data3, domainAxis, rangeAxis3, renderer3); subplot2.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(domainAxis); plot.setGap(0); // add the subplots... plot.add(subplot3, 1); plot.add(subplot1, 10); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart(plot); }
From source file:pisco.batch.visu.BatchingChartFactory.java
private static JFreeChart createCombinedChart(String title, XYPlot batchplot, XYPlot objPlot) { CombinedDomainXYPlot plot = new CombinedDomainXYPlot(createDateAxis()); plot.setGap(10.0);/*w w w.ja va 2s. c om*/ plot.add(objPlot, 1); plot.add(batchplot, 2); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, false); CHOCO_THEME.apply(chart); return chart; }
From source file:net.sf.mzmine.chartbasics.gui.javafx.demo.FXCombinedChartGestureDemo.java
private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); // create subplot 2... final XYDataset data2 = createDataset(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0);/*from w w w . j a va 2 s . co m*/ // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
From source file:it.cnr.istc.iloc.gui.TimelinesChart.java
@Override public void currentNode(Solver.Node n) { final CombinedDomainXYPlot combined_plot = new CombinedDomainXYPlot(new DateAxis("Time")); combined_plot.setGap(3.0);/*from www. ja va 2 s.c o m*/ combined_plot.setOrientation(PlotOrientation.VERTICAL); Set<Type> c_types = new HashSet<>(); LinkedList<Type> queue = new LinkedList<>(); queue.addAll(solver.getTypes()); while (!queue.isEmpty()) { Type c_type = queue.pollFirst(); if (!c_types.contains(c_type)) { c_types.add(c_type); queue.addAll(c_type.getTypes()); } } for (Type type : c_types) { if (visualizers.containsKey(type.getClass())) { for (XYPlot plot : visualizers.get(type.getClass()).getPlots(type)) { TextTitle title = new TextTitle(type.name, new Font("SansSerif", Font.PLAIN, 11), Color.BLACK, RectangleEdge.TOP, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, new RectangleInsets(4, 4, 4, 4)); XYTitleAnnotation titleAnn = new XYTitleAnnotation(0.01, 1, title, RectangleAnchor.TOP_LEFT); plot.addAnnotation(titleAnn); combined_plot.add(plot, 1); } } } setChart(new JFreeChart("", new Font("SansSerif", Font.BOLD, 14), combined_plot, false)); setBorder(BorderFactory.createEtchedBorder()); }
From source file:sernet.gs.ui.rcp.main.bsi.views.chart.RealisierungLineChart.java
private JFreeChart createProgressChart(Object dataset) { final double plotGap = 10.0; final int axisUpperBoundPadding = 50; final int labelFontSize = 10; XYDataset data1 = (XYDataset) dataset; XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis(Messages.RealisierungLineChart_1); XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis(Messages.RealisierungLineChart_2)); plot.setGap(plotGap);// w w w .j av a2 s . co m plot.add(subplot1, 1); plot.setOrientation(PlotOrientation.VERTICAL); CountMassnahmen command = new CountMassnahmen(); try { command = ServiceFactory.lookupCommandService().executeCommand(command); } catch (CommandException e) { ExceptionUtil.log(e, Messages.RealisierungLineChart_3); } int totalNum = command.getTotalCount(); NumberAxis axis = (NumberAxis) subplot1.getRangeAxis(); axis.setUpperBound(totalNum + axisUpperBoundPadding); ValueMarker bst = new ValueMarker(totalNum); bst.setPaint(Color.GREEN); bst.setLabel(Messages.RealisierungLineChart_4); bst.setLabelAnchor(RectangleAnchor.LEFT); bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, labelFontSize)); //$NON-NLS-1$ bst.setLabelTextAnchor(TextAnchor.CENTER_LEFT); subplot1.addRangeMarker(bst, Layer.BACKGROUND); // return a new chart containing the overlaid plot... JFreeChart chart = new JFreeChart(Messages.RealisierungLineChart_6, JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.spantus.exp.segment.exec.DrawSegmentComparision.java
/** * initialize//from w w w . ja v a2 s . co m */ public void init() { final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time")); plot.setGap(10.0); plot.setOrientation(PlotOrientation.VERTICAL); XYSeries[] seriesArr = createSeries(getWavName(), getMarkerName()); for (XYSeries series : seriesArr) { final XYSeriesCollection data1 = new XYSeriesCollection(series); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis(series.getDescription()); final XYPlot subplot = new XYPlot(data1, null, rangeAxis1, renderer1); plot.add(subplot, 1); } final JFreeChart chart = new JFreeChart("Segmentation Result", JFreeChart.DEFAULT_TITLE_FONT, plot, false); final ChartPanel chartPanel = new ChartPanel(chart); setContentPane(chartPanel); chartPanel.setPreferredSize(new Dimension(500, 270)); }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo1.java
/** * Creates a combined chart./* ww w.java2s.c o m*/ * * @return the combined chart. */ private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset1(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); // create subplot 2... final XYDataset data2 = createDataset2(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); rangeAxis2.setAutoRangeIncludesZero(false); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo4.java
/** * Creates a combined chart./*w w w .ja v a 2 s .c om*/ * * @return The combined chart. */ private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = createDataset1(); final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Range 1"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // add secondary axis subplot1.setDataset(1, createDataset2()); final NumberAxis axis2 = new NumberAxis("Range Axis 2"); axis2.setAutoRangeIncludesZero(false); subplot1.setRangeAxis(1, axis2); subplot1.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); subplot1.setRenderer(1, new StandardXYItemRenderer()); subplot1.mapDatasetToRangeAxis(1, 1); final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); // create subplot 2... final XYDataset data2 = createDataset2(); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Range 2"); rangeAxis2.setAutoRangeIncludesZero(false); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("CombinedDomainXYPlot Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
From source file:r2d2e.solution.moduloteste.teste.GraficoD2.java
/** * Creates a combined chart./*from w w w . j a va 2 s.co m*/ * * @return the combined chart. */ private JFreeChart createCombinedChart() { // create subplot 1... final XYDataset data1 = collection; final XYItemRenderer renderer1 = new StandardXYItemRenderer(); final NumberAxis rangeAxis1 = new NumberAxis("Nvel (cm)"); final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); /* final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); */ // create subplot 2... final XYDataset data2 = collection2; final XYItemRenderer renderer2 = new StandardXYItemRenderer(); final NumberAxis rangeAxis2 = new NumberAxis("Tenso (volts)"); final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // create subplot 3... final XYDataset data3 = collection3; final XYItemRenderer renderer3 = new StandardXYItemRenderer(); final NumberAxis rangeAxis3 = new NumberAxis("Tenso (volts)"); final XYPlot subplot3 = new XYPlot(data3, null, rangeAxis3, renderer3); subplot3.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Tempo")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.add(subplot3, 1); plot.setOrientation(PlotOrientation.VERTICAL); // return a new chart containing the overlaid plot... return new JFreeChart("Grficos", JFreeChart.DEFAULT_TITLE_FONT, plot, true); }