JAVA代码获取柱状图数据

//获取柱状图数据的方法

   public OrderMoneyNumVo getOrderMoneyCount(Integer siteNumber) {
        //柱状图参数实体类
        OrderMoneyNumVo orderMoneyNumVo = new OrderMoneyNumVo();
        ArrayList<String> xData = new ArrayList<>();
        ArrayList<Integer> yData = new ArrayList<>();
        //初始化一个日历对象
        Calendar calendar = Calendar.getInstance();
        int month = 0;
        int numMoney = 0;
        for (int i = 0; i < 12; i++, calendar.add(Calendar.MONTH, -1)) {
            month = calendar.get(Calendar.MONTH) + 1;
            xData.add(String.valueOf(month));
            numMoney = organizationDao.getOrderMoneyByMonth(month, siteNumber);
            yData.add(numMoney);
        }
        //将倒序改为正序
        Collections.reverse(xData);
        Collections.reverse(yData);
        orderMoneyNumVo.setxData(xData);
        orderMoneyNumVo.setyData(yData);
        return orderMoneyNumVo;
    }

    原文作者:SunnyLjs
    原文地址: https://blog.csdn.net/SunnyLjs/article/details/80934704
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