Jump to content
Changes to the Jaspersoft community edition download ×

Tooltip not coming up within Chart in Dyanmic Reports


Recommended Posts

Hi All,

I'm using JFreeCharts along with DynamicReports for generating charts and reports. I'm trying to get tooltip inside my Chart component by using the below code.

BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());


Unfortunately, I'm unable to get the tooltip inside the chart context, Please let me know how to get tooltip inside chart in Dynamic reports.


I'm Copying the entire code here.

public class BarChartReportExecutiveSummaryExample {

    * <p>Constructor for BarChartReport.</p>
   public BarChartReportExecutiveSummaryExample() {

    * <p>main.</p>
    * @param args an array of {@link String} objects.
   public static void main(String[] args) {
       new BarChartReportExecutiveSummaryExample();

   private void build() {
       FontBuilder boldFont = stl.fontArialBold().setFontSize(12);

       TextColumnBuilder<String> itemColumn = col.column("Item", "item", type.stringType());
       TextColumnBuilder<Integer> quantityColumn = col.column("Quantity", "quantity", type.integerType());
       TextColumnBuilder<BigDecimal> unitPriceColumn = col.column("Unit price", "unitprice", type.bigDecimalType());

       try {
           BarChartBuilder barChartBuilder1 = cht.barChart()
                   .setTitle("Bar chart")
                   .customizers(new ExecutiveSummaryChartCustomizer())
                   .series(cht.serie(quantityColumn), cht.serie(unitPriceColumn))

                   .toPdf(new FileOutputStream("C:\Work\BotSinkMR2Branch963\BotSink\main\src\user_interface\Configurator\dist\test.pdf"))

       } catch (DRException e) {
       } catch (FileNotFoundException e) {

   private JRDataSource createDataSource() {
       DRDataSource dataSource = new DRDataSource("item", "quantity", "unitprice");
       dataSource.add("Tablet", 350, new BigDecimal(300));
       dataSource.add("Laptop", 300, new BigDecimal(500));
       dataSource.add("Smartphone", 450, new BigDecimal(250));
       return dataSource;

   public static class ExecutiveSummaryChartCustomizer implements DRIChartCustomizer, Serializable {
       private static final long serialVersionUID = 1L;
       public void customize(JFreeChart chart, ReportParameters reportParameters) {
           BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
           renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

           renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());


Thanks in advance.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...