**See www.zabbix.com for the official Zabbix site.**

# Docs/specs/ZBX-1911

**Chart Graphs**

There are following types of chart graphs:

- Normal – graph for each item are drown in given order with possible overlaying

- Stacked – graphs for items are stacked on top of each other

Normal Graphs has following drawing styles:

- Line – draws graph as line connecting each data point

- Filled region – draws graph as region formed by graph line and y axis

- Bold line – same as line, only thicker

- Dot – draws graph as points, each representing item value

- Dashed line – same as line, only dashed

- Gradient line – same as filled region, only with gradient

Stacked graphs supports only filled regions as drawing style. Negative values for stacked graphs are treated separately under x axis.

There is following options:

- Height and width of image containing graph, graph size is calculated to fit free of legend area.

- Show legend containing item, trigger and percentile info

- Show working time – intervals set in Administration>General>Working times as grayed out periods which are not in working time

- Show triggers – show item triggers expression functions comparison values as horizontal dashed lines, for those triggers which has only one function and if function used more than once in expression use first value. We don’t show triggers for stacked graphs. DISCUSSION!

- Show percentile [left/right] – calculate percentile according item values and draw horizontal line

- Y axis [min/max] values – set calculated, fixed or item

o Calculated – uses algorithm

o Fixed – given floating point number

o Item – item last value

- Items – items with following options:

o Function – min, max or avg value for each time point on x axis, or all three combined

o Draw style – mentioned above

o Y axis side – plot graph against left or right y axis values

o Color

**Calculation of left and right axis min and max values**

If fixed is set, then fixed is used. If item are used, then item last value is used , if last value doesn’t exist rise error. If calculated is set, special algorithm applies.

Max value is next greater value to maximal value within all items, which divides with double value of grid cell height. Same applies to minimal value only value should be smaller, than smallest.

We get value difference from item max value and min value: diff = max – min

We get vertical cell count dividing graph height with constant cell height: cCount = height/cHeight

We calculate secure cell represented value by dividing difference and cell count - 2: cVal = diff/(cCount-2)

We calculate graph min value by dividing min value and cell height and flooring: gMin = floor(min / cVal)

Same applies to max value.

If one fixed value is set, then it is used as item max/min value in calculation and count is subtracted by 1 not 2.

**Special cases**

To make decision to take data from history or trends we look in DB, if there exists at least on history data point right before start time of graph, we use history, if doesn’t exist we look for same in trends, if exists then use trends, if not exists, we fall back to history. Also if on pixel is representing one hour or more, then we use trends instead of history.

If data is missing for more than 4 delays, then do not interpolate data, but draw nothing instead for that period. For item delay default delay is used if set or minimal delay from flexible intervals. Interpolation is always performed for Zabbix trapper and SNMP trap items.

**Additionally**

Graph contains generation time like “Data from [trends/history]. Generated in x.xx sec.”.

Item names in legend are written with hostname like “hostname:itemname”.

For title graph name is used “name (1h)”, for simple graphs title of graph is “hostname:item (1h)”.

If item type changed from unsigned to float, show only float values in graph.

**Was (will be removed)**

Draw triggers in legend only if graph height greater than 120px.