holoviz / holoviz/hvplot

Strange behaviour of generated HTML file

Open
#1,594 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info

```plaintext
pandas-2.2.3
holoviews-1.20.2
hvplot-0.11.3
Python 3.11.11
Windows 11 x64, Version 24H2 (OS Build 26100.4061)
Firefox 138.0.4
Edge 136.0.3240.92 (Official build) (64-bit)
```

#### Description of expected behavior and the observed behavior
Expected: generated HTML file should display all graphs with all data consistently
Observed: some data is missing from selected graphs when a previous graph had different groups.
Steps to reproduce (after running the code):
1. Open the generated HTML file (dummy.html) in a browser -> "group1" is displayed with two lines (blue and red)
2. Select "group3" from the "key1"-menu -> "group3" is missing some line already (should be displayed in yellow
3. Select "group1" from the "key1"-menu -> "group1" is now missing part of the data, too (red part is missing), also the legend is not updated
4. Select "group2" from the "key1"-menu -> data is displayed correctly, also legend is updated
5. Select "group1" from the "key1"-menu -> data is displayed correctly again
#### Complete, minimal, self-contained example code that reproduces the issue

```python
from __future__ import annotations

import pandas as pd

import holoviews as hv
import hvplot
from hvplot import pandas # noqa: F401

data = [
{"key1": "group1", "key2": 0, "x": 1, "y": 1},
{"key1": "group1", "key2": 0, "x": 2, "y": 2},
{"key1": "group1", "key2": 1, "x": 3, "y": 3},
{"key1": "group1", "key2": 1, "x": 4, "y": 4},

{"key1": "group2", "key2": 0, "x": 1, "y": 1},
{"key1": "group2", "key2": 0, "x": 2, "y": 2},
{"key1": "group2", "key2": 1, "x": 4, "y": 4},
{"key1": "group2", "key2": 1, "x": 5, "y": 5},

{"key1": "group3", "key2": 0, "x": 1, "y": 1},
{"key1": "group3", "key2": 0, "x": 2, "y": 2},
{"key1": "group3", "key2": 2, "x": 5, "y": 5},
{"key1": "group3", "key2": 2, "x": 6, "y": 6},
]

df = pd.DataFrame(data)
graph = df.hvplot.line(x="x", y="y", by="key2", groupby="key1")
hv.save(graph, "dummy.html")

```

#### Stack traceback and/or browser JavaScript console output

#### Screenshots or screencasts of the bug in action

- [ ] I may be interested in making a pull request to address this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.