Logged In: NO

The points on the line are defined in LineChartProperties as
an array of Shapes, as with the array of Colors.

Legend is calculating where to place the 'icon' and then
painting a bunch of 'icons' and labels inside a double nested
for loop.

Here is the code to make it use the same shapes as the
points on the line. (We are printing with pdfs via FOP so we
only care about the line charts)

Nb you will need to alter the source and use something like
netbeans to edit and compile. Not JBuilder which deals with
jars in the most moronic way possible. After recompiling
Legend.java you need to add it to the jar, the command is
something like
jar uf jCharts0.6.0.jar org/jCharts/Legend.class
(I actually called my jar 0.6.1 to avoid overwriting if the code
was bad :-)

In Legend:

You have to add some imports (go import happy, if in doubt
go grab some more imports! Does not effect size of output
class files at all):

import org.jCharts.ChartData.interfaces.*;
import org.jCharts.properties.*;
import org.jCharts.axisChart.*;
import org.jCharts.types.*;

import java.awt.*;
import java.awt.geom.*;

etc. (ad nauseam)

after:

private ArrayList paints;

add

private Shape[] shapes;

in processLegendLabels after:

this.paints.add( iDataSet.getPain(i) );

add:

if (this.chart instanceof AxisChart) {
AxisChart ac = (AxisChart) this.chart;
IAxisPlotDataSet iAxisPlotDataSet = ac.getIDataSeries
().getIAxisPlotDataSet( ChartType.LINE );
IAxisChartDataSet iacds = (IAxisChartDataSet)
iAxisPlotDataSet;
LineChartProperties lineChartProperties =
(LineChartProperties) iacds.getChartTypeProperties();
this.shapes = lineChartProperties.getShapes();
}

nb: the chart properties are stored in a hashmap, if you are
using charts other than ChartType.LINE you will need to do
something different

in render after:

for( int i=0; i < this.numColumns; i++ )
{
rectangle.x=posX;

add:

if (shapes != null) {
g2d.setPain( (Paint) this.paints.get( labelIndex ) );
g2d.setTransform(AffineTransform.getTranslateInstance
(rectangle.getMinX(), rectangle.getMinY()));
g2d.fill(this.shapes[labelIndex]);
g2d.setTransform(AffineTransform.getTranslateInstance
(0.0, 0.0));
} else {

nb you need to indent the following code, and close the else
after the next:

g2d.draw( rectangle );

Sorry I can't directly upload files from work as the internet
machine is not connected to our network and I typed that out
by hand from a printout of the code, so apologies for any
typing errors that prevent it from compiling. Consider it an
exercise left to the reader :-)

BTW since we are printing rather than webbing, I also had to
redo the AxisProperties, because the grey lines were very
hard to read. We have a problem in that we're spitting out a
jpeg, and then the fop->pdf is stretching the jpeg to fit the
width of the page... does anyone know exactly how wide to
set the jpeg (in pixels) so that there is no stretch on the pdf?
We're using A4 - I think the printable width (less margins) is
19cm...?