Skip to content
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] API for Styling Lens Embeddables #69349

Closed
clintandrewhall opened this issue Jun 16, 2020 · 12 comments
Closed

[Lens] API for Styling Lens Embeddables #69349

clintandrewhall opened this issue Jun 16, 2020 · 12 comments
Labels
enhancement New value added to drive a business result Feature:Lens NeededFor:Canvas Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects

Comments

@clintandrewhall
Copy link
Contributor

clintandrewhall commented Jun 16, 2020

@wylieconlon asked I create this issue to track/discuss theming of Lens Embeddables in Canvas.

Canvas now supports Lens Embeddables. We'd like to work with the Lens team to define and utilize an API for altering various visual attributes of a visualization from our context.

Background

Canvas allows users to define their own CSS style definitions for any Canvas element. This flexibility has made Canvas easier to customize. While we don't expect Lens visualizations to duplicate these granular levels of style flexibility, as Lens approaches GA and visualizations are added to Canvas workpads, the expectation of being able to customize at least some parts of the visualization will be there.

Screen Shot 2020-06-16 at 6 24 27 PM

This is something we may be able to leverage in Elastic Charts or other HTML-based embeddables. We're currently exploring options.

Feature Request

While this list may not be exhaustive, we'd like Lens Embeddables to support changing the following attributes:

  • Font, including family, style, weight and size
    • It might be prudent to define classes of text-- like label, heading, primary or secondary-- which can customize the above. Viz like Metric might have primary and secondary, for example.

Screen Shot 2020-06-16 at 6 44 07 PM

  • Palette, including a gradient option

Screen Shot 2020-06-16 at 6 44 48 PM

  • Line and Border, including color, width, and style (dotted, dashed, etc)
  • Background, including color, opacity, perhaps image?
  • Fill, including color, opacity
  • Scale

We can certainly update/flesh out this list as the conversation proceeds. Thanks!

@clintandrewhall clintandrewhall added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Feature:Lens labels Jun 16, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas (Team:Canvas)

@kibanamachine kibanamachine added this to Inbox in Canvas Jun 16, 2020
@kibanamachine kibanamachine added this to Long-term goals in Lens Jun 16, 2020
@clintandrewhall clintandrewhall moved this from Inbox to On Radar in Canvas Jun 17, 2020
@wylieconlon wylieconlon added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Jun 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293
Copy link
Contributor

There is no generic "dark mode" flag, will something like this just be done with the detailed color settings?

I wonder whether we can distill this list into a typescript interface and make it part of the expression context like the "searchContext". This way visualize can integrate with it as well (I guess Canvas has the same requirements there). cc @ppisljar

@wylieconlon
Copy link
Contributor

I'm concerned about defining an API that ignores the visualization subtypes, and is trying to be too broad- is it possible that what we actually want is a "Lens styling editor" which can be configured differently for the XY charts, pie charts, tables, etc?

@ppisljar
Copy link
Member

i agree with @wylieconlon proposal. in canvas visualizations will have arguments that allow you to override the default sytling, for example pie function has font and palette properties. We plan to follow the same with our chart functions, for example metric_vis function has a property font as well as colorSchema which unfortunatelly doesn't use the pallete (something we should definetelly align on)

then of course editor needs to be registered with canvas for every function, which would expose the ui to configure this. we are not providing canvas ui's for our chart functions, but canvas team could definitively implement them, and i would suggest to do so if you find yourself in need of a chart that we support (for example tagcloud ?).

so i think lens team should do the same, xy_chart function should have font property and palette property, probably all the others (i am wondering are they not there already maybe?). however as lens is not GA yet i would suggest canvas team not to try to implement editor for xy_chart function at this point but rather wait until it becomes a bit more stable.

What I think would be very valuable (and this issue is the start of it) is to start listing things that are common across different functions/charts in our teams and start aligning on those. for example lets all use the same font function to configure fonts for our charts, and lets all call the argument for that configuration the same.

