-
Notifications
You must be signed in to change notification settings - Fork 8
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
Theme-aware tokens for graphs #783
Comments
I'm wondering if Plotly has the right hooks to be-aware of CSS Custom Properties to use for styling. I expect that we actually need programmatic hooks into the theme changing and for querying the theme-aware token values programmatically from JS. FAST gives those APIs but we should find the right way to expose that to apps. |
If this issue is accurate then Plotly still doesn't support styling via CSS plotly/plotly.js#1195 (comment) But exposing tokens through our normal mechanism and adding APIs to convert them to JS values and to subscribe to theme changes seems like a good direction. |
Some ideas for what the programmatic API could look like:
|
Is it possible to expose variables for fonts and font sizes as well? This will be required for styling the legends, graph titles, axis names, tec. |
Here is the first PR that wants to use these tokens. For now I'm suggesting using the tokens in This also revealed a desire to export this API from When we fix this issue we should go and update that code to use the new API. |
Here's a PR pulling base token values (unaware of themes) from nimble-tokens. |
Hi @jattasNI @rajsite , we have a work item to make the reusable plotly component theme aware coming up. Any plans for bringing in the API anytime sooner? If yes we can incorporate it right away. If not we will go ahead with using the tokens in |
@ni-ramya I believe our visual designer @RickA-NI is working on coming up with a definitive list of values for some of the missing tokens as we speak and hopes to have it ready next week. Once that's ready the Nimble dev work involved in the ideal solution is:
None of this is planned immediately by the Nimble team but I think it's mostly pretty easy to accomplish (though 3 requires a bit of API design). If your team is interested in contributing those changes we'd be happy to help you along. If not then we'd have to have a conversation about when Nimble team will be able to get to it. |
@jattasNI thanks for the reply. Since you have mentioned that the Nimble team does not plan it immediately, we would like to take it up. But we would also like to understand the efforts involved in it. Could you please briefly summarise the total effort involved in exposing the Nimble API? We can consider design discussions, development efforts, unit testing, documentation and any additional work that I may have missed. A ballpark number would be helpful in our commitment as well. |
@ni-ramya that's great news! Items 1 and 2 above should each only be a couple hours of work. If it's your first contribution then you'd probably want to pad that estimate with some time to get familiar with the repo and have some back and forth on your first PR. Maybe 3 days total? Item 3 will require more discussion and testing so I'd suggest reserving about a week (plus any additional ramp up time if it's a different developer than the one who did 1 and 2). |
Hey @ni-ramya, talked this over some more with Jesse and at the moment we aren't completely confident about implementing the Observer approach discussed above. We need to think of the design a bit more, some things we need to figure out. I'll capture some of the discussions we had for our future reference:
However, to unblock you today, I think you could accomplish leveraging the nimble CSS Custom Properties by using For an Angular component I think you would want to get the relevant CSS properties values on |
# Pull Request ## 🤨 Rationale This PR has the update to add a design token for graph gridlines to make it theme aware. We have a graph visualization in the Data spaces module of the Test Insights app. To make the graph theme aware, we have added a nimble design token for the graph gridlines. This is part of #783. <!--- Provide some background and a description of your work. What problem does this change solve? Include links to issues, work items, or other discussions. --> ## 👩💻 Implementation - Added a design token called `graphGridlineColor` <!--- Describe how the change addresses the problem. Consider factors such as complexity, alternative solutions, performance impact, etc. Consider listing files with important changes or comment on them directly in the pull request. --> ## 🧪 Testing All existing tests should pass <!--- Detail the testing done to ensure this submission meets requirements. Include automated/manual test additions or modifications, testing done on a local build, private CI run results, and additional testing not covered by automatic pull request validation. --> ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [ ] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Vikash Venkatesh <[email protected]>
😯 Problem to Solve
The PDV app in SLE is going to add a Plotly graph to their app. It would be good for Nimble to help them style it with theme-aware colors/fonts/spacing/line thicknesses.
💁 Proposed Solution
Ideas:
nimble-graph
component that wraps plotly in a FAST template and applies the tokens automatically📋 Tasks
The text was updated successfully, but these errors were encountered: