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.

Parameters

The following parameters are supported for the Clock widget.

Parametertypenamevalue
Refresh interval0rf_rate0 - No refresh;
10 - 10 seconds;
30 - 30 seconds;
60 - 1 minute;
120 - 2 minutes;
600 - 10 minutes;
900 - (default) 15 minutes.
Time type0time_type0 - (default) Local time;
1 - Server time;
2 - Host time.
Clock type0clock_type0 - (default) Analog;
1 - Digital.

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

Parametertypenamevalue
Item
(required)
4itemidItem ID.

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

Parametertypenamevalue
Show0show1 - Date;
2 - (default) Time;
3 - Time zone.

Note: To configure multiple values, create a dashboard widget field object for each value.
Advanced configuration0adv_conf0 - (default) Disabled;
1 - Enabled.

Parameter Advanced configuration must be set to “Enabled” to configure Background color and all options for Date, Time and Time zone.
Background color1bg_colorHexadecimal color code (e.g. FF0000).

Default: “” (empty).
Date
Size0date_sizeValid values range from 1-100.

Default: 20.
Bold0date_bold0 - (default) Disabled;
1 - Enabled.
Color1date_colorHexadecimal color code (e.g. FF0000).

Default: “” (empty).
Time
Size0time_sizeValid values range from 1-100.

Default: 30.
Bold0time_bold0 - (default) Disabled;
1 - Enabled.
Color1time_colorHexadecimal color code (e.g. FF0000).

Default: “” (empty).
Seconds0time_sec0 - Disabled;
1 - (default) Enabled.
Format0time_format0 - (default) 24-hour;
1 - 12-hour.
Time zone
Size0tzone_sizeValid values range from 1-100.

Default: 20.
Bold0tzone_bold0 - (default) Disabled;
1 - Enabled.
Color1tzone_colorHexadecimal color code (e.g. FF0000).

Default: “” (empty).
Time zone1tzone_timezoneValid 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 Time zone not available if Time type is set to “Host time”.
Format0tzone_format0 - (default) Short;
1 - Full.

Parameter Format not available if Time type is set to “Host 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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "dashboard.create",
  4. "params": {
  5. "name": "My dashboard",
  6. "display_period": 30,
  7. "auto_start": 1,
  8. "pages": [
  9. {
  10. "widgets": [
  11. {
  12. "type": "clock",
  13. "name": "Clock",
  14. "x": 0,
  15. "y": 0,
  16. "width": 4,
  17. "height": 3,
  18. "view_mode": 0,
  19. "fields": [
  20. {
  21. "type": 0,
  22. "name": "clock_type",
  23. "value": 1
  24. },
  25. {
  26. "type": 0,
  27. "name": "show",
  28. "value": 1
  29. },
  30. {
  31. "type": 0,
  32. "name": "show",
  33. "value": 2
  34. },
  35. {
  36. "type": 0,
  37. "name": "show",
  38. "value": 3
  39. },
  40. {
  41. "type": 0,
  42. "name": "adv_conf",
  43. "value": 1
  44. },
  45. {
  46. "type": 0,
  47. "name": "date_size",
  48. "value": 20
  49. },
  50. {
  51. "type": 1,
  52. "name": "date_color",
  53. "value": "E1E1E1"
  54. },
  55. {
  56. "type": 0,
  57. "name": "time_bold",
  58. "value": 1
  59. },
  60. {
  61. "type": 0,
  62. "name": "tzone_size",
  63. "value": 10
  64. },
  65. {
  66. "type": 1,
  67. "name": "tzone_color",
  68. "value": "E1E1E1"
  69. },
  70. {
  71. "type": 1,
  72. "name": "tzone_timezone",
  73. "value": "Europe/Riga"
  74. },
  75. {
  76. "type": 0,
  77. "name": "tzone_format",
  78. "value": 1
  79. }
  80. ]
  81. }
  82. ]
  83. }
  84. ],
  85. "userGroups": [
  86. {
  87. "usrgrpid": 7,
  88. "permission": 2
  89. }
  90. ],
  91. "users": [
  92. {
  93. "userid": 1,
  94. "permission": 3
  95. }
  96. ]
  97. },
  98. "id": 1
  99. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "dashboardids": [
  5. "3"
  6. ]
  7. },
  8. "id": 1
  9. }

See also