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

Plotly_chart can't deploy #4302

Open
1 task done
liguanlian opened this issue Nov 4, 2024 · 2 comments
Open
1 task done

Plotly_chart can't deploy #4302

liguanlian opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
status: awaiting response Further information is requested

Comments

@liguanlian
Copy link

Duplicate Check

Describe the bug

there is my code

import threading

import numpy as np
import plotly.express as px
import matplotlib
import matplotlib.pyplot as plt
import flet as ft
from flet.matplotlib_chart import MatplotlibChart
from flet.plotly_chart import PlotlyChart
matplotlib.use("svg")

def main(page: ft.Page):

#plotly
df = px.data.gapminder().query("continent=='Oceania'")
fig1 = px.line(df, x="year", y="lifeExp", color="country")
plotly_fig = PlotlyChart(fig1,visible=False, expand=True)



#matplotlib
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 5, 6])
ply_fig = MatplotlibChart(fig,visible=True, expand=False)

contents = ft.Container(
    width=400,height=800,content=
    ft.Column(
        scroll=ft.ScrollMode.ALWAYS,
        controls=[
            ft.Text('this is a MatplotlibChart'),
            ft.Container(ply_fig),
            ft.Text('this is a PlotlyChart'),
            ft.Container(plotly_fig),


        ]
    )


)

page.add(contents)

ft.app(main)

when I use ply_fig,the page is OK, but the plotly_fig will let all disappear

20241104102614

20241104102658

Code sample

Code
[Paste your code here]
import threading

import numpy as np
import plotly.express as px
import matplotlib
import matplotlib.pyplot as plt
import flet as ft
from flet.matplotlib_chart import MatplotlibChart
from flet.plotly_chart import PlotlyChart
matplotlib.use("svg")

def main(page: ft.Page):

# 绘制plotly图像
df = px.data.gapminder().query("continent=='Oceania'")
fig1 = px.line(df, x="year", y="lifeExp", color="country")
plotly_fig = PlotlyChart(fig1,visible=False, expand=True)



# 绘制matplotlib图像
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 5, 6])
ply_fig = MatplotlibChart(fig,visible=True, expand=False)

contents = ft.Container(
    width=400,height=800,content=
    ft.Column(
        scroll=ft.ScrollMode.ALWAYS,
        controls=[
            ft.Text('this is a MatplotlibChart'),
            ft.Container(ply_fig),
            ft.Text('this is a PlotlyChart'),
            ft.Container(plotly_fig),
        ]
    )
)

page.add(contents)

ft.app(main)

To reproduce

Nothing

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS

Operating system details

window 11

Flet version

V0.24

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

@afraniofilho
Copy link

I'm not sure if I have had the same problem but the plotly graph is not shown after I build the app for windows. It works well in runtime.

@OwenMcDonnell OwenMcDonnell self-assigned this Nov 6, 2024
@OwenMcDonnell
Copy link
Contributor

So, to be clear the second image is what you get when you take the above code (which should really be re-formatted by the way) and simply change the PlotlyChart visible property to True?
If that is the issue then it is not reporducible on macOS.

@ndonkoHenri ndonkoHenri added the status: awaiting response Further information is requested label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting response Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants