[comment]: # ({84b81c15-a55a0f20})
# 9 Grafico (classico)

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

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

Questi parametri e i possibili valori delle proprietà per i rispettivi oggetti campo del widget dashboard consentono di configurare il widget [*Graph (classic)*](/manual/web_interface/frontend_sections/dashboards/widgets/graph_classic) nei metodi `dashboard.create` e `dashboard.update`.

::: noteimportant
Le proprietà `fields` del widget non vengono validate durante la creazione o l'aggiornamento di una dashboard.
Ciò consente agli utenti di modificare i [widget integrati](/manual/web_interface/frontend_sections/dashboards/widgets) e creare [widget personalizzati](/devel/modules/tutorials/widget), ma introduce anche il rischio di creare o aggiornare i widget in modo errato.
Per garantire la corretta creazione o il corretto aggiornamento del widget *Graph (classic)*, fare riferimento al comportamento dei parametri descritto nelle tabelle seguenti.
:::

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

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

I seguenti parametri sono supportati per il widget *Graph (classic)*.

|Parametro|<|[type](/manual/api/reference/dashboard/object#dashboard-widget-field)|name|value|
|-|-----|-|-----|-------------------|
|*Intervallo di aggiornamento*|<|0|rf_rate|0 - Nessun aggiornamento;<br>10 - 10 secondi;<br>30 - 30 secondi;<br>60 - *(predefinito)* 1 minuto;<br>120 - 2 minuti;<br>600 - 10 minuti;<br>900 - 15 minuti.|
|*Sorgente*|<|0|source_type|0 - *(predefinito)* Graph;<br>1 - Grafico semplice.|
|*Graph*|<|6|graphid.0|ID [Graph](/manual/api/reference/graph/get).<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio* se *Sorgente* è impostato su "Graph"|
|<|*Graph (Widget)*|1|graphid.\_reference|Invece dell'ID [Graph](/manual/api/reference/graph/get):<br>`ABCDE._graphid` - imposta un [widget compatibile](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (con il parametro *Reference* impostato su "`ABCDE`") come sorgente dati per i grafici.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio* se *Sorgente* è impostato su "Simple graph" e *Graph* non è impostato|
|*Item*|<|4|itemid.0|ID [Item](/manual/api/reference/item/get).<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio* se *Sorgente* è impostato su "Simple graph" e *Item (Widget)* non è impostato|
|<|*Item (Widget)*|1|itemid.\_reference|Invece dell'ID [Item](/manual/api/reference/item/get):<br>`ABCDE._itemid` - imposta un [widget compatibile](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (con il parametro *Reference* impostato su "`ABCDE`") come sorgente dati per gli item.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio* se *Sorgente* è impostato su "Simple graph" e *Item* non è impostato|
|*Periodo di tempo*|<|1|time_period.\_reference|`DASHBOARD._timeperiod` - imposta il [selettore del periodo di tempo](/manual/web_interface/time_period_selector) della dashboard come sorgente dati;<br>`ABCDE._timeperiod` - imposta un [widget compatibile](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (con il parametro *Reference* impostato su "`ABCDE`") come sorgente dati.<br><br>Predefinito: `DASHBOARD._timeperiod`<br><br>In alternativa, è possibile impostare il periodo di tempo solo nei parametri *From* e *To*.|
|<|*From*|1|time_period.from|Stringa temporale valida in sintassi temporale assoluta (`YYYY-MM-DD hh:mm:ss`) o [relativa](/manual/web_interface/time_period_selector) (`now`, `now/d`, `now/w-1w`, ecc.).<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *supportato* se *Periodo di tempo* non è impostato<br>- *obbligatorio* se `time_period.to` è impostato|
|^|*To*|1|time_period.to|Stringa temporale valida in sintassi temporale assoluta (`YYYY-MM-DD hh:mm:ss`) o [relativa](/manual/web_interface/time_period_selector) (`now`, `now/d`, `now/w-1w`, ecc.).<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *supportato* se *Periodo di tempo* non è impostato<br>- *obbligatorio* se `time_period.from` è impostato|
|*Mostra legenda*|<|0|show_legend|0 - Disabilitato;<br>1 - *(predefinito)* Abilitato.|
|*Sostituisci host*|<|1|override_hostid.\_reference|`ABCDE._hostid` - imposta un [widget compatibile](/manual/web_interface/frontend_sections/dashboards/widgets#widget-compatibility) (con il parametro *Reference* impostato su "`ABCDE`") come sorgente dati per gli host;<br>`DASHBOARD._hostid` - imposta il [selettore host](/manual/web_interface/frontend_sections/dashboards/widgets#override-host) della dashboard come sorgente dati per gli host.<br><br>Questo parametro non è supportato se si configura il widget in una [dashboard template](/manual/api/reference/templatedashboard/object).|
|*Reference*|<|1|reference|Qualsiasi valore stringa composto da 5 caratteri (ad esempio, `ABCDE` o `JBPNL`). Questo valore deve essere univoco all'interno della dashboard a cui appartiene il widget.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio*|

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

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

I seguenti esempi hanno lo scopo di descrivere solo la configurazione degli oggetti campo del widget della dashboard per il widget *Graph (classic)*.
Per ulteriori informazioni sulla configurazione di una dashboard, vedere [`dashboard.create`](/manual/api/reference/dashboard/create).

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

[comment]: # ({8071c2ec-a6ab08a1})
#### Configurazione di un widget *Graph (classic)*

Configurare un widget *Graph (classic)* che visualizza un grafico semplice per l'item "42269".

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

Risposta:

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

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

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

- [Campo del widget della dashboard](/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})
