Package com.dianping.cat.report.page

Examples of com.dianping.cat.report.page.LineChart


    Map<String, LineChart> charts = new LinkedHashMap<String, LineChart>();
    int step = m_dataExtractor.getStep();

    for (Entry<String, Map<String, String>> keyMapEntry : aggregationKeys.entrySet()) {
      String chartTitle = keyMapEntry.getKey();
      LineChart lineChart = new LineChart();
      lineChart.setTitle(chartTitle);
      lineChart.setHtmlTitle(chartTitle);
      lineChart.setId(chartTitle);
      lineChart.setStart(startDate);
      lineChart.setUnit(buildUnit(chartTitle));
      lineChart.setStep(step * TimeHelper.ONE_MINUTE);

      if (keyMapEntry.getValue().entrySet().isEmpty()) {
        lineChart.add("none", buildNoneData(startDate, endDate, 1));
      }

      for (Entry<String, String> ip2MetricKey : keyMapEntry.getValue().entrySet()) {
        String key = ip2MetricKey.getValue();
        String lineTitle = ip2MetricKey.getKey();

        if (dataWithOutFutures.containsKey(key)) {
          Map<Long, Double> all = convertToMap(datas.get(key), startDate, 1);
          Map<Long, Double> current = convertToMap(dataWithOutFutures.get(key), startDate, step);

          addLastMinuteData(current, all, m_lastMinute, endDate);
          convertFlowMetric(lineChart, current, lineTitle);
        } else {
          lineChart.add(lineTitle, buildNoneData(startDate, endDate, 1));
        }
      }
      charts.put(chartTitle, lineChart);
    }
    return charts;
View Full Code Here


    }
  }

  private LineChart buildAvg(List<Map<String, double[]>> datas, Date start, int size, long step, String name,
        String queryType) {
    LineChart item = new LineChart();

    item.setStart(start);
    item.setSize(size);
    item.setStep(step);
    item.setTitle(name + " Response Time (ms)");

    for (Map<String, double[]> data : datas) {
      double[] sum = data.get("sum");
      double[] totalCount = data.get("total_count");
      double[] avg = new double[sum.length];
      for (int i = 0; i < sum.length; i++) {
        if (totalCount[i] > 0) {
          avg[i] = sum[i] / totalCount[i];
        }
      }
      item.addValue(avg);
    }

    item.setSubTitles(buildSubTitle(start, size, step, queryType));
    return item;
  }
View Full Code Here

    return item;
  }

  private LineChart buildFail(List<Map<String, double[]>> datas, Date start, int size, long step, String name,
        String queryType) {
    LineChart item = new LineChart();

    item.setStart(start);
    item.setSize(size);
    item.setStep(step);
    item.setTitle(name + " Error (count)");

    for (Map<String, double[]> data : datas) {
      item.addValue(data.get("failure_count"));
    }
    item.setSubTitles(buildSubTitle(start, size, step, queryType));
    return item;
  }
View Full Code Here

        allDatas = datas;
      } else {
        mergerList(allDatas, datas);
      }
    }
    LineChart item = buildAvg(allDatas, start, size, step, display, queryType);
    model.setResponseTrend(item.getJsonString());

    item = buildTotal(allDatas, start, size, step, display, queryType);
    model.setHitTrend(item.getJsonString());

    item = buildFail(allDatas, start, size, step, display, queryType);
    model.setErrorTrend(item.getJsonString());
  }
View Full Code Here

    return allDatas;
  }

  private LineChart buildTotal(List<Map<String, double[]>> datas, Date start, int size, long step, String name,
        String queryType) {
    LineChart item = new LineChart();

    item.setStart(start);
    item.setSize(size);
    item.setStep(step);
    item.setTitle(name + " Hits (count)");

    for (Map<String, double[]> data : datas) {
      double[] totalCount = data.get("total_count");

      item.addValue(totalCount);
    }

    item.setSubTitles(buildSubTitle(start, size, step, queryType));
    return item;
  }
