Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Datetime fixes with flask 1.0?

I had a Dash running fine with the previous flask. The code included candlesticks charts which now are not processed at all. I assume this refers with the format date column because other simple graphs are fine. But now the direction is to reformat all date columns?, but needs to be also friendly with the previous flask, Any idea?

Could you create a small, reproducable example and show how it changed from previous flask to the new flask?

by replicating to an example i noted that in the previous version it allowed me to “pass” the hoverinfo line when it seems it was not even required, (I just noted that it automatically includes this information if i omit this line in either versions).
is it because of the new flask or the new plotly ? :face_with_monocle:

Removing the hoverinfo line in the candlesticks definition runs fine

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like

import plotly.graph_objs as go

app = dash.Dash()

app.layout = html.Div([
html.H1(‘Stock Tickers’),
dcc.Dropdown(
id=‘my-dropdown’,
options=[
{‘label’: ‘ASX’, ‘value’: ‘ASX.AX’},
],
value=‘ASX’
),
dcc.Graph(id=‘my-graph’)
])

@app.callback(Output(‘my-graph’, ‘figure’), [Input(‘my-dropdown’, ‘value’)])
def update_graph(ticker):

layout = {
    'yaxis': {'title': 'PRICE'},
    'xaxis': {'title': 'Date'},}        

if ticker == "ASX.AX":
    
    
    data = []
    daysback = 250
    df2 = pd.read_csv('ASXstock/{}.csv'.format('ASX.AX'))
    df2.fillna(method='ffill', inplace=True)
    df2 = df2[-daysback:]

trace = go.Candlestick(x=df2.Date,
                       open=df2.Open,
                       high=df2.High,
                       low=df2.Low,
                       close=df2.Close,
                       name = ticker,
                       hoverlabel = dict(namelength = 20),
                           hoverinfo = 'Open:' + str(df2.Open) + '<br>' +'high:' + str(df2.High) + '<br>' +'low:' + str(df2.Low) + '<br>' + 'Close: ' + str(df2.Close),# Remove this line and it works in both

                       increasing=dict(line=dict(color= '#17BECF')),
                       decreasing=dict(line=dict(color= '#7F7F7F')))
data.append(trace)

return go.Figure(data = data, layout = layout)  

if name == ‘main’:
app.run_server()