List of usage examples for org.jfree.chart.plot XYPlot setDomainAxis
public void setDomainAxis(ValueAxis axis)
From source file:net.relet.freimap.LinkInfo.java
private void sexupPlot(Plot plot) { if (plot instanceof CombinedDomainXYPlot) { List<Plot> subs = (List<Plot>) (((CombinedDomainXYPlot) plot).getSubplots()); Iterator<Plot> i = subs.iterator(); while (i.hasNext()) { Plot p = i.next();//from w w w . j a va2 s . c om sexupPlot(p); } } else if (plot instanceof XYPlot) { XYPlot xyplot = (XYPlot) plot; xyplot.setBackgroundPaint(VisorFrame.bgcolor2); xyplot.setDomainAxis(new DateAxis()); sexupAxis(xyplot.getDomainAxis()); sexupAxis(xyplot.getRangeAxis()); } }
From source file:playground.dgrether.analysis.charts.DgMixedDeltaUtilsModeGroupChart.java
public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("% of Population Sorted by Income"); ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Utils [Utils]"); plot.setDomainAxis(xAxis); plot.setRangeAxis(yAxis);/* w ww .j av a2 s .c o m*/ //RANGE xAxis.setRange(0.0, 102.0); yAxis.setRange(-0.31, 0.61); DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer1 = new XYLineAndShapeRenderer(false, true); renderer1.setSeriesPaint(0, colorScheme.COLOR1B); renderer1.setSeriesPaint(1, colorScheme.COLOR2B); renderer1.setSeriesPaint(2, colorScheme.COLOR3B); renderer1.setSeriesPaint(3, colorScheme.COLOR4B); plot.setDataset(0, this.inomeModeChoiceDs); plot.setRenderer(0, renderer1); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); plot.setDataset(1, this.avgDeltaScoreIncomeDs); for (int i = 0; i <= 3; i++) { renderer2.setSeriesStroke(i, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(i, new BasicStroke(3.0f)); renderer2.setSeriesPaint(i, colorScheme.getColor(i + 1, "a")); } plot.setRenderer(1, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); return chart; }
From source file:bzstats.chart.KillRatioHistoryChart.java
protected JFreeChart getChart() { DefaultTableXYDataset dataset = new DefaultTableXYDataset(); fillDataset(dataset);//w ww. ja v a2 s .c o m XYPlot plot = new XYPlot(); NumberAxis xaxis = new NumberAxis("Time"); xaxis.setTickLabelsVisible(false); NumberAxis yaxis = new NumberAxis("Killratio"); plot.setDomainAxis(xaxis); plot.setRangeAxis(yaxis); plot.setDataset(dataset); plot.setRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES)); JFreeChart chart = new JFreeChart("Killratio", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.addSubtitle(new TextTitle("kills/deaths")); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.ujmp.jfreechart.MatrixChartPanel.java
public synchronized void redraw() { Dataset dataset = null;/* w w w. java 2 s .c o m*/ dataset = new XYSeriesCollectionWrapper(getMatrix()); // dataset = new CategoryDatasetWrapper(getMatrix()); String title = getMatrix().getLabel(); String xLabel = StringUtil.format(getMatrix().getMatrix().getDimensionLabel(Matrix.ROW)); String yLabel = null; // setChart(ChartFactory.createLineChart(title, xLabel, yLabel, // (CategoryDataset) dataset, PlotOrientation.VERTICAL, true, // true, false)); setChart(ChartFactory.createXYLineChart(title, xLabel, yLabel, (XYDataset) dataset, PlotOrientation.VERTICAL, true, true, false)); XYPlot plot = getChart().getXYPlot(); if (getConfig().isLogScaleDomain()) { try { NumberAxis axis = new LogarithmicAxis(null); plot.setDomainAxis(axis); } catch (Exception e) { NumberAxis axis = new NumberAxis(); plot.setDomainAxis(axis); } } else { NumberAxis axis = new NumberAxis(); plot.setDomainAxis(axis); } if (getConfig().isLogScaleRange()) { try { NumberAxis axis = new LogarithmicAxis(null); plot.setRangeAxis(axis); } catch (Exception e) { NumberAxis axis = new NumberAxis(); plot.setRangeAxis(axis); } } else { NumberAxis axis = new NumberAxis(); plot.setRangeAxis(axis); } getChart().setTitle((String) null); getChart().setBackgroundPaint(Color.WHITE); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShapesVisible(false); renderer.setDrawSeriesLineAsPath(true); for (int i = 0; i < getMatrix().getColumnCount(); i++) { renderer.setSeriesStroke(i, new BasicStroke(3)); plot.setRenderer(i, renderer); } plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.getRangeAxis().setAutoRange(true); plot.getDomainAxis().setAutoRange(true); plot.getDomainAxis().setUpperMargin(0); setMouseZoomable(false); }
From source file:com.googlecode.logVisualizer.chart.VerticalXYBarChartBuilder.java
private JFreeChart createChart(final IntervalXYDataset dataset) { final JFreeChart chart = ChartFactory.createXYBarChart(getTitle(), xLable, false, yLable, dataset, PlotOrientation.VERTICAL, isIncludeLegend(), true, false); final XYPlot plot = (XYPlot) chart.getPlot(); final NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); double lastXValue = 0; if (dataset.getSeriesCount() > 0) lastXValue = dataset.getXValue(0, dataset.getItemCount(0) - 1); plot.setDomainAxis(new FixedZoomNumberAxis(lastXValue)); plot.setNoDataMessage("No data available"); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.black); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); setBarShadowVisible(chart, false);/*from w w w .j a v a 2 s .c o m*/ plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (dataset.getSeriesCount() > 0) plot.getDomainAxis().setUpperBound(lastXValue); plot.getDomainAxis().setLowerBound(0); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setUpperMargin(0.1); return chart; }
From source file:org.mwc.cmap.LiveDataMonitor.views.LiveDataMonitor.java
/** * Creates the Chart based on a dataset// w w w. j av a 2 s . c o m */ private JFreeChart createChart(final TimeSeriesCollection dataset) { final String annTitle = "[PENDING]"; final String catLabel = "Time"; final String valueLabel = "Value"; final JFreeChart chart = ChartFactory.createXYLineChart(annTitle, catLabel, valueLabel, dataset, PlotOrientation.VERTICAL, false, true, false); final XYPlot plot = chart.getXYPlot(); final DateAxis dateA = new DateAxis(); plot.setDomainAxis(dateA); plot.setRenderer(new XYLineAndShapeRenderer()); plot.setNoDataMessage("No data available"); return chart; }
From source file:playground.dgrether.analysis.charts.DgAvgDeltaMoneyGroupChart.java
public JFreeChart createChart() { XYPlot plot = new XYPlot(); ValueAxis xAxis = this.axisBuilder.createValueAxis("Income [Chf / Year]"); ValueAxis yAxis = this.axisBuilder.createValueAxis("Delta Money [Chf]"); plot.setDomainAxis(xAxis); plot.setRangeAxis(yAxis);//from w ww.j a v a2 s .c o m DgColorScheme colorScheme = new DgColorScheme(); XYItemRenderer renderer2; renderer2 = new XYLineAndShapeRenderer(true, true); renderer2.setSeriesItemLabelsVisible(0, true); renderer2.setSeriesItemLabelGenerator(0, this.labelGenerator); plot.setDataset(0, this.dataset); renderer2.setSeriesStroke(0, new BasicStroke(2.0f)); renderer2.setSeriesOutlineStroke(0, new BasicStroke(3.0f)); renderer2.setSeriesPaint(0, colorScheme.getColor(1, "a")); plot.setRenderer(0, renderer2); JFreeChart chart = new JFreeChart("", plot); chart.setBackgroundPaint(ChartColor.WHITE); chart.getLegend().setItemFont(this.axisBuilder.getAxisFont()); chart.setTextAntiAlias(true); return chart; }
From source file:playground.christoph.icem2011.LogLinkTravelTime.java
private void createChart(Link link, String file) { // String s = data.get(linkId).toString(); // String[] travelTimes = s.split("\n"); List<Double> etts = data.get(link.getId()); final XYSeriesCollection xyData = new XYSeriesCollection(); final XYSeries expectedTravelTimes = new XYSeries("expected travel times", false, true); final XYSeries measuredTravelTimes = new XYSeries("measured travel times", false, true); for (int i = 0; i < times.size(); i++) { double time = times.get(i); if (time > graphCutOffTime) break; // do not display values > 30h in the graph double hour = Double.valueOf(time) / 3600.0; expectedTravelTimes.add(hour, Double.valueOf(etts.get(i))); measuredTravelTimes.add(hour,/* w w w . j ava 2s . c o m*/ Double.valueOf(measuredTravelTime.getLinkTravelTime(link, time, null, null))); } xyData.addSeries(expectedTravelTimes); xyData.addSeries(measuredTravelTimes); // final JFreeChart chart = ChartFactory.createXYStepChart( final JFreeChart chart = ChartFactory.createXYLineChart( "Compare expected and measured travel times for link " + link.getId().toString(), "time", "travel time", xyData, PlotOrientation.VERTICAL, true, // legend false, // tooltips false // urls ); XYPlot plot = chart.getXYPlot(); final CategoryAxis axis1 = new CategoryAxis("hour"); axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7)); plot.setDomainAxis(new NumberAxis("time")); try { ChartUtilities.saveChartAsPNG(new File(file), chart, 1024, 768); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.matsim.core.utils.charts.XYScatterChart.java
private JFreeChart createChart(final String title, final String categoryAxisLabel, final String valueAxisLabel, final XYSeriesCollection dataset) { JFreeChart c = ChartFactory.createScatterPlot(title, categoryAxisLabel, valueAxisLabel, dataset, PlotOrientation.VERTICAL, true, // legend? false, // tooltips? false // URLs? );/*from w w w . j av a2 s . c o m*/ if (this.isLogarithmicAxis) { XYPlot p = (XYPlot) c.getPlot(); LogarithmicAxis axis_x = new LogarithmicAxis(this.xAxisLabel); LogarithmicAxis axis_y = new LogarithmicAxis(this.yAxisLabel); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); p.setDomainAxis(axis_x); p.setRangeAxis(axis_y); } return c; }
From source file:daylightchart.sunchart.chart.SunChart.java
private void createAzimuthAxis(final XYPlot plot) { final NumberAxis axis = new NumberAxis(); axis.setTickLabelFont(ChartConfiguration.chartFont.deriveFont(Font.PLAIN, 12)); axis.setVerticalTickLabels(true);//from www.j av a 2s.c om // plot.setDomainAxis(axis); }