Closed
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
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
Code sample
Code
[Paste your code here]
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