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

[Vega] user should be able to toggle "textTruncate" option for tooltips #80524

Merged
merged 4 commits into from
Oct 19, 2020

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Oct 14, 2020

Closes: #80325

Summary

New configuration property was added for tooltips

image

Screens

  • textTruncate is true:
    image
  • textTruncate is false (default value):
    image

Spec for testing

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "config": {
    "kibana": {
      "tooltips": {
         textTruncate: false
      }
    }
  }
  "data": {
    "values": [
      {"a": " long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text", "b": 28},
      {"a": "B", "b": 55},
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "a", "type": "nominal"},
    "y": {"field": "b", "type": "quantitative"},
    "tooltip": [
      {"field": "a", "type": "nominal"},
      {"field": "b", "type": "quantitative"}
    ]
  }
}

@alexwizp alexwizp self-assigned this Oct 14, 2020
@alexwizp alexwizp added v7.11.0 v8.0.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:fix release_note:enhancement Feature:Vega Vega visualizations and removed release_note:fix labels Oct 14, 2020
Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good reason to truncate the text by default? I would have expected the default to show the full value with word-wrap: break-word. What do you think about changing the defaults?

@alexwizp
Copy link
Contributor Author

@wylieconlon not sure that I can answer for your question. This truncate logic was added in: #33465. My idea was to save all saved visualizations as it. @cchaos could you please help us to find the right solution from the UX perspective

@stratoula
Copy link
Contributor

stratoula commented Oct 15, 2020

I think I agree with @wylieconlon, it should not be truncated by default and it should have a max width. In the above spec when the flag is false the tooltip width is quite big. So maybe we should have a max width and break the words on a new line.

@alexwizp alexwizp changed the title [Vega] user should be able to override the default tooltip width [Vega] user should be able to toggle "textTruncate" option for tooltips Oct 15, 2020
@alexwizp
Copy link
Contributor Author

@wylieconlon @stratoula thank you, I've checked your proposal, it really looks much better. 🙇

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is much better now 👏 LGTM!

@alexwizp alexwizp marked this pull request as ready for review October 15, 2020 14:00
@alexwizp alexwizp requested a review from a team October 15, 2020 14:00
@alexwizp alexwizp requested a review from a team as a code owner October 15, 2020 14:00
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning truncation off by default is fine. What happens if that really long value didn't have spaces?

@stratoula
Copy link
Contributor

It still breaks to a new line @cchaos
Screenshot 2020-10-16 at 9 13 15 AM

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Screenshots and code LGTM

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
visTypeVega 1.4MB 1.4MB +446.0B

page load bundle size

id before after diff
visTypeVega 135.3KB 135.4KB +164.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alexwizp alexwizp merged commit f68e0a3 into elastic:master Oct 19, 2020
alexwizp added a commit to alexwizp/kibana that referenced this pull request Oct 19, 2020
…ps (elastic#80524)

* [Vega] user should be able to override the default tooltip width

Closes: elastic#80325

* fix jest

* fix PR comments

Co-authored-by: Kibana Machine <[email protected]>
alexwizp added a commit that referenced this pull request Oct 19, 2020
…ps (#80524) (#80998)

* [Vega] user should be able to override the default tooltip width

Closes: #80325

* fix jest

* fix PR comments

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
@alexwizp alexwizp deleted the #80325 branch January 16, 2021 15:27
@brechun
Copy link

brechun commented Dec 28, 2021

Is this feature deprecated? I am running Kibana 7.10.2 and spec for testing shown above and the tooltip does not truncate.

@alexwizp
Copy link
Contributor Author

@brechun I see the PR was added in 7.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Vega Vega visualizations release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Vega] user should be able to override the default tooltip width
7 participants