Plotly python on mobile device

hello guys, I use plotly for stock ohlc charts, and I find it very good for displaying candlestick charts on normally pc monitor or laptop, however, for mobile device, is there anything I can referenced for creating charts for mobile? especially if the chart can be auto adapted?

I use flask for my website project

or at least I want to know whether this option is not available yet? so that I can save some time on looking around.

many thanks!

Hi @raygrrr welcome to the community.

Not sure if I understand your question. If you want to test your charts how the look like on a smaller device, you can change this on the browswer (Firefox/Chrome/Edge…)

I think you can use dash bootstrap components and then set width of dbc.Col as xs, md, lg and your chart will auto arrange. For Example:

# Imports.
import pandas as pd
import plotly.express as px
from dash import Dash, html, dcc
import plotly.graph_objects as go
from datetime import datetime

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')

fig = go.Figure(data=[go.Candlestick(x=df['Date'],
                open=df['AAPL.Open'],
                high=df['AAPL.High'],
                low=df['AAPL.Low'],
                close=df['AAPL.Close'])])


app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP, dbc.icons.FONT_AWESOME])

# Creates the layout.
app.layout=html.Div([
    dbc.Row([
        dbc.Col([
            dcc.Graph(figure=fig)
        ], xs=12, lg=6, md=6, style={'text-align': 'center'}),
        dbc.Col([
            dcc.Graph(figure=fig)
        ], xs=12, lg=6, md=6, style={'text-align': 'center'})
    ], className='p-2 align-items-center')
])

if __name__ == "__main__":
    app.run_server(debug=False,port=1118)

3 Likes