/** * 2D栏位组合图初始化 组合图和前面的单一图使用的元数据格式是不一样的,请大家注意它们的区别 * * @param * @return */ public ActionForward fcf2DBarMsInit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // 实例化一个图形配置对象 GraphConfig graphConfig = new GraphConfig(); // 主标题 graphConfig.setCaption("Google软件2010年月度销售业绩图表"); // 设置数字值的前缀 graphConfig.setNumberPrefix("$"); // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节 // graphConfig.put("propertyName", "value"); graphConfig.setCanvasBorderThickness(new Boolean(true)); // 实例化组合种类配置对象 CategoriesConfig categoriesConfig = new CategoriesConfig(); List cateList = new ArrayList(); cateList.add(new Categorie("一月")); cateList.add(new Categorie("二月")); cateList.add(new Categorie("三月")); cateList.add(new Categorie("四月")); cateList.add(new Categorie("五月")); cateList.add(new Categorie("六月")); categoriesConfig.setCategories(cateList); List list = getFcfDataList4Group(new BaseDto()); String xmlString = FcfDataMapper.toFcfXmlData(list, graphConfig, categoriesConfig); request.setAttribute("xmlString", xmlString); return mapping.findForward("2dBarMsView"); }
/** * 折线组合图初始化(双Y轴) * * @param * @return */ public ActionForward fcfLineMs2YInit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // 实例化一个图形配置对象 GraphConfig graphConfig = new GraphConfig(); // 主标题 graphConfig.setCaption("Google软件2010年月度销售业绩图表"); // 设置数字值的前缀 // graphConfig.setNumberPrefix("$"); // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节 // graphConfig.put("propertyName", "value"); // 主Y轴坐标名 graphConfig.put("PYAxisName", "Product A"); // 不支持中文 // 次Y轴坐标名 graphConfig.put("SYAxisName", "Product B"); // 不支持中文 graphConfig.setCanvasBorderThickness(new Boolean(true)); graphConfig.setShowValues(new Boolean(false)); // 是否格式化数字,默认为1(True),自动的给你的数字加上K(千)或M(百万);若取0,则不加K或M graphConfig.put("formatNumberScale ", "0"); // 实例化组合种类配置对象 CategoriesConfig categoriesConfig = new CategoriesConfig(); List cateList = new ArrayList(); cateList.add(new Categorie("一月")); cateList.add(new Categorie("二月")); cateList.add(new Categorie("三月")); cateList.add(new Categorie("四月")); cateList.add(new Categorie("五月")); cateList.add(new Categorie("六月")); cateList.add(new Categorie("七月")); cateList.add(new Categorie("八月")); cateList.add(new Categorie("九月")); cateList.add(new Categorie("十月")); cateList.add(new Categorie("十一月")); cateList.add(new Categorie("十二月")); categoriesConfig.setCategories(cateList); List list = getFcfDataList4LineGroup42Y(new BaseDto()); String xmlString = FcfDataMapper.toFcfXmlData(list, graphConfig, categoriesConfig); request.setAttribute("xmlString", xmlString); System.out.println(xmlString); return mapping.findForward("lineMs2YView"); }