how do i customize bars colors in Bar chart..
-
- Posts: 14
- Joined: Tue May 06, 2008 5:57 am
how do i customize bars colors in Bar chart..
hi every body, i create bar chart, created chart bars are displayed with default colors, how do i customize bars colors in Bar chart..
Thanks in advance
Thanks in advance
-
- Posts: 9
- Joined: Thu Apr 17, 2008 2:23 pm
hi sreehari.ojili
You need to override the method getItemPaint in the BarRenderer class...
Example:
I hope that help you...
hug,
Keyboarder
You need to override the method getItemPaint in the BarRenderer class...
Example:
Code: Select all
plot.setRenderer(new BarRenderer(){
public Paint getItemPaint(int row, int item) {
if (item == 0) return Color.RED;
}
});
hug,
Keyboarder
The default sequence of colors etc is defined by org.jfree.chart.plot.DefaultDrawingSupplier
To change the sequence, create a new instance of DrawingSupplier and then call this method on your plot.
If you only need to customize colors for a particular chart, then just call
To change the sequence, create a new instance of DrawingSupplier and then call this method
Code: Select all
public void setDrawingSupplier(DrawingSupplier supplier)
If you only need to customize colors for a particular chart, then just call
Code: Select all
renderer.setSeriesPaint(int series, java.awt.Paint paint)
-
- Posts: 14
- Joined: Tue May 06, 2008 5:57 am
hi, thanks to all,
here my case is to customise only particular chart , the below code fixed my problem..
i have one more query i am using dual axis chart (combination of bar & line chart). i am using ploting line chart by using below code.
i want to increase the line size(i mean line width)
here my case is to customise only particular chart , the below code fixed my problem..
Code: Select all
renderer.setSeriesPaint(int series, java.awt.Paint paint)
i want to increase the line size(i mean line width)
Code: Select all
final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(true, false);
renderer2.setSeriesPaint(0, new Color(153, 153, 255));
Code: Select all
renderer2.setSeriesStroke(int series, java.awt.Stroke stroke)
-
- Posts: 14
- Joined: Tue May 06, 2008 5:57 am
hi skunk
thanks a lot,
the code which u posted is fixed my problem..
i am facing one more problem i need to put one small line between each categories.. and i need to print category labels in in two lines alternatively...
i have only one series in my domain axis..i am print 30 items(dates) in domain axis. first item label(01/03) has to print in first line and second item label(02/03) has to print in another line..please help me to come out of this problem.
it needs to be print as mentioned below order
___|___|___|___|___|___|___|___|___|___|___|___|___| domain axis
01/03 03/03 05/03 07/03 09/03
02/03 04/03 06/03 07/03

the code which u posted is fixed my problem..
i am facing one more problem i need to put one small line between each categories.. and i need to print category labels in in two lines alternatively...
i have only one series in my domain axis..i am print 30 items(dates) in domain axis. first item label(01/03) has to print in first line and second item label(02/03) has to print in another line..please help me to come out of this problem.
it needs to be print as mentioned below order
___|___|___|___|___|___|___|___|___|___|___|___|___| domain axis
01/03 03/03 05/03 07/03 09/03
02/03 04/03 06/03 07/03
-
- Posts: 14
- Joined: Tue May 06, 2008 5:57 am
hi skunk, thanks for your reply, can send/post ur mail id, so that i will send my template image and what outout i got using jfree.. image will give me detail view...
Thanks in Advance,
Sreehari Ojili..
sreehari.ojili@cambridge-asia.com
Thanks in Advance,
Sreehari Ojili..
sreehari.ojili@cambridge-asia.com
-
- Posts: 14
- Joined: Tue May 06, 2008 5:57 am
hi skunk, sorry for type mistakes, can send/post ur mail id, so that i will send my template image and what outout i got using jfree.. image will give you detail view...
Thanks in Advance,
Sreehari Ojili..
sreehari.ojili@cambridge-asia.com
Thanks in Advance,
Sreehari Ojili..
sreehari.ojili@cambridge-asia.com