Skip to content

Commit f67bf30

Browse files
committed
fix: use average instead of sum as default aggregation for time series plot
The initial plot type for time filter animations defaults to AGGREGATION_TYPES.sum, causing misleading y-axis values (e.g. earthquake magnitudes showing as 2000/4000/6000 instead of actual values). All other aggregation defaults in the codebase use average. Fixes #3122 Signed-off-by: pierreeurope <pierre.europe@pm.me>
1 parent 8c5030c commit f67bf30

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/utils/src/plot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,6 @@ export function getDefaultPlotType(filter, datasets) {
698698
interval,
699699
defaultTimeFormat,
700700
type: PLOT_TYPES.histogram,
701-
aggregation: AGGREGATION_TYPES.sum
701+
aggregation: AGGREGATION_TYPES.average
702702
};
703703
}

test/fixtures/test-csv-data.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ export const mergedTimeFilter = {
662662
interval: '1-hour',
663663
defaultTimeFormat: 'L H A',
664664
type: 'histogram',
665-
aggregation: 'sum'
665+
aggregation: 'average'
666666
},
667667
yAxis: null,
668668
value: [1474606800000, 1474617600000],
@@ -712,7 +712,7 @@ export const mergedEpochFilter = {
712712
interval: '15-minute',
713713
defaultTimeFormat: 'L LT',
714714
type: 'histogram',
715-
aggregation: 'sum'
715+
aggregation: 'average'
716716
},
717717
yAxis: null,
718718
value: [1472700000000, 1472760000000],
@@ -751,7 +751,7 @@ export const expectedSyncedTsFilter = {
751751
interval: '15-second',
752752
defaultTimeFormat: 'L LTS',
753753
type: 'histogram',
754-
aggregation: 'sum',
754+
aggregation: 'average',
755755
colorsByDataId: {
756756
'test-csv-data-1': '#FF0000',
757757
'test-csv-data-2': '#00FF00'

test/node/reducers/vis-state-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,7 +2938,7 @@ test('#visStateReducer -> setFilter.fixedDomain & DynamicDomain & gpu & cpu', as
29382938
plotType: {
29392939
type: 'histogram',
29402940
interval: '15-second',
2941-
aggregation: 'sum',
2941+
aggregation: 'average',
29422942
defaultTimeFormat: 'L LTS'
29432943
},
29442944
yAxis: null,
@@ -3384,14 +3384,14 @@ test('#visStateReducer -> SET_FILTER_PLOT.yAxis', t => {
33843384
interval: '15-second',
33853385
defaultTimeFormat: 'L LTS',
33863386
type: 'lineChart',
3387-
aggregation: 'sum'
3387+
aggregation: 'average'
33883388
},
33893389
yAxis: yAxisField,
33903390
lineChart: {
33913391
yDomain: [0, 12124],
33923392
xDomain: [1474070985000, 1474072215000],
33933393
interval: '15-second',
3394-
aggregation: 'sum',
3394+
aggregation: 'average',
33953395
series: {
33963396
lines: [
33973397
[
@@ -3416,15 +3416,15 @@ test('#visStateReducer -> SET_FILTER_PLOT.yAxis', t => {
34163416
{x: 1474072050000, y: 4, delta: 'last', pct: -0.9069767441860465},
34173417
{x: 1474072110000, y: 5, delta: 'last', pct: 0.25},
34183418
{x: 1474072170000, y: 0, delta: 'last', pct: -1},
3419-
{x: 1474072200000, y: 13, delta: 'last', pct: null}
3419+
{x: 1474072200000, y: 6.5, delta: 'last', pct: null}
34203420
]
34213421
],
34223422
markers: []
34233423
},
34243424
yAxis: 'uid',
3425-
title: 'Total of uid',
3425+
title: 'Average of uid',
34263426
fieldType: 'integer',
3427-
allTime: {title: 'All Time Average', value: 580.5454545454545},
3427+
allTime: {title: 'All Time Average', value: 580.25},
34283428
bins
34293429
},
34303430
speed: 1,

test/node/schemas/vis-state-schema-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test('#visStateSchema -> v1 -> save load filters', t => {
107107
interval: '1-hour',
108108
defaultTimeFormat: 'L H A',
109109
type: 'histogram',
110-
aggregation: 'sum'
110+
aggregation: 'average'
111111
},
112112
yAxis: null,
113113
animationWindow: 'free',

test/node/utils/filter-utils-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ test('filterUtils -> mergeFilterWithTimeline', t => {
567567
interval: '1-minute',
568568
defaultTimeFormat: 'L LT',
569569
type: 'histogram',
570-
aggregation: 'sum'
570+
aggregation: 'average'
571571
},
572572
yAxis: null,
573573
gpu: true,

test/node/utils/timeline-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('#timeline -> getTimelineFromFilter', t => {
2222
interval: '5-minute',
2323
defaultTimeFormat: 'L LT',
2424
type: 'histogram',
25-
aggregation: 'sum'
25+
aggregation: 'average'
2626
},
2727
yAxis: null,
2828
gpu: true,

0 commit comments

Comments
 (0)