Search in sources :

Example 1 with PivotDTO

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;
}
Also used : PivotDTO(org.graylog.plugins.views.search.views.widgets.aggregation.PivotDTO) ArrayList(java.util.ArrayList)

Example 2 with PivotDTO

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());
}
Also used : AggregationConfigDTO(org.graylog.plugins.views.search.views.widgets.aggregation.AggregationConfigDTO) WidgetEntity(org.graylog2.contentpacks.model.entities.WidgetEntity) DashboardWidgetEntity(org.graylog2.contentpacks.model.entities.DashboardWidgetEntity) PivotDTO(org.graylog.plugins.views.search.views.widgets.aggregation.PivotDTO) ElasticsearchQueryString(org.graylog.plugins.views.search.elasticsearch.ElasticsearchQueryString)

Aggregations

PivotDTO (org.graylog.plugins.views.search.views.widgets.aggregation.PivotDTO)2 ArrayList (java.util.ArrayList)1 ElasticsearchQueryString (org.graylog.plugins.views.search.elasticsearch.ElasticsearchQueryString)1 AggregationConfigDTO (org.graylog.plugins.views.search.views.widgets.aggregation.AggregationConfigDTO)1 DashboardWidgetEntity (org.graylog2.contentpacks.model.entities.DashboardWidgetEntity)1 WidgetEntity (org.graylog2.contentpacks.model.entities.WidgetEntity)1