plotly / dash-alternative-viz

Dash components & demos to create Altair, Matplotlib, Highcharts , and Bokeh graphs within Dash apps.
https://dash.plotly.com
MIT License
7 stars 1 forks source link

Candlestick charts are not working #9

Closed satyan-g closed 3 years ago

satyan-g commented 3 years ago

I see the following warning in Chrome DeveloperTools console:

'The "constructorType" property is incorrect or some required module is not imported.'

Sample code to reproduce the issue:

import dash
import dash_alternative_viz as dav
import dash_html_components as html
from dash.dependencies import Input, Output
import requests

data = requests.get('https://cdn.jsdelivr.net/gh/highcharts/highcharts@v7.0.0/samples/data/new-intraday.json').json()
print(data)
candlestick = {
      'series': [{
            'name': 'AAPL',
            'type': 'candlestick',
            'data': data,
            'tooltip': {
                'valueDecimals': 2
            }
        }]
    }

print(data[:5])
app = dash.Dash(__name__)
app.layout = html.Div([
  html.Button(id="my_button", children="More data!"),
  dav.HighChart(id="my_highchart",  constructorType='stockChart', options=candlestick)
])

if __name__ == '__main__':
    app.run_server(debug=True)
satyan-g commented 3 years ago

Judging by the error message, I suppose dav needs to import highcharts/highstock somewhere.

satyan-g commented 3 years ago

Adding 'highstock.js' to external scripts resolved the issue