/**
   * @param dowCountMap
   * @param perDayCountMap
   * @param dowCategory
   * @param dateCategory
   * @param roamingTrend
   */
  private void populateRoamerCountChart(
      final Map<RoamerType, Map<DayOfWeek, Double>> dowCountMap,
      final Map<RoamerType, Map<Long, Double>> perDayCountMap,
      final Set<DayOfWeek> dowCategory,
      final Set<Long> dateCategory,
      final RoamingTrend roamingTrend,
      final long startDate) {

    final List<ChartSeries> dowCountSeriesList = new ArrayList<ChartSeries>();
    for (final RoamerType roamerType : dowCountMap.keySet()) {
      final ChartSeries series = new ChartSeries();
      series.setName(roamerType.getDisplayName());
      series.setData(dowCountMap.get(roamerType).values());
      dowCountSeriesList.add(series);
    }

    final List<ChartSeries> perDayCountSeriesList = new ArrayList<ChartSeries>();
    for (final RoamerType roamerType : perDayCountMap.keySet()) {
      final PerDaySeries series = new PerDaySeries();
      series.setName(roamerType.getDisplayName());
      series.setPointStart(startDate);
      series.setData(perDayCountMap.get(roamerType).values());
      perDayCountSeriesList.add(series);
    }

    final RoamingTrendChart roamerCountChart = new RoamingTrendChart();
    roamerCountChart.setDowCategoryList(dowCategory);
    // roamerCountChart.setPerDayCategoryList(dateCategory);
    roamerCountChart.setDowSeriesList(dowCountSeriesList);
    roamerCountChart.setPerDaySeriesList(perDayCountSeriesList);
    roamingTrend.setRoamersCountChart(roamerCountChart);
  }
  /**
   * @param dowCallMap
   * @param perDayCallMap
   * @param dowCategory
   * @param dateCategory
   * @param roamingTrend
   */
  private void populateVoiceCallChart(
      final Map<VoiceType, Map<DayOfWeek, Double>> dowCallMap,
      final Map<VoiceType, Map<Long, Double>> perDayCallMap,
      final Set<DayOfWeek> dowCategory,
      final Set<Long> dateCategory,
      final RoamingTrend roamingTrend,
      final long startDate) {
    final List<ChartSeries> dowCallSeriesList = new ArrayList<ChartSeries>();
    for (final VoiceType voiceType : dowCallMap.keySet()) {
      final ChartSeries series = new ChartSeries();
      series.setName(voiceType.name());
      series.setData(dowCallMap.get(voiceType).values());
      dowCallSeriesList.add(series);
    }

    final List<ChartSeries> perDayCallSeriesList = new ArrayList<ChartSeries>();
    for (final VoiceType voiceType : perDayCallMap.keySet()) {
      final PerDaySeries series = new PerDaySeries();
      series.setName(voiceType.name());
      series.setPointStart(startDate);
      series.setData(perDayCallMap.get(voiceType).values());
      perDayCallSeriesList.add(series);
    }

    final RoamingTrendChart voiceChart = new RoamingTrendChart();
    voiceChart.setDowCategoryList(dowCategory);
    // voiceChart.setPerDayCategoryList(dateCategory);
    voiceChart.setDowSeriesList(dowCallSeriesList);
    voiceChart.setPerDaySeriesList(perDayCallSeriesList);
    roamingTrend.setRoamersMTMOChart(voiceChart);
  }
  /**
   * @param dowCallMap
   * @param perDayCallMap
   * @param dowCategory
   * @param dateCategory
   * @param roamingTrend
   */
  private void populateDataChart(
      final Map<DayOfWeek, Double> dowDataMap,
      final Map<Long, Double> perDayDataMap,
      final Set<DayOfWeek> dowCategory,
      final Set<Long> dateCategory,
      final RoamingTrend roamingTrend,
      final long startDate) {

    final List<ChartSeries> dowDataSeriesList = new ArrayList<ChartSeries>();

    if (!dowDataMap.values().isEmpty()) {
      final ChartSeries dowSeries = new ChartSeries();
      dowSeries.setName("Data");
      dowSeries.setShowInLegend(false);
      dowSeries.setData(dowDataMap.values());
      dowDataSeriesList.add(dowSeries);
    }
    final List<ChartSeries> perDayDataSeriesList = new ArrayList<ChartSeries>();
    if (!perDayDataMap.values().isEmpty()) {
      final PerDaySeries dateSeries = new PerDaySeries();
      dateSeries.setName("Data");
      dateSeries.setShowInLegend(false);
      dateSeries.setData(perDayDataMap.values());
      dateSeries.setPointStart(startDate);
      perDayDataSeriesList.add(dateSeries);
    }

    final RoamingTrendChart dataChart = new RoamingTrendChart();
    dataChart.setDowCategoryList(dowCategory);
    // dataChart.setPerDayCategoryList(dateCategory);
    dataChart.setDowSeriesList(dowDataSeriesList);
    dataChart.setPerDaySeriesList(perDayDataSeriesList);
    roamingTrend.setRoamersDataChart(dataChart);
  }
