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

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

[comment]: # ({ca0f9b93-028866a6})
### Description

These parameters and the possible property values for the respective dashboard widget field objects allow to configure the [*Graph (classic)*](/manual/web_interface/frontend_sections/dashboards/widgets/graph_classic) widget in `dashboard.create` and `dashboard.update` methods.

::: noteimportant
Widget `fields` properties are not validated during the creation or update of a dashboard.
This allows users to modify [built-in widgets](/manual/web_interface/frontend_sections/dashboards/widgets) and create [custom widgets](/devel/modules/tutorials/widget), but also introduces the risk of creating or updating widgets incorrectly.
To ensure the successful creation or update of the *Graph (classic)* widget, please refer to the parameter behavior outlined in the tables below.
:::

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

[comment]: # ({411e9d2d-f319d6dc})
### Parameters

The following parameters are supported for the *Graph (classic)* widget.

|Parameter|<|[type](/manual/api/reference/dashboard/object#dashboard-widget-field)|name|value|
|-|-----|-|-----|-------------------|
|*Refresh interval*|<|0|rf_rate|0 - No refresh;<br>10 - 10 seconds;<br>30 - 30 seconds;<br>60 - *(default)* 1 minute;<br>120 - 2 minutes;<br>600 - 10 minutes;<br>900 - 15 minutes.|
|*Source*|<|0|source_type|0 - *(default)* Graph;<br>1 - Simple graph.|
|*Graph*|<|6|graphid.0|[Graph](/manual/api/reference/graph/get) ID.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required* if *Source* is set to "Graph"|
|<|*Graph (Widget)*|1|graphid.\_reference|Instead of [Graph](/manual/api/reference/graph/get) ID:<br>`ABCDE._graphid` - set a [compatible widget](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (with its *Reference* parameter set to "`ABCDE`") as the data source for graphs.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required* if *Source* is set to "Simple graph" and *Graph* is not set|
|*Item*|<|4|itemid.0|[Item](/manual/api/reference/item/get) ID.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required* if *Source* is set to "Simple graph" and *Item (Widget)* is not set|
|<|*Item (Widget)*|1|itemid.\_reference|Instead of [Item](/manual/api/reference/item/get) ID:<br>`ABCDE._itemid` - set a [compatible widget](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (with its *Reference* parameter set to "`ABCDE`") as the data source for items.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required* if *Source* is set to "Simple graph" and *Item* is not set|
|*Time period*|<|1|time_period.\_reference|`DASHBOARD._timeperiod` - set the dashboard [time period selector](/manual/web_interface/time_period_selector) as the data source;<br>`ABCDE._timeperiod` - set a [compatible widget](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (with its *Reference* parameter set to "`ABCDE`") as the data source.<br><br>Default: `DASHBOARD._timeperiod`<br><br>Alternatively, you can set the time period only in the *From* and *To* parameters.|
|<|*From*|1|time_period.from|Valid time string in absolute (`YYYY-MM-DD hh:mm:ss`) or [relative](/manual/web_interface/time_period_selector) time syntax (`now`, `now/d`, `now/w-1w`, etc.).<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *supported* if *Time period* is not set<br>- *required* if `time_period.to` is set|
|^|*To*|1|time_period.to|Valid time string in absolute (`YYYY-MM-DD hh:mm:ss`) or [relative](/manual/web_interface/time_period_selector) time syntax (`now`, `now/d`, `now/w-1w`, etc.).<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *supported* if *Time period* is not set<br>- *required* if `time_period.from` is set|
|*Show legend*|<|0|show_legend|0 - Disabled;<br>1 - *(default)* Enabled.|
|*Override host*|<|1|override_hostid.\_reference|`ABCDE._hostid` - set a [compatible widget](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (with its *Reference* parameter set to "`ABCDE`") as the data source for hosts;<br>`DASHBOARD._hostid` - set the dashboard [host selector](/manual/web_interface/frontend_sections/dashboards/widgets#override-host) as the data source for hosts.<br><br>This parameter is not supported if configuring the widget on a [template dashboard](/manual/api/reference/templatedashboard/object).|
|*Reference*|<|1|reference|Any string value consisting of 5 characters (e.g., `ABCDE` or `JBPNL`). This value must be unique within the dashboard to which the widget belongs.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|

[comment]: # ({/411e9d2d-f319d6dc})

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

The following examples aim to only describe the configuration of the dashboard widget field objects for the *Graph (classic)* widget.
For more information on configuring a dashboard, see [`dashboard.create`](/manual/api/reference/dashboard/create).

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

[comment]: # ({8071c2ec-a6ab08a1})
#### Configuring a *Graph (classic)* widget

Configure a *Graph (classic)* widget that displays a simple graph for the item "42269".

[Request](/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
}
```

Response:

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

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

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

-   [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})
