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

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

[comment]: # ({e0ee1e5d-e0ee1e5d})
### 説明

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

このメソッドは、新しいグラフを作成することができます。

::: noteclassic
このメソッドは、*Admin*および*Super admin*タイプのユーザーのみ利用可能です。メソッドを呼び出す権限は、ユーザーの役割の設定で取り消すことができます。詳細は[ユーザーの役割](/manual/web_interface/frontend_sections/administration/user_roles)を参照してください。
:::

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

[comment]: # ({11e52fc0-fc8b02f4})
### パラメーター

`(object/array)` 作成するグラフ。

[graphの標準プロパティ](object#graph)に加えて、このメソッドは以下のパラメーターを受け付けます。

|パラメーター|[タイプ](/manual/api/reference_commentary#data_types)|説明|
|--|--|------|
|**gitems**<br>(必須)|array|グラフ用に作成するグラフ[アイテム](/manual/api/reference/graphitem/object)。|

[comment]: # ({/11e52fc0-fc8b02f4})

[comment]: # ({d64b873d-d64b873d})
### 戻り値

`(object)` `graphids`プロパティの下に作成されたグラフのIDを含むオブジェクトを返します。返されるIDの順序は、渡されたグラフの順序と一致します。

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

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

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

[comment]: # ({49500778-cd12048c})
#### グラフの作成

2つのアイテムからなるグラフを作成します。

リクエスト:

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

レスポンス:

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

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

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

-   [Graph item](/manual/api/reference/graphitem/object#graph_item)

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

[comment]: # ({4e535c8e-4e535c8e})
### ソース

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

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