Tooltips & Tick Marks

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Jon Theophilus

Tooltips & Tick Marks

Post by Jon Theophilus » Fri Nov 15, 2002 9:15 pm

First:
I am trying to set the scale in a Gantt chart. I am using version 0.9.2 of JFreechart and also using modified code to allow for multiple tasks per category. I want to display a year at a time and show all 12 months as tick marks. Also with the date format of 2002 NOV. Here is my code to create the chart:

//Set dataset
setDataset(this.createDataset(s));
// setTitle(null) NOTE: this is not needed because the super(null) constructor sets the title to nulls

chartPanel = super.createGantt();

Calendar calendar = Calendar.getInstance();
Date startDate = date(1, Calendar.JANUARY, calendar.get(Calendar.YEAR));
Date endDate = date(31, Calendar.DECEMBER, calendar.get(Calendar.YEAR));

JFreeChart chart = this.getChart();
CategoryPlot plot = chart.getCategoryPlot();
DateAxis axis = (DateAxis) plot.getRangeAxis();
axis.setMinimumDate(startDate);
axis.setMaximumDate(endDate);

DateUnit tick = new DateUnit(Calendar.MONTH, 12);
axis.setTickUnit(tick);

Second: I am able to display tick marks when I hover over a bar. Since I am using code that allows me to change the start date of a bar by dragging the bar visually I would like to have the tooltip stay visable while I drag the bar. The tooltip would update as you drag the bar. How would I do this??

Any help is greatly appreciated. I am kind of at a loss at this point.

Thanks,
Jon

Dave Gilbert

Re: Tooltips & Tick Marks

Post by Dave Gilbert » Mon Nov 18, 2002 10:28 am

Hi Jon,

Try changing this line:

DateUnit tick = new DateUnit(Calendar.MONTH, 12);

to:

DateUnit tick = new DateUnit(Calendar.MONTH, 1);

I'm not sure how to get the tooltip to update and stay visible at the same time.

Regards,

DG

Jon Theophilus

Re: Tooltips & Tick Marks

Post by Jon Theophilus » Mon Nov 18, 2002 5:21 pm

That does not seem to work. Any other ideas? Could something be overriding my code??
Thanks,
Jon

Locked