@Override
public Chart getChart() {
// Create Chart
Chart chart = new Chart(800, 600);
// generates linear data
Collection<Date> xData = new ArrayList<Date>();
Collection<Double> yData = new ArrayList<Double>();
DateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
Date date = null;
for (int i = 1; i <= 10; i++) {
try {
date = sdf.parse(i + ".10.2008");
} catch (ParseException e) {
e.printStackTrace();
}
xData.add(date);
yData.add(Math.random() * i);
}
// Customize Chart
chart.setChartTitle("LineChart03");
chart.setXAxisTitle("X");
chart.setYAxisTitle("Y");
chart.getStyleManager().setPlotBackgroundColor(ChartColor.getAWTColor(ChartColor.GREY));
chart.getStyleManager().setPlotGridLinesColor(new Color(255, 255, 255));
chart.getStyleManager().setChartBackgroundColor(Color.WHITE);
chart.getStyleManager().setLegendBackgroundColor(Color.PINK);
chart.getStyleManager().setChartFontColor(Color.MAGENTA);
chart.getStyleManager().setChartTitleBoxBackgroundColor(new Color(0, 222, 0));
chart.getStyleManager().setChartTitleBoxVisible(true);
chart.getStyleManager().setChartTitleBoxBorderColor(Color.BLACK);
chart.getStyleManager().setPlotGridLinesVisible(false);
chart.getStyleManager().setAxisTickPadding(20);
chart.getStyleManager().setAxisTickMarkLength(15);
chart.getStyleManager().setPlotPadding(20);
chart.getStyleManager().setChartTitleFont(new Font(Font.MONOSPACED, Font.BOLD, 24));
chart.getStyleManager().setLegendFont(new Font(Font.SERIF, Font.PLAIN, 18));
chart.getStyleManager().setLegendPosition(LegendPosition.InsideSE);
chart.getStyleManager().setLegendSeriesLineLength(12);
chart.getStyleManager().setAxisTitleFont(new Font(Font.SANS_SERIF, Font.ITALIC, 18));
chart.getStyleManager().setAxisTickLabelsFont(new Font(Font.SERIF, Font.PLAIN, 11));
chart.getStyleManager().setDatePattern("dd-MMM");
chart.getStyleManager().setDecimalPattern("#0.000");
chart.getStyleManager().setLocale(Locale.GERMAN);
Series series = chart.addSeries("Fake Data", xData, yData);
series.setLineColor(SeriesColor.BLUE);
series.setMarkerColor(Color.ORANGE);
series.setMarker(SeriesMarker.CIRCLE);
series.setLineStyle(SeriesLineStyle.SOLID);