Switched from jCharts.0.7.5 to krysalis-jCharts-1.0.0-alpha-1

"Jiang, Xihua" <[email protected]> Fri, 7 Jan 2005 14:50:19 -0800
Newsgroups gmane.comp.krysalis.jcharts.user
Message-ID <CB9351707A48AB499FF3FFD575797F53294963@ine001p4.pimco.imswest.sscims.com>
Hi,

I just switched from jCharts.0.7.5 to krysalis-jCharts-1.0.0-alpha-1. My ap=
p builds fine, but got a run-time error as follows:

Warning: legend shape is null
java.lang.NullPointerException
        at org.krysalis.jcharts.Legend.calculateDrawingValues(Unknown Sourc=
e)
        at org.krysalis.jcharts.Legend.computeLegendXY(Unknown Source)
        at org.krysalis.jcharts.axisChart.AxisChart.renderChart(Unknown Sou=
rce)
        at org.krysalis.jcharts.Chart.render(Unknown Source)
        ...

I didn't make any change to my source code. What else should I do?=20
Here's my source code:

    /**
     * Plot the time series data as line chart.=20
     */
    public int plot() throws ChartDataException, PropertyException {
        ...
        String xAxisTitle=3D null, yAxisTitle=3D null;
        dataSeries =3D new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle,=
 getChartTitle() );
        LineChartProperties lineChartProperties=3D new LineChartProperties(=
 strokes, shapes );

        AxisChartDataSet axisChartDataSet =3D new AxisChartDataSet(data,leg=
endLabels,paints,ChartType.LINE,lineChartProperties);
        dataSeries.addIAxisPlotDataSet(axisChartDataSet);

        chartProperties=3D new ChartProperties();
        axisProperties=3D new AxisProperties();
        legendProperties=3D new LegendProperties();
        ChartStroke xAxisGridLines=3D new ChartStroke( new BasicStroke( 1.0=
f,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,1f,new float[] {2f},0f ),Col=
or.lightGray);
        axisProperties.getXAxisProperties().setGridLineChartStroke( xAxisGr=
idLines );
        axisProperties.getXAxisProperties().setShowGridLines( AxisTypePrope=
rties.GRID_LINES_ONLY_WITH_LABELS );

        DataAxisProperties yAxis =3D (DataAxisProperties) axisProperties.ge=
tYAxisProperties();
        yAxis.setGridLineChartStroke( xAxisGridLines );
        yAxis.setShowGridLines( AxisTypeProperties.GRID_LINES_ONLY_WITH_LAB=
ELS );
        yAxis.setNumItems(yNumItems);
        yAxis.setRoundToNearest(roundToNearest);

        UserDefinedScaleCalculator u=3D new UserDefinedScaleCalculator(yMin=
, yIncrement);
        yAxis.setScaleCalculator( u );

        yAxisMinWidth =3D getYLabelMinWidth(yAxis);

        //repaint();

        return PTError.PMPT_ERROR_SUCCESS;
    }

    public void paint(Graphics g) {
            Graphics plotGraphics =3D g.create(yAxisOffset,0,dim.width-yAxi=
sOffset,dim.height);
            try {
                Graphics2D g2d =3D (Graphics2D) plotGraphics;
                AxisChart axisChart=3D new AxisChart(dataSeries,=20
                                                   chartProperties,=20
                                                   axisProperties,=20
                                                   legendProperties, dim.wi=
dth-yAxisOffset, dim.height );              =20
                axisChart.setGraphics2D(g2d);
                axisChart.render();
            }
            catch( ChartDataException chartDataException )
            {
                chartDataException.printStackTrace();
            }
            catch( PropertyException propertyException ) {
                propertyException.printStackTrace();
            }
    }


This message contains confidential information and is intended only for the=
 individual named. If you are not the named addressee, you should not disse=
minate, distribute, alter or copy this e-mail. Please notify the sender imm=
ediately by e-mail if you have received this e-mail by mistake and delete t=
his e-mail from your system. E-mail transmissions cannot be guaranteed to b=
e secure or without error as information could be intercepted, corrupted, l=
ost, destroyed, arrive late or incomplete, or=20
contain viruses. The sender, therefore, does not accept liability for any e=
rrors or omissions in the contents of this message which arise during or as=
 a result of e-mail transmission. If verification is required, please reque=
st a hard-copy version. This message is provided for information purposes a=
nd should not be construed as a solicitation or offer to buy or sell any se=
curities or related financial instruments in any jurisdiction.



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt