Different colored line between points

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jesclaine
Posts: 2
Joined: Tue Dec 21, 2010 3:43 pm
antibot: No, of course not.

Different colored line between points

Post by jesclaine » Tue Jan 11, 2011 4:00 pm

Hi,

i know it's possible to choose one color for one curve :

Code: Select all

XYItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(index, Color.blue);
But I want to know if is it possible to have for one curve different color between points ?

For exemple :

x---------------x~~~~~~~~~~~~~~x==================x

Where x are points, --------- is a red line, ~~~~~~~~ is a orange line and ======== is a yellow line.

Thanks.

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

Re: Different colored line between points

Post by matinh » Wed Jan 12, 2011 1:08 pm

This really depends on the renderer you are using. For example the YXLineAndShapeRenderer has limited support through the getItemPaint() method.
It shouldn't be to hard to extend an existing renderer and overwrite some methods like getItemPaint(), draw() or drawPrimaryLine() to implement what you need.

Also search this forum. This kind of question has been asked before and you will eventually find useful answers in other threads.

hth,
- martin

Locked