List of usage examples for org.jfree.chart.plot XYPlot setRangeAxis
public void setRangeAxis(ValueAxis axis)
From source file:ec.nbdemetra.ui.chart3d.functions.Functions2DChart.java
private void configureAxis(XYPlot plot) { NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRange(true);// w w w . j a v a2 s . co m xAxis.setAutoRangeIncludesZero(false); plot.setDomainAxis(xAxis); NumberAxis yAxis = new NumberAxis(); yAxis.setAutoRange(true); yAxis.setAutoRangeIncludesZero(false); plot.setRangeAxis(yAxis); }
From source file:ec.ui.chart.RevisionChartPanel.java
private void configureAxis(XYPlot plot) { SimpleDateFormat sdf = new SimpleDateFormat("MM-yyyy"); DateAxis dateAxis = new DateAxis(); dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateAxis.setDateFormatOverride(sdf); plot.setDomainAxis(dateAxis);//w ww . j a v a 2 s . c o m NumberAxis yaxis = new NumberAxis(); plot.setRangeAxis(yaxis); }
From source file:org.jgrasstools.gears.utils.chart.Scatter.java
public JFreeChart getChart() { if (chart == null) { chart = ChartFactory.createXYLineChart(title, // chart title xLabel,//from w w w . j a va2 s . c o m // domain axis label yLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); if (xLog) { LogAxis xAxis = new LogAxis(""); xAxis.setBase(10); plot.setDomainAxis(xAxis); } if (yLog) { LogAxis yAxis = new LogAxis(""); yAxis.setBase(10); plot.setRangeAxis(yAxis); } ValueAxis rangeAxis = plot.getRangeAxis(); if (rangeAxis instanceof NumberAxis) { NumberAxis axis = (NumberAxis) rangeAxis; axis.setAutoRangeIncludesZero(false); } XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); double x = 1.5; double w = x * 2; renderer.setSeriesShape(0, new Ellipse2D.Double(-x, x, w, w)); setShapeLinesVisibility(plot); } return chart; }
From source file:playground.dgrether.linkanalysis.DgCountPerIterationGraph.java
public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("Iteration"); xAxis.setRange(this.controllerConfig.getFirstIteration(), this.controllerConfig.getLastIteration() + 2); ValueAxis yAxis = this.axisBuilder.createValueAxis("Trips"); // yAxis.setRange(-0.05, 0.3); // xAxis.setVisible(false); // xAxis.setFixedAutoRange(1.0); plot.setDomainAxis(xAxis);/*from w w w . ja v a2s .c o m*/ plot.setRangeAxis(yAxis); plot.setDataset(0, this.dataset); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); for (int i = 0; i < this.dataset.getSeriesCount(); i++) { renderer2.setSeriesItemLabelsVisible(i, true); renderer2.setSeriesOutlineStroke(i, new BasicStroke(3.0f)); renderer2.setSeriesStroke(i, new BasicStroke(2.0f)); renderer2.setSeriesPaint(i, colorScheme.getColor(i + 1, "a")); } // renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator); // renderer2.setSeriesStroke(1, new BasicStroke(2.0f)); // renderer2.setSeriesOutlineStroke(1, new BasicStroke(3.0f)); // renderer2.setSeriesPaint(1, colorScheme.getColor(2, "a")); plot.setRenderer(0, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); // chart.removeLegend(); return chart; }
From source file:playground.dgrether.signalsystems.analysis.DgGreenSplitPerIterationGraph.java
public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("Iteration"); xAxis.setRange(this.controllerConfig.getFirstIteration(), this.controllerConfig.getLastIteration() + 2); ValueAxis yAxis = this.axisBuilder.createValueAxis("GreenTime"); // yAxis.setRange(-0.05, 0.3); // xAxis.setVisible(false); // xAxis.setFixedAutoRange(1.0); plot.setDomainAxis(xAxis);/*from w w w. j av a 2 s .c o m*/ plot.setRangeAxis(yAxis); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); renderer2.setSeriesItemLabelsVisible(0, true); // renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator); plot.setDataset(0, this.getDataset()); renderer2.setSeriesStroke(0, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f)); renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a")); renderer2.setSeriesStroke(1, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(1, new BasicStroke(3.0f)); renderer2.setSeriesPaint(1, colorScheme.getColor(2, "a")); renderer2.setSeriesStroke(2, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(2, new BasicStroke(3.0f)); renderer2.setSeriesPaint(2, colorScheme.getColor(3, "a")); renderer2.setSeriesStroke(3, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(3, new BasicStroke(3.0f)); renderer2.setSeriesPaint(3, colorScheme.getColor(4, "a")); plot.setRenderer(0, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); // chart.removeLegend(); return chart; }
From source file:ec.ui.view.StabilityView.java
private void showDetail(Graphs g) { XYPlot plot = detailChart.getXYPlot(); NumberAxis yAxis = new NumberAxis(); yAxis.setTickLabelPaint(Color.GRAY); plot.setRangeAxis(yAxis); NumberAxis xAxis = new NumberAxis(); xAxis.setTickLabelPaint(Color.GRAY); xAxis.setTickUnit(new NumberTickUnit(1)); xAxis.setRange(-0.5, ((double) g.getMaxElements()) - 0.5); plot.setDomainAxis(xAxis);/*from w w w.j a va2s . c o m*/ plot.setDataset(MEAN_INDEX, new BasicXYDataset(Collections.singletonList(g.S1_))); plot.setDataset(POINTS_INDEX, new BasicXYDataset(Collections.singletonList(g.S2_))); plot.setDataset(SMOOTH_INDEX, new BasicXYDataset(Collections.singletonList(g.S3_))); rescaleAxis((NumberAxis) plot.getRangeAxis()); detailChart.setTitle(g.label_); panel.setChart(detailChart); panel.setToolTipText("Right click to show complete data"); onColorSchemeChange(); }
From source file:daylightchart.daylightchart.chart.DaylightChart.java
@SuppressWarnings("deprecation") private void createHoursAxis(final XYPlot plot) { final DateAxis axis = new DateAxis(); axis.setLowerMargin(0.0f);// w ww . j a v a 2 s. co m axis.setUpperMargin(0.0f); axis.setTickLabelFont(ChartConfiguration.chartFont.deriveFont(Font.PLAIN, 12)); // Fix the axis range for all the hours in the day axis.setRange(new Date(70, 0, 1), new Date(70, 0, 2)); // plot.setRangeAxis(axis); }
From source file:org.esa.beam.visat.toolviews.stat.ProfilePlotPanel.java
private void updateScalingOfYAxis() { final boolean logScaled = (Boolean) yAxisRangeControl.getBindingContext() .getBinding(PROPERTY_NAME_LOG_SCALED).getPropertyValue(); final XYPlot plot = chart.getXYPlot(); plot.setRangeAxis(StatisticChartStyling.updateScalingOfAxis(logScaled, plot.getRangeAxis(), true)); }
From source file:ec.nbdemetra.benchmarking.calendarization.CalendarizationChartView.java
private static JFreeChart createChart(String title) { JFreeChart result = ChartFactory.createXYLineChart("", "", "", Charts.emptyXYDataset(), PlotOrientation.VERTICAL, false, false, false); result.setPadding(TsCharts.CHART_PADDING); result.setTitle(new TextTitle(title, new Font("SansSerif", Font.PLAIN, 12))); XYPlot plot = result.getXYPlot(); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); LinesThickness linesThickness = LinesThickness.Thin; XYLineAndShapeRenderer daily = new XYLineAndShapeRenderer(true, false); daily.setAutoPopulateSeriesPaint(false); daily.setAutoPopulateSeriesStroke(false); daily.setBaseStroke(TsCharts.getStrongStroke(linesThickness)); plot.setRenderer(DAILY_INDEX, daily); XYDifferenceRenderer difference = new XYDifferenceRenderer(); difference.setAutoPopulateSeriesPaint(false); difference.setAutoPopulateSeriesStroke(false); difference.setBaseStroke(TsCharts.getNormalStroke(linesThickness)); plot.setRenderer(DIFF_INDEX, difference); XYLineAndShapeRenderer smooth = new XYLineAndShapeRenderer(true, false); smooth.setAutoPopulateSeriesPaint(false); smooth.setAutoPopulateSeriesStroke(false); smooth.setBaseStroke(TsCharts.getStrongStroke(linesThickness)); plot.setRenderer(SMOOTH_INDEX, smooth); DateAxis domainAxis = new DateAxis(); domainAxis.setTickMarkPosition(DateTickMarkPosition.START); domainAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR); plot.setDomainAxis(domainAxis);//www .j a v a 2 s.com NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setTickLabelPaint(TsCharts.CHART_TICK_LABEL_COLOR); plot.setRangeAxis(rangeAxis); return result; }
From source file:playground.dgrether.analysis.charts.DgTravelTimeCalculatorChart.java
@Override public JFreeChart createChart() { XYSeriesCollection dataset = this.createDataSet(); XYPlot plot = new XYPlot(); DgAxisBuilder axisBuilder = new DgDefaultAxisBuilder(); ValueAxis xAxis = axisBuilder.createValueAxis("Simulation Time"); // xAxis.setRange(this.controllerConfig.getFirstIteration(), this.controllerConfig.getLastIteration() + 2); ValueAxis yAxis = axisBuilder.createValueAxis("Travel Time"); // yAxis.setRange(-0.05, 0.3); // xAxis.setVisible(false); // xAxis.setFixedAutoRange(1.0); plot.setDomainAxis(xAxis);/* w w w. j a v a 2s . co m*/ plot.setRangeAxis(yAxis); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, false); renderer2.setSeriesItemLabelsVisible(0, true); // renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator); plot.setDataset(0, dataset); renderer2.setSeriesStroke(0, new BasicStroke(1.0f)); renderer2.setSeriesOutlineStroke(0, new BasicStroke(1.0f)); renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a")); renderer2.setSeriesStroke(1, new BasicStroke(1.0f)); renderer2.setSeriesOutlineStroke(1, new BasicStroke(1.0f)); renderer2.setSeriesPaint(1, colorScheme.getColor(2, "a")); renderer2.setSeriesStroke(2, new BasicStroke(1.0f)); renderer2.setSeriesOutlineStroke(2, new BasicStroke(1.0f)); renderer2.setSeriesPaint(2, colorScheme.getColor(3, "a")); renderer2.setSeriesStroke(3, new BasicStroke(1.0f)); renderer2.setSeriesOutlineStroke(3, new BasicStroke(1.0f)); renderer2.setSeriesPaint(3, colorScheme.getColor(4, "a")); plot.setRenderer(0, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); // chart.removeLegend(); return chart; }