How to change colors bars in WaterFall Chart?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
m.ibbrahim
Posts: 3
Joined: Mon Aug 14, 2006 1:35 pm

How to change colors bars in WaterFall Chart?

Post by m.ibbrahim » Fri Oct 27, 2006 7:18 am

Hi Friends,
I am a newbie to JFree and I am trying hard to change the default colors of bars in WaterFall model chart. I have used the following code to change the colors in waterfall chart. But, it's not working. Can anyone help please.

Code: Select all

    	            WaterfallBarRenderer renderer = (WaterfallBarRenderer) plot.getRenderer();
    	            DecimalFormat decimalformat1 = new DecimalFormat("##,###.00");
    	            
    	            renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", decimalformat1));        
    	            //renderer.setItemLabelsVisible(true);
    	            GradientPaint gp0 = new GradientPaint(
    	                    0.0f, 0.0f, Color.blue, 
    	                    0.0f, 0.0f, new Color(0, 0, 64)
    	                );
    	                GradientPaint gp1 = new GradientPaint(
    	                    0.0f, 0.0f, Color.green, 
    	                    0.0f, 0.0f, new Color(0, 64, 0)
    	                );
    	                GradientPaint gp2 = new GradientPaint(
    	                    0.0f, 0.0f, Color.red, 
    	                    0.0f, 0.0f, new Color(64, 0, 0)
    	                );
    	            
    	                renderer.setSeriesPaint(0, gp0);
    	                renderer.setSeriesPaint(1, gp1);
    	                renderer.setSeriesPaint(2, gp2);
    	                renderer.setSeriesPaint(3, gp2);

    	            chart.getCategoryPlot().setRenderer(renderer);
Thanks.

Locked