gt: 			date[16]  = DateUtilities.createDate(2001, jan, 21, 12, 0);
context: /*
   * JasperReports - Free Java Reporting Library.
   * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
   * http://www.jaspersoft.com
   *
   * Unless you have purchased a commercial license agreement from Jaspersoft,
   * the following license terms apply:
   *
   * This program is part of JasperReports.
   *
   * JasperReports is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * JasperReports is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public License
   * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
   */
  
  /*
   * Contributors:
   * Eugene D - eugenedruy@users.sourceforge.net 
   * Adrian Jackson - iapetus@users.sourceforge.net
   * David Taylor - exodussystems@users.sourceforge.net
   * Lars Kristensen - llk@users.sourceforge.net
   */
  package net.sf.jasperreports.engine.convert;
  
  import java.util.Calendar;
  import java.util.Date;
  import java.util.Locale;
  import java.util.TimeZone;
  
  import net.sf.jasperreports.charts.ChartContext;
  import net.sf.jasperreports.engine.DefaultJasperReportsContext;
  import net.sf.jasperreports.engine.JRChart;
  import net.sf.jasperreports.engine.JRChartDataset;
  import net.sf.jasperreports.engine.JRException;
  import net.sf.jasperreports.engine.JRExpression;
  import net.sf.jasperreports.engine.JasperReportsContext;
  
  import org.jfree.data.category.CategoryDataset;
  import org.jfree.data.category.DefaultCategoryDataset;
  import org.jfree.data.category.IntervalCategoryDataset;
  import org.jfree.data.gantt.Task;
  import org.jfree.data.gantt.TaskSeries;
  import org.jfree.data.gantt.TaskSeriesCollection;
  import org.jfree.data.general.Dataset;
  import org.jfree.data.general.DefaultPieDataset;
  import org.jfree.data.general.DefaultValueDataset;
  import org.jfree.data.general.PieDataset;
  import org.jfree.data.time.Day;
  import org.jfree.data.time.Hour;
  import org.jfree.data.time.Minute;
  import org.jfree.data.time.SimpleTimePeriod;
  import org.jfree.data.time.TimePeriodValues;
  import org.jfree.data.time.TimePeriodValuesCollection;
  import org.jfree.data.time.TimeSeries;
  import org.jfree.data.time.TimeSeriesCollection;
  import org.jfree.data.time.Year;
  import org.jfree.data.xy.DefaultHighLowDataset;
  import org.jfree.data.xy.DefaultXYZDataset;
  import org.jfree.data.xy.OHLCDataset;
  import org.jfree.data.xy.XYDataset;
  import org.jfree.data.xy.XYSeries;
  import org.jfree.data.xy.XYSeriesCollection;
  import org.jfree.data.xy.XYZDataset;
  import org.jfree.date.DateUtilities;
  
  
  /**
   * @author Teodor Danciu (teodord@users.sourceforge.net)
   */
  public class ConvertChartContext implements ChartContext
  {
  	private final ReportConverter reportConverter;
  	private final JRChart chart;
  	
  	protected ConvertChartContext(ReportConverter reportConverter, JRChart chart)
  	{
  		this.reportConverter = reportConverter;
  		this.chart = chart;
  	}
  	
  	@Override
  	public JasperReportsContext getJasperReportsContext()
  	{
  		return DefaultJasperReportsContext.getInstance();//FIXMECONTEXT
  	}
  	
  	@Override
  	public String evaluateTextExpression(JRExpression expression) throws JRException 
  	{
  		if (expression != null)
  		{
  			return expression.getText();
  		}
  		return null;
  	}
  
  	@Override
  	public Object evaluateExpression(JRExpression expression) throws JRException 
  	{
  		return null;
  	}
  
  	@Override
  	public JRChart getChart() {
  		return chart;
  	}
  
  	@Override
  	public Dataset getDataset()
  	{//FIXMETHEME make different datasets
  		Dataset dataset = null;
  		switch (chart.getDataset().getDatasetType()){
  		case JRChartDataset.CATEGORY_DATASET:
  			dataset = createCategoryDataset();
  			break;
  		case JRChartDataset.GANTT_DATASET:
  			dataset = createGanttDataset();
  			break;
  		case JRChartDataset.HIGHLOW_DATASET:
  			dataset = createHighLowDataset();
  			break;
  		case JRChartDataset.PIE_DATASET:
  			dataset = createPieDataset();
  			break;
  		case JRChartDataset.TIMEPERIOD_DATASET:
  			dataset = createTimePeriodDataset();
  			break;
  		case JRChartDataset.TIMESERIES_DATASET:
  			dataset = createTimeSeriesDataset();
  			break;
  		case JRChartDataset.VALUE_DATASET:
  			dataset = new DefaultValueDataset(50);
  			break;
  		case JRChartDataset.XY_DATASET:
  			dataset = createXyDataset();
  			break;
  		case JRChartDataset.XYZ_DATASET:
  			dataset = createXyzDataset();
  			break;
  		}
  		return dataset;
  	}
  
  	@Override
  	public Object getLabelGenerator() {
  		return null;
  	}
  
  	@Override
  	public Locale getLocale() {
  		return reportConverter.getLocale();
  	}
  
  	@Override
  	public TimeZone getTimeZone() {
  		return reportConverter.getTimeZone();
  	}
  	
  	private static DefaultCategoryDataset sampleCategoryDataset;
  	
  	private CategoryDataset createCategoryDataset()
  	{
  		if (sampleCategoryDataset == null)
  		{
  			DefaultCategoryDataset dataset = new DefaultCategoryDataset();
  			dataset.addValue(1.0, "First", "One");
  			dataset.addValue(4.0, "First", "Two");
  			dataset.addValue(3.0, "First", "Three");
  			dataset.addValue(5.0, "First", "Four");
  			dataset.addValue(5.0, "First", "Five");
  			dataset.addValue(7.0, "First", "Six");
  			dataset.addValue(7.0, "First", "Seven");
  			dataset.addValue(8.0, "First", "Eight");
  			dataset.addValue(5.0, "Second", "One");
  			dataset.addValue(7.0, "Second", "Two");
  			dataset.addValue(6.0, "Second", "Three");
  			dataset.addValue(8.0, "Second", "Four");
  			dataset.addValue(4.0, "Second", "Five");
  			dataset.addValue(4.0, "Second", "Six");
  			dataset.addValue(2.0, "Second", "Seven");
  			dataset.addValue(1.0, "Second", "Eight");
  			dataset.addValue(4.0, "Third", "One");
  			dataset.addValue(3.0, "Third", "Two");
  			dataset.addValue(2.0, "Third", "Three");
  			dataset.addValue(3.0, "Third", "Four");
  			dataset.addValue(6.0, "Third", "Five");
  			dataset.addValue(3.0, "Third", "Six");
  			dataset.addValue(4.0, "Third", "Seven");
  			dataset.addValue(3.0, "Third", "Eight");
  			
  			sampleCategoryDataset = dataset;
  		}
  		
  		return sampleCategoryDataset;
  	}
  	
  	private static PieDataset samplePieDataset;
  	
  	private PieDataset createPieDataset()
  	{
  		if (samplePieDataset == null)
  		{
  			DefaultPieDataset dataset = new DefaultPieDataset();
  			dataset.setValue("First", new Double(45));
  			dataset.setValue("Second", new Double(10));
  			dataset.setValue("Third", new Double(15));
  			dataset.setValue("Fourth", new Double(25));
  			dataset.setValue("Fifth", new Double(5));
  			
  			samplePieDataset = dataset;
  		}
  		
  		return samplePieDataset;
  	}
  	
  	private static XYSeriesCollection sampleXyDataset;
  	
  	private XYDataset createXyDataset()
  	{
  		if (sampleXyDataset == null)
  		{
  			XYSeriesCollection dataset = new XYSeriesCollection();
  
  			XYSeries series = new XYSeries("First");
  			series.add(1.0, 500.2);
  			series.add(5.0, 694.1);
  			series.add(4.0, 100.0);
  			series.add(12.5, 734.4);
  			series.add(17.3, 453.2);
  			series.add(21.2, 500.2);
  			series.add(21.9, null);
  			series.add(25.6, 734.4);
  			series.add(30.0, 453.2);
  			dataset.addSeries(series);
  
  			series = new XYSeries("Second");
  			series.add(2.0, 400.2);
  			series.add(6.0, 594.1);
  			series.add(5.0, 90.0);
  			series.add(13.5, 634.4);
  			series.add(18.3, 353.2);
  			series.add(22.2, 400.2);
  			series.add(22.9, null);
  			series.add(26.6, 634.4);
  			series.add(31.0, 353.2);
  			dataset.addSeries(series);
  
  			series = new XYSeries("Third");
  			series.add(0.0, 600.2);
  			series.add(4.0, 794.1);
  			series.add(3.0, 200.0);
  			series.add(11.5, 834.4);
  			series.add(16.3, 553.2);
  			series.add(20.2, 600.2);
  			series.add(20.9, null);
  			series.add(24.6, 834.4);
  			series.add(29.0, 553.2);
  			dataset.addSeries(series);
  			
  			sampleXyDataset = dataset;
  		}
  
  		return sampleXyDataset;
  	}
  	
  	private static TimeSeriesCollection sampleTimeSeriesDataset;
  	
  	private TimeSeriesCollection createTimeSeriesDataset()
  	{
  //		TimeSeries series1 = new TimeSeries("Series 1", Day.class);
  //		series1.add(new Day(1, 1, 2003), 54.3);
  //		series1.add(new Day(2, 1, 2003), 20.3);
  //		series1.add(new Day(3, 1, 2003), 43.4);
  //		series1.add(new Day(4, 1, 2003), -12.0);
  //		
  //		TimeSeries series2 = new TimeSeries("Series 2", Day.class);
  //		series2.add(new Day(1, 1, 2003), 8.0);
  //		series2.add(new Day(2, 1, 2003), 16.0);
  //		series2.add(new Day(3, 1, 2003), 21.0);
  //		series2.add(new Day(4, 1, 2003), 5.0);
  //		
  //		TimeSeriesCollection dataset = new TimeSeriesCollection();
  //		dataset.addSeries(series1);
  //		dataset.addSeries(series2);
  //		return dataset;
  		
  		if (sampleTimeSeriesDataset == null)
  		{
  			TimeSeriesCollection dataset = new TimeSeriesCollection();
  			
  			TimeSeries series = new TimeSeries("First", "Year", "Count", Year.class);
  
  			series.add(new Year(1976), Integer.valueOf(0));
  			series.add(new Year(1977), Integer.valueOf(1));
  			series.add(new Year(1978), Integer.valueOf(0));
  			series.add(new Year(1979), Integer.valueOf(2));
  			series.add(new Year(1980), Integer.valueOf(0));
  			series.add(new Year(1981), Integer.valueOf(1));
  			series.add(new Year(1982), Integer.valueOf(2));
  			series.add(new Year(1983), Integer.valueOf(5));
  			series.add(new Year(1984), Integer.valueOf(21));
  			series.add(new Year(1985), Integer.valueOf(18));
  			series.add(new Year(1986), Integer.valueOf(18));
  			series.add(new Year(1987), Integer.valueOf(25));
  			series.add(new Year(1988), Integer.valueOf(11));
  			series.add(new Year(1989), Integer.valueOf(16));
  			series.add(new Year(1990), Integer.valueOf(23));
  			series.add(new Year(1991), Integer.valueOf(14));
  			series.add(new Year(1992), Integer.valueOf(31));
  			series.add(new Year(1993), Integer.valueOf(38));
  			series.add(new Year(1994), Integer.valueOf(31));
  			series.add(new Year(1995), Integer.valueOf(56));
  			series.add(new Year(1996), Integer.valueOf(45));
  			series.add(new Year(1997), Integer.valueOf(74));
  			series.add(new Year(1998), Integer.valueOf(68));
  			series.add(new Year(1999), Integer.valueOf(98));
  			series.add(new Year(2000), Integer.valueOf(85));
  			series.add(new Year(2001), Integer.valueOf(66));
  			series.add(new Year(2002), Integer.valueOf(71));
  			series.add(new Year(2003), Integer.valueOf(65));
  			series.add(new Year(2004), Integer.valueOf(59));
  			series.add(new Year(2005), Integer.valueOf(60));
  			
  			dataset.addSeries(series);
  			
  			sampleTimeSeriesDataset = dataset;
  		}
  		
  		return sampleTimeSeriesDataset;
  	}
  	
  	private static DefaultXYZDataset sampleXyzDataset;
  	
  	private XYZDataset createXyzDataset()
  	{
  		if (sampleXyzDataset == null)
  		{
  			DefaultXYZDataset dataset = new DefaultXYZDataset(); 
  			
  			dataset.addSeries(
  				"First", 
  				new double[][]{ 
  					{2.1, 2.3, 2.3, 2.2, 2.2, 1.8, 1.8, 1.9, 2.3, 3.8}, 
  					{14.1, 11.1, 10.0, 8.8, 8.7, 8.4, 5.4, 4.1, 4.1, 25}, 
  					{2.4, 2.7, 2.7, 2.2, 2.2, 2.2, 2.1, 2.2, 1.6, 4}
  					}
  				);
  			
  			sampleXyzDataset = dataset;
  		}
  		
  		return sampleXyzDataset;
  	}
  
  	private static TaskSeriesCollection sampleGanttDataset;
  	
  	private IntervalCategoryDataset createGanttDataset() 
  	{
  		if (sampleGanttDataset == null)
  		{
  			TaskSeriesCollection dataset = new TaskSeriesCollection();
  
  			TaskSeries series = new TaskSeries("Scheduled");
  			series.add(new Task("First", new SimpleTimePeriod(date(1, Calendar.APRIL, 2008), date(5, Calendar.APRIL, 2008))));
  			series.add(new Task("Second", new SimpleTimePeriod(date(9, Calendar.APRIL, 2008), date(9, Calendar.APRIL, 2008))));
  			series.add(new Task("Third", new SimpleTimePeriod(date(10, Calendar.APRIL, 2008), date(5, Calendar.MAY, 2008))));
  			series.add(new Task("Fourth", new SimpleTimePeriod(date(6, Calendar.MAY, 2008), date(30, Calendar.MAY, 2008))));
  			series.add(new Task("Fifth", new SimpleTimePeriod(date(2, Calendar.JUNE, 2008), date(2, Calendar.JUNE, 2008))));
  			dataset.add(series);
  			
  			series = new TaskSeries("Actual");
  			series.add(new Task("First", new SimpleTimePeriod(date(1, Calendar.APRIL, 2008), date(5, Calendar.APRIL, 2008))));
  			series.add(new Task("Second", new SimpleTimePeriod(date(9, Calendar.APRIL, 2008), date(9, Calendar.APRIL, 2008))));
  			series.add(new Task("Third", new SimpleTimePeriod(date(10, Calendar.APRIL, 2008), date(15, Calendar.MAY, 2008))));
  			series.add(new Task("Fourth", new SimpleTimePeriod(date(15, Calendar.MAY, 2008), date(17, Calendar.JUNE, 2008))));
  			series.add(new Task("Fifth", new SimpleTimePeriod(date(30, Calendar.JUNE, 2008), date(30, Calendar.JUNE, 2008))));
  			dataset.add(series);
  
  			sampleGanttDataset = dataset;
  		}
  		
  		return sampleGanttDataset;
  	}
  	
  	private static Date date(int day, int month, int year)
  	{
  		Calendar calendar = Calendar.getInstance();
  		calendar.set(year, month, day);
  		return calendar.getTime();
  	}
  
  	private static DefaultHighLowDataset sampleHighLowDataset;
  	
  	private OHLCDataset createHighLowDataset() 
  	{
  		if (sampleHighLowDataset == null)
  		{
  			Date[] date = new Date[47];
  			double[] high = new double[47];
  			double[] low = new double[47];
  			double[] open = new double[47];
  			double[] close = new double[47];
  			double[] volume = new double[47];
  			
  			int jan = 1;
  			int feb = 2;
  			
  			date[0]  = DateUtilities.createDate(2001, jan, 4, 12, 0);
  			high[0]  = 47.0;
  			low[0]   = 33.0;
  			open[0]  = 35.0;
  			close[0] = 33.0;
  			volume[0] = 100.0;
  			
  			date[1]  = DateUtilities.createDate(2001, jan, 5, 12, 0);
  			high[1]  = 47.0;
  			low[1]   = 32.0;
  			open[1]  = 41.0;
  			close[1] = 37.0;
  			volume[1] = 150.0;
  			
  			date[2]  = DateUtilities.createDate(2001, jan, 6, 12, 0);
  			high[2]  = 49.0;
  			low[2]   = 43.0;
  			open[2]  = 46.0;
  			close[2] = 48.0;
  			volume[2] = 70.0;
  			
  			date[3]  = DateUtilities.createDate(2001, jan, 7, 12, 0);
  			high[3]  = 51.0;
  			low[3]   = 39.0;
  			open[3]  = 40.0;
  			close[3] = 47.0;
  			volume[3] = 200.0;
  			
  			date[4]  = DateUtilities.createDate(2001, jan, 8, 12, 0);
  			high[4]  = 60.0;
  			low[4]   = 40.0;
  			open[4]  = 46.0;
  			close[4] = 53.0;
  			volume[4] = 120.0;
  			
  			date[5]  = DateUtilities.createDate(2001, jan, 9, 12, 0);
  			high[5]  = 62.0;
  			low[5]   = 55.0;
  			open[5]  = 57.0;
  			close[5] = 61.0;
  			volume[5] = 110.0;
  			
  			date[6]  = DateUtilities.createDate(2001, jan, 10, 12, 0);
  			high[6]  = 65.0;
  			low[6]   = 56.0;
  			open[6]  = 62.0;
  			close[6] = 59.0;
  			volume[6] = 70.0;
  			
  			date[7]  = DateUtilities.createDate(2001, jan, 11, 12, 0);
  			high[7]  = 55.0;
  			low[7]   = 43.0;
  			open[7]  = 45.0;
  			close[7] = 47.0;
  			volume[7] = 20.0;
  			
  			date[8]  = DateUtilities.createDate(2001, jan, 12, 12, 0);
  			high[8]  = 54.0;
  			low[8]   = 33.0;
  			open[8]  = 40.0;
  			close[8] = 51.0;
  			volume[8] = 30.0;
  			
  			date[9]  = DateUtilities.createDate(2001, jan, 13, 12, 0);
  			high[9]  = 47.0;
  			low[9]   = 33.0;
  			open[9]  = 35.0;
  			close[9] = 33.0;
  			volume[9] = 100.0;
  			
  			date[10]  = DateUtilities.createDate(2001, jan, 14, 12, 0);
  			high[10]  = 54.0;
  			low[10]   = 38.0;
  			open[10]  = 43.0;
  			close[10] = 52.0;
  			volume[10] = 50.0;
  			
  			date[11]  = DateUtilities.createDate(2001, jan, 15, 12, 0);
  			high[11]  = 48.0;
  			low[11]   = 41.0;
  			open[11]  = 44.0;
  			close[11] = 41.0;
  			volume[11] = 80.0;
  			
  			date[12]  = DateUtilities.createDate(2001, jan, 17, 12, 0);
  			high[12]  = 60.0;
  			low[12]   = 30.0;
  			open[12]  = 34.0;
  			close[12] = 44.0;
  			volume[12] = 90.0;
  			
  			date[13]  = DateUtilities.createDate(2001, jan, 18, 12, 0);
  			high[13]  = 58.0;
  			low[13]   = 44.0;
  			open[13]  = 54.0;
  			close[13] = 56.0;
  			volume[13] = 20.0;
  			
  			date[14]  = DateUtilities.createDate(2001, jan, 19, 12, 0);
  			high[14]  = 54.0;
  			low[14]   = 32.0;
  			open[14]  = 42.0;
  			close[14] = 53.0;
  			volume[14] = 70.0;
  			
  			date[15]  = DateUtilities.createDate(2001, jan, 20, 12, 0);
  			high[15]  = 53.0;
  			low[15]   = 39.0;
  			open[15]  = 50.0;
  			close[15] = 49.0;
  			volume[15] = 60.0;
  			
  