@Test public void generateXticks() { Chart<Object, Number> chart = new Chart<>(); Series<Object, Number> series1 = new Series<>(); series1.addPoint("XYZ", 123); series1.addPoint("ABC", 112); chart.addSeries(series1); Series<Object, Number> series2 = new Series<>(); series2.addPoint("XYZ", 223); chart.addSeries(series2); List<Object[]> xticks = flotXticksGenerator.generateXticks(chart); assertNotNull(xticks); assertEquals(2, xticks.size()); assertEquals(0, xticks.get(0)[0]); assertEquals("XYZ", xticks.get(0)[1]); assertEquals(1, xticks.get(1)[0]); assertEquals("ABC", xticks.get(1)[1]); }
public List<Object[]> generateXticks(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); List<Object[]> xticks = Lists.newArrayList(); if (CollectionUtils.isEmpty(chart.getSeriesList())) { return xticks; } Series<?, Number> series = chart.getSeriesList().get(0); if (series == null) { return xticks; } for (int i=0; i < series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); xticks.add(new Object[] {i, point.getX()}); } return xticks; }
FlotXticksGenerator { public List<Object[]> generateXticks(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); List<Object[]> xticks = Lists.newArrayList(); if (CollectionUtils.isEmpty(chart.getSeriesList())) { return xticks; } Series<?, Number> series = chart.getSeriesList().get(0); if (series == null) { return xticks; } for (int i=0; i < series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); xticks.add(new Object[] {i, point.getX()}); } return xticks; } }
FlotXticksGenerator { public List<Object[]> generateXticks(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); List<Object[]> xticks = Lists.newArrayList(); if (CollectionUtils.isEmpty(chart.getSeriesList())) { return xticks; } Series<?, Number> series = chart.getSeriesList().get(0); if (series == null) { return xticks; } for (int i=0; i < series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); xticks.add(new Object[] {i, point.getX()}); } return xticks; }  }
FlotXticksGenerator { public List<Object[]> generateXticks(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); List<Object[]> xticks = Lists.newArrayList(); if (CollectionUtils.isEmpty(chart.getSeriesList())) { return xticks; } Series<?, Number> series = chart.getSeriesList().get(0); if (series == null) { return xticks; } for (int i=0; i < series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); xticks.add(new Object[] {i, point.getX()}); } return xticks; }  List<Object[]> generateXticks(Chart<?, Number> chart); }
FlotXticksGenerator { public List<Object[]> generateXticks(Chart<?, Number> chart) { Preconditions.checkNotNull(chart); List<Object[]> xticks = Lists.newArrayList(); if (CollectionUtils.isEmpty(chart.getSeriesList())) { return xticks; } Series<?, Number> series = chart.getSeriesList().get(0); if (series == null) { return xticks; } for (int i=0; i < series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); xticks.add(new Object[] {i, point.getX()}); } return xticks; }  List<Object[]> generateXticks(Chart<?, Number> chart);  }