{
if(chart != null)
{
write( "JRDesignChart " + chartName + " = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_XYBAR);\n");
writeChart( chart, chartName);
JRChartDataset dataset = chart.getDataset();
if( dataset.getDatasetType() == JRChartDataset.TIMESERIES_DATASET )
{
writeTimeSeriesDataset( (JRTimeSeriesDataset)dataset, chartName, "TimeSeriesDataset");
}
else if( dataset.getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET ){
writeTimePeriodDataset( (JRTimePeriodDataset)dataset, chartName, "XyDataset");
}
else if( dataset.getDatasetType() == JRChartDataset.XY_DATASET ){
writeXyDataset( (JRXyDataset) chart.getDataset(), chartName, "XyDataset");
}
writeBarPlot( (JRBarPlot) chart.getPlot(), chartName);
flush();
}