private void createDateClienteModel() {
    dateClienteModel = new LineChartModel();
    LineChartSeries mueblesI = new LineChartSeries();
    LineChartSeries mueblesE = new LineChartSeries();

    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());
    }

    dateClienteModel.addSeries(mueblesI);
    dateClienteModel.addSeries(mueblesE);

    dateClienteModel.setTitle("Reporte Diario");
    dateClienteModel.setZoom(true);
    dateClienteModel.setAnimate(true);
    dateClienteModel.getAxis(AxisType.Y).setLabel("Muebles");
    dateClienteModel.getAxis(AxisType.Y).setMin(0);
    DateAxis axis = new DateAxis("Fechas");
    dateClienteModel.setLegendPosition("e");
    dateClienteModel.setShowPointLabels(true);
    axis.setTickAngle(-50);

    dateClienteModel.getAxes().put(AxisType.X, axis);
  }
Example #2
0
  public void displayLocation() {
    pokupiPodatke();
    dateModel = new LineChartModel();

    dateModel.setExtender("chartExtender");
    dateModel.setZoom(true);
    dateModel.getAxis(AxisType.Y).setLabel("Values");

    for (ProgramMjerenja pm : selektiraniPodaci.keySet()) {
      List<Podatak> podaci = selektiraniPodaci.get(pm);

      LineChartSeries series1 = new LineChartSeries();
      series1.setLabel(pm.getKomponentaId().getNaziv());
      for (Podatak p : podaci) {
        if (p.getObuhvat() > 74) {
          series1.set(sdf.format(p.getVrijeme()), p.getVrijednost());
        }
      }
      //            series1.setMarkerStyle("circle");
      dateModel.addSeries(series1);
    }
    DateAxis axis = new DateAxis("Dates");
    axis.setTickAngle(-50);
    axis.setMin(sdf.format(d1));
    axis.setMax(sdf.format(d2));
    axis.setTickFormat("%m. %d. %H:%M");
    dateModel.getAxes().put(AxisType.X, axis);
    dateModel.setLegendPosition("ne");
  }
  private void createDateModel() {
    System.out.println("INICIA HISTORIAL");
    dateModel = new LineChartModel();
    LineChartSeries series1 = new LineChartSeries();
    series1.setLabel("Historial");

    for (int i = 0; i < histrorial.size(); i++) {
      String fecha =
          String.valueOf(histrorial.get(i).getFechaMedicion().getYear() + 1900)
              + "-"
              + String.valueOf(histrorial.get(i).getFechaMedicion().getMonth() + 1)
              + "-"
              + String.valueOf(histrorial.get(i).getFechaMedicion().getDate());
      series1.set(fecha, histrorial.get(i).getValor());
    }

    dateModel.addSeries(series1);

    dateModel.setTitle("HISTORIAL");
    dateModel.setZoom(true);
    dateModel.getAxis(AxisType.Y).setLabel("VALOR");
    DateAxis axis = new DateAxis("FECHA");
    axis.setTickAngle(-50);
    String fecha =
        String.valueOf(new Date().getYear() + 1900)
            + "-"
            + String.valueOf(new Date().getMonth() + 1)
            + "-"
            + String.valueOf(new Date().getDate());
    System.out.println("FECHA LIMITE " + fecha);
    axis.setMax(fecha);
    axis.setTickFormat("%#d %b, %y");

    dateModel.getAxes().put(AxisType.X, axis);
  }