This is a translation of the original English documentation page. Help us make it better.

16 Pie chart

Description

These parameters and the possible property values for the respective dashboard widget field objects allow to configure the Pie chart widget in dashboard.create and dashboard.update methods.

Parameters

The following parameters are supported for the Pie chart widget.

Parameter type name value
Refresh interval 0 rf_rate 0 - No refresh;
10 - 10 seconds;
30 - 30 seconds;
60 - (default) 1 minute;
120 - 2 minutes;
600 - 10 minutes;
900 - 15 minutes.

Data set

The following parameters are supported for configuring a Data set.

The first number in the property name (e.g. ds.0.hosts.0, ds.0.items.0) represents the particular data set, while the second number, if present, represents the configured host or item.

Parameter type name value
Data set type 0 ds.0.dataset_type 0 - Item list;
1 - (default) Item pattern.
Parameters if Data set type is set to "Item list"
Items 4 ds.0.itemids.0 Item ID.
When configuring the widget on a template dashboard, only items configured on the template should be set.

Note: To configure multiple items, create a dashboard widget field object for each item.

Parameter behavior:
- required
Color 1 ds.0.color.0 Hexadecimal color code (e.g. FF0000).
Item type 0 ds.0.type.0 0 - (default) Normal;
1 - Total.

Parameter Item type "Total" can be set only for one item in the whole chart.
Parameters if Data set type is set to "Item pattern"
Host pattern 1 ds.0.hosts.0 Host name or pattern (e.g., "Zabbix*").

Parameter Host pattern not available when configuring the widget on a template dashboard.

Parameter behavior:
- required
Item pattern 1 ds.0.items.0 Item name or pattern (e.g., "*: Number of processed *values per second").
When configuring the widget on a template dashboard, only the pattern for items configured on the template should be set.

Parameter behavior:
- required
Color 1 ds.0.color Hexadecimal color code (e.g. FF0000).
Aggregation function 0 ds.0.aggregate_function 1 - min;
2 - max;
3 - avg;
4 - count;
5 - sum;
6 - first;
7 - (default) last.
Data set aggregation 0 ds.0.dataset_aggregation 0 - (default) none;
1 - min;
2 - max;
3 - avg;
4 - count;
5 - sum.

Parameter Data set aggregation not available if Item type in "Item list" data set is set to "Total".
Data set label 1 ds.0.data_set_label Any string value.

Default: "" (empty).

Displaying options

The following parameters are supported for configuring Displaying options.

Parameter type name value
History data selection 0 source 0 - (default) Auto;
1 - History;
2 - Trends.
Draw 0 draw_type 0 - (default) Pie;
1 - Doughnut.
Space between sectors 0 space Valid values range from 0-10.

Default: 1.
Merge sectors smaller than N% (checkbox) 0 merge 0 - (default) Disabled;
1 - Enabled.
Merge sectors smaller than N% (value) 0 merge_percent Valid values range from 1-10.

Default: 1.

Parameter Merge sectors smaller than N% (value) not available if Merge sectors smaller than N% (checkbox) is set to "Disabled".
Merge sectors smaller than N% (color) 1 merge_color Hexadecimal color code (e.g. FF0000).
Parameters if Draw is set to "Doughnut"
Width 0 width 20 - 20% of the radius;
30 - 30% of the radius;
40 - 40% of the radius;
50 - (default) 50% of the radius.
Show total value 0 total_show 0 - (default) Disabled;
1 - Enabled.
Parameters if Show total value is set to "Enabled"
Size 0 value_size_type 0 - (default) Auto;
1 - Custom.
Size (value for custom size) 0 value_size Valid values range from 1-100.

Default: 20.
Decimal places 0 decimal_places Valid values range from 0-6.

Default: 2.
Units (checkbox) 0 units_show 0 - (default) Disabled;
1 - Enabled.
Units (value) 1 units Any string value.

Parameter Units (value) not available if Units (checkbox) is set to "Disabled".
Bold 0 value_bold 0 - (default) Disabled;
1 - Enabled.
Color 1 value_color Hexadecimal color code (e.g. FF0000).

Time period

The following parameters are supported for configuring Time period.

Parameter type name value
Set custom time period 0 graph_time 0 - (default) Disabled;
1 - Enabled.
From 1 time_from Valid time string in format YYYY-MM-DD hh:mm:ss.
Relative time period values (now, now/d, now/w-1w, etc.) are also supported.

Default: now-1h.
To 1 time_to Valid time string value in format YYYY-MM-DD hh:mm:ss.
Relative time period values (now, now/d, now/w-1w, etc.) are also supported.

Default: now.

Legend

The following parameters are supported for configuring Legend.

Parameter type name value
Show legend 0 legend 0 - Disabled;
1 - (default) Enabled.
Show aggregation function 0 legend_aggregation 0 - (default) Disabled;
1 - Enabled.
Number of rows 0 legend_lines Valid values range from 1-10.

Default: 1.
Number of columns 0 legend_columns Valid values range from 1-4.

Default: 4.

Examples

The following examples aim to only describe the configuration of the dashboard widget field objects for the Pie chart widget. For more information on configuring a dashboard, see dashboard.create.

Configuring a Pie chart widget

Configure a Pie chart widget in the following way:

  • 2 data sets for a total of 9 items on 1 host.
  • The first data set is of type "Item list" and consists of 3 items that are all with type "Normal" and represented by a different color.
  • The second data set is of type "Item pattern", consists of 6 items, has a configured aggregation for each item, and is represented by a custom color.
  • The second data set also has a custom data set label.
  • Data in the pie chart are displayed as a doughnut chart with a custom width and total value with units in the center.
  • Data in the pie chart are displayed and aggregated for a custom time period of the last 3 hours.
  • Pie chart legend displays configured items in 4 rows.

Request:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "piechart",
                               "name": "Pie chart",
                               "x": 0,
                               "y": 0,
                               "width": 8,
                               "height": 5,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 0,
                                       "name": "ds.0.dataset_type",
                                       "value": 0
                                   },
                                   {
                                       "type": 4,
                                       "name": "ds.0.itemids.1",
                                       "value": 23264
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.0.color.1",
                                       "value": "FF0000"
                                   },
                                   {
                                       "type": 0,
                                       "name": "ds.0.type.1",
                                       "value": 0
                                   },
                                   {
                                       "type": 4,
                                       "name": "ds.0.itemids.2",
                                       "value": 23269
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.0.color.2",
                                       "value": "BF00FF"
                                   },
                                   {
                                     "type": 0,
                                     "name": "ds.0.type.2",
                                     "value": 0
                                   },
                                   {
                                       "type": 4,
                                       "name": "ds.0.itemids.3",
                                       "value": 23257
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.0.color.3",
                                       "value": "0040FF"
                                   },
                                   {
                                     "type": 0,
                                     "name": "ds.0.type.3",
                                     "value": 0
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.hosts.0",
                                       "value": "Zabbix server"
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.items.0",
                                       "value": "*: Number of processed *values per second"
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.color",
                                       "value": "000000"
                                   },
                                   {
                                       "type": 0,
                                       "name": "ds.1.aggregate_function",
                                       "value": 3
                                   },
                                   {
                                       "type": 1,
                                       "name": "ds.1.data_set_label",
                                       "value": "Number of processed values per second"
                                   },
                                   {
                                       "type": 0,
                                       "name": "draw_type",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "width",
                                       "value": 30
                                   },
                                   {
                                       "type": 0,
                                       "name": "total_show",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "units_show",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "graph_time",
                                       "value": 1
                                   },
                                   {
                                       "type": 1,
                                       "name": "time_from",
                                       "value": "now-3h"
                                   },
                                   {
                                       "type": 0,
                                       "name": "legend_lines",
                                       "value": 4
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": 7,
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": 1,
                       "permission": 3
                   }
               ]
           },
           "id": 1
       }

Response:

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

See also