[comment]: # translation:outdated

[comment]: # ({000fdd04-000fdd04})
# graph.create

[comment]: # ({/000fdd04-000fdd04})

[comment]: # ({c0a9ce2e-e0ee1e5d})
### Descrizione

`object graph.create(object/array graphs)`

Questo metodo consente di creare nuovi grafici.

::: noteclassic
Questo metodo è disponibile solo per i tipi di utente *Admin* e *Super admin*.
Le autorizzazioni per chiamare il metodo possono essere revocate nelle impostazioni del ruolo utente.
Per ulteriori informazioni, vedere [User roles](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/c0a9ce2e-e0ee1e5d})

[comment]: # ({80694c55-fc8b02f4})
### Parametri

`(object/array)` Grafici da creare.

Oltre alle [proprietà standard del grafico](object#graph), il
metodo accetta i seguenti parametri.

|Parametro|[Type](/manual/api/reference_commentary#data-types)|Descrizione|
|--|--|------|
|gitems|array|[Item del grafico](/manual/api/reference/graphitem/object) da creare per il grafico.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio*|

[comment]: # ({/80694c55-fc8b02f4})

[comment]: # ({d64b873d-d64b873d})
### Restituisce i valori

`(object)` Restituisce un oggetto contenente gli ID dei grafici creati
sotto la proprietà `graphids`. L'ordine degli ID restituiti corrisponde a
ordine dei grafici passati.

[comment]: # ({/d64b873d-d64b873d})

[comment]: # ({b41637d2-b41637d2})
### Esempi

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({a5d4a0e3-cd12048c})
#### Creazione di un grafico

Creare un grafico con due item.

[Richiesta](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "graph.create",
    "params": {
        "name": "MySQL bandwidth",
        "width": 900,
        "height": 200,
        "gitems": [
            {
                "itemid": "22828",
                "color": "00AA00"
            },
            {
                "itemid": "22829",
                "color": "3333FF"
            }
        ]
    },
    "id": 1
}
```

Risposta:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "graphids": [
            "652"
        ]
    },
    "id": 1
}
```

[comment]: # ({/a5d4a0e3-cd12048c})

[comment]: # ({9c4b324a-88266563})
### Vedi anche

-   [Item del grafico](/manual/api/reference/graphitem/object#graph-item)

[comment]: # ({/9c4b324a-88266563})

[comment]: # ({4e535c8e-4e535c8e})
### Fonte

CGraph::create() in *ui/include/classes/api/services/CGraph.php*.

[comment]: # ({/4e535c8e-4e535c8e})
