Problem when recreating LineChartModel

1

Good morning. I am trying to recreate a LineChartModel and I can not get it to appear. The data is saved well in dateModel.addSeries (series). It also gives me no type of error.

If I try the primefaces page example it works fine, but compared to mine, I do not see differences in the obtaining of values.

I leave my code:

private void createDateModel() {
    dateModel = new LineChartModel();
    LineChartSeries series = new LineChartSeries();
    series.setLabel("Series");

    List<Coupon> cupon = cuponBean.cuponesPorDia();
    List<Long> cuponCount = cuponBean.cuponesPorDiaCount();
    for (int i = 0; i < cupon.size(); i++){
        Date fecha = cupon.get(i).getPurchaseDatetime();
        SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
        String fechaFormateada = sdf.format(fecha);
        int numeroCupones = Integer.parseInt(cuponCount.get(i).toString());
        series.set(fechaFormateada,numeroCupones);
    }
    dateModel.addSeries(series);         
    dateModel.setTitle("Zoom for Details");
    dateModel.setZoom(true);
    dateModel.getAxis(AxisType.Y).setLabel("Values");
    DateAxis axis = new DateAxis("Dates");
    axis.setTickAngle(-50);
    axis.setMax("2017-11-29");
    axis.setTickFormat("%b %#d, %y");
    dateModel.getAxes().put(AxisType.X, axis);
}
    
asked by Chosbuster 28.11.2017 в 14:57
source

1 answer

0

Novice failure (facepalm). The problem was in SimpleDateFormat ("dd / M / yyyy"). changing it to SimpleDateFormat ("yyyy-MM-dd") already works

    
answered by 28.11.2017 в 15:09