List of usage examples for org.jfree.chart.plot CombinedDomainXYPlot setRangeCrosshairVisible
public void setRangeCrosshairVisible(boolean flag)
From source file:de.codesourcery.eve.skills.ui.components.impl.PriceHistoryComponent.java
private JPanel createFreeChartPanel2() { /*//from w w w . j ava2 s . c om * Price plot. */ final StandardXYItemRenderer renderer1 = new StandardXYItemRenderer(); renderer1.setDrawSeriesLineAsPath(false); final ValueAxis priceAxis = new NumberAxis("ISK"); currentDataSets.pricePlot = new XYPlot(currentDataSets.prices, null, priceAxis, renderer1); currentDataSets.pricePlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); /* * Buy/sell volume plot. */ final StandardXYItemRenderer renderer2 = // XYBarRenderer new StandardXYItemRenderer(); final ValueAxis volumeAxis = new NumberAxis("Units"); TimeSeriesCollection volumes = new TimeSeriesCollection(); volumes.addSeries(currentDataSets.buyVolume); volumes.addSeries(currentDataSets.sellVolume); currentDataSets.volumePlot = new XYPlot(volumes, null, volumeAxis, renderer2); currentDataSets.volumePlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); /* * Combined plot. */ final ValueAxis dateAxis = new DateAxis("Date"); final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(dateAxis); plot.setGap(10.0); plot.add(currentDataSets.pricePlot, 2); plot.add(currentDataSets.volumePlot, 1); plot.setOrientation(PlotOrientation.VERTICAL); /* * Create chart. */ chart = new JFreeChart(item.getName(), JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); changeDateRange((DisplayRange) this.dateRangeChooser.getSelectedItem()); // display chart ChartPanel chartPanel = new ChartPanel(chart); // chartPanel.setMouseZoomable(true, false); return chartPanel; }