Change of cursor on data

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
raghavan_26
Posts: 59
Joined: Fri Oct 13, 2006 11:35 am
Contact:

Change of cursor on data

Post by raghavan_26 » Mon Jul 23, 2007 6:08 pm

Hi,

Is there any option in jfreechart to change my cursor when on data ..

for example the mouse pointer is an arrow and it should change to hand when on data .

Thanks and regards
raghavan

lukkumar
Posts: 17
Joined: Thu Jun 07, 2007 8:10 pm

Post by lukkumar » Mon Jul 23, 2007 10:37 pm

Hi,
Do you mean that you want the data to represent as a link. Then JFreeChart has a capability to represent a data as a link in which case the cursor would be a hand, and you can place no destination for the link, so that no action is performed when u try to click...

Laks.

raghavan_26
Posts: 59
Joined: Fri Oct 13, 2006 11:35 am
Contact:

Post by raghavan_26 » Tue Jul 24, 2007 5:44 am

Yeah something just similar to that.

If the present cursor on the entire chart is pointer and when You move your cursor on the plotted data can we change that cursor to hand ..

Thanks and regards
raghavan

lukkumar
Posts: 17
Joined: Thu Jun 07, 2007 8:10 pm

Post by lukkumar » Tue Jul 24, 2007 3:43 pm

Hi,
I saw this forum, I thought that it might help you...
http://www.jfree.org/phpBB2/viewtopic.php?t=21649

Also look at the example below...

// Create tooltip and URL generators
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", Locale.UK);
StandardXYToolTipGenerator ttg = new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
sdf, NumberFormat.getInstance());
TimeSeriesURLGenerator urlg = new TimeSeriesURLGenerator(
sdf, "bar_chart.jsp", "series", "hitDate");

// Create the X-Axis
DateAxis xAxis = new DateAxis(null);
xAxis.setLowerMargin(0.0);
xAxis.setUpperMargin(0.0);

// Create the X-Axis
NumberAxis yAxis = new NumberAxis(null);
yAxis.setAutoRangeIncludesZero(true);

// Create the renderer
StackedXYAreaRenderer renderer =
new StackedXYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES, ttg, urlg);
renderer.setSeriesPaint(0, new Color(255, 255, 180));
renderer.setSeriesPaint(1, new Color(206, 230, 255));
renderer.setSeriesPaint(2, new Color(255, 230, 230));
renderer.setSeriesPaint(3, new Color(206, 255, 206));
renderer.setShapePaint(Color.gray);
renderer.setShapeStroke(new BasicStroke(0.5f));
renderer.setShape(new Ellipse2D.Double(-3, -3, 6, 6));
renderer.setOutline(true);

// Create the plot
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);

There is a feature call TimeSeriesURLGenerator and there might be other similar URLGenerators like this, see it in the API of jfreechart and you can provide no destination to the link (or you can give a destination if you want to direct a user to different page on clicking), in which case you will get a mouse cursor instead of the pointer when u move your mouse to the data...

Hope this helps you...

raghavan_26
Posts: 59
Joined: Fri Oct 13, 2006 11:35 am
Contact:

Post by raghavan_26 » Tue Jul 24, 2007 4:52 pm

Thanks a lot lukkumar ...

The link u have given is what I am looking for .. thanks a lot .

The example you have given only changes the tooltip text not the cursor type ..

regards
raghavan

Locked