View Full Code Here

    if (queryType.equalsIgnoreCase("month") || queryType.equalsIgnoreCase("week")) {
      size = (int) ((end.getTime() - start.getTime()) / TimeHelper.ONE_DAY);
      step = TimeHelper.ONE_DAY;
    }
    List<Map<String, double[]>> allDatas = buildLineChartData(start, end, domain, type, name, ip, queryType);
    LineChart item = buildAvg(allDatas, start, size, step, display, queryType);
    model.setResponseTrend(item.getJsonString());

    item = buildTotal(allDatas, start, size, step, display, queryType);
    model.setHitTrend(item.getJsonString());

    item = buildFail(allDatas, start, size, step, display, queryType);
    model.setErrorTrend(item.getJsonString());
  }
View Full Code Here

    return charts;
  }

  public Pair<LineChart, PieChart> buildErrorChartData(final Map<String, double[]> datas, Date startDate,
        Date endDate, final Map<String, double[]> dataWithOutFutures) {
    LineChart lineChart = new LineChart();
    int step = m_dataExtractor.getStep();
    lineChart.setStart(startDate);
    lineChart.setStep(step * TimeHelper.ONE_MINUTE);
    PieChart pieChart = new PieChart();
    List<PieChart.Item> items = new ArrayList<PieChart.Item>();

    pieChart.addItems(items);
    for (Entry<String, double[]> entry : dataWithOutFutures.entrySet()) {
      String key = entry.getKey();
      double[] value = entry.getValue();
      Map<Long, Double> all = convertToMap(datas.get(key), startDate, 1);
      Map<Long, Double> current = convertToMap(dataWithOutFutures.get(key), startDate, step);

      addLastMinuteData(current, all, m_lastMinute, endDate);
      lineChart.setSize(value.length);
      lineChart.add(entry.getKey(), current);

      double sum = computeSum(current);
      items.add(new Item().setTitle(entry.getKey()).setNumber(sum));
    }
    return new Pair<LineChart, PieChart>(lineChart, pieChart);
View Full Code Here

    int step = m_dataExtractor.getStep();

    for (Entry<String, double[]> entry : dataWithOutFutures.entrySet()) {
      String key = entry.getKey();
      double[] value = entry.getValue();
      LineChart lineChart = new LineChart();

      lineChart.setId(key);
      lineChart.setTitle(key);
      lineChart.setStart(startDate);
      lineChart.setSize(value.length);
      lineChart.setStep(step * TimeHelper.ONE_MINUTE);

      Map<Long, Double> all = convertToMap(datas.get(key), startDate, 1);
      Map<Long, Double> current = convertToMap(dataWithOutFutures.get(key), startDate, step);

      addLastMinuteData(current, all, m_lastMinute, endDate);
      lineChart.add(entry.getKey(), current);
      charts.put(key, lineChart);
    }
    return charts;
  }
View Full Code Here

    int step = m_dataExtractor.getStep();

    for (Entry<String, double[]> entry : dataWithOutFutures.entrySet()) {
      String key = entry.getKey();
      double[] value = entry.getValue();
      LineChart lineChart = new LineChart();

      lineChart.setId(key);
      lineChart.setTitle(key);
      lineChart.setStart(startDate);
      lineChart.setSize(value.length);
      lineChart.setStep(step * TimeHelper.ONE_MINUTE);

      Map<Long, Double> all = convertToMap(datas.get(key), startDate, 1);
      Map<Long, Double> current = convertToMap(dataWithOutFutures.get(key), startDate, step);

      addLastMinuteData(current, all, m_lastMinute, endDate);
      lineChart.add(entry.getKey(), current);
      charts.put(key, lineChart);
    }
    return charts;
  }
View Full Code Here

    String type = payload.getType();

    try {
      filterCommands(model, payload.isShowActivity());

      LineChart lineChart = m_appGraphCreator.buildLineChart(linechartEntity1, linechartEntity2, type);
      List<AppDataSpreadInfo> appDataSpreadInfos = m_appDataService.buildAppDataSpreadInfo(linechartEntity1, field);
      Collections.sort(appDataSpreadInfos, new Sorter(sortBy).buildLineChartInfoComparator());

      model.setLineChart(lineChart);
      model.setAppDataSpreadInfos(appDataSpreadInfos);
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.page.LineChart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.