use of org.graylog.plugins.views.search.views.widgets.aggregation.PivotDTO in project graylog2-server by Graylog2.
the class DashboardWidgetConverter method genPivotForPie.
private List<PivotDTO> genPivotForPie(String field, String stackedFields, int limit) {
final PivotDTO fieldPivot = PivotDTO.Builder.builder().type("values").field(field).config(ValueConfigDTO.Builder.builder().limit(limit).build()).build();
final List<PivotDTO> rowPivots = new ArrayList<>(stackedFieldPivots(stackedFields));
rowPivots.add(fieldPivot);
return rowPivots;
}
use of org.graylog.plugins.views.search.views.widgets.aggregation.PivotDTO in project graylog2-server by Graylog2.
the class DashboardWidgetConverter method createMapWidget.
private List<WidgetEntity> createMapWidget() {
final String field = config.getString("field");
final PivotDTO fieldPivot = PivotDTO.Builder.builder().type("values").config(ValueConfigDTO.Builder.builder().build()).field(field).build();
final AggregationConfigDTO widgetConfig = AggregationConfigDTO.Builder.builder().series(ImmutableList.of(createSeriesDTO("count", ""))).visualization("map").rowPivots(ImmutableList.of(fieldPivot)).columnPivots(Collections.emptyList()).sort(Collections.emptyList()).build();
final WidgetEntity.Builder widgetEntityBuilder = aggregationWidgetBuilder().config(widgetConfig);
final Optional<String> query = config.getOptionalString("query");
query.ifPresent(s -> widgetEntityBuilder.query(ElasticsearchQueryString.of(s)));
return ImmutableList.of(widgetEntityBuilder.build());
}
Aggregations