I'd like to use two colors to draw one chart. I want to divide it into two parts, each of them I'd like to use one color.
Is there someone who knows how to implement this effect? Thanks a lot!
different colors for different parts of one chart
It is linechart. I want to use one color to draw one half part of it, and use another color to draw the rest. What can I do? The color means the line's color. Thanks a lotmatinh wrote:What kind of chart do you use? Barchart, linechart, other?
What exactly do you want to be in different colors? The actual data which the renderer draws or the plot's background, or anything else?
- martin
You have to modify the renderer class or provide your own using the setRenderer() method of your plot.
You probably use the XYLineAndShapeRenderer (which is the default for linecharts IIRC). So you have two possibilities:
* modify the source of XYLineAndShapeRenderer
* write your own renderer (eventually derive from XYLineAndShapeRenderer) and tell the plot to use it[/list]
I'd probably try the second suggestion. Have a look at the drawItem() method. You probably just want to override this method.
Also have a look at the getItemPaint() method from AbstractRenderer which is used by XYLineAndShapeRenderer. Eventually overriding this method is enough for your needs.
hth,
- martin
You probably use the XYLineAndShapeRenderer (which is the default for linecharts IIRC). So you have two possibilities:
* modify the source of XYLineAndShapeRenderer
* write your own renderer (eventually derive from XYLineAndShapeRenderer) and tell the plot to use it[/list]
I'd probably try the second suggestion. Have a look at the drawItem() method. You probably just want to override this method.
Also have a look at the getItemPaint() method from AbstractRenderer which is used by XYLineAndShapeRenderer. Eventually overriding this method is enough for your needs.
hth,
- martin
This question is asked over and over. Search is your friend
http://www.jfree.org/phpBB2/viewtopic.php?t=16931
http://www.jfree.org/phpBB2/viewtopic.php?t=16931