Search in sources :

Example 1 with SimpleChartData

use of com.sohu.cache.web.chart.model.SimpleChartData in project cachecloud by sohutv.

the class AppController method assembleJson.

private String assembleJson(List<AppCommandStats> appCommandStatsList, Integer addDay) {
    if (appCommandStatsList == null || appCommandStatsList.isEmpty()) {
        return "[]";
    }
    List<SimpleChartData> list = new ArrayList<SimpleChartData>();
    for (AppCommandStats stat : appCommandStatsList) {
        try {
            SimpleChartData chartData = SimpleChartData.getFromAppCommandStats(stat, addDay);
            list.add(chartData);
        } catch (ParseException e) {
            logger.info(e.getMessage(), e);
        }
    }
    JSONArray jsonArray = JSONArray.fromObject(list);
    return jsonArray.toString();
}
Also used : ArrayList(java.util.ArrayList) JSONArray(net.sf.json.JSONArray) SimpleChartData(com.sohu.cache.web.chart.model.SimpleChartData) ParseException(java.text.ParseException)

Example 2 with SimpleChartData

use of com.sohu.cache.web.chart.model.SimpleChartData in project cachecloud by sohutv.

the class AppController method assembleAppStatsJson.

/**
     * AppStats列表组装成json串
     */
private String assembleAppStatsJson(List<AppStats> appStats, String statName) {
    if (appStats == null || appStats.isEmpty()) {
        return "[]";
    }
    List<SimpleChartData> list = new ArrayList<SimpleChartData>();
    for (AppStats stat : appStats) {
        try {
            SimpleChartData chartData = SimpleChartData.getFromAppStats(stat, statName);
            list.add(chartData);
        } catch (ParseException e) {
            logger.info(e.getMessage(), e);
        }
    }
    JSONArray jsonArray = JSONArray.fromObject(list);
    return jsonArray.toString();
}
Also used : ArrayList(java.util.ArrayList) JSONArray(net.sf.json.JSONArray) SimpleChartData(com.sohu.cache.web.chart.model.SimpleChartData) ParseException(java.text.ParseException)

Example 3 with SimpleChartData

use of com.sohu.cache.web.chart.model.SimpleChartData in project cachecloud by sohutv.

the class AppController method assembleGroupJson.

/**
     * AppCommandGroup列表组装成json串
     */
private String assembleGroupJson(List<AppCommandGroup> appCommandGroupList) {
    if (appCommandGroupList == null || appCommandGroupList.isEmpty()) {
        return "[]";
    }
    List<SimpleChartData> list = new ArrayList<SimpleChartData>();
    for (AppCommandGroup appCommandGroup : appCommandGroupList) {
        SimpleChartData chartData = SimpleChartData.getFromAppCommandGroup(appCommandGroup);
        list.add(chartData);
    }
    JSONArray jsonArray = JSONArray.fromObject(list);
    return jsonArray.toString();
}
Also used : ArrayList(java.util.ArrayList) JSONArray(net.sf.json.JSONArray) SimpleChartData(com.sohu.cache.web.chart.model.SimpleChartData)

Aggregations

SimpleChartData (com.sohu.cache.web.chart.model.SimpleChartData)3 ArrayList (java.util.ArrayList)3 JSONArray (net.sf.json.JSONArray)3 ParseException (java.text.ParseException)2