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] when there's only one bar/record in XYChart, it's not being displayed #60730

Closed
mbondyra opened this issue Mar 20, 2020 · 3 comments · Fixed by #61452
Closed

[Lens] when there's only one bar/record in XYChart, it's not being displayed #60730

mbondyra opened this issue Mar 20, 2020 · 3 comments · Fixed by #61452
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@mbondyra
Copy link
Contributor

Kibana version:
7.5.1, 7.6, master

Describe the bug:

Steps to reproduce:

  1. Use the sample data and the setup as presented in the screenshot (it can be bar chart).
  2. Manipulate time range to select only one bar.
    Bug: The screen is empty (different than no results placeholder though)

Expected behavior:
A single bar appears in the chart.

Screenshots (if relevant):
image

@mbondyra mbondyra changed the title [Lens] when there's only one item in XYChart, it's not being displayed [Lens] when there's only one bar/record in XYChart, it's not being displayed Mar 20, 2020
@mbondyra mbondyra added bug Fixes for quality problems that affect the customer experience v7.7.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed v7.7.0 labels Mar 20, 2020
@elasticmachine
Copy link
Contributor

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

@mbondyra mbondyra self-assigned this Mar 24, 2020
@mbondyra
Copy link
Contributor Author

mbondyra commented Mar 26, 2020

The bug can be reproduced in elastic-charts, cc @markov00.
When I have a single bar/single data entry and a defined xDomain in Settings, even if the entry timestamp is contained in xDomain, it’s not being displayed on the chart. Example here:
https://codesandbox.io/s/naughty-jennings-pyhpn

Changing data in the above code to two entries with different timestamp will result in proper behaviour:

data: [
      {
        "fa649ca3-0d37-4885-b259-1a05b880afd6": "Men's Accessories",
        "e4013ff7-36af-4ef9-9580-d965f7c586d1": 1585090080000,
        "531d9b2e-911e-42f4-827c-8aed834a1c3b": 1
      },
      {
        "fa649ca3-0d37-4885-b259-1a05b880afd6": "Men's Accessories",
        "e4013ff7-36af-4ef9-9580-d965f7c586d1": 1585090085000,
        "531d9b2e-911e-42f4-827c-8aed834a1c3b": 1
      }
    ],

@mbondyra mbondyra added the Feature:ElasticCharts Issues related to the elastic-charts library label Mar 26, 2020
@mbondyra
Copy link
Contributor Author

Here's the comment from @markov00 :

The problem here is that you want to draw a bar chart or an histogram chart with only a single value on a custom domain interval.
It will render correctly if you use a Line or Area series because a single line/area data point doesn’t have any width. With bars instead, the bar width needs to be considered, especially when you are rendering a bar in a linear axis where each pixel on the x axis is a different point in time.
At the moment, to render a bar chart or an histogram automatically we try to compute the minimum x interval between our data points to know exactly how much space a bar can take along the x axis. If we just have one data point in our chart this cannot be done. Because of this, we added a parameter called minInterval in the xDomain, currently expressed in milliseconds if you are using it for a x time scale. This parameter is the minimum number of milliseconds between consecutive buckets. Note that this is a static value and doesn’t take in consideration any leap second, day light savings, so for intervals that spans between those two values, it has to be computed as the minimum in terms of milliseconds between consecutive buckets, eg:

  • if you have simple day buckets, on a “regular” domain range, then the minInterval is usually computed or set to 24 *60 *60 *1000 ms
  • if you have a week long time interval, but in the middle there is a light saving day, than the interval is then changed to 23 *60 *60 *1000 ms or 24 *60 *60 *1000 if we are adding 1 hour
    We internally do that automatically when we have 1 or more data points, but as you have discovered this can’t be done automatically when we don’t have a way to compute it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants