Skip to content

Conversation

@maximlt
Copy link
Member

@maximlt maximlt commented Dec 13, 2023

Addresses #1214

import pandas as pd
import hvplot.pandas

df = pd.DataFrame({
        "Open": [100.00, 101.25, 102.75],
        "High": [104.10, 105.50, 110.00],
        "Low": [94.00, 97.10, 99.20],
        "Close": [101.15, 99.70, 109.50],
        "Volume": [10012, 5000, 18000],
    }, index=[pd.Timestamp("2022-08-01"), pd.Timestamp("2022-08-03"), pd.Timestamp("2022-08-04")])

ohlc_cols = ["Open", "High", "Low", "Close"]
df.hvplot.ohlc(y=ohlc_cols, hover_cols=["Volume"])
image

neg, pos = self.kwds.get('neg_color', 'red'), self.kwds.get('pos_color', 'green')
color_exp = (dim(o)>dim(c)).categorize({True: neg, False: pos})
ds = Dataset(data, [x], [o, h, l, c])
ds = Dataset(data, [x], [o, h, l, c] + self.hover_cols)
Copy link
Member

Choose a reason for hiding this comment

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

Have you checked if this works when hover_cols="all"?

ds = Dataset(data, [x], [o, h, l, c] + self.hover_cols)
ohlc_cols = [o, h, l, c]
if x in self.hover_cols:
self.hover_cols.remove(x)
Copy link
Member

Choose a reason for hiding this comment

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

Can this problem if x is a or l and self.hover_cols is all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why would x be equal to l?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry. I just took all the letters of all and did not see that it was already part of the ohlc columns.

@maximlt maximlt merged commit 1c2eb15 into main Dec 21, 2023
@maximlt maximlt deleted the fix_ohlc_hover_cols branch December 21, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants