Ejemplo n.º 1
0
  @RequestMapping("/ajaxChart.html")
  public String ajaxFill(
      @RequestParam("sym") String param,
      @RequestParam("name") String name,
      ModelMap model,
      HttpServletRequest request,
      HttpSession session,
      HttpServletResponse response)
      throws Exception {
    log.debug("ChartController ");
    List<Document> list = (List<Document>) session.getAttribute("results");
    OutputStream stream = response.getOutputStream();
    response.setContentType("image/jpeg");

    ChartUtilities.writeChartAsJPEG(
        stream,
        ChartUtils.createChart(ChartUtils.sortListDocument(list, param), "BAR", name),
        400,
        300);
    stream.close();

    return null;
  }
Ejemplo n.º 2
0
  @RequestMapping("/ajaxChartGantt.html")
  public String ajaxGantt(
      @RequestParam("sym") String param,
      @RequestParam("name") String name,
      ModelMap model,
      HttpServletRequest request,
      HttpSession session,
      HttpServletResponse response)
      throws Exception {
    log.debug("ChartController ");
    List<Document> list = (List<Document>) session.getAttribute("resultsSingle");
    OutputStream stream = response.getOutputStream();
    response.setContentType("image/jpeg");
    ChartUtilities.writeChartAsJPEG(
        stream, ChartUtils.createGanttChart("Gantt", "Fechas", "Tarea", list), 900, 600);
    stream.close();

    return null;
  }