Vaadin Charts 3: the graph is not displayed when timeline in navigator is l

The graph is not displayed when timeline in navigator is less than the maximum

Please see video
https://youtu.be/hdw5tpny3o4

public class SingleLineSeries {

  private final Collection<UsersMonthTo> avgCaloriesByMonths;

  public SingleLineSeries(Collection<UsersMonthTo> avgCaloriesByMonths) {
    this.avgCaloriesByMonths = avgCaloriesByMonths;
  }

  public String getDescription() { return "Single line chart with timeline"; }

  protected Component getChart() {
    final Chart chart = new Chart();
    chart.setTimeline(true);
    Configuration configuration = chart.getConfiguration();
    configuration.getTitle().setText("AAPL Stock Price");
    DataSeries dataSeries = new DataSeries();

    for(UsersMonthTo avgCaloriesByMonth : avgCaloriesByMonths) {
      DataSeriesItem item = new DataSeriesItem();
      item.setX(Date.from(avgCaloriesByMonth.getDate().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
      item.setY(avgCaloriesByMonth.getAvgCalories());
      dataSeries.add(item);
    }

    configuration.setSeries(dataSeries);
    RangeSelector rangeSelector = new RangeSelector();
    rangeSelector.setSelected(1);
    configuration.setRangeSelector(rangeSelector);
    chart.drawChart(configuration); return chart;
  }
}

Does anyone know how to fix this? Thanks

Hi,

Is it possible that your data is not sorted? Do you get any error message in the browser console?

Regards,

Guille

Hi! Thanks for the hint! Indeed, the data were not sorted))

Great to hear it was that!