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

Extra hover text not work in Candlestick charts #2481

Closed
Yevgnen opened this issue Mar 20, 2018 · 4 comments
Closed

Extra hover text not work in Candlestick charts #2481

Yevgnen opened this issue Mar 20, 2018 · 4 comments
Labels
bug something broken

Comments

@Yevgnen
Copy link

Yevgnen commented Mar 20, 2018

Example:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np
import pandas as pd
import plotly.graph_objs as go
import plotly.offline as py


import datetime

n = 20
open = 2 + np.abs(np.random.randn(n))
high = open + 1
low = open - 1
close = open + np.random.randn(n)
df = pd.DataFrame(
    {
        'open': open,
        'high': high,
        'low': low,
        'close': close
    },
    index=pd.date_range(
        '2010-01-01',
        pd.to_datetime('2010-01-01') + datetime.timedelta(days=n - 1)))

hovertext = []
for i in range(len(df.open)):
    hovertext.append('Point' + str(i))

trace = go.Candlestick(
    x=df.index,
    open=df.open,
    high=df.high,
    low=df.low,
    close=df.close,
    text=hovertext,
    hoverinfo='all')
data = [trace]
py.plot(data, filename='ohlc_custom_hover.html')

However, turning the line trace = go.Candlestick( to trace = go.Ohlc( works just fine.

The plotly version is 2.2.3.

@etpinard
Copy link
Contributor

In js: https://codepen.io/etpinard/pen/OvWYNQ?editors=1010

Thanks for the report.

@etpinard
Copy link
Contributor

etpinard commented Mar 30, 2018

Hmm. Here's another very annoying finance chart bug. Candlestick traces generate box traces. Box traces have a text attribute, but those text values correspond to the box' sample values and are shown only when hovering over box points. In other words, text values do no appear in hover labels over boxes. So there's no way to just push text info the generate box traces like we do for OHLC traces.

It feels like I've been saying this a million times, but really, we should get rid of our transform trace hacks.

@etpinard
Copy link
Contributor

Done in #2561

@alexcjohnson
Copy link
Collaborator

Fixed by #2510 - this is working now on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants