<span id="更新看板图表完整顺序"></span>

# Update the complete dashboard chart order

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

`PATCH /data-dashboards/{dashboard_id}/chart-order` uses exactly one nonempty X-Workspace-ID to select the workspace. Only chart_ids is needed in the body, but the handler uses ordinary single JSON decoding. Unlike drill-through, it does not reject unknown fields or a second JSON value. Keep these validation levels distinct.

<span id="请求参数"></span>

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```json
{"chart_ids":["chart-b","chart-a"]}
```

:::::
:::::{tab-item} Parameters

| Fields | Type | Constraints |
| --- | --- | --- |
| chart_ids | array (array of strings) | Must be explicitly provided and non-null. Complete ordering of all nondeleted chart IDs, not a partial move list |

The service requires nonempty IDs without surrounding whitespace. In a same-tenant transaction, the DAO locks the active dashboard and all nondeleted charts and requires matching counts, no duplicates, and no foreign IDs. pending/deleting charts reject sorting with409/ErrDataDashboardOperationActive. Existing layout_config fields are retained; only order becomes the zero-based index. Unchanged layouts are not updated. This neither recreates charts nor changes SQL.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Fields

Success uses a code/msg/data envelope and echoes order in data.chart_ids. An explicit [] for an empty dashboard may pass validation, but copying the empty slice may produce null in the response. Do not infer chart deletion from the echo. Omitted/null input and invalid arrangements map to 400/ErrParamInvalid; missing objects to 404/ErrDataDashboardNotFound; permission/dependency errors follow dashboard mappings. Responses provide no concurrency version. Reread details before submission to avoid stale ordering.

Current Go SDK and CLI omit an explicit empty array into {}, while Python preserves []. See SDK differences. This does not mean the entire sorting capability is missing from all three clients.

:::::
::::::
:::::::
