Package com.dianping.cat.report.page

Examples of com.dianping.cat.report.page.PieChart$Item


    vistor.visitTransactionReport(transactionReport);
    return vistor.getCacheReport();
  }

  private String buildPieChart(CacheReport report) {
    PieChart chart = new PieChart();
    List<Item> items = new ArrayList<Item>();
    List<CacheNameItem> nameItems = report.getNameItems();

    for (CacheNameItem cacheItem : nameItems) {
      String name = cacheItem.getName().getId();

      if (name.endsWith(":get") || name.endsWith(":mGet")) {
        items.add(new Item().setTitle(name).setNumber(cacheItem.getName().getTotalCount()));
      }
    }
    chart.addItems(items);
    return chart.getJsonString();
  }
View Full Code Here


    return buildChartData(datas, type);
  }

  public Pair<PieChart, List<PieChartDetailInfo>> buildPieChart(QueryEntity entity, AppDataGroupByField field) {
    List<PieChartDetailInfo> infos = new LinkedList<PieChartDetailInfo>();
    PieChart pieChart = new PieChart().setMaxSize(Integer.MAX_VALUE);
    List<Item> items = new ArrayList<Item>();
    List<AppDataCommand> datas = m_appDataService.queryAppDataCommandsByField(entity, field);

    for (AppDataCommand data : datas) {
      Pair<Integer, Item> pair = buildPieChartItem(entity.getCommand(), data, field);
      Item item = pair.getValue();
      PieChartDetailInfo info = new PieChartDetailInfo();

      info.setId(pair.getKey()).setTitle(item.getTitle()).setRequestSum(item.getNumber());
      infos.add(info);
      items.add(item);
    }
    pieChart.setTitle(field.getName() + "访问情况");
    pieChart.addItems(items);
    updatePieChartDetailInfo(infos);

    return new Pair<PieChart, List<PieChartDetailInfo>>(pieChart, infos);
  }
View Full Code Here

      model.setGraph4(graph4);
    }
  }

  private void buildTransactionNamePieChart(List<TransactionNameModel> names, Model model) {
    PieChart chart = new PieChart();
    List<Item> items = new ArrayList<Item>();

    for (int i = 1; i < names.size(); i++) {
      TransactionNameModel name = names.get(i);
      Item item = new Item();
      TransactionName transaction = name.getDetail();
      item.setNumber(transaction.getTotalCount()).setTitle(transaction.getId());
      items.add(item);
    }

    chart.addItems(items);
    model.setPieChart(new JsonBuilder().toJson(chart));
  }
View Full Code Here

  private List<PieChart> buildDetailPieChart(MetricReport report) {
    Map<String, Statistic> statics = report.getStatistics();
    List<PieChart> charts = new ArrayList<PieChart>();

    for (Entry<String, Statistic> entry : statics.entrySet()) {
      PieChart chart = new PieChart().setMaxSize(Integer.MAX_VALUE);
      List<Item> items = new ArrayList<Item>();
      Statistic values = entry.getValue();
      Map<String, StatisticsItem> statisticsItems = values.getStatisticsItems();

      for (StatisticsItem tmp : statisticsItems.values()) {
        Item item = new Item();

        item.setNumber(tmp.getCount());
        item.setTitle(tmp.getId());
        items.add(item);
      }
      chart.setTitle(entry.getKey());
      chart.addItems(items);
      charts.add(chart);
    }
    return charts;
  }
View Full Code Here

        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);
View Full Code Here

      model.setGraph2(graph2);
    }
  }

  private void buildEventNamePieChart(List<EventNameModel> names, Model model) {
    PieChart chart = new PieChart();
    List<Item> items = new ArrayList<Item>();

    for (int i = 1; i < names.size(); i++) {
      EventNameModel name = names.get(i);
      Item item = new Item();
      EventName event = name.getDetail();
      item.setNumber(event.getTotalCount()).setTitle(event.getId());
      items.add(item);
    }

    chart.addItems(items);
    model.setPieChart(new JsonBuilder().toJson(chart));
  }
View Full Code Here

    m_type = type;
    m_status = status;
  }

  public PieChart getPieChart() {
    PieChart chart = new PieChart();
    List<Item> items = new ArrayList<Item>();

    for (java.util.Map.Entry<String, Integer> entry : m_items.entrySet()) {
      Item item = new Item();

      item.setNumber(entry.getValue()).setTitle(entry.getKey());
      items.add(item);
    }
    chart.addItems(items);
   
    return chart;
  }
View Full Code Here

    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue());
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here

    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List<Item> itemList = new ArrayList<Item>();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

  public Item createShoppingItem(String itemName, String itemDesc,
      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
    Money money = createMoney(unitPrice, currency);
    Item item = _objectFact.createItem();
    item.setItemName(itemName);
    item.setItemDescription(itemDesc);
    item.setQuantity(quantity);
    item.setUnitPrice(money);

    if (taxTableSelector != null) {
      item.setTaxTableSelector(taxTableSelector);
    }
   
    if (privateItemData != null) {
      AnyType anyType = _objectFact.createAnyType();
      anyType.setAny(privateItemData);
      item.setMerchantPrivateItemData(anyType);
    }
   
    return item;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.page.PieChart$Item

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.