Skip to content

Commit

Permalink
[Lens] Display ast bucket in lines/areas
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Mar 10, 2023
1 parent 0a6458b commit 74dd3f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ export const getXDomain = (
.filter((v) => !isUndefined(v))
.sort()
);

const [firstXValue] = xValues;
const lastXValue = xValues[xValues.length - 1];

const domainMin = Math.min(firstXValue, baseDomain.min);
const domainMaxValue = Math.max(baseDomain.max - baseDomain.minInterval, lastXValue);
const domainMax = hasBars ? domainMaxValue : domainMaxValue + baseDomain.minInterval;
const domainMaxValue = baseDomain.max - baseDomain.minInterval;
const domainMax = Math.max(domainMaxValue, lastXValue);

const duration = moment.duration(baseDomain.minInterval);
const selectedUnit = find(dateMath.units, (u) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ describe('XYChart component', () => {

expect(component.find(Settings).prop('xDomain')).toEqual({
// shortened to 24th midnight (elastic-charts automatically adds one min interval)
max: new Date('2021-04-25').valueOf(),
max: new Date('2021-04-24').valueOf(),
// extended to 22nd midnight because of first bucket
min: new Date('2021-04-22').valueOf(),
minInterval: 24 * 60 * 60 * 1000,
Expand All @@ -449,7 +449,7 @@ describe('XYChart component', () => {
domainStart: new Date('2021-04-22T12:00:00.000Z').valueOf(),
domainEnd: new Date('2021-04-24T12:00:00.000Z').valueOf(),
domainMin: new Date('2021-04-22').valueOf(),
domainMax: new Date('2021-04-25').valueOf(),
domainMax: new Date('2021-04-24').valueOf(),
})
);
});
Expand Down

0 comments on commit 74dd3f5

Please sign in to comment.