You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When rendering the result of an expression in an expression renderer, it is sometimes important to have some information about the context the result is rendered in because it can influence different aspects. In the case of Lens, there are several real world use cases for this:
noInteractivity: When a Lens visualization is embedded in a Canvas workpad, filter actions can't be dispatched. But the chart renderer doesn't know about this and is still appearing interactive (e.g. changing the cursor when hovering over bars and letting the user brush to select a range on the x axis which doesn't have any effect). [Lens] Option to disable interactions #65630
edit: In Lens there a features planned that would require to offer some chart interactivity only when within the Lens editor, not on dashboards. [Lens] Client side table sorting #76962
preview: Lens is rendering visualizations in a "preview" mode in suggestions. This is currently done using a special separate expression, but could be solved more easily using a mode passed directly to the renderer
Proposal
This can be done by adding a mode option to the expression runner / component wrapper as part of the IExpressionLoaderParams:
This mode which is restricted by an enum ('noInteractivity' | 'edit' | 'preview' | 'display' with defaulting to 'display') is exposed to the renderer as part of the handlers:
As the possible modes are defined in a central place, this becomes a part of the generic contract of expression renderers. When implementing a renderer, it should respect the current mode as well as it can.
When rendering the result of an expression in an expression renderer, it is sometimes important to have some information about the context the result is rendered in because it can influence different aspects. In the case of Lens, there are several real world use cases for this:
noInteractivity: When a Lens visualization is embedded in a Canvas workpad, filter actions can't be dispatched. But the chart renderer doesn't know about this and is still appearing interactive (e.g. changing the cursor when hovering over bars and letting the user brush to select a range on the x axis which doesn't have any effect). [Lens] Option to disable interactions #65630edit: In Lens there a features planned that would require to offer some chart interactivity only when within the Lens editor, not on dashboards. [Lens] Client side table sorting #76962preview: Lens is rendering visualizations in a "preview" mode in suggestions. This is currently done using a special separate expression, but could be solved more easily using a mode passed directly to the rendererProposal
This can be done by adding a
modeoption to the expression runner / component wrapper as part of theIExpressionLoaderParams:This mode which is restricted by an enum (
'noInteractivity' | 'edit' | 'preview' | 'display'with defaulting to'display') is exposed to the renderer as part of the handlers:As the possible modes are defined in a central place, this becomes a part of the generic contract of expression renderers. When implementing a renderer, it should respect the current mode as well as it can.