List of usage examples for org.jfree.chart.block LabelBlock LabelBlock
public LabelBlock(String label)
From source file:com.jaxzin.iraf.forecast.swing.JForecaster.java
@SuppressWarnings({ "FieldRepeatedlyAccessedInMethod" }) private void customizeChart(final JFreeChart chart) { // Set the transparency of the histogram bars // chart.getXYPlot().setForegroundAlpha(0.5f); // Lock the y-axis to 0.0->0.5 // Customize the y-logAxis logAxis = new LogarithmicAxis("Account Value"); logAxis.setAutoRange(true);/* w ww. j a v a 2 s .c o m*/ logAxis.setAllowNegativesFlag(true); logAxis.setNumberFormatOverride(NumberFormat.getCurrencyInstance()); linearAxis = new NumberAxis("Account Value"); linearAxis.setAutoRange(true); linearAxis.setNumberFormatOverride(NumberFormat.getCurrencyInstance()); //noinspection ConditionalExpression chart.getXYPlot().setRangeAxis(controlPanel.isLogScale() ? logAxis : linearAxis); // Customize the legend (add title, reverse order, attach to right side) final BlockContainer legendWrap = new BlockContainer(); final Block title = new LabelBlock("Percentiles"); legendWrap.setArrangement(new ColumnArrangement()); legendWrap.add(title); final LegendTitle legendTitle = new LegendTitle(new ReversedLegendItemSource(chart.getXYPlot()), new ColumnArrangement(), new ColumnArrangement()); legendWrap.add(legendTitle); chart.getLegend().setWrapper(legendWrap); chart.getLegend().setPosition(RectangleEdge.RIGHT); // Customize the format of the tooltips chart.getXYPlot().getRenderer().setBaseToolTipGenerator( new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("yyyy"), NumberFormat.getCurrencyInstance())); }