-
-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
I pass vals in a distinct order but PivotTable shows them in alphabetical order. How to keep the original order?
import dash
from dash import html
from dash_pivottable import PivotTable
# Sample data
data = [
{"Category": "A", "Year": "2020", "Value1": 100, "Value2": 200},
{"Category": "B", "Year": "2020", "Value1": 150, "Value2": 250},
{"Category": "A", "Year": "2021", "Value1": 200, "Value2": 300},
{"Category": "B", "Year": "2021", "Value1": 250, "Value2": 350},
]
# Create the Dash app
app = dash.Dash(__name__)
app.layout = html.Div(
children=[
PivotTable(
id="pivot-table",
data=data,
rows=["Category"],
cols=["Year"],
vals=["Value2", "Value1"], # Intentionally ordered as Value2, Value1
aggregatorName="Sum",
rendererName="Table",
)
]
)
if __name__ == "__main__":
app.run_server(debug=True)
Metadata
Metadata
Assignees
Labels
No labels