Clint's list is a good start, but i think its important that we don't just list those, but add a function (existing or a link to an issue describing it) that you should use and the argument name and type.

for example:

  • charts should allow font configuration. they should use font argument type which can be produced with font function
  • charts should allow pallete configuration. they should use pallete argument type which can be produced with pallete function
    ^^ here actually i think we have a problem as we are all working with different pallete types and this needs to be aligned first
  • if chart allows you to configure a specific color it should use color argument type which can be produced with color function

@wylieconlon
Copy link
Contributor

@ppisljar I'm not sure I see it in your proposal above, so I want to clarify: the way that Canvas is using both Lens and Visualize charts is using the Embeddable API, through a custom wrapper function. Nothing in our current APIs would let the Canvas editor distinguish between a "Lens pie chart" and "Lens table", or "Visualize pie chart" and "Visualize table"- because the only thing available is the ID of the saved object. Do you see the problem, and do you have a proposed solution?

I would expect two possible solutions:

  • We accept a limited set of styling options that are shared by all visualizations
  • We build a new type of editor component that is able to read the Visualize and Lens saved objects and construct the right type of UI for styling them.

@ppisljar
Copy link
Member

my proposal is that canvas uses expression functions direclty. Its fine that there is a way to add embeddable, but if embeddable is based on expression canvas should allow you to "inline" the embeddable, basically replacing embeddable with actual expression powering it. This is when canvas users would get full control over pallets, fonts, all the settings pretty much.

when using embeddables, i am not sure we can really do something for "all the embeddables". it will be hard to enforce all embeddables are using some parameters passed on the input, also we probably want a fallback in case the parameters are not provided. Currently color pallete is something that is configured on the chart level and its different for every chart. Most likely also those settings won't make sense for every chart, and i guess users will be confused if they are setting the color pallete (in canvas) and the chart doesnt change (either because we forgot to use that input or because its irrelevant .... for example in table chart)

@clintandrewhall
Copy link
Contributor Author

clintandrewhall commented Jun 23, 2020

@wylieconlon While a provided UI is useful, it won't be everything Canvas needs. We'll want to default colors/font/etc programmatically as well as provide one-off customization to the user.

@ppisljar We shouldn't limit this to the realm of expressions, (e.g. "we'll place a parameter in the expression"). I agree that having these customizations there is useful as well as germane... but we can't discount programmatic customization.

I think we can get around this with my forthcoming proposal on defaulting in Expressions. But I hope we can find a great way to pass styling/theming through an embeddable to a Lens/Chart renderable easily.

@wylieconlon
Copy link
Contributor

@ppisljar Your proposal of using the Lens functions directly is not something that I'm comfortable doing until we are GA, because we intend to change the API soon. The same goes for Visualize: we should find a solution that lets us style the embeddable from the outside.

@clintandrewhall If we don't provide an editor for use by apps like Canvas, then Canvas will have to provide the same kind of styling options for all Lens visualizations. I think it will be a better user experience with a UI that is able to understand the type of visualization.

@clintandrewhall
Copy link
Contributor Author

@wylieconlon I'm not arguing against a UI. I'm saying I'd prefer it not be the only avenue of styling Lens visualizations. If a user has 10 Lens viz on a Canvas workpad, I don't want them having to style each one individually because Canvas has no way to manipulate it programmatically.

@timductive timductive added enhancement New value added to drive a business result impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Jul 30, 2020
@stacey-gammon stacey-gammon added NeededFor:Canvas and removed Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas labels Sep 16, 2020
@kibanamachine kibanamachine removed this from On Radar in Canvas Sep 16, 2020
@ghudgins
Copy link

ghudgins commented Nov 9, 2021

Related visualization issue: #2207

@stratoula stratoula removed the impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. label Jan 30, 2024
@stratoula
Copy link
Contributor

I am closing this as work for canvas has been deprioritized. We are in discussions on allowing styling changes as fonts etch but we are tracking them on different issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Lens NeededFor:Canvas Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
No open projects
Lens
  
Long-term goals
Development

No branches or pull requests

9 participants