List of usage examples for org.jfree.chart.plot CombinedDomainXYPlot setGap
public void setGap(double gap)
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); 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 ww.j a v a 2s. com 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); plot.add(objPlot, 1);//w w w . j ava 2 s . co m 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:tools.descartes.bungee.chart.ChartGenerator.java
public static JFreeChart createTimeSeriesChart(final List<XYPlot> plots) { final CombinedDomainXYPlot plot = createRelativeTimeSeriesPlot(); plot.setGap(20); JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); boolean manyCharts = plots.size() > 3; int num = 0;/*from w ww. j a va 2s. co m*/ for (XYPlot xyPlot : plots) { num++; if (manyCharts && xyPlot.getRangeAxis().getLabel() == "Arrival Rate [1/s]") { plot.add(xyPlot, 3); } else { plot.add(xyPlot, 1); } chart.setBackgroundPaint(Color.white); customizePlot(xyPlot); if (manyCharts && xyPlot.getRangeAxis().getLabel() != "Arrival Rate [1/s]" && num != 4 && num != 7) { xyPlot.getRangeAxis().setLabel(""); } } return chart; }
From source file:grafix.graficos.ConstrutorGrafico.java
private void adicionarPlots(final CombinedDomainXYPlot cplot) { cplot.setGap(8.0); XYPlot plotCandles = janela.getConfiguracoesJanela().getCandles().getPlot(janela); XYPlot plotVolumes = janela.getConfiguracoesJanela().getVolume().getPlot(janela); XYPlot[] plotsExtras = gerarTodosOsPlotsExtras(); if (plotCandles != null) { cplot.add(plotCandles, janela.getConfiguracoesJanela().getCandles().getTamanho()); }//from ww w . ja v a 2s .c om if (plotVolumes != null) { cplot.add(plotVolumes, janela.getConfiguracoesJanela().getVolume().getTamanho()); } for (int i = 0; i < plotsExtras.length; i++) { if (plotsExtras[i] != null) { cplot.add(plotsExtras[i], 1); /////////////// Tamanho fixo em 1 !!!!!!!!!!!!!!!!!!!!!! } } }
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); // add the subplots... plot.add(subplot1, 1);/*ww w. j av a 2s .c o m*/ 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:br.prof.salesfilho.oci.image.GraphicBuilder.java
public void createCombinedChart(Map<String, double[]> mapSeries, String legendTitle) { XYSeriesCollection xds;/*from ww w . ja v a 2 s . c o m*/ final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis(legendTitle)); plot.setGap(10.0); for (Map.Entry<String, double[]> entrySet : mapSeries.entrySet()) { String serieName = entrySet.getKey(); double[] values = entrySet.getValue(); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); final XYSeries series = new XYSeries(serieName); for (int i = 0; i < values.length; i++) { series.add(i, Precision.round(values[i], 2)); renderer.setSeriesVisible(i, true, true); renderer.setSeriesShapesVisible(i, true); } xds = new XYSeriesCollection(); xds.addSeries(series); final NumberAxis rangeAxis = new NumberAxis(serieName); final XYPlot subplot = new XYPlot(xds, null, rangeAxis, renderer); subplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.add(subplot); } this.chart = new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); chartPanel.setChart(chart); }
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); plot.add(subplot1, 1);// w w w .ja va 2 s . co m 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: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); combined_plot.setOrientation(PlotOrientation.VERTICAL); Set<Type> c_types = new HashSet<>(); LinkedList<Type> queue = new LinkedList<>(); queue.addAll(solver.getTypes());//w w w . ja va 2s . c o m 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:r2d2e.solution.moduloteste.teste.GraficoD2.java
/** * Creates a combined chart./*w w w .j a va 2 s. com*/ * * @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); }