[comment]: # translation:outdated

[comment]: # ({84b81c15-a55a0f20})
# 9 Graph (classic)

[comment]: # ({/84b81c15-a55a0f20})

[comment]: # ({f070c252-028866a6})
### 説明

これらのパラメーターと、各ダッシュボードウィジェットフィールドオブジェクトの有効なプロパティ値を使用することで、`dashboard.create`メソッドおよび`dashboard.update`メソッドで[*グラフ（クラシック）*](/manual/web_interface/frontend_sections/dashboards/widgets/graph_classic)ウィジェットを設定できます。

::: noteimportant
ウィジェットの`fields`プロパティは、ダッシュボードの作成または更新時に検証されません。
これにより、ユーザーは[組み込みウィジェット](/manual/web_interface/frontend_sections/dashboards/widgets)を変更したり、[カスタムウィジェット](/devel/modules/tutorials/widget)を作成したりできますが、ウィジェットを誤って作成または更新してしまうリスクも生じます。
*グラフ（クラシック）*ウィジェットを正常に作成または更新するには、以下の表に記載されているパラメーターの動作を参照してください。
:::

[comment]: # ({/f070c252-028866a6})

[comment]: # ({5b5973a0-f319d6dc})
### Parameters

*グラフ（クラシック）*ウィジェットでは、以下のパラメーターがサポートされています。

|パラメーター|<|[type](/manual/api/reference/dashboard/object#dashboard-widget-field)|name|value|
|-|-----|-|-----|-------------------|
|*更新間隔*|<|0|rf_rate|0 - 更新なし;<br>10 - 10秒;<br>30 - 30秒;<br>60 - *(デフォルト)* 1分;<br>120 - 2分;<br>600 - 10分;<br>900 - 15分|
|*ソース*|<|0|source_type|0 - *(デフォルト)* グラフ;<br>1 - シンプルグラフ|
|*グラフ*|<|6|graphid.0|[グラフ](/manual/api/reference/graph/get) ID.<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *ソース*が"グラフ"に設定されている場合は*必須*|
|<|*グラフ (ウィジェット)*|1|graphid.\_reference|[グラフ](/manual/api/reference/graph/get) ID:<br>`ABCDE._graphid` の代わりに、グラフのデータソースとして [互換性のあるウィジェット](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (*Reference* パラメータを "`ABCDE` に設定) を設定します。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *ソース* が "シンプル グラフ" に設定され、*グラフ* が設定されていない場合は *必須*|
|*アイテム*|<|4|itemid.0|[アイテム](/manual/api/reference/item/get) ID.<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *ソース* が"シンプルグラフ"に設定され、*アイテム (ウィジェット)* が設定されていない場合は *必須*|
|<|*アイテム (ウィジェット)*|1|itemid.\_reference|[アイテム](/manual/api/reference/item/get) ID:<br>`ABCDE._itemid` の代わりに、アイテムのデータソースとして [互換性のあるウィジェット](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (*Reference* パラメータを "`ABCDE` に設定) を設定します。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *ソース* が "シンプル グラフ" に設定され、*アイテム* が設定されていない場合は *必須*|
|*期間*|<|1|time_period.\_reference|`DASHBOARD._timeperiod` - [*期間*セレクター](/manual/web_interface/time_period_selector)をデータソースとして設定します。<br>`ABCDE._timeperiod` - [互換性のあるウィジェット](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility)（*Reference*パラメータを"`ABCDE`"に設定）をデータソースとして設定します。<br><br>デフォルト: `DASHBOARD._timeperiod`<br><br>または、*From*パラメータと*To*パラメータでのみ期間を設定することもできます。|
|<|*From*|1|time_period.from|絶対時刻 (`YYYY-MM-DD hh:mm:ss`) または [相対時刻](/manual/web_interface/time_period_selector) 構文 (`now`、`now/d`、`now/w-1w` など) の有効な時刻文字列<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *期間* が設定されていない場合は *サポート*されます|
|^|*To*|1|time_period.to|絶対時刻 (`YYYY-MM-DD hh:mm:ss`) または [相対時刻](/manual/web_interface/time_period_selector) 構文 (`now`、`now/d`、`now/w-1w` など) で有効な時刻文字列<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *期間* が設定されていない場合は *サポート* されます|
|*凡例を表示*|<|0|show_legend|0 - 無効;<br>1 - *(デフォルト)* 有効|
|*ホストのオーバーライド*|<|1|override_hostid.\_reference|`ABCDE._hostid` - [互換性のあるウィジェット](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility)（*Reference*パラメータを"`ABCDE`"に設定）をホストのデータソースとして設定します。<br>`DASHBOARD._hostid` - ダッシュボードの[*ホスト*セレクター](/manual/web_interface/frontend_sections/dashboards/widgets#override-host)をホストのデータソースとして設定します。<br><br>このパラメータは、[テンプレートダッシュボード](/manual/api/reference/templatedashboard/object)でウィジェットを構成する場合、サポートされません。|
|*Reference*|<|1|reference|5文字で構成される任意の文字列値（例：`ABCDE`、`JBPNL`）。この値は、ウィジェットが属するダッシュボード内で一意である必要があります。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *必須*|

[comment]: # ({/5b5973a0-f319d6dc})

[comment]: # ({b74496a7-313ae2b7})
### 例

次の例は、*グラフ（クラシック）*ウィジェットのダッシュボードウィジェットフィールドオブジェクトの設定を説明することだけを目的としています。
ダッシュボードの設定の詳細については、[`dashboard.create`](/manual/api/reference/dashboard/create)を参照してください。

[comment]: # ({/b74496a7-313ae2b7})

[comment]: # ({8071c2ec-a6ab08a1})
#### *グラフ（クラシック）*ウィジェットの設定

アイテム"42269"のシンプルなグラフを表示する*グラフ（クラシック）*ウィジェットを設定します。

[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "dashboard.create",
    "params": {
        "name": "My dashboard",
        "display_period": 30,
        "auto_start": 1,
        "pages": [
            {
                "widgets": [
                    {
                        "type": "graph",
                        "name": "Graph (classic)",
                        "x": 0,
                        "y": 0,
                        "width": 36,
                        "height": 5,
                        "view_mode": 0,
                        "fields": [
                            {
                                "type": 0,
                                "name": "source_type",
                                "value": 1
                            },
                            {
                                "type": 4,
                                "name": "itemid.0",
                                "value": 42269
                            },
                            {
                                "type": 1,
                                "name": "reference",
                                "value": "RSTUV"
                            }
                        ]
                    }
                ]
            }
        ],
        "userGroups": [
            {
                "usrgrpid": 7,
                "permission": 2
            }
        ],
        "users": [
            {
                "userid": 1,
                "permission": 3
            }
        ]
    },
    "id": 1
}
```

レスポンス:

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

[comment]: # ({/8071c2ec-a6ab08a1})

[comment]: # ({e9d30322-c57c98c8})
### 参照

-   [Dashboard widget field](/manual/api/reference/dashboard/object#dashboard-widget-field)
-   [`dashboard.create`](/manual/api/reference/dashboard/create)
-   [`dashboard.update`](/manual/api/reference/dashboard/update)

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