List of usage examples for org.jfree.chart.renderer.category CategoryItemRenderer setSeriesToolTipGenerator
public void setSeriesToolTipGenerator(int series, CategoryToolTipGenerator generator);
From source file:de.fub.maps.project.plugins.tasks.eval.Barchart.java
public Barchart() { setLayout(new BorderLayout()); plot = new CategoryPlot() { private static final long serialVersionUID = 1L; @Override//from w ww . j a v a2s. c om public LegendItemCollection getLegendItems() { CategoryItemRenderer renderer = getRenderer(0); return renderer.getLegendItems(); } }; plot.setRangeAxis(new NumberAxis()); plot.setDomainAxis(new CategoryAxis()); plot.getDomainAxis().setMaximumCategoryLabelLines(3); plot.getDomainAxis().setCategoryLabelPositionOffset(5); plot.setDataset(dataset); plot.setOrientation(PlotOrientation.VERTICAL); chart = new JFreeChart(null, null, plot, true); chart.setBackgroundPaint(Color.white); BarRenderer renderer = new BarRenderer(); renderer.setBarPainter(new StandardBarPainter()); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); renderer.setAutoPopulateSeriesFillPaint(true); renderer.setAutoPopulateSeriesPaint(true); renderer.setShadowVisible(false); renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator()); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); chartPanel = new ChartPanel(chart, false); chartPanel.setBackground(Color.white); add(chartPanel, BorderLayout.CENTER); }
From source file:org.jfree.chart.ChartFactory.java
public static void setCategoryStandardTooltips(JFreeChart chart) { CategoryDataset data = chart.getCategoryPlot().getDataset(); CategoryItemRenderer r = ((CategoryPlot) chart.getPlot()).getRenderer(); for (int i = 0; i < data.getRowCount(); i++) { r.setSeriesToolTipGenerator(i, new StandardCategoryToolTipGenerator()); }/*w w w . j a va2 s. c o m*/ }