-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] Fitting functions #69820
[Lens] Fitting functions #69820
Changes from all commits
bebac29
e983014
3fbff62
426f2ce
44a17c3
8c7381e
64ee8ef
9bb7843
c1ddaaa
e51ff5e
e3c6f94
a278772
bfb6898
b3fb6e8
2434486
85c128e
1ece895
34cff58
7a20163
c6cdca0
c0adafc
fc6bd1d
edf1818
7e744a1
5d0b6f4
bde6bec
4facefc
3c3a4d6
6d6f8d0
188f3a7
4fd45fa
af9b28e
cb4c969
e0d313f
62d6945
b48b8d6
8e9aa69
328184f
ba332b3
f016ece
90fbbb3
efd751e
653ae04
68f961d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Fit } from '@elastic/charts'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
export type FittingFunction = typeof fittingFunctionDefinitions[number]['id']; | ||
|
||
export const fittingFunctionDefinitions = [ | ||
{ | ||
id: 'None', | ||
title: i18n.translate('xpack.lens.fittingFunctionsTitle.none', { | ||
defaultMessage: 'Hide', | ||
}), | ||
description: i18n.translate('xpack.lens.fittingFunctionsDescription.none', { | ||
defaultMessage: 'Do not fill gaps', | ||
}), | ||
}, | ||
{ | ||
id: 'Zero', | ||
title: i18n.translate('xpack.lens.fittingFunctionsTitle.zero', { | ||
defaultMessage: 'Zero', | ||
}), | ||
description: i18n.translate('xpack.lens.fittingFunctionsDescription.zero', { | ||
defaultMessage: 'Fill gaps with zeros', | ||
}), | ||
}, | ||
{ | ||
id: 'Linear', | ||
title: i18n.translate('xpack.lens.fittingFunctionsTitle.linear', { | ||
defaultMessage: 'Linear', | ||
}), | ||
description: i18n.translate('xpack.lens.fittingFunctionsDescription.linear', { | ||
defaultMessage: 'Fill gaps with a line', | ||
}), | ||
}, | ||
{ | ||
id: 'Carry', | ||
title: i18n.translate('xpack.lens.fittingFunctionsTitle.carry', { | ||
defaultMessage: 'Last', | ||
}), | ||
description: i18n.translate('xpack.lens.fittingFunctionsDescription.carry', { | ||
defaultMessage: 'Fill gaps with the last value', | ||
}), | ||
}, | ||
{ | ||
id: 'Lookahead', | ||
title: i18n.translate('xpack.lens.fittingFunctionsTitle.lookahead', { | ||
defaultMessage: 'Next', | ||
}), | ||
description: i18n.translate('xpack.lens.fittingFunctionsDescription.lookahead', { | ||
defaultMessage: 'Fill gaps with the next value', | ||
}), | ||
}, | ||
] as const; | ||
flash1293 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export function getFitEnum(fittingFunction?: FittingFunction) { | ||
if (fittingFunction) { | ||
return Fit[fittingFunction]; | ||
} | ||
return Fit.None; | ||
} | ||
|
||
export function getFitOptions(fittingFunction?: FittingFunction) { | ||
return { type: getFitEnum(fittingFunction) }; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.lnsXyToolbar__popover { | ||
width: 400px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not using an EUI variable like $euiSize * 24? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had something in the back of my mind about not using variables for "arbitrary" sizes that are not tied to padding/margins. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you swapped the meaning of my upper/lowercase comment and the result is that these are the opposite of what I was expecting. The I18n name should be capitalized for sure, and I also had a preference to have lowercase
id
fields. As this is currently set up, it looks wrong:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that id's should be lowercase, though I do think the visible values should be lowercase as well if you think about an input and it's label being more like sentence, you wouldn't capitalize "None" in a sentence.