Skip to content

Commit

Permalink
lens_min-interval-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Mar 31, 2020
1 parent ef72135 commit b5a6d39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('xy_expression', () => {
Object {
"max": 1546491600000,
"min": 1546405200000,
"minInterval": 10000,
"minInterval": undefined,
}
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,19 @@ export function XYChart({
const shouldRotate = isHorizontalChart(layers);

const xTitle = (xAxisColumn && xAxisColumn.name) || args.xTitle;
const interval = parseInterval(xAxisColumn?.meta?.aggConfigParams?.interval);

// add minInterval only for single row value as it cannot be determined from dataset
const minInterval =
data.tables[layers[0].layerId].rows.length === 1
? parseInterval(xAxisColumn?.meta?.aggConfigParams?.interval)?.asMilliseconds()
: undefined;

const xDomain =
data.dateRange && layers.every(l => l.xScaleType === 'time')
? {
min: data.dateRange.fromDate.getTime(),
max: data.dateRange.toDate.getTime(),
minInterval: interval?.asMilliseconds(),
minInterval,
}
: undefined;
return (
Expand Down

0 comments on commit b5a6d39

Please sign in to comment.