首页 > 解决方案 > 数据表插入 HTML 时出错 - 破折号

问题描述

我试图在我的图表之前在我的仪表板中插入一个 DataTable,但我总是收到与数据表相关的错误。

我的代码是:

import dash_table_experiments
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objects as go
import numpy as np
import dash_table_experiments as dash_table
import dash
from dash.dependencies import Input, Output
import dash_table
import pandas as pd


html.Div(

dash_table.DataTable(
    id='table',
    columns=[{"name": i, "id": i} for i in df2.columns],
    data=df2.to_dict('records'),
),

)


app = dash.Dash()
app.layout = html.Div([
    html.H1(children = "Dashboard Para Gestão De Produção",
    style = {'textAlign' : 'center',}),
        html.Div(children = "_______________________________",
                 style = {'textAlign' : 'center',}),


    dcc.Graph(
        id = 'lines-chart',
        figure = {
            'data' : [
        {'x': df2['OrderType'], 'y': df2['Qty'],                'type': 'bar', 'name': 'Dropado'},
        {'x': df2['OrderType'], 'y': df2['OrderTypeProcessed'], 'type': 'bar', 'name': 'Realizado'}


            ],
            'layout' : {
                'title': 'Grafico'
            }
        }
    ),

])```



错误:

TypeError:意外的关键字参数data允许的参数:column_widths、columns、editable、enable_drag_and_drop、filterable、filters、header_row_height、id、max_rows_in_viewport、min_height、min_width、resizable、row_height、row_scroll_timeout、row_selectable、row_update、rows、selected_row_indices、sortColumn、sortDirection、sortable、 tab_index

如何修复此错误?

标签: plotlyplotly-dash

解决方案


推荐阅读