[comment]: # ({e66cbe53-a55a0f20})
# 10 Graph (classic)

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

[comment]: # ({ca0f9b93-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]: # ({/ca0f9b93-028866a6})

[comment]: # ({b5d1ac50-f319d6dc})
### パラメータ

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

|パラメータ|<|[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|[Graph](/manual/api/reference/graph/get) ID。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *Source* が「Graph」に設定されている場合は *必須*|
|<|*グラフ（ウィジェット）*|1|graphid.\_reference|[Graph](/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>- *Source* が「Simple graph」に設定されており、*Graph* が設定されていない場合は *必須*|
|*アイテム*|<|4|itemid.0|[Item](/manual/api/reference/item/get) ID。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *Source* が「Simple graph」に設定されており、*Item (Widget)* が設定されていない場合は *必須*|
|<|*アイテム（ウィジェット）*|1|itemid.\_reference|[Item](/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>- *Source* が「Simple graph」に設定されており、*Item* が設定されていない場合は *必須*|
|*期間*|<|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>または、*開始* および *終了* パラメータでのみ期間を設定することもできます。|
|<|*開始*|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>- *Time period* が設定されていない場合に *サポート*<br>- `time_period.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>- *Time period* が設定されていない場合に *サポート*<br>- `time_period.from` が設定されている場合は *必須*|
|*凡例の表示*|<|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]: # ({/b5d1ac50-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})
