Rendering Gradient Fills

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
raumaduth
Posts: 9
Joined: Fri Oct 19, 2007 9:13 am

Rendering Gradient Fills

Post by raumaduth » Mon Oct 29, 2007 8:54 am

Hi,

I am trying to fill an area chart with a gradient fill, (similar to how the barchart renderer does a gradient fill with the gradient paint transformer). In essence i am defining the max and min values of an area chart and filling defining a gradient fill for rectangle enclosing the graph. My shading goes off the moment i resize or zoom into a chart. is there any way to prevent this from happening. I noticed with the bar chart renderer, the setGradientPaintTransformer method is set once when setting the renderer properties, and the shading is kept perfectly on zooms and resizes. How can i do this for an XYArea Chart.???

Please help..

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Oct 29, 2007 11:17 am

You need to modify the (fixed) control points for the GradientPaint once you know the dimensions of the chart (which is not until drawing time). The bar renderer does this as it draws each bar. You could perhaps do this in the initialise() method in the area renderer, since you only want one gradient.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

raumaduth
Posts: 9
Joined: Fri Oct 19, 2007 9:13 am

Rendering Gradient Fills

Post by raumaduth » Mon Oct 29, 2007 1:00 pm

Hi,

Thanks for your speedy reply David. Im not sure how to do this. please can you elaborate?

Thanks

raumaduth
Posts: 9
Joined: Fri Oct 19, 2007 9:13 am

Rendering Gradient Fills

Post by raumaduth » Tue Oct 30, 2007 7:27 am

anybody know how to implement this???? :? :? :?

raumaduth
Posts: 9
Joined: Fri Oct 19, 2007 9:13 am

still trying to render a gradient fill

Post by raumaduth » Tue Nov 13, 2007 2:28 pm

Hi

Anyone know how to implement a the gradient fill i require above?

ridwaan

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Nov 14, 2007 12:20 pm

What have you tried so far?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked