Example #1
0
  /**
   * Builds an XY multiple series renderer.
   *
   * @param colors the series rendering color
   * @param styles the series point style
   * @return the XY multiple series renderer
   */
  protected XYMultipleSeriesRenderer buildRenderer(int[] colors, PointStyle[] styles) {
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    renderer.setAxisTitleTextSize(25);
    renderer.setChartTitleTextSize(25);
    renderer.setLabelsTextSize(25);
    renderer.setLegendTextSize(25);
    renderer.setPointSize(10f);

    renderer.setBackgroundColor(ColorUtil.BLACK);
    renderer.setApplyBackgroundColor(true);

    renderer.setMargins(new int[] {20, 30, 15, 20});

    for (int i = 0; i < colors.length; i++) {
      renderer.addSeriesRenderer(getXYSeriesRenderer(colors[i], styles[i]));
    }

    return renderer;
  }
Example #2
0
  /**
   * Builds a bar multiple series renderer to use the provided colors.
   *
   * @param colors the series renderers colors
   * @return the bar multiple series renderer
   */
  protected XYMultipleSeriesRenderer buildBarRenderer(int[] colors) {
    XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
    renderer.setAxisTitleTextSize(25);
    renderer.setChartTitleTextSize(25);
    renderer.setLabelsTextSize(25);
    renderer.setLegendTextSize(25);

    renderer.setBackgroundColor(ColorUtil.BLACK);
    renderer.setApplyBackgroundColor(true);

    int length = colors.length;

    for (int i = 0; i < length; i++) {
      XYSeriesRenderer r = new XYSeriesRenderer();
      r.setColor(colors[i]);
      renderer.addSeriesRenderer(r);
    }

    return renderer;
  }