exclude high brightness yellow series.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
creator9229
Posts: 2
Joined: Sat Jul 28, 2012 2:25 pm
antibot: No, of course not.

exclude high brightness yellow series.

Post by creator9229 » Sat Jul 28, 2012 2:35 pm

hello, I have problem.
Envirement:
- I create JFreechart useing 'StandardXYItemRenderer', 'XYPlot'.
- SeriesPaint is auto genaration.
- Series count is dynamic. it could be more 50.
Problem:
- Yellow Series is high brightness. User hard to see the yellow series(third series).
I tried:
- Plot background change the row bightness but User don't want to change(for excel export.).
- serSeriesPaint(ex> renderer.setSeriesPaint(3, Color.Blue) ) but next series is yellow. Can't exclude high brightness yellow.
- Googling suggest 'DrawingSupplier but I can't know how to make DrawingSupplier.

please reply.

John Matthews
Posts: 479
Joined: Wed Sep 12, 2007 3:18 pm

Re: exclude high brightness yellow series.

Post by John Matthews » Sun Jul 29, 2012 3:58 am

I usually just override getItemPaint(), as discussed here, but replacing the DrawingSupplier seems like a more general solution. The default drawing supplier is owned by Plot. Starting from TimeSeriesChartDemo1, here's a minimal example:

Image

Code: Select all

plot.setDrawingSupplier(new DrawingSupplier() {

    @Override
    public Paint getNextPaint() {
        return Color.blue;
    }

    @Override
    public Shape getNextShape() {
        return ShapeUtilities.createDiamond(4f);
    }

    @Override
    public Stroke getNextStroke() {
        return new BasicStroke();
    }
    // ...
});
 

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: exclude high brightness yellow series.

Post by matinh » Wed Aug 01, 2012 7:48 am

What I did is something like this:

Code: Select all

final Paint[] paintArray;
// create default colors but modify some colors that are hard to see
paintArray = ChartColor.createDefaultPaintArray();
paintArray[2] = new Color(0x00, 0xBB, 0x00); 
paintArray[3] = new Color(0xEE, 0xAA, 0x00);

plot.setDrawingSupplier(new DefaultDrawingSupplier(
                paintArray,
                DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
hth,
- martin

Post Reply