Providing Series comparator

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
fcamblor
Posts: 1
Joined: Sat Sep 18, 2010 3:23 pm
antibot: No, of course not.

Providing Series comparator

Post by fcamblor » Sat Sep 18, 2010 5:22 pm

Hi there !

I'm using JFreechart 1.0.9 (bundled in Hudson).
I'm building a simple chart with multiple series : "not build", "unstables", "failures", "success"

For ergonomic reasons, I want to :
- fix a color for each serie
- display each serie in a given order : 1/ not builds, 2/ unstables, 3/ failures and 4/ success.

I noticed JFreechart was sorting series with the default string comparator, so by default, the series was in this order : 1/ failures, 2/ not builds, 3/ success and 4/ unstables

I found a workaround : putting an index in the serie label (for example "1) not builds") but it is not really a great workaround.

I tried, too, to use the CategoryPlot.setFixedLegendItems() method (reorganizing CategoryPlot.getLegendItems() in my order) : this allows to successfully sort legend items, but then, my colors displayed on chart are no longer synchronized with my legend colors.

=> Would it be possible to provide a serie comparator somewhere ?

Locked