[Lens] Thresholds: cap threshold width in suggestions (#112816)

* 🐛 Cap threshold width to 1px in suggestions

* 🐛 Remove icons from previews

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Marco Liberati 2021-09-29 10:10:57 +02:00 committed by GitHub
parent 93debf4b52
commit a251dbf1f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,20 @@ export function toPreviewExpression(
return toExpression(
{
...state,
layers: state.layers.map((layer) => ({ ...layer, hide: true })),
layers: state.layers.map((layer) =>
layer.layerType === layerTypes.DATA
? { ...layer, hide: true }
: // cap the threshold line to 1px
{
...layer,
hide: true,
yConfig: layer.yConfig?.map(({ lineWidth, ...config }) => ({
...config,
lineWidth: 1,
icon: undefined,
})),
}
),
// hide legend for preview
legend: {
...state.legend,