[comment]: # translation:outdated

[comment]: # ({40e66620-d2516189})
# 5.graph.update

[comment]: # ({/40e66620-d2516189})

[comment]: # ({2b982521-fbd2d6c5})
### 描述

`对象 graph.update(object/array graphs)`

此方法用于更新已存在的图表。

[comment]: # ({/2b982521-fbd2d6c5})

[comment]: # ({591782e3-72c99624})
### 参数

`(对象/数组)` 要更新的图表属性。

每一个图表都必须定义`graphid` 属性, 其它属性均为可选项.
只有被传递的属性会被更新, 其他属性将保持不变。

除了 [标准图表属性](object#graph) 之外，此方法还接受以下参数。

|参数     类|描述|<|
|--------------|------|-|
|gitems|array|替换已存在图表监控项的图表监控项。如果一个图表监控项的 `gitemid` 属性已经被定义，那么它将会被更新, 否则将会创建一个新的图表监控项。|

[comment]: # ({/591782e3-72c99624})

[comment]: # ({f44ab5e5-9a0b4500})
### 返回值

`(对象)` 在 `graphids` 属性下，返回一个包含已更新图表的ID的对象。

[comment]: # ({/f44ab5e5-9a0b4500})

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

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

[comment]: # ({70f1ee52-7b33f5ce})
#### 设置Y刻度的最大值

设置Y刻度的最大值为固定值100。

请求:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "graph.update",
    "params": {
        "graphid": "439",
        "ymax_type": 1,
        "yaxismax": 100
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

响应:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "graphids": [
            "439"
        ]
    },
    "id": 1
}
```

[comment]: # ({/70f1ee52-7b33f5ce})

[comment]: # ({73275f35-84b1446b})
### 来源

CGraph::update() in
*frontends/php/include/classes/api/services/CGraph.php*.

[comment]: # ({/73275f35-84b1446b})
