List of usage examples for org.jfree.chart.plot XYPlot setOrientation
public void setOrientation(PlotOrientation orientation)
From source file:de.iteratec.visualizationmodel.jfreechart.ChartFactory.java
public JFreeChart createXYStepChart(XYDataset dataset) { XYToolTipGenerator toolTipGenerator = !showTooltips ? null : new StandardXYToolTipGenerator(); XYURLGenerator urlGenerator = !showUrls ? null : new StandardXYURLGenerator(); XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator); XYPlot plot = new XYPlot(dataset, (ValueAxis) xAxis, (ValueAxis) yAxis, null); plot.setRenderer(renderer);/* ww w.j a v a2 s . c o m*/ plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.getRenderer().setSeriesStroke(0, new BasicStroke(5.0f)); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, showLegend); THEME.apply(chart); return chart; }
From source file:org.optaplanner.benchmark.impl.statistic.single.pickedmovetypestepscore.PickedMoveTypeStepScoreDiffSingleStatistic.java
private XYPlot createPlot(BenchmarkReport benchmarkReport, int scoreLevelIndex) { Locale locale = benchmarkReport.getLocale(); NumberAxis xAxis = new NumberAxis("Time spent"); xAxis.setNumberFormatOverride(new MillisecondsSpentNumberFormat(locale)); NumberAxis yAxis = new NumberAxis("Step score diff level " + scoreLevelIndex); yAxis.setNumberFormatOverride(NumberFormat.getInstance(locale)); yAxis.setAutoRangeIncludesZero(true); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); plot.setOrientation(PlotOrientation.VERTICAL); return plot;/*from w ww .j ava 2s . c o m*/ }
From source file:org.jfree.chart.demo.MultipleAxisDemo1.java
/** * Creates the demo chart./*from w ww .j ava2 s . c o m*/ * * @return The chart. */ private JFreeChart createChart() { final XYDataset dataset1 = createDataset("Series 1", 100.0, new Minute(), 200); final JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 1", "Time of Day", "Primary Range Axis", dataset1, true, true, false); chart.setBackgroundPaint(Color.white); chart.addSubtitle(new TextTitle("Four datasets and four range axes.")); final XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); final StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer(); renderer.setPaint(Color.black); // AXIS 2 final NumberAxis axis2 = new NumberAxis("Range Axis 2"); axis2.setAutoRangeIncludesZero(false); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); final XYDataset dataset2 = createDataset("Series 2", 1000.0, new Minute(), 170); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); XYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); // AXIS 3 final NumberAxis axis3 = new NumberAxis("Range Axis 3"); axis3.setLabelPaint(Color.blue); axis3.setTickLabelPaint(Color.blue); plot.setRangeAxis(2, axis3); final XYDataset dataset3 = createDataset("Series 3", 10000.0, new Minute(), 170); plot.setDataset(2, dataset3); plot.mapDatasetToRangeAxis(2, 2); XYItemRenderer renderer3 = new StandardXYItemRenderer(); renderer3.setSeriesPaint(0, Color.blue); plot.setRenderer(2, renderer3); // AXIS 4 final NumberAxis axis4 = new NumberAxis("Range Axis 4"); axis4.setLabelPaint(Color.green); axis4.setTickLabelPaint(Color.green); plot.setRangeAxis(3, axis4); final XYDataset dataset4 = createDataset("Series 4", 25.0, new Minute(), 200); plot.setDataset(3, dataset4); plot.mapDatasetToRangeAxis(3, 3); XYItemRenderer renderer4 = new StandardXYItemRenderer(); renderer4.setSeriesPaint(0, Color.green); plot.setRenderer(3, renderer4); return chart; }
From source file:org.optaplanner.benchmark.impl.statistic.single.pickedmovetypebestscore.PickedMoveTypeBestScoreDiffSingleStatistic.java
private XYPlot createPlot(BenchmarkReport benchmarkReport, int scoreLevelIndex) { Locale locale = benchmarkReport.getLocale(); NumberAxis xAxis = new NumberAxis("Time spent"); xAxis.setNumberFormatOverride(new MillisecondsSpentNumberFormat(locale)); NumberAxis yAxis = new NumberAxis("Best score diff level " + scoreLevelIndex); yAxis.setNumberFormatOverride(NumberFormat.getInstance(locale)); yAxis.setAutoRangeIncludesZero(true); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); plot.setOrientation(PlotOrientation.VERTICAL); return plot;/*ww w. ja v a 2 s . c om*/ }
From source file:org.schreibubi.JCombinations.logic.visitors.ChartNodesVisitor.java
public void visit(Shmoo s) throws Exception { if (s.componentSelected(this.treePaths, OurTreeNode.MYSELF | OurTreeNode.PARENTS | OurTreeNode.CHILDS)) { NumberAxis xAxis = new NumberAxis(s.getTrim() + " [" + s.getXdataDefault().getUnit() + "]"); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis( s.getMeasure() + " [" + ((Ydata) s.getYdata().get(0)).getUnit() + "]"); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer = new XYLineAndShapeRendererExtended(true, true); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); this.dutData = new ArrayList<ArrayList<Double>>(); this.dutName = new ArrayList<String>(); for (int i = 0; i < s.getChildCount(); i++) (s.getChildAt(i)).accept(this); XYSeriesCollection xyseries = new XYSeriesCollection(); ArrayList<Double> x = s.getXdataDefault().getXPositions(); for (int j = 0; j < this.dutData.size(); j++) { ArrayList<Double> y = this.dutData.get(j); XYSeries xy = new XYSeries(this.dutName.get(j)); for (int i = 0; i < y.size(); i++) xy.add(x.get(i), y.get(i)); xyseries.addSeries(xy);//from w w w . java2s . co m } XYPlot plot = new XYPlot(xyseries, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); Marker marker = s.getMarker(); if (marker != null) plot.addRangeMarker(marker, Layer.BACKGROUND); ExtendedJFreeChart chart = new ExtendedJFreeChart(s.getDescription(), JFreeChart.DEFAULT_TITLE_FONT, plot, false); if (marker == null) chart.addSubtitle(new TextTitle(s.getSubtitle())); else chart.addSubtitle(new TextTitle( s.getSubtitle() + " " + s.getValueAt(3) + "/" + s.getValueAt(4) + "/" + s.getValueAt(5))); chart.setTreePath(s.getTreePath()); this.charts.add(chart); } }
From source file:com.sixrr.metrics.ui.charts.HistogramDialog.java
private JFreeChart createChart(IntervalXYDataset dataset, boolean isIntegral) { final String title = getTitle(); final NumberAxis xAxis = new NumberAxis(); if (isIntegral) { xAxis.setTickUnit(new NumberTickUnit(1.0)); }//from w w w. ja v a 2 s .c om if (metricType == MetricType.Ratio || metricType == MetricType.RecursiveRatio) { xAxis.setNumberFormatOverride(new PercentFormatter()); } final XYToolTipGenerator tooltipGenerator = new StandardXYToolTipGenerator(); final XYItemRenderer renderer = new XYBarRenderer(); renderer.setToolTipGenerator(tooltipGenerator); renderer.setURLGenerator(null); final ValueAxis yAxis = new NumberAxis(); final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setOrientation(PlotOrientation.VERTICAL); return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true); }
From source file:wattsup.jsdk.ui.LineChartPanelSupport.java
@Override public JFreeChart createChart() { this.timeSeries_ = new TimeSeriesCollection(); this.dataset_ = new TranslatingXYDataset(this.timeSeries_); JFreeChart chart = ChartFactory.createTimeSeriesChart(this.getTitle(), null, this.getAxisLabel(), this.dataset_, true, true, false); chart.setBackgroundPaint(getBackground()); XYPlot xyPlot = chart.getXYPlot(); xyPlot.setOrientation(PlotOrientation.VERTICAL); xyPlot.setBackgroundPaint(Color.WHITE); xyPlot.setDomainGridlinePaint(Color.BLACK.darker()); xyPlot.setRangeGridlinePaint(Color.BLACK.darker()); xyPlot.setAxisOffset(new RectangleInsets(5.0D, 5.0D, 5.0D, 5.0D)); xyPlot.setDomainCrosshairLockedOnData(true); xyPlot.setRangeCrosshairVisible(true); chart.setAntiAlias(true);//from w ww . j a v a 2s . co m return chart; }
From source file:com.sixrr.metrics.ui.charts.DiffHistogramDialog.java
private JFreeChart createChart(IntervalXYDataset dataset, boolean isIntegral) { final String title = getTitle(); final NumberAxis xAxis = new NumberAxis(); if (metricType.equals(MetricType.Ratio) || metricType.equals(MetricType.RecursiveRatio)) { xAxis.setNumberFormatOverride(new PercentFormatter()); }// w w w .j ava 2s. com if (isIntegral) { xAxis.setTickUnit(new NumberTickUnit(1.0)); } final XYToolTipGenerator tooltipGenerator = new StandardXYToolTipGenerator(); final XYItemRenderer renderer = new XYBarRenderer(); renderer.setToolTipGenerator(tooltipGenerator); renderer.setURLGenerator(null); final ValueAxis yAxis = new NumberAxis(); final XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setOrientation(PlotOrientation.VERTICAL); return new JFreeChart(title, JFreeChartConstants.DEFAULT_TITLE_FONT, plot, true); }
From source file:org.optaplanner.benchmark.impl.statistic.single.constraintmatchtotalbestscore.ConstraintMatchTotalBestScoreSingleStatistic.java
private XYPlot createPlot(BenchmarkReport benchmarkReport, int scoreLevelIndex) { Locale locale = benchmarkReport.getLocale(); NumberAxis xAxis = new NumberAxis("Time spent"); xAxis.setNumberFormatOverride(new MillisecondsSpentNumberFormat(locale)); NumberAxis yAxis = new NumberAxis("Constraint match total weight level " + scoreLevelIndex); yAxis.setNumberFormatOverride(NumberFormat.getInstance(locale)); yAxis.setAutoRangeIncludesZero(false); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); plot.setOrientation(PlotOrientation.VERTICAL); return plot;/* w ww . j a v a 2 s . c om*/ }
From source file:rozpoznawanie_zad1_klasyf.ChartRenderer.java
public ChartRenderer(String tytul) { NumberAxis xAxis = new NumberAxis("Cecha 2"); // xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis("Cecha 1"); //XYItemRenderer rend; // rend = new XYLineAndShapeRenderer(false, true); //XYItemRenderer rend = new XYLineAndShapeRenderer(true, false); XYDotRenderer rend = new XYDotRenderer(); rend.setDotHeight(5);/*from www.j a v a2 s . co m*/ rend.setDotWidth(5); XYPlot plot = new XYPlot(ds, xAxis, yAxis, rend); // dataset.addSeries("sin", sin); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart fc = new JFreeChart(plot); cf = new ChartFrame(tytul, fc); cf.setSize(1280, 720); }