Example #1
0
  /**
   * 获取FlashReport元数据 (柱状组合图)
   *
   * @param pDto
   * @return
   */
  private List getFcfDataList4Group(Dto pDto) {
    pDto.put("fcfid", "6");
    List dataList = new ArrayList();
    DataSet dataSet1 = new DataSet();
    dataSet1.setSeriesname("产品A");
    dataSet1.setColor("FDC12E");
    pDto.put("product", "1");
    List alist = alist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List aSetList = new ArrayList();
    for (int i = 0; i < alist.size(); i++) {
      Dto dto = (BaseDto) alist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      aSetList.add(set);
    }
    dataSet1.setData(aSetList);
    dataList.add(dataSet1);

    DataSet dataSet2 = new DataSet();
    dataSet2.setSeriesname("产品B");
    dataSet2.setColor("56B9F9");
    pDto.put("product", "2");
    List blist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List bSetList = new ArrayList();
    for (int i = 0; i < blist.size(); i++) {
      Dto dto = (BaseDto) blist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      bSetList.add(set);
    }
    dataSet2.setData(bSetList);
    dataList.add(dataSet2);
    return dataList;
  }
Example #2
0
 /**
  * FCF 3D柱状图初始化
  *
  * @param
  * @return
  */
 public ActionForward fcf3DColumnInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表");
   // 设置数字值的前缀
   graphConfig.setNumberPrefix("$");
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   Dto qDto = new BaseDto();
   qDto.put("product", "1");
   // 查询原始数据
   List list = g4Reader.queryForList("Demo.getFcfDataList", qDto);
   List dataList = new ArrayList();
   // 将原始数据对象转换为框架封装的Set报表数据对象
   for (int i = 0; i < list.size(); i++) {
     Dto dto = (BaseDto) list.get(i);
     // 实例化一个图表元数据对象
     Set set = new Set();
     set.setName(dto.getAsString("name")); // 名称
     set.setValue(dto.getAsString("value")); // 数据值
     set.setColor(dto.getAsString("color")); // 柱状图颜色
     dataList.add(set);
   }
   // 将图表数据转为Flash能解析的XML资料格式
   String xmlString = FcfDataMapper.toFcfXmlData(dataList, graphConfig);
   // 此Key对应的<flashReport />标签的datavar属性
   request.setAttribute("xmlString", xmlString);
   return mapping.findForward("3dColumnView");
 }
Example #3
0
 /**
  * FCF 面积图初始化
  *
  * @param
  * @return
  */
 public ActionForward fcfAreaInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表");
   // 设置数字值的前缀
   graphConfig.setNumberPrefix("$");
   // graphConfig.setShowValues(true);
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   // 设置水平分割线的颜色
   graphConfig.put("divLineColor", "008ED6");
   // 设置水平分割线的透明度
   graphConfig.put("divLineAlpha", "10");
   // 设置对水平分割区域使用斑马纹
   graphConfig.put("showAlternateHGridColor", "1");
   // 设置斑马纹颜色
   graphConfig.put("AlternateHGridColor", "BFFFFF");
   // 设置斑马纹的透明度
   graphConfig.put("alternateHGridAlpha", "10");
   // graphConfig.put("areaAlpha", "60");
   // graphConfig.put("areaBorderColor", "441570");
   Dto qDto = new BaseDto();
   qDto.put("product", "1");
   // 查询原始数据
   List list = g4Reader.queryForList("Demo.getFcfDataList", qDto);
   List dataList = new ArrayList();
   // 将原始数据对象转换为框架封装的Set报表数据对象
   for (int i = 0; i < list.size(); i++) {
     Dto dto = (BaseDto) list.get(i);
     // 实例化一个图表元数据对象
     Set set = new Set();
     set.setName(dto.getAsString("name")); // 名称
     set.setValue(dto.getAsString("value")); // 数据值
     // set.setColor(dto.getAsString("color"));
     dataList.add(set);
   }
   // 将图表数据转为Flash能解析的XML资料格式
   String xmlString = FcfDataMapper.toFcfXmlData(dataList, graphConfig);
   // 此Key对应的<flashReport />标签的datavar属性
   request.setAttribute("xmlString", xmlString);
   return mapping.findForward("areaView");
 }
