public PieChartModel getLivePieModel() {
    int random1 = (int) (Math.random() * 1000);
    int random2 = (int) (Math.random() * 1000);

    liveChartModel.getData().put("Candidate 1", random1);
    liveChartModel.getData().put("Candidate 2", random2);
    liveChartModel.setLegendPosition("w");
    liveChartModel.setShowDataLabels(true);

    return liveChartModel;
  }
示例#2
0
 public void createChartModelByPlace() {
   chartModelByPlace = new PieChartModel();
   for (Report rp : repByPlaceList) {
     System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n\n" + rp);
     chartModelByPlace.set(rp.getOrigin() + "-" + rp.getDestination(), rp.getTotal());
   }
 }
  private PieChartModel createPieChartModel() {
    PieChartModel model = new PieChartModel();
    model.setLegendPosition("w");
    model.setShowDataLabels(true);
    model.set("Work", 11);
    model.set("Eat", 2);
    model.set("Commute", 2);
    model.set("Watch TV", 2);
    model.set("Sleep", 7);

    return model;
  }