draw on XYSeries on top of others

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

draw on XYSeries on top of others

Post by guest » Sun Aug 07, 2005 8:31 pm

I use a selection JList widget with an XYPlot. If the user selects one
or more names in the JList, I then

1) 'gray out' all the other XYSeries in the XYSeriesCollection
2) leave the color of the selected series unchanged
3) the selected lines stand out nicely against the background
of the grayed-out lines -- most of the time

This works fine, except that the original order of the (possibly
many) series is preserved; gray lines may be drawn on top
of the selected (and still brightly colored) lines.

How can I ensure that my selected lines are drawn on top of
the grayed-out lines?

Thanks!

- Paul Shannon
Institute for Systems Biology
Seattle

fowlerje
Posts: 3
Joined: Mon Aug 08, 2005 6:58 pm

Post by fowlerje » Mon Aug 08, 2005 7:38 pm

Try

XYPlot.getDatasetRenderingOrder();
XYPlot.setDatasetRenderingOrder(DatasetRenderingOrder order);

Hope it helps.

dhchou
Posts: 138
Joined: Tue Jul 05, 2005 11:01 pm

Post by dhchou » Mon Aug 08, 2005 10:51 pm

DatasetRenderingOrder only has two orders: FORWARD and REVERSE. It has a private constructor so you can't directly create a new type of order.

I believe the original question implies that an arbitrary rendering order is desired. I am not sure this is currently supported by JFreeChart.

Daniel

guest

Re: draw one XYSeries on top of others

Post by guest » Sat Oct 01, 2005 11:13 pm

replying, belatedly, to my own posting: the solution -- for me, anyway -- turned out to be to

1) remove all XYSeries from the collection
2) add back the 'selected' xeries first
3) add the deselected series last
4) set the rendering color of each deselected series to gray

the default rendering order (thanks, dhchou and folerje for the
tip) appears to be REVERSE, so that first added are last drawn.

- Paul

Locked