Skip to content

Commit

Permalink
adding support for multiple split series buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed May 8, 2018
1 parent 1259007 commit 20e0e23
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/core_plugins/kbn_vislib_vis_types/public/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default function PointSeriesVisType(Private) {
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
max: 3,
aggFilter: ['!geohash_grid', '!filter']
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/kbn_vislib_vis_types/public/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default function PointSeriesVisType(Private) {
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
max: 3,
aggFilter: ['!geohash_grid', '!filter']
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default function PointSeriesVisType(Private) {
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
max: 3,
aggFilter: ['!geohash_grid', '!filter']
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/core_plugins/kbn_vislib_vis_types/public/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default function PointSeriesVisType(Private) {
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
max: 3,
aggFilter: ['!geohash_grid', '!filter']
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ describe('getAspects', function () {
}).to.throwError(TypeError);
});

it('throws an error if there are multiple series aspects', function () {
init(2, 1, 1);

expect(function () {
getAspects(vis, table);
}).to.throwError(TypeError);
});

it('creates a fake x aspect if the column does not exist', function () {
init(0, 0, 1);

Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/agg_response/point_series/_get_aspects.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function PointSeriesGetAspectsProvider(Private) {
.transform(columnToAspect, {})
// unwrap groups that only have one value, and validate groups that have more
.transform(function (aspects, group, name) {
if (name !== 'y' && group.length > 1) {
throw new TypeError('Only multiple metrics are supported in point series');
if ((name !== 'y' && name !== 'series') && group.length > 1) {
throw new TypeError('Only multiple metrics and series are supported in point series');
}

aspects[name] = group.length > 1 ? group : group[0];
Expand Down
5 changes: 3 additions & 2 deletions src/ui/public/agg_response/point_series/_get_point.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ export function PointSeriesGetPointProvider() {
}

if (series) {
point.aggConfig = series.agg;
point.series = series.agg.fieldFormatter()(unwrap(row[series.i]));
const seriesArray = series.length ? series : [ series ];
point.aggConfig = seriesArray[0].agg;
point.series = seriesArray.map(s => s.agg.fieldFormatter()(unwrap(row[s.i]))).join(' - ');
} else if (y) {
// If the data is not split up with a series aspect, then
// each point's "series" becomes the y-agg that produced it
Expand Down

0 comments on commit 20e0e23

Please sign in to comment.