[comment]: # ({9ee1626a-75e1f9a9})
# 10 图形原型

[comment]: # ({/9ee1626a-75e1f9a9})

[comment]: # ({ba208c2a-fff692ae})
### 描述

这些参数及对应仪表板小部件字段objects的可选属性值允许通过`dashboard.create`和`dashboard.update`方法配置[*Graph prototype*](/manual/web_interface/frontend_sections/monitoring/dashboard/widgets/graph_prototype)小部件。

::: noteimportant
小部件`fields`的属性在仪表板创建或update过程中不会进行验证。
这使得用户可以修改[built-in widgets](/manual/web_interface/frontend_sections/monitoring/dashboard/widgets)和create[开发模块](/manual/modules#开发模块)，但也存在错误创建或更新小部件的风险。
为确保成功创建或update*图形原型*小部件，请参考下方表格中列出的参数要求。

:::

[comment]: # ({/ba208c2a-fff692ae})

[comment]: # ({b68cef93-a17f027e})
### 参数

以下参数支持用于*图形原型*部件。

| 参数 | [仪表板小部件字段](/manual/api/reference/dashboard/object#仪表板小部件字段) | 名称 | 值 |
|-----|-|-----|-------------------|
| *Refresh interval* | 0 | rf_rate | 0 - 不刷新;<br>10 - 10秒;<br>30 - 30秒;<br>60 - *(默认)* 1分钟;<br>120 - 2分钟;<br>600 - 10分钟;<br>900 - 15分钟. |
| *Source* | 0 | source_type | 2 - *(默认)* 图形原型;<br>3 - 简单图形原型. |
| *Graph prototype* | 7 | graphid | [Graph prototype](/manual/api/reference/graphprototype/get) ID.<br><br>当*来源*设置为"图形原型"时，必须提供*图形原型*参数. |
| *Item prototype* | 5 | itemid | [Item prototype](/manual/api/reference/itemprototype/get) ID.<br><br>当*来源*设置为"简单图形原型"时，必须提供*监控项原型*参数. |
| *Show legend* | 0 | show_legend | 0 - 禁用;<br>1 - *(默认)* 启用. |
| *Dynamic item* | 0 | dynamic | 0 - *(默认)* 禁用;<br>1 - 启用. |
| *Columns* | 0 | columns | 有效值范围为1-24.<br><br> 默认: 2. |
| *Rows* | 0 | rows | 有效值范围为1-16.<br><br> 默认: 1. |

[comment]: # ({/b68cef93-a17f027e})

[comment]: # ({bc39c20a-0dcd55e8})
### 示例

以下示例仅针对*图形原型*小部件的仪表板小部件字段objects的配置进行说明。
有关配置仪表板的更多信息，请参阅[`dashboard.create`](/manual/api/reference/dashboard/create)。

[comment]: # ({/bc39c20a-0dcd55e8})

[comment]: # ({c7baef00-6ed953dc})
#### 配置 *图形原型* 部件

配置一个*图形原型*部件，该部件显示由低级发现创建的监控项原型（ID: "42316"）生成的3个图形网格（3列，1行）。

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "dashboard.create",
    "params": {
        "name": "My dashboard",
        "display_period": 30,
        "auto_start": 1,
        "pages": [
            {
                "widgets": [
                    {
                        "type": "graphprototype",
                        "name": "Graph prototype",
                        "x": 0,
                        "y": 0,
                        "width": 16,
                        "height": 5,
                        "view_mode": 0,
                        "fields": [
                            {
                                "type": 0,
                                "name": "source_type",
                                "value": 3
                            },
                            {
                                "type": 5,
                                "name": "itemid",
                                "value": 42316
                            },
                            {
                                "type": 0,
                                "name": "columns",
                                "value": 3
                            }
                        ]
                    }
                ]
            }
        ],
        "userGroups": [
            {
                "usrgrpid": 7,
                "permission": 2
            }
        ],
        "users": [
            {
                "userid": 1,
                "permission": 3
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```
响应:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "dashboardids": [
            "3"
        ]
    },
    "id": 1
}
```

[comment]: # ({/c7baef00-6ed953dc})

[comment]: # ({e9d30322-176ec50c})
### 另请参阅

-   [仪表板小部件字段](/manual/api/reference/dashboard/object#仪表板小部件字段)
-   [`dashboard.create`](/manual/api/reference/dashboard/create)
-   [`dashboard.update`](/manual/api/reference/dashboard/update)

[comment]: # ({/e9d30322-176ec50c})