Beispiel #4
0
  private JFreeChart makeChart() throws KeyedException {

    if (chartSeries.size() == 0) throw new IllegalStateException("addChartSeries() not called");

    if (range == null) {
      for (ChartSeries s : chartSeries) {
        if (range == null) range = s.getTimeSeries().getRange();
        else range = range.union(s.getTimeSeries().getRange());
      }
    }

    // use number axis for dates, with special formatter
    DateAxis dateAxis = new DateAxis();
    dateAxis.setDateFormatOverride(new CustomDateFormat("M/d/y"));
    if (range.getTimeDomain().getLabel().equals("workweek"))
      dateAxis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());

    // combined plot with shared date axis
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(dateAxis);

    for (ChartSeries s : chartSeries) {
      makeSubPlot(plot, s);
    }

    // make the chart, remove the legend, set the title
    JFreeChart chart = new JFreeChart(plot);
    if (!withLegend) chart.removeLegend();
    chart.setBackgroundPaint(Color.white);
    chart.setTitle(new TextTitle(title));

    return chart;
  }
  private BarChartModel createBarModel() {
    BarChartModel model = new BarChartModel();
    ChartSeries sales = new ChartSeries();
    sales.setLabel("Sales");
    sales.set(2004, 1000);
    sales.set(2005, 1170);
    sales.set(2006, 660);
    sales.set(2007, 1030);

    ChartSeries expenses = new ChartSeries();
    expenses.setLabel("Expenses");
    expenses.set("2004", 400);
    expenses.set("2005", 460);
    expenses.set("2006", 1120);
    expenses.set("2007", 540);

    model.addSeries(sales);
    model.addSeries(expenses);
    model.setTitle("Company Performance");

    return model;
  }
  private void createHorizontalVentasModel() {
    horizontalBarModel = new HorizontalBarChartModel();

    for (ReporteMueble item : reporte.getInformeMuebles()) {
      ChartSeries muebles = new ChartSeries();
      muebles.setLabel(item.getNombre());
      muebles.set("Tipos", item.getCantidad());
      horizontalBarModel.addSeries(muebles);
    }

    horizontalBarModel.setTitle("Ventas por Mueble");
    horizontalBarModel.setLegendPosition("e");
    horizontalBarModel.setZoom(true);
    horizontalBarModel.setAnimate(true);

    Axis xAxis = horizontalBarModel.getAxis(AxisType.X);
    xAxis.setLabel("Ventas");
    xAxis.setMin(0);

    Axis yAxis = horizontalBarModel.getAxis(AxisType.Y);
    //
  }
  private BarChartModel initBarModel() {
    BarChartModel model = new BarChartModel();

    ChartSeries mueblesI = new ChartSeries();
    ChartSeries mueblesE = new ChartSeries();

    mueblesI.setLabel("Muebles Interior");
    mueblesE.setLabel("Muebles Exterior");

    for (InformeDiario item : reporte.getInformeDiarios()) {
      mueblesI.set(sdf.format(item.getFecha().getTime()), item.getMueblesInterior());
      mueblesE.set(sdf.format(item.getFecha().getTime()), item.getMueblesExterior());
    }

    model.addSeries(mueblesI);
    model.addSeries(mueblesE);

    return model;
  }
Beispiel #8
0
 private void makeSubPlot(CombinedDomainXYPlot container, ChartSeries series)
     throws KeyedException {
   int index = series.getSubPlotIndex();
   int nextDatasetOffset = 0;
   XYPlot plot = null;
   try {
     if (index > 0) {
       plot = (XYPlot) container.getSubplots().get(index - 1);
       nextDatasetOffset = plot.getDatasetCount();
     }
   } catch (Exception e) {
     throw K.CHART_SUBPLOT_ERR.exception(e, index);
   }
   if (plot == null) plot = series.isLine() ? getLinePlot() : getBarPlot();
   XYItemRenderer renderer = series.isLine() ? getLineRenderer() : getBarRenderer();
   plot.setRenderer(nextDatasetOffset, renderer);
   plot.setDataset(nextDatasetOffset, getDataset(series.getTimeSeries(), series.getName()));
   if (index < 1) container.add(plot, series.getWeight());
 }