简体   繁体   English

plotly dash display graph_objects 饼图在 html 元素内

[英]plotly dash display graph_objects pie chart inside html elemet

I am trying to display pie chart inside html div as below:我正在尝试在 html div 中显示饼图,如下所示:

html.Div([
go.Figure(data=Piedata)
])

I got an error:我收到一个错误:

“An object was provided as children instead of a component, string, or number (or list of those). “object 是作为子项提供的,而不是组件、字符串或数字(或它们的列表)。 Check the children property”检查孩子的财产”

If I try to display the same chart in a separate file using .show() it works, but when I try to display it in the app.py file with another html.div components I got this error.如果我尝试使用.show()在单独的文件中显示相同的图表,它可以工作,但是当我尝试在带有另一个html.div组件的 app.py 文件中显示它时,我收到了这个错误。

Use dcc.Graph(figure=your_figure_name) instead改用 dcc.Graph(figure=your_figure_name)

html.Div([
    dcc.Graph(figure=your_figure_name)
])

Look at https://dash.plotly.com/dash-core-components/graph for more details about its documentation查看https://dash.plotly.com/dash-core-components/graph了解有关其文档的更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据插入条形图 plotly graph_objects 的问题 - problem with inserting data into the bar chart plotly graph_objects 如何使用 graph_objects 子模块在可绘制的旭日图上设置颜色? - How can I set the colors on a plotly sunburst chart using the graph_objects submodule? 在 graph_objects 填充散点图上堆叠 plotly express 折线图 - Stack plotly express line chart atop graph_objects filled scatter plot 如何使用plotly graph_objects scatter with date - How to use plotly graph_objects scatter with date yaxis 可以在 plotly 中动态添加到 graph_objects 布局中吗? - Can yaxis be dynamically added into an graph_objects Layout in plotly? Plotly:如何使用 graph_objects 创建旭日形子图? - Plotly: How to create sunburst subplot using graph_objects? Plotly graph_objects 将 df 列添加到 hovertemplate - Plotly graph_objects add df column to hovertemplate 饼图不会生成-破折号/图 - Pie chart wont generate - dash/plotly python plotly express vs graph_objects:什么是plotly.express的line_group for plotly.graph_objects - python plotly express vs graph_objects: what is the equivalent of plotly.express's line_group for plotly.graph_objects plotly graph_objects (go) 从两个下拉菜单中选择两条线在同一个图中进行比较 - plotly graph_objects (go) selecting two lines from two dropdowns menu to compare in the same figure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM