Labels and tooltips generation methods in Gantt charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
PJCrew2
Posts: 3
Joined: Thu May 03, 2007 8:22 am

Labels and tooltips generation methods in Gantt charts

Post by PJCrew2 » Sat May 05, 2007 7:10 pm

Seems to me that they are not acting properly. Here is a code:

Code: Select all

                    IntervalCategoryDataset dataset = JCollisionAssignmentClass.
                                                      createDistributionDataset(mainDistributionGraph, 0);
                    JFreeChart chart = JCollisionAssignmentClass.createGanttChart(
                            dataset);
                    CategoryPlot plot = chart.getCategoryPlot();
                    CategoryItemRenderer renderer = plot.getRenderer();
                    StandardCategoryItemLabelGenerator generator = new
                                                                   StandardCategoryItemLabelGenerator() {
                        public String generateLabel(CategoryDataset dataset,
                                                    int series, int category) {
                            return "!!!";
                        }
                    };
                    renderer.setItemLabelGenerator(generator);
                    renderer.setItemLabelsVisible(true);
                    renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator() {
                        public String generateToolTip(CategoryDataset dataset,
                                                      int series, int category) {

                            return "!!!";
                        }
                    }
                    );

                    chartPanel1.setChart(chart);
dataset includes tasks and subtasks. When pointing with a mouse on any subtask, tooltip "!!!" is always displayed, but the labels are only generated, when a task has no subtasks. Is there any possibility to fix the issue? I'd gladly did it myself, but haven't found where exactly ToolTipGenerator and LabelGenerator are calling generateToolTip and generateLabel. Seems to me that generateLabel should be called for a subtask either. Thanks in advance to all!

Locked