@Test void shouldCreateToolsChartForMultipleActions() { ToolsTrendChart chart = new ToolsTrendChart(); List<BuildResult<AnalysisBuildResult>> compositeResults = new ArrayList<>(); compositeResults.add(new BuildResult<>(new Build(1), new CompositeBuildResult() .add(createAnalysisBuildResult(CHECK_STYLE, 1), createAnalysisBuildResult(SPOT_BUGS, 3)))); compositeResults.add(new BuildResult<>(new Build(2), new CompositeBuildResult() .add(createAnalysisBuildResult(CHECK_STYLE, 2), createAnalysisBuildResult(SPOT_BUGS, 4)))); LinesChartModel model = chart.create(compositeResults, new ChartModelConfiguration()); verifySeries(model.getSeries().get(0), CHECK_STYLE, 1, 2); verifySeries(model.getSeries().get(1), SPOT_BUGS, 3, 4); assertThatJson(model).node("domainAxisLabels") .isArray().hasSize(2).containsExactly("#1", "#2"); assertThatJson(model).node("series") .isArray().hasSize(2); }
@Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { ToolSeriesBuilder builder = new ToolSeriesBuilder(); LinesDataSet lineModel = builder.createDataSet(configuration, results); LinesChartModel model = new LinesChartModel(); Palette[] colors = Palette.values(); int index = 0; for (String name : lineModel.getDataSetIds()) { LineSeries lineSeries = new LineSeries(name, colors[index++].getNormal(), StackedMode.SEPARATE_LINES, FilledMode.LINES); if (index == colors.length) { index = 0; } lineSeries.addAll(lineModel.getSeries(name)); model.addSeries(lineSeries); } model.setDomainAxisLabels(lineModel.getDomainAxisLabels()); return model; }
ToolsTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { ToolSeriesBuilder builder = new ToolSeriesBuilder(); LinesDataSet lineModel = builder.createDataSet(configuration, results); LinesChartModel model = new LinesChartModel(); Palette[] colors = Palette.values(); int index = 0; for (String name : lineModel.getDataSetIds()) { LineSeries lineSeries = new LineSeries(name, colors[index++].getNormal(), StackedMode.SEPARATE_LINES, FilledMode.LINES); if (index == colors.length) { index = 0; } lineSeries.addAll(lineModel.getSeries(name)); model.addSeries(lineSeries); } model.setDomainAxisLabels(lineModel.getDomainAxisLabels()); return model; } }
ToolsTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { ToolSeriesBuilder builder = new ToolSeriesBuilder(); LinesDataSet lineModel = builder.createDataSet(configuration, results); LinesChartModel model = new LinesChartModel(); Palette[] colors = Palette.values(); int index = 0; for (String name : lineModel.getDataSetIds()) { LineSeries lineSeries = new LineSeries(name, colors[index++].getNormal(), StackedMode.SEPARATE_LINES, FilledMode.LINES); if (index == colors.length) { index = 0; } lineSeries.addAll(lineModel.getSeries(name)); model.addSeries(lineSeries); } model.setDomainAxisLabels(lineModel.getDomainAxisLabels()); return model; }  }
ToolsTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { ToolSeriesBuilder builder = new ToolSeriesBuilder(); LinesDataSet lineModel = builder.createDataSet(configuration, results); LinesChartModel model = new LinesChartModel(); Palette[] colors = Palette.values(); int index = 0; for (String name : lineModel.getDataSetIds()) { LineSeries lineSeries = new LineSeries(name, colors[index++].getNormal(), StackedMode.SEPARATE_LINES, FilledMode.LINES); if (index == colors.length) { index = 0; } lineSeries.addAll(lineModel.getSeries(name)); model.addSeries(lineSeries); } model.setDomainAxisLabels(lineModel.getDomainAxisLabels()); return model; }  @Override LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results,
            final ChartModelConfiguration configuration); }
ToolsTrendChart implements TrendChart { @Override public LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results, final ChartModelConfiguration configuration) { ToolSeriesBuilder builder = new ToolSeriesBuilder(); LinesDataSet lineModel = builder.createDataSet(configuration, results); LinesChartModel model = new LinesChartModel(); Palette[] colors = Palette.values(); int index = 0; for (String name : lineModel.getDataSetIds()) { LineSeries lineSeries = new LineSeries(name, colors[index++].getNormal(), StackedMode.SEPARATE_LINES, FilledMode.LINES); if (index == colors.length) { index = 0; } lineSeries.addAll(lineModel.getSeries(name)); model.addSeries(lineSeries); } model.setDomainAxisLabels(lineModel.getDomainAxisLabels()); return model; }  @Override LinesChartModel create(final Iterable<? extends BuildResult<AnalysisBuildResult>> results,
            final ChartModelConfiguration configuration);  }