List of usage examples for org.jfree.chart.plot XYPlot setRangeAxis
public void setRangeAxis(ValueAxis axis)
From source file:daylightchart.options.chart.BaseChartOptions.java
private static JFreeChart createDummyChart() { final JFreeChart chart = new JFreeChart(new XYPlot()); chart.setTitle(""); final XYPlot plot = chart.getXYPlot(); plot.setDomainAxis(new DateAxis()); plot.setRangeAxis(new DateAxis()); return chart; }
From source file:org.jfree.chart.demo.LogAxisDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createScatterPlot("Log Axis Demo 1", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); LogAxis logaxis = new LogAxis("X"); LogAxis logaxis1 = new LogAxis("Y"); xyplot.setDomainAxis(logaxis);//w ww. ja v a 2 s . c om xyplot.setRangeAxis(logaxis1); return jfreechart; }
From source file:org.jfree.chart.demo.LogarithmicAxisDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createScatterPlot("Logarithmic Axis Demo 1", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); LogarithmicAxis logarithmicaxis = new LogarithmicAxis("X"); LogarithmicAxis logarithmicaxis1 = new LogarithmicAxis("Y"); xyplot.setDomainAxis(logarithmicaxis); xyplot.setRangeAxis(logarithmicaxis1); return jfreechart; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.XYAreaChartExpression.java
/** * Creates a stacked XY area plot. The chart object returned by this method uses an {@link * org.jfree.chart.plot.XYPlot} instance as the plot, with a {@link org.jfree.chart.axis.NumberAxis} for the domain * axis, a {@link org.jfree.chart.axis.NumberAxis} as the range axis, and a {@link * org.jfree.chart.renderer.xy.StackedXYAreaRenderer2} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel a label for the X-axis (<code>null</code> permitted). * @param yAxisLabel a label for the Y-axis (<code>null</code> permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the plot orientation (horizontal or vertical) (<code>null</code> NOT permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * @return A stacked XY area chart./*from w w w .ja v a 2 s .com*/ */ protected static JFreeChart createStackedXYAreaChart(final String title, final String xAxisLabel, final String yAxisLabel, final XYDataset dataset, final PlotOrientation orientation, final boolean legend, final boolean tooltips, final boolean urls) { if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } final NumberAxis xAxis = new NumberAxis(xAxisLabel); xAxis.setAutoRangeIncludesZero(false); xAxis.setLowerMargin(0.0); xAxis.setUpperMargin(0.0); final NumberAxis yAxis = new NumberAxis(yAxisLabel); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } final StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(toolTipGenerator, urlGenerator); renderer.setOutline(true); final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(orientation); plot.setRangeAxis(yAxis); // forces recalculation of the axis range return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }
From source file:org.jfree.chart.demo.XYBarChartDemo7.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("XYBarChartDemo7", "Date", true, "Y", intervalxydataset, PlotOrientation.VERTICAL, true, false, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainAxis(new DateAxis("Date")); SymbolAxis symbolaxis = new SymbolAxis("Series", new String[] { "S1", "S2", "S3" }); symbolaxis.setGridBandsVisible(false); xyplot.setRangeAxis(symbolaxis); XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer(); xybarrenderer.setUseYInterval(true); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); return jfreechart; }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PaintScaleFactory.java
public static ValueAxis getPaintScaleAxis(double lower, double upper, String label) { // return a simple axis for the scale double inc = (upper - lower) / maxDivisions; final XYSeries s1 = new XYSeries("Series 1"); for (int i = 0; i < maxDivisions; i++) { s1.add(i, i * inc);/*from w w w .j a v a 2s . c o m*/ } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(s1); JFreeChart chart = ChartFactory.createXYLineChart("Axis Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, false); final XYPlot plot = chart.getXYPlot(); final NumberAxis domainAxis = new NumberAxis("xish"); final NumberAxis rangeAxis = new NumberAxis(label); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); return plot.getRangeAxis(); }
From source file:umberto.WeightedClusterCoefficient.ChartUtils.java
public static void scaleLogarithmicChart(JFreeChart chart, XYSeries dSeries, boolean normalized) { XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis logxaxis = new LogarithmicAxis(plot.getDomainAxis().getLabel()); NumberAxis logyaxis = new LogarithmicAxis(plot.getRangeAxis().getLabel()); plot.setRangeAxis(logyaxis); plot.setDomainAxis(logxaxis);/*from w w w.j a v a 2 s . com*/ }
From source file:de.laures.cewolf.taglib.CewolfChartFactory.java
public static JFreeChart getCombinedChartInstance(String chartType, String title, String xAxisLabel, String yAxisLabel, List plotDefinitions, String layout) throws ChartValidationException, DatasetProduceException { final int chartTypeConst = getChartTypeConstant(chartType); switch (chartTypeConst) { case COMBINED_XY: final int layoutConst = getLayoutConstant(layout); Plot plot = null;//from w w w . j a v a 2 s . c o m switch (layoutConst) { case DOMAIN: ValueAxis domainAxis = new DateAxis(xAxisLabel); plot = new CombinedDomainXYPlot(domainAxis); for (int i = 0; i < plotDefinitions.size(); i++) { PlotDefinition pd = (PlotDefinition) plotDefinitions.get(i); check((Dataset) pd.getDataset(), XYDataset.class, chartType); XYPlot temp = (XYPlot) pd.getPlot(chartTypeConst); temp.setRangeAxis(new NumberAxis(pd.getYaxislabel())); ((CombinedDomainXYPlot) plot).add(temp); } return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); case RANGE: ValueAxis rangeAxis = new NumberAxis(yAxisLabel); plot = new CombinedRangeXYPlot(rangeAxis); for (int i = 0; i < plotDefinitions.size(); i++) { PlotDefinition pd = (PlotDefinition) plotDefinitions.get(i); check((Dataset) pd.getDataset(), XYDataset.class, chartType); XYPlot temp = (XYPlot) pd.getPlot(chartTypeConst); temp.setDomainAxis(new DateAxis(pd.getXaxislabel())); ((CombinedRangeXYPlot) plot).add(temp); } return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); default: throw new AttributeValidationException(layout, " any value"); } default: throw new UnsupportedChartTypeException(chartType); } }
From source file:org.jfree.chart.demo.XYTaskDatasetDemo1.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("XYTaskDatasetDemo1", "Resource", false, "Timing", intervalxydataset, PlotOrientation.HORIZONTAL, true, false, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setRangePannable(true);/*from ww w . ja va 2 s . c o m*/ SymbolAxis symbolaxis = new SymbolAxis("Series", new String[] { "Team A", "Team B", "Team C", "Team D" }); symbolaxis.setGridBandsVisible(false); xyplot.setDomainAxis(symbolaxis); XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer(); xybarrenderer.setUseYInterval(true); xyplot.setRangeAxis(new DateAxis("Timing")); ChartUtilities.applyCurrentTheme(jfreechart); return jfreechart; }
From source file:org.jfree.chart.demo.LogarithmicAxisDemo2.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createScatterPlot("Logarithmic Axis Demo 2", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); LogarithmicAxis logarithmicaxis = new LogarithmicAxis("X"); logarithmicaxis.setExpTickLabelsFlag(true); logarithmicaxis.setStrictValuesFlag(false); LogarithmicAxis logarithmicaxis1 = new LogarithmicAxis("Y"); logarithmicaxis1.setAllowNegativesFlag(true); logarithmicaxis1.setLog10TickLabelsFlag(true); xyplot.setDomainAxis(logarithmicaxis); xyplot.setRangeAxis(logarithmicaxis1); return jfreechart; }