Example #4
0
 /**
  * 查询数据报表XML格式串
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public ActionForward queryReportXmlDatas(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   CommonActionForm aForm = (CommonActionForm) form;
   Dto dto = aForm.getParamAsDto(request);
   String product = "(产品一)";
   if (dto.getAsString("product").equals("2")) {
     product = "(产品二)";
   }
   List list = g4Reader.queryForList("Demo.getFcfDataList", dto);
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表" + product);
   // X坐标轴名称
   graphConfig.setXAxisName("月度");
   // 数字值前缀
   graphConfig.setNumberPrefix("$");
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《G4Studio开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   List dataList = new ArrayList();
   // 将原始数据对象转换为框架封装的Set报表数据对象
   for (int i = 0; i < list.size(); i++) {
     Dto dto1 = (BaseDto) list.get(i);
     // 实例化一个图表元数据对象
     Set set = new Set();
     set.setName(dto1.getAsString("name")); // 名称
     set.setValue(dto1.getAsString("value")); // 数据值
     set.setColor(dto1.getAsString("color")); // 柱状图颜色
     dataList.add(set);
   }
   // 将图表数据转为Flash能解析的XML资料格式
   String xmlString = FcfDataMapper.toFcfXmlData(dataList, graphConfig);
   Dto outDto = new BaseDto();
   outDto.put("success", new Boolean(true));
   outDto.put("xmlstring", xmlString);
   write(JsonHelper.encodeObject2Json(outDto), response);
   return mapping.findForward(null);
 }
Example #5
0
  /**
   * 获取FlashReport元数据 (折线组合图)(双Y轴)
   *
   * @param pDto
   * @return
   */
  private List getFcfDataList4LineGroup42Y(Dto pDto) {
    pDto.put("fcfid", "12");
    List dataList = new ArrayList();
    DataSet dataSet1 = new DataSet();
    dataSet1.setSeriesname("产品A");
    dataSet1.setColor("FDC12E");
    dataSet1.setParentYAxis(G4Constants.REPORT2Y_FIRST);
    dataSet1.setRenderAs("Line");
    pDto.put("product", "1");
    List alist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List aSetList = new ArrayList();
    for (int i = 0; i < alist.size(); i++) {
      Dto dto = (BaseDto) alist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      aSetList.add(set);
    }
    dataSet1.setData(aSetList);
    dataList.add(dataSet1);

    DataSet dataSet2 = new DataSet();
    dataSet2.setSeriesname("产品B");
    dataSet2.setColor("44BC2F");
    dataSet2.setParentYAxis(G4Constants.REPORT2Y_SECOND);
    pDto.put("product", "2");
    List blist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List bSetList = new ArrayList();
    for (int i = 0; i < blist.size(); i++) {
      Dto dto = (BaseDto) blist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      bSetList.add(set);
    }
    dataSet2.setData(bSetList);
    dataList.add(dataSet2);
    return dataList;
  }
Example #6
0
  /**
   * 获取FlashReport元数据 (交叉图)
   *
   * @param pDto
   * @return
   */
  private List getFcfDataList4JCT(Dto pDto) {
    pDto.put("fcfid", "12");
    List dataList = new ArrayList();
    DataSet dataSet1 = new DataSet();
    dataSet1.setSeriesname("产品A");
    dataSet1.setColor("FDC12E");
    dataSet1.setShowValues(new Boolean(false));
    pDto.put("product", "1");
    List alist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    ;
    List aSetList = new ArrayList();
    for (int i = 0; i < alist.size(); i++) {
      Dto dto = (BaseDto) alist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      aSetList.add(set);
    }
    dataSet1.setData(aSetList);
    dataList.add(dataSet1);

    DataSet dataSet2 = new DataSet();
    dataSet2.setSeriesname("产品B");
    dataSet2.setColor("44BC2F");
    dataSet2.setShowValues(new Boolean(false));
    pDto.put("product", "2");
    List blist = blist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List bSetList = new ArrayList();
    for (int i = 0; i < blist.size(); i++) {
      Dto dto = (BaseDto) blist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      bSetList.add(set);
    }
    dataSet2.setData(bSetList);
    dataList.add(dataSet2);

    DataSet dataSet3 = new DataSet();
    dataSet3.setSeriesname("合计");
    dataSet3.setColor("3CBBD7");
    dataSet3.setShowValues(new Boolean(false));
    dataSet3.setParentYAxis(G4Constants.REPORT2Y_SECOND);
    List sumlist = g4Reader.queryForList("Demo.getFcfSumDataList", pDto);
    List sumSetList = new ArrayList();
    for (int i = 0; i < sumlist.size(); i++) {
      Dto dto = (BaseDto) sumlist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      sumSetList.add(set);
    }
    dataSet3.setData(sumSetList);
    dataList.add(dataSet3);
    return dataList;
  }