2 Clock

Description

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

Widget fields properties are not validated during the creation or update of a dashboard. This allows users to modify built-in widgets and create custom widgets, but also introduces the risk of creating or updating widgets incorrectly. To ensure the successful creation or update of the Clock widget, please refer to the parameter behavior outlined in the tables below.

Parameters

The following parameters are supported for the Clock widget.

Parameter type name value
Refresh interval 0 rf_rate 0 - No refresh;
10 - 10 seconds;
30 - 30 seconds;
60 - 1 minute;
120 - 2 minutes;
600 - 10 minutes;
900 - (default) 15 minutes.
Time type 0 time_type 0 - (default) Local time;
1 - Server time;
2 - Host time.
Clock type 0 clock_type 0 - (default) Analog;
1 - Digital.

The following parameters are supported if Time type is set to "Host time".

Parameter type name value
Item 4 itemid.0 Item ID.

Parameter behavior:
- required

The following parameters are supported if Clock type is set to "Digital".

Parameter type name value
Show 0 show.0 1 - Date;
2 - (default) Time;
3 - Time zone.

Note: To configure multiple values, create a dashboard widget field object for each value with an incremented number in the property name.

Advanced configuration

The following advanced configuration parameters are supported if Clock type is set to "Digital".

Parameter type name value
Background color 1 bg_color Hexadecimal color code (e.g. FF0000).

Default: "" (empty).
Date

The following advanced configuration parameters are supported if Clock type is set to "Digital", and Show is set to "Date".

Parameter type name value
Size 0 date_size Possible values range from 1-100.

Default: 20.
Bold 0 date_bold 0 - (default) Disabled;
1 - Enabled.
Color 1 date_color Hexadecimal color code (e.g. FF0000).

Default: "" (empty).
Time

The following advanced configuration parameters are supported if Clock type is set to "Digital", and Show is set to "Time".

Parameter type name value
Size 0 time_size Possible values range from 1-100.

Default: 30.
Bold 0 time_bold 0 - (default) Disabled;
1 - Enabled.
Color 1 time_color Hexadecimal color code (e.g. FF0000).

Default: "" (empty).
Seconds 0 time_sec 0 - Disabled;
1 - (default) Enabled.
Format 0 time_format 0 - (default) 24-hour;
1 - 12-hour.
Time zone

The following advanced configuration parameters are supported if Clock type is set to "Digital", and Show is set to "Time zone".

Parameter type name value
Size 0 tzone_size Possible values range from 1-100.

Default: 20.
Bold 0 tzone_bold 0 - (default) Disabled;
1 - Enabled.
Color 1 tzone_color Hexadecimal color code (e.g. FF0000).

Default: "" (empty).
Time zone 1 tzone_timezone Valid timezone string (e.g. Europe/Riga, system, UTC, etc.). For the full list of supported time zones please refer to PHP documentation.

Default: local.

Parameter behavior:
- supported if Time type is set to "Local time" or "Server time"
Format 0 tzone_format 0 - (default) Short;
1 - Full.

Parameter behavior:
- supported if Time type is set to "Local time" or "Server time"

Examples

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

Configuring a Clock widget

Configure a Clock widget that displays local date, time and time zone in a customized digital clock.

Request:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "clock",
                               "name": "Clock",
                               "x": 0,
                               "y": 0,
                               "width": 12,
                               "height": 3,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 0,
                                       "name": "clock_type",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "show.0",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "show.1",
                                       "value": 2
                                   },
                                   {
                                       "type": 0,
                                       "name": "show.2",
                                       "value": 3
                                   },
                                   {
                                       "type": 0,
                                       "name": "date_size",
                                       "value": 20
                                   },
                                   {
                                       "type": 1,
                                       "name": "date_color",
                                       "value": "E1E1E1"
                                   },
                                   {
                                       "type": 0,
                                       "name": "time_bold",
                                       "value": 1
                                   },
                                   {
                                       "type": 0,
                                       "name": "tzone_size",
                                       "value": 10
                                   },
                                   {
                                       "type": 1,
                                       "name": "tzone_color",
                                       "value": "E1E1E1"
                                   },
                                   {
                                       "type": 1,
                                       "name": "tzone_timezone",
                                       "value": "Europe/Riga"
                                   },
                                   {
                                       "type": 0,
                                       "name": "tzone_format",
                                       "value": 1
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": 7,
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": 1,
                       "permission": 3
                   }
               ]
           },
           "id": 1
       }

Response:

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

See also