예제 #1
0
  @Override
  public Chart getChart() {

    // Create Chart
    Chart chart = new Chart(800, 600);

    // generates linear data
    Collection<Date> xData = new ArrayList<Date>();
    Collection<Number> yData = new ArrayList<Number>();

    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().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().setNormalDecimalPattern("#0.000");
    chart.getStyleManager().setLocale(Locale.GERMAN);

    Series series = chart.addDateSeries("Fake Data", xData, yData);
    series.setLineColor(SeriesColor.BLUE);
    series.setMarkerColor(Color.ORANGE);
    series.setMarker(SeriesMarker.CIRCLE);
    series.setLineStyle(SeriesLineStyle.SOLID);

    return chart;
  }
예제 #2
0
  @Override
  public Color getLegendBackgroundColor() {

    return ChartColor.getAWTColor(ChartColor.WHITE);
  }
예제 #3
0
  @Override
  public Color getChartTitleBoxBorderColor() {

    return ChartColor.getAWTColor(ChartColor.GREY);
  }
예제 #4
0
  @Override
  public Color getChartTitleBoxBackgroundColor() {

    return ChartColor.getAWTColor(ChartColor.GREY);
  }
예제 #5
0
  @Override
  public Color getChartFontColor() {

    return ChartColor.getAWTColor(ChartColor.BLACK);
  }
예제 #6
0
  // Error Bars ///////////////////////////////
  @Override
  public Color getErrorBarsColor() {

    return ChartColor.getAWTColor(ChartColor.DARK_GREY);
  }
예제 #7
0
  @Override
  public Color getPlotGridLinesColor() {

    return ChartColor.getAWTColor(ChartColor.WHITE);
  }
예제 #8
0
  @Override
  public Color getPlotBorderColor() {

    return ChartColor.getAWTColor(ChartColor.WHITE);
  }
예제 #9
0
  @Override
  public Color getPlotBackgroundColor() {

    return ChartColor.getAWTColor(ChartColor.LIGHT_GREY);
  }
예제 #10
0
  @Override
  public Color getAxisTickLabelsColor() {

    return ChartColor.getAWTColor(ChartColor.DARK_GREY);
  }