@wavemaker-ai/app-ng-runtime 12.0.2-rc.647771 → 12.1.0-rc.647821

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/build-task/bundles/index.umd.js +2489 -2963
  2. package/build-task/fesm2022/index.mjs +2307 -2786
  3. package/build-task/fesm2022/index.mjs.map +1 -1
  4. package/build-task/types/index.d.ts +401 -844
  5. package/components/advanced/carousel/bundles/index.umd.js +387 -344
  6. package/components/advanced/carousel/fesm2022/index.mjs +363 -325
  7. package/components/advanced/carousel/fesm2022/index.mjs.map +1 -1
  8. package/components/advanced/carousel/types/index.d.ts +85 -86
  9. package/components/advanced/custom/bundles/index.umd.js +298 -249
  10. package/components/advanced/custom/fesm2022/index.mjs +280 -236
  11. package/components/advanced/custom/fesm2022/index.mjs.map +1 -1
  12. package/components/advanced/custom/types/index.d.ts +49 -49
  13. package/components/advanced/login/bundles/index.umd.js +177 -127
  14. package/components/advanced/login/fesm2022/index.mjs +162 -117
  15. package/components/advanced/login/fesm2022/index.mjs.map +1 -1
  16. package/components/advanced/login/types/index.d.ts +33 -34
  17. package/components/advanced/marquee/bundles/index.umd.js +93 -63
  18. package/components/advanced/marquee/fesm2022/index.mjs +73 -48
  19. package/components/advanced/marquee/fesm2022/index.mjs.map +1 -1
  20. package/components/advanced/marquee/types/index.d.ts +11 -12
  21. package/components/base/bundles/index.umd.js +5515 -6359
  22. package/components/base/fesm2022/index.mjs +5169 -6027
  23. package/components/base/fesm2022/index.mjs.map +1 -1
  24. package/components/base/types/index.d.ts +1198 -1154
  25. package/components/basic/anchor/bundles/index.umd.js +273 -195
  26. package/components/basic/anchor/fesm2022/index.mjs +251 -178
  27. package/components/basic/anchor/fesm2022/index.mjs.map +1 -1
  28. package/components/basic/anchor/types/index.d.ts +40 -41
  29. package/components/basic/audio/bundles/index.umd.js +124 -75
  30. package/components/basic/audio/fesm2022/index.mjs +104 -60
  31. package/components/basic/audio/fesm2022/index.mjs.map +1 -1
  32. package/components/basic/audio/types/index.d.ts +22 -23
  33. package/components/basic/html/bundles/index.umd.js +144 -113
  34. package/components/basic/html/fesm2022/index.mjs +125 -99
  35. package/components/basic/html/fesm2022/index.mjs.map +1 -1
  36. package/components/basic/html/types/index.d.ts +20 -17
  37. package/components/basic/icon/bundles/index.umd.js +144 -72
  38. package/components/basic/icon/fesm2022/index.mjs +124 -57
  39. package/components/basic/icon/fesm2022/index.mjs.map +1 -1
  40. package/components/basic/icon/types/index.d.ts +18 -19
  41. package/components/basic/iframe/bundles/index.umd.js +143 -93
  42. package/components/basic/iframe/fesm2022/index.mjs +124 -79
  43. package/components/basic/iframe/fesm2022/index.mjs.map +1 -1
  44. package/components/basic/iframe/types/index.d.ts +28 -29
  45. package/components/basic/label/bundles/index.umd.js +136 -120
  46. package/components/basic/label/fesm2022/index.mjs +118 -107
  47. package/components/basic/label/fesm2022/index.mjs.map +1 -1
  48. package/components/basic/label/types/index.d.ts +14 -15
  49. package/components/basic/picture/bundles/index.umd.js +171 -130
  50. package/components/basic/picture/fesm2022/index.mjs +152 -116
  51. package/components/basic/picture/fesm2022/index.mjs.map +1 -1
  52. package/components/basic/picture/types/index.d.ts +21 -22
  53. package/components/basic/progress/progress-bar/bundles/index.umd.js +211 -160
  54. package/components/basic/progress/progress-bar/fesm2022/index.mjs +193 -147
  55. package/components/basic/progress/progress-bar/fesm2022/index.mjs.map +1 -1
  56. package/components/basic/progress/progress-bar/types/index.d.ts +45 -41
  57. package/components/basic/progress/progress-circle/bundles/index.umd.js +294 -165
  58. package/components/basic/progress/progress-circle/fesm2022/index.mjs +274 -150
  59. package/components/basic/progress/progress-circle/fesm2022/index.mjs.map +1 -1
  60. package/components/basic/progress/progress-circle/types/index.d.ts +41 -42
  61. package/components/basic/progress/progress-utils/bundles/index.umd.js +27 -29
  62. package/components/basic/progress/progress-utils/fesm2022/index.mjs +18 -25
  63. package/components/basic/progress/progress-utils/fesm2022/index.mjs.map +1 -1
  64. package/components/basic/progress/progress-utils/types/index.d.ts +3 -5
  65. package/components/basic/rich-text-editor/bundles/index.umd.js +294 -228
  66. package/components/basic/rich-text-editor/fesm2022/index.mjs +275 -214
  67. package/components/basic/rich-text-editor/fesm2022/index.mjs.map +1 -1
  68. package/components/basic/rich-text-editor/types/index.d.ts +55 -56
  69. package/components/basic/search/bundles/index.umd.js +1129 -1090
  70. package/components/basic/search/fesm2022/index.mjs +1117 -1083
  71. package/components/basic/search/fesm2022/index.mjs.map +1 -1
  72. package/components/basic/search/types/index.d.ts +132 -130
  73. package/components/basic/spinner/bundles/index.umd.js +216 -120
  74. package/components/basic/spinner/fesm2022/index.mjs +201 -110
  75. package/components/basic/spinner/fesm2022/index.mjs.map +1 -1
  76. package/components/basic/spinner/types/index.d.ts +30 -31
  77. package/components/basic/tree/bundles/index.umd.js +756 -756
  78. package/components/basic/tree/fesm2022/index.mjs +740 -745
  79. package/components/basic/tree/fesm2022/index.mjs.map +1 -1
  80. package/components/basic/tree/types/index.d.ts +106 -97
  81. package/components/basic/video/bundles/index.umd.js +164 -108
  82. package/components/basic/video/fesm2022/index.mjs +145 -94
  83. package/components/basic/video/fesm2022/index.mjs.map +1 -1
  84. package/components/basic/video/types/index.d.ts +29 -30
  85. package/components/chart/bundles/index.umd.js +1768 -1737
  86. package/components/chart/fesm2022/index.mjs +1713 -1728
  87. package/components/chart/fesm2022/index.mjs.map +1 -1
  88. package/components/chart/types/index.d.ts +102 -104
  89. package/components/containers/accordion/bundles/index.umd.js +522 -494
  90. package/components/containers/accordion/fesm2022/index.mjs +502 -479
  91. package/components/containers/accordion/fesm2022/index.mjs.map +1 -1
  92. package/components/containers/accordion/types/index.d.ts +116 -116
  93. package/components/containers/layout-grid/bundles/index.umd.js +260 -164
  94. package/components/containers/layout-grid/fesm2022/index.mjs +231 -140
  95. package/components/containers/layout-grid/fesm2022/index.mjs.map +1 -1
  96. package/components/containers/layout-grid/types/index.d.ts +30 -27
  97. package/components/containers/linear-layout/bundles/index.umd.js +220 -178
  98. package/components/containers/linear-layout/fesm2022/index.mjs +193 -156
  99. package/components/containers/linear-layout/fesm2022/index.mjs.map +1 -1
  100. package/components/containers/linear-layout/types/index.d.ts +26 -26
  101. package/components/containers/panel/bundles/index.umd.js +343 -215
  102. package/components/containers/panel/fesm2022/index.mjs +330 -207
  103. package/components/containers/panel/fesm2022/index.mjs.map +1 -1
  104. package/components/containers/panel/types/index.d.ts +48 -49
  105. package/components/containers/tabs/bundles/index.umd.js +832 -779
  106. package/components/containers/tabs/fesm2022/index.mjs +811 -763
  107. package/components/containers/tabs/fesm2022/index.mjs.map +1 -1
  108. package/components/containers/tabs/types/index.d.ts +134 -126
  109. package/components/containers/tile/bundles/index.umd.js +93 -60
  110. package/components/containers/tile/fesm2022/index.mjs +75 -47
  111. package/components/containers/tile/fesm2022/index.mjs.map +1 -1
  112. package/components/containers/tile/types/index.d.ts +11 -12
  113. package/components/containers/wizard/bundles/index.umd.js +1096 -1078
  114. package/components/containers/wizard/fesm2022/index.mjs +1069 -1056
  115. package/components/containers/wizard/fesm2022/index.mjs.map +1 -1
  116. package/components/containers/wizard/types/index.d.ts +258 -252
  117. package/components/data/card/bundles/index.umd.js +439 -229
  118. package/components/data/card/fesm2022/index.mjs +408 -203
  119. package/components/data/card/fesm2022/index.mjs.map +1 -1
  120. package/components/data/card/types/index.d.ts +50 -48
  121. package/components/data/form/bundles/index.umd.js +3392 -3339
  122. package/components/data/form/fesm2022/index.mjs +3350 -3304
  123. package/components/data/form/fesm2022/index.mjs.map +1 -1
  124. package/components/data/form/types/index.d.ts +561 -482
  125. package/components/data/list/bundles/index.umd.js +1523 -1601
  126. package/components/data/list/fesm2022/index.mjs +1507 -1590
  127. package/components/data/list/fesm2022/index.mjs.map +1 -1
  128. package/components/data/list/types/index.d.ts +300 -283
  129. package/components/data/live-table/bundles/index.umd.js +299 -280
  130. package/components/data/live-table/fesm2022/index.mjs +284 -270
  131. package/components/data/live-table/fesm2022/index.mjs.map +1 -1
  132. package/components/data/live-table/types/index.d.ts +42 -39
  133. package/components/data/pagination/bundles/index.umd.js +848 -881
  134. package/components/data/pagination/fesm2022/index.mjs +835 -879
  135. package/components/data/pagination/fesm2022/index.mjs.map +1 -1
  136. package/components/data/pagination/types/index.d.ts +110 -106
  137. package/components/data/table/bundles/index.umd.js +4977 -5042
  138. package/components/data/table/fesm2022/index.mjs +4937 -5007
  139. package/components/data/table/fesm2022/index.mjs.map +1 -1
  140. package/components/data/table/types/index.d.ts +770 -736
  141. package/components/dialogs/alert-dialog/bundles/index.umd.js +259 -118
  142. package/components/dialogs/alert-dialog/fesm2022/index.mjs +243 -109
  143. package/components/dialogs/alert-dialog/fesm2022/index.mjs.map +1 -1
  144. package/components/dialogs/alert-dialog/types/index.d.ts +31 -26
  145. package/components/dialogs/confirm-dialog/bundles/index.umd.js +250 -121
  146. package/components/dialogs/confirm-dialog/fesm2022/index.mjs +236 -114
  147. package/components/dialogs/confirm-dialog/fesm2022/index.mjs.map +1 -1
  148. package/components/dialogs/confirm-dialog/types/index.d.ts +34 -29
  149. package/components/dialogs/default/bundles/index.umd.js +509 -373
  150. package/components/dialogs/default/fesm2022/index.mjs +485 -354
  151. package/components/dialogs/default/fesm2022/index.mjs.map +1 -1
  152. package/components/dialogs/default/types/index.d.ts +129 -86
  153. package/components/dialogs/design-dialog/bundles/index.umd.js +320 -142
  154. package/components/dialogs/design-dialog/fesm2022/index.mjs +305 -132
  155. package/components/dialogs/design-dialog/fesm2022/index.mjs.map +1 -1
  156. package/components/dialogs/design-dialog/types/index.d.ts +31 -20
  157. package/components/dialogs/iframe-dialog/bundles/index.umd.js +258 -111
  158. package/components/dialogs/iframe-dialog/fesm2022/index.mjs +245 -105
  159. package/components/dialogs/iframe-dialog/fesm2022/index.mjs.map +1 -1
  160. package/components/dialogs/iframe-dialog/types/index.d.ts +27 -22
  161. package/components/dialogs/login-dialog/bundles/index.umd.js +139 -106
  162. package/components/dialogs/login-dialog/fesm2022/index.mjs +125 -97
  163. package/components/dialogs/login-dialog/fesm2022/index.mjs.map +1 -1
  164. package/components/dialogs/login-dialog/types/index.d.ts +27 -26
  165. package/components/dialogs/partial-dialog/bundles/index.umd.js +302 -149
  166. package/components/dialogs/partial-dialog/fesm2022/index.mjs +289 -143
  167. package/components/dialogs/partial-dialog/fesm2022/index.mjs.map +1 -1
  168. package/components/dialogs/partial-dialog/types/index.d.ts +37 -32
  169. package/components/input/base-form/bundles/index.umd.js +143 -139
  170. package/components/input/base-form/fesm2022/index.mjs +129 -130
  171. package/components/input/base-form/fesm2022/index.mjs.map +1 -1
  172. package/components/input/base-form/types/index.d.ts +28 -29
  173. package/components/input/base-form-custom/bundles/index.umd.js +107 -121
  174. package/components/input/base-form-custom/fesm2022/index.mjs +88 -107
  175. package/components/input/base-form-custom/fesm2022/index.mjs.map +1 -1
  176. package/components/input/base-form-custom/types/index.d.ts +23 -26
  177. package/components/input/button/bundles/index.umd.js +177 -89
  178. package/components/input/button/fesm2022/index.mjs +158 -75
  179. package/components/input/button/fesm2022/index.mjs.map +1 -1
  180. package/components/input/button/types/index.d.ts +24 -25
  181. package/components/input/button-group/bundles/index.umd.js +110 -72
  182. package/components/input/button-group/fesm2022/index.mjs +90 -57
  183. package/components/input/button-group/fesm2022/index.mjs.map +1 -1
  184. package/components/input/button-group/types/index.d.ts +13 -14
  185. package/components/input/calendar/bundles/index.umd.js +615 -647
  186. package/components/input/calendar/fesm2022/index.mjs +596 -649
  187. package/components/input/calendar/fesm2022/index.mjs.map +1 -1
  188. package/components/input/calendar/types/index.d.ts +130 -131
  189. package/components/input/caption-position/bundles/index.umd.js +175 -188
  190. package/components/input/caption-position/fesm2022/index.mjs +159 -177
  191. package/components/input/caption-position/fesm2022/index.mjs.map +1 -1
  192. package/components/input/caption-position/types/index.d.ts +31 -34
  193. package/components/input/checkbox/bundles/index.umd.js +339 -200
  194. package/components/input/checkbox/fesm2022/index.mjs +319 -185
  195. package/components/input/checkbox/fesm2022/index.mjs.map +1 -1
  196. package/components/input/checkbox/types/index.d.ts +46 -41
  197. package/components/input/checkboxset/bundles/index.umd.js +256 -170
  198. package/components/input/checkboxset/fesm2022/index.mjs +242 -161
  199. package/components/input/checkboxset/fesm2022/index.mjs.map +1 -1
  200. package/components/input/checkboxset/types/index.d.ts +26 -27
  201. package/components/input/chips/bundles/index.umd.js +721 -733
  202. package/components/input/chips/fesm2022/index.mjs +706 -723
  203. package/components/input/chips/fesm2022/index.mjs.map +1 -1
  204. package/components/input/chips/types/index.d.ts +101 -90
  205. package/components/input/color-picker/bundles/index.umd.js +312 -137
  206. package/components/input/color-picker/fesm2022/index.mjs +296 -126
  207. package/components/input/color-picker/fesm2022/index.mjs.map +1 -1
  208. package/components/input/color-picker/types/index.d.ts +35 -36
  209. package/components/input/composite/bundles/index.umd.js +127 -112
  210. package/components/input/composite/fesm2022/index.mjs +106 -96
  211. package/components/input/composite/fesm2022/index.mjs.map +1 -1
  212. package/components/input/composite/types/index.d.ts +26 -27
  213. package/components/input/currency/bundles/index.umd.js +237 -104
  214. package/components/input/currency/fesm2022/index.mjs +219 -91
  215. package/components/input/currency/fesm2022/index.mjs.map +1 -1
  216. package/components/input/currency/types/index.d.ts +30 -31
  217. package/components/input/dataset-aware-form/bundles/index.umd.js +298 -346
  218. package/components/input/dataset-aware-form/fesm2022/index.mjs +286 -339
  219. package/components/input/dataset-aware-form/fesm2022/index.mjs.map +1 -1
  220. package/components/input/dataset-aware-form/types/index.d.ts +80 -80
  221. package/components/input/epoch/base-date-time/bundles/index.umd.js +809 -1081
  222. package/components/input/epoch/base-date-time/fesm2022/index.mjs +796 -1073
  223. package/components/input/epoch/base-date-time/fesm2022/index.mjs.map +1 -1
  224. package/components/input/epoch/base-date-time/types/index.d.ts +244 -247
  225. package/components/input/epoch/date/bundles/index.umd.js +619 -513
  226. package/components/input/epoch/date/fesm2022/index.mjs +604 -503
  227. package/components/input/epoch/date/fesm2022/index.mjs.map +1 -1
  228. package/components/input/epoch/date/types/index.d.ts +63 -64
  229. package/components/input/epoch/date-time/bundles/index.umd.js +682 -511
  230. package/components/input/epoch/date-time/fesm2022/index.mjs +672 -506
  231. package/components/input/epoch/date-time/fesm2022/index.mjs.map +1 -1
  232. package/components/input/epoch/date-time/types/index.d.ts +111 -112
  233. package/components/input/epoch/date-time-picker/bundles/index.umd.js +417 -321
  234. package/components/input/epoch/date-time-picker/fesm2022/index.mjs +405 -314
  235. package/components/input/epoch/date-time-picker/fesm2022/index.mjs.map +1 -1
  236. package/components/input/epoch/date-time-picker/types/index.d.ts +135 -80
  237. package/components/input/epoch/picker/bundles/index.umd.js +201 -148
  238. package/components/input/epoch/picker/fesm2022/index.mjs +183 -135
  239. package/components/input/epoch/picker/fesm2022/index.mjs.map +1 -1
  240. package/components/input/epoch/picker/types/index.d.ts +46 -38
  241. package/components/input/epoch/time/bundles/index.umd.js +534 -392
  242. package/components/input/epoch/time/fesm2022/index.mjs +523 -386
  243. package/components/input/epoch/time/fesm2022/index.mjs.map +1 -1
  244. package/components/input/epoch/time/types/index.d.ts +107 -108
  245. package/components/input/file-upload/bundles/index.umd.js +500 -477
  246. package/components/input/file-upload/fesm2022/index.mjs +484 -466
  247. package/components/input/file-upload/fesm2022/index.mjs.map +1 -1
  248. package/components/input/file-upload/types/index.d.ts +110 -109
  249. package/components/input/number/bundles/index.umd.js +241 -101
  250. package/components/input/number/fesm2022/index.mjs +224 -89
  251. package/components/input/number/fesm2022/index.mjs.map +1 -1
  252. package/components/input/number/types/index.d.ts +28 -29
  253. package/components/input/radioset/bundles/index.umd.js +240 -156
  254. package/components/input/radioset/fesm2022/index.mjs +226 -147
  255. package/components/input/radioset/fesm2022/index.mjs.map +1 -1
  256. package/components/input/radioset/types/index.d.ts +25 -26
  257. package/components/input/rating/bundles/index.umd.js +353 -266
  258. package/components/input/rating/fesm2022/index.mjs +337 -255
  259. package/components/input/rating/fesm2022/index.mjs.map +1 -1
  260. package/components/input/rating/types/index.d.ts +52 -53
  261. package/components/input/select/bundles/index.umd.js +295 -217
  262. package/components/input/select/fesm2022/index.mjs +280 -207
  263. package/components/input/select/fesm2022/index.mjs.map +1 -1
  264. package/components/input/select/types/index.d.ts +38 -39
  265. package/components/input/slider/bundles/index.umd.js +316 -197
  266. package/components/input/slider/fesm2022/index.mjs +297 -183
  267. package/components/input/slider/fesm2022/index.mjs.map +1 -1
  268. package/components/input/slider/types/index.d.ts +43 -44
  269. package/components/input/switch/bundles/index.umd.js +257 -219
  270. package/components/input/switch/fesm2022/index.mjs +243 -210
  271. package/components/input/switch/fesm2022/index.mjs.map +1 -1
  272. package/components/input/switch/types/index.d.ts +34 -35
  273. package/components/input/text/bundles/index.umd.js +1585 -1120
  274. package/components/input/text/fesm2022/index.mjs +1542 -1082
  275. package/components/input/text/fesm2022/index.mjs.map +1 -1
  276. package/components/input/text/types/index.d.ts +313 -310
  277. package/components/input/textarea/bundles/index.umd.js +224 -100
  278. package/components/input/textarea/fesm2022/index.mjs +207 -88
  279. package/components/input/textarea/fesm2022/index.mjs.map +1 -1
  280. package/components/input/textarea/types/index.d.ts +32 -33
  281. package/components/navigation/breadcrumb/bundles/index.umd.js +205 -131
  282. package/components/navigation/breadcrumb/fesm2022/index.mjs +188 -118
  283. package/components/navigation/breadcrumb/fesm2022/index.mjs.map +1 -1
  284. package/components/navigation/breadcrumb/types/index.d.ts +29 -28
  285. package/components/navigation/menu/bundles/index.umd.js +1461 -950
  286. package/components/navigation/menu/fesm2022/index.mjs +1416 -910
  287. package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
  288. package/components/navigation/menu/types/index.d.ts +220 -193
  289. package/components/navigation/navbar/bundles/index.umd.js +172 -79
  290. package/components/navigation/navbar/fesm2022/index.mjs +155 -67
  291. package/components/navigation/navbar/fesm2022/index.mjs.map +1 -1
  292. package/components/navigation/navbar/types/index.d.ts +19 -20
  293. package/components/navigation/popover/bundles/index.umd.js +543 -519
  294. package/components/navigation/popover/fesm2022/index.mjs +524 -505
  295. package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
  296. package/components/navigation/popover/types/index.d.ts +86 -86
  297. package/components/page/default/bundles/index.umd.js +634 -451
  298. package/components/page/default/fesm2022/index.mjs +600 -422
  299. package/components/page/default/fesm2022/index.mjs.map +1 -1
  300. package/components/page/default/types/index.d.ts +123 -119
  301. package/components/page/footer/bundles/index.umd.js +91 -63
  302. package/components/page/footer/fesm2022/index.mjs +71 -48
  303. package/components/page/footer/fesm2022/index.mjs.map +1 -1
  304. package/components/page/footer/types/index.d.ts +11 -12
  305. package/components/page/header/bundles/index.umd.js +96 -59
  306. package/components/page/header/fesm2022/index.mjs +76 -44
  307. package/components/page/header/fesm2022/index.mjs.map +1 -1
  308. package/components/page/header/types/index.d.ts +12 -13
  309. package/components/page/left-panel/bundles/index.umd.js +405 -407
  310. package/components/page/left-panel/fesm2022/index.mjs +386 -393
  311. package/components/page/left-panel/fesm2022/index.mjs.map +1 -1
  312. package/components/page/left-panel/types/index.d.ts +47 -40
  313. package/components/page/right-panel/bundles/index.umd.js +115 -78
  314. package/components/page/right-panel/fesm2022/index.mjs +96 -64
  315. package/components/page/right-panel/fesm2022/index.mjs.map +1 -1
  316. package/components/page/right-panel/types/index.d.ts +14 -13
  317. package/components/page/top-nav/bundles/index.umd.js +91 -60
  318. package/components/page/top-nav/fesm2022/index.mjs +73 -47
  319. package/components/page/top-nav/fesm2022/index.mjs.map +1 -1
  320. package/components/page/top-nav/types/index.d.ts +11 -12
  321. package/components/prefab/bundles/index.umd.js +253 -173
  322. package/components/prefab/fesm2022/index.mjs +233 -158
  323. package/components/prefab/fesm2022/index.mjs.map +1 -1
  324. package/components/prefab/types/index.d.ts +35 -33
  325. package/core/bundles/index.umd.js +4466 -5642
  326. package/core/fesm2022/index.mjs +3997 -5202
  327. package/core/fesm2022/index.mjs.map +1 -1
  328. package/core/types/index.d.ts +1785 -1808
  329. package/http/bundles/index.umd.js +339 -413
  330. package/http/fesm2022/index.mjs +323 -402
  331. package/http/fesm2022/index.mjs.map +1 -1
  332. package/http/types/index.d.ts +107 -112
  333. package/locales/moment/am-et.js +73 -0
  334. package/locales/moment/bm.js +2 -0
  335. package/locales/moment/ca.js +1 -1
  336. package/locales/moment/de-at.js +29 -1
  337. package/locales/moment/de-ch.js +29 -1
  338. package/locales/moment/de.js +29 -1
  339. package/locales/moment/hu.js +3 -3
  340. package/locales/moment/id.js +12 -1
  341. package/locales/moment/ka.js +1 -1
  342. package/locales/moment/mk.js +0 -1
  343. package/locales/moment/nl-be.js +1 -1
  344. package/locales/moment/pl.js +1 -1
  345. package/locales/moment/ps.js +188 -0
  346. package/locales/moment/pt-br.js +14 -6
  347. package/locales/moment/sv.js +1 -1
  348. package/locales/moment/sw.js +56 -14
  349. package/locales/moment/uk.js +5 -4
  350. package/locales/moment/uz-latn.js +1 -1
  351. package/locales/moment/uz.js +1 -1
  352. package/npm-shrinkwrap.json +2 -2
  353. package/oAuth/bundles/index.umd.js +326 -483
  354. package/oAuth/fesm2022/index.mjs +267 -429
  355. package/oAuth/fesm2022/index.mjs.map +1 -1
  356. package/oAuth/types/index.d.ts +22 -26
  357. package/package-lock.json +2 -2
  358. package/package.json +1 -1
  359. package/runtime/base/bundles/index.umd.js +6380 -6093
  360. package/runtime/base/fesm2022/index.mjs +6368 -6107
  361. package/runtime/base/fesm2022/index.mjs.map +1 -1
  362. package/runtime/base/types/index.d.ts +1336 -1359
  363. package/runtime/dynamic/bundles/index.umd.js +1215 -851
  364. package/runtime/dynamic/fesm2022/index.mjs +1253 -898
  365. package/runtime/dynamic/fesm2022/index.mjs.map +1 -1
  366. package/runtime/dynamic/types/index.d.ts +140 -128
  367. package/scripts/datatable/datatable.js +20 -30
  368. package/security/bundles/index.umd.js +297 -438
  369. package/security/fesm2022/index.mjs +282 -443
  370. package/security/fesm2022/index.mjs.map +1 -1
  371. package/security/types/index.d.ts +127 -130
  372. package/swipey/bundles/index.umd.js +57 -48
  373. package/swipey/fesm2022/index.mjs +55 -50
  374. package/swipey/fesm2022/index.mjs.map +1 -1
  375. package/swipey/types/index.d.ts +19 -21
  376. package/transpiler/bundles/index.umd.js +1174 -811
  377. package/transpiler/fesm2022/index.mjs +1109 -757
  378. package/transpiler/fesm2022/index.mjs.map +1 -1
  379. package/transpiler/types/index.d.ts +32 -36
  380. package/variables/bundles/index.umd.js +2226 -3245
  381. package/variables/fesm2022/index.mjs +2117 -3237
  382. package/variables/fesm2022/index.mjs.map +1 -1
  383. package/variables/types/index.d.ts +410 -393
  384. package/build-task/.npmignore +0 -2
  385. package/components/advanced/carousel/.npmignore +0 -2
  386. package/components/advanced/custom/.npmignore +0 -2
  387. package/components/advanced/login/.npmignore +0 -2
  388. package/components/advanced/marquee/.npmignore +0 -2
  389. package/components/base/.npmignore +0 -2
  390. package/components/basic/anchor/.npmignore +0 -2
  391. package/components/basic/audio/.npmignore +0 -2
  392. package/components/basic/html/.npmignore +0 -2
  393. package/components/basic/icon/.npmignore +0 -2
  394. package/components/basic/iframe/.npmignore +0 -2
  395. package/components/basic/label/.npmignore +0 -2
  396. package/components/basic/picture/.npmignore +0 -2
  397. package/components/basic/progress/progress-bar/.npmignore +0 -2
  398. package/components/basic/progress/progress-circle/.npmignore +0 -2
  399. package/components/basic/progress/progress-utils/.npmignore +0 -2
  400. package/components/basic/rich-text-editor/.npmignore +0 -2
  401. package/components/basic/search/.npmignore +0 -2
  402. package/components/basic/spinner/.npmignore +0 -2
  403. package/components/basic/tree/.npmignore +0 -2
  404. package/components/basic/video/.npmignore +0 -2
  405. package/components/chart/.npmignore +0 -2
  406. package/components/containers/accordion/.npmignore +0 -2
  407. package/components/containers/layout-grid/.npmignore +0 -2
  408. package/components/containers/linear-layout/.npmignore +0 -2
  409. package/components/containers/panel/.npmignore +0 -2
  410. package/components/containers/tabs/.npmignore +0 -2
  411. package/components/containers/tile/.npmignore +0 -2
  412. package/components/containers/wizard/.npmignore +0 -2
  413. package/components/data/card/.npmignore +0 -2
  414. package/components/data/form/.npmignore +0 -2
  415. package/components/data/list/.npmignore +0 -2
  416. package/components/data/live-table/.npmignore +0 -2
  417. package/components/data/pagination/.npmignore +0 -2
  418. package/components/data/table/.npmignore +0 -2
  419. package/components/dialogs/alert-dialog/.npmignore +0 -2
  420. package/components/dialogs/confirm-dialog/.npmignore +0 -2
  421. package/components/dialogs/default/.npmignore +0 -2
  422. package/components/dialogs/design-dialog/.npmignore +0 -2
  423. package/components/dialogs/iframe-dialog/.npmignore +0 -2
  424. package/components/dialogs/login-dialog/.npmignore +0 -2
  425. package/components/dialogs/partial-dialog/.npmignore +0 -2
  426. package/components/input/base-form/.npmignore +0 -2
  427. package/components/input/base-form-custom/.npmignore +0 -2
  428. package/components/input/button/.npmignore +0 -2
  429. package/components/input/button-group/.npmignore +0 -2
  430. package/components/input/calendar/.npmignore +0 -2
  431. package/components/input/caption-position/.npmignore +0 -2
  432. package/components/input/checkbox/.npmignore +0 -2
  433. package/components/input/checkboxset/.npmignore +0 -2
  434. package/components/input/chips/.npmignore +0 -2
  435. package/components/input/color-picker/.npmignore +0 -2
  436. package/components/input/composite/.npmignore +0 -2
  437. package/components/input/currency/.npmignore +0 -2
  438. package/components/input/dataset-aware-form/.npmignore +0 -2
  439. package/components/input/epoch/base-date-time/.npmignore +0 -2
  440. package/components/input/epoch/date/.npmignore +0 -2
  441. package/components/input/epoch/date-time/.npmignore +0 -2
  442. package/components/input/epoch/date-time-picker/.npmignore +0 -2
  443. package/components/input/epoch/picker/.npmignore +0 -2
  444. package/components/input/epoch/time/.npmignore +0 -2
  445. package/components/input/file-upload/.npmignore +0 -2
  446. package/components/input/number/.npmignore +0 -2
  447. package/components/input/radioset/.npmignore +0 -2
  448. package/components/input/rating/.npmignore +0 -2
  449. package/components/input/select/.npmignore +0 -2
  450. package/components/input/slider/.npmignore +0 -2
  451. package/components/input/switch/.npmignore +0 -2
  452. package/components/input/text/.npmignore +0 -2
  453. package/components/input/textarea/.npmignore +0 -2
  454. package/components/navigation/breadcrumb/.npmignore +0 -2
  455. package/components/navigation/menu/.npmignore +0 -2
  456. package/components/navigation/navbar/.npmignore +0 -2
  457. package/components/navigation/popover/.npmignore +0 -2
  458. package/components/page/default/.npmignore +0 -2
  459. package/components/page/footer/.npmignore +0 -2
  460. package/components/page/header/.npmignore +0 -2
  461. package/components/page/left-panel/.npmignore +0 -2
  462. package/components/page/right-panel/.npmignore +0 -2
  463. package/components/page/top-nav/.npmignore +0 -2
  464. package/components/prefab/.npmignore +0 -2
  465. package/core/.npmignore +0 -2
  466. package/http/.npmignore +0 -2
  467. package/oAuth/.npmignore +0 -2
  468. package/runtime/base/.npmignore +0 -2
  469. package/runtime/dynamic/.npmignore +0 -2
  470. package/security/.npmignore +0 -2
  471. package/swipey/.npmignore +0 -2
  472. package/transpiler/.npmignore +0 -2
  473. package/variables/.npmignore +0 -2
@@ -1,1745 +1,1776 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@wm/components/basic/spinner'), require('@angular/core'), require('@wm/core'), require('@wm/components/base'), require('lodash-es'), require('moment')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@angular/common', '@wm/components/basic/spinner', '@angular/core', '@wm/core', '@wm/components/base', 'lodash-es', 'moment'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.chart = {}), global.ng.common, global.wm.components.basic.spinner, global.ng.core, global.wm.core, global.wm.components.base, global._, global.momentLib));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@wm/components/basic/spinner'), require('@angular/core'), require('@wm/core'), require('@wm/components/base'), require('lodash-es'), require('moment')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@angular/common', '@wm/components/basic/spinner', '@angular/core', '@wm/core', '@wm/components/base', 'lodash-es', 'moment'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.chart = {}), global.ng.common, global.wm.components.basic.spinner, global.ng.core, global.wm.core, global.wm.components.base, global._, global.momentLib));
5
5
  })(this, (function (exports, i2, spinner, i0, i1, base, lodashEs, momentLib) { 'use strict';
6
6
 
7
- function _interopNamespaceDefault(e) {
8
- var n = Object.create(null);
9
- if (e) {
10
- Object.keys(e).forEach(function (k) {
11
- if (k !== 'default') {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: function () { return e[k]; }
16
- });
17
- }
18
- });
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
7
+ function _interopNamespaceDefault(e) {
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
23
 
24
- var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);
25
- var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
26
- var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
27
- var momentLib__namespace = /*#__PURE__*/_interopNamespaceDefault(momentLib);
24
+ var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);
25
+ var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
27
+ var momentLib__namespace = /*#__PURE__*/_interopNamespaceDefault(momentLib);
28
28
 
29
- const registerProps = () => {
30
- base.register('wm-chart', new Map([
31
- ['aggregation', { value: 'none', ...base.PROP_STRING }],
32
- ['aggregationcolumn', base.PROP_STRING],
33
- ['areaviewtype', { value: 'stack', ...base.PROP_STRING }],
34
- ['barspacing', { value: 'medium', ...base.PROP_STRING }],
35
- ['bubblesize', base.PROP_STRING],
36
- ['centerlabel', base.PROP_STRING],
37
- ['class', base.PROP_STRING],
38
- ['customcolors', base.PROP_ANY],
39
- ['dataset', base.PROP_ANY],
40
- ['datasource', base.PROP_STRING],
41
- ['donutratio', { value: 'medium', ...base.PROP_STRING }],
42
- ['formattype', { value: '', PROP_STRING: base.PROP_STRING }],
43
- ['groupby', base.PROP_STRING],
44
- ['height', { value: '210px', PROP_STRING: base.PROP_STRING }],
45
- ['highlightpoints', base.PROP_BOOLEAN],
46
- ['iconclass', base.PROP_STRING],
47
- ['iconurl', base.PROP_STRING],
48
- ['interpolation', { value: 'linear', ...base.PROP_STRING }],
49
- ['labelthreshold', { value: 0.01, ...base.PROP_NUMBER }],
50
- ['labeltype', { value: 'percent', ...base.PROP_STRING }],
51
- ['legendtype', { value: 'furious', ...base.PROP_STRING }],
52
- ['linethickness', base.PROP_STRING],
53
- ['loadingdatamsg', { value: 'Loading...', ...base.PROP_STRING }],
54
- ['name', base.PROP_STRING],
55
- ['nodatamessage', { value: 'No Data Available.', ...base.PROP_STRING }],
56
- ['offset', base.PROP_STRING],
57
- ['offsetbottom', { value: 55, ...base.PROP_NUMBER }],
58
- ['offsetleft', { value: 75, ...base.PROP_NUMBER }],
59
- ['offsetright', { value: 25, ...base.PROP_NUMBER }],
60
- ['offsettop', { value: 25, ...base.PROP_NUMBER }],
61
- ['orderby', base.PROP_STRING],
62
- ['reducexticks', { value: true, ...base.PROP_BOOLEAN }],
63
- ['shape', { value: 'circle', ...base.PROP_STRING }],
64
- ['show', { value: true, ...base.PROP_BOOLEAN }],
65
- ['showlabels', { value: 'outside', ...base.PROP_STRING }],
66
- ['showlabelsoutside', { value: true, ...base.PROP_BOOLEAN }],
67
- ['showlegend', { value: 'top', ...base.PROP_STRING }],
68
- ['showvalues', { value: false, ...base.PROP_BOOLEAN }],
69
- ['showxaxis', { value: true, ...base.PROP_BOOLEAN }],
70
- ['showxdistance', { value: false, ...base.PROP_BOOLEAN }],
71
- ['showyaxis', { value: true, ...base.PROP_BOOLEAN }],
72
- ['showydistance', { value: false, ...base.PROP_BOOLEAN }],
73
- ['staggerlabels', { value: false, ...base.PROP_BOOLEAN }],
74
- ['subheading', base.PROP_STRING],
75
- ['theme', base.PROP_STRING],
76
- ['title', base.PROP_STRING],
77
- ['tooltips', { value: true, ...base.PROP_BOOLEAN }],
78
- ['type', base.PROP_STRING],
79
- ['viewtype', { value: 'Grouped', ...base.PROP_STRING }],
80
- ['xaxisdatakey', base.PROP_STRING],
81
- ['xaxislabel', base.PROP_STRING],
82
- ['xaxislabeldistance', { value: 12, ...base.PROP_NUMBER }],
83
- ['xdateformat', base.PROP_STRING],
84
- ['xdomain', { value: 'Default', ...base.PROP_STRING }],
85
- ['xnumberformat', base.PROP_STRING],
86
- ['xunits', base.PROP_STRING],
87
- ['yaxisdatakey', base.PROP_STRING],
88
- ['yaxislabel', base.PROP_STRING],
89
- ['yaxislabeldistance', { value: 12, ...base.PROP_NUMBER }],
90
- ['ydomain', { value: 'Default', ...base.PROP_STRING }],
91
- ['ynumberformat', base.PROP_STRING],
92
- ['yunits', base.PROP_STRING]
93
- ]));
94
- };
29
+ const registerProps = () => {
30
+ base.register("wm-chart", /* @__PURE__ */ new Map([
31
+ ["aggregation", {
32
+ value: "none",
33
+ ...base.PROP_STRING
34
+ }],
35
+ ["aggregationcolumn", base.PROP_STRING],
36
+ ["areaviewtype", {
37
+ value: "stack",
38
+ ...base.PROP_STRING
39
+ }],
40
+ ["barspacing", {
41
+ value: "medium",
42
+ ...base.PROP_STRING
43
+ }],
44
+ ["bubblesize", base.PROP_STRING],
45
+ ["centerlabel", base.PROP_STRING],
46
+ ["class", base.PROP_STRING],
47
+ ["customcolors", base.PROP_ANY],
48
+ ["dataset", base.PROP_ANY],
49
+ ["datasource", base.PROP_STRING],
50
+ ["donutratio", {
51
+ value: "medium",
52
+ ...base.PROP_STRING
53
+ }],
54
+ ["formattype", {
55
+ value: "",
56
+ PROP_STRING: base.PROP_STRING
57
+ }],
58
+ ["groupby", base.PROP_STRING],
59
+ ["height", {
60
+ value: "210px",
61
+ PROP_STRING: base.PROP_STRING
62
+ }],
63
+ ["highlightpoints", base.PROP_BOOLEAN],
64
+ ["iconclass", base.PROP_STRING],
65
+ ["iconurl", base.PROP_STRING],
66
+ ["interpolation", {
67
+ value: "linear",
68
+ ...base.PROP_STRING
69
+ }],
70
+ ["labelthreshold", {
71
+ value: .01,
72
+ ...base.PROP_NUMBER
73
+ }],
74
+ ["labeltype", {
75
+ value: "percent",
76
+ ...base.PROP_STRING
77
+ }],
78
+ ["legendtype", {
79
+ value: "furious",
80
+ ...base.PROP_STRING
81
+ }],
82
+ ["linethickness", base.PROP_STRING],
83
+ ["loadingdatamsg", {
84
+ value: "Loading...",
85
+ ...base.PROP_STRING
86
+ }],
87
+ ["name", base.PROP_STRING],
88
+ ["nodatamessage", {
89
+ value: "No Data Available.",
90
+ ...base.PROP_STRING
91
+ }],
92
+ ["offset", base.PROP_STRING],
93
+ ["offsetbottom", {
94
+ value: 55,
95
+ ...base.PROP_NUMBER
96
+ }],
97
+ ["offsetleft", {
98
+ value: 75,
99
+ ...base.PROP_NUMBER
100
+ }],
101
+ ["offsetright", {
102
+ value: 25,
103
+ ...base.PROP_NUMBER
104
+ }],
105
+ ["offsettop", {
106
+ value: 25,
107
+ ...base.PROP_NUMBER
108
+ }],
109
+ ["orderby", base.PROP_STRING],
110
+ ["reducexticks", {
111
+ value: true,
112
+ ...base.PROP_BOOLEAN
113
+ }],
114
+ ["shape", {
115
+ value: "circle",
116
+ ...base.PROP_STRING
117
+ }],
118
+ ["show", {
119
+ value: true,
120
+ ...base.PROP_BOOLEAN
121
+ }],
122
+ ["showlabels", {
123
+ value: "outside",
124
+ ...base.PROP_STRING
125
+ }],
126
+ ["showlabelsoutside", {
127
+ value: true,
128
+ ...base.PROP_BOOLEAN
129
+ }],
130
+ ["showlegend", {
131
+ value: "top",
132
+ ...base.PROP_STRING
133
+ }],
134
+ ["showvalues", {
135
+ value: false,
136
+ ...base.PROP_BOOLEAN
137
+ }],
138
+ ["showxaxis", {
139
+ value: true,
140
+ ...base.PROP_BOOLEAN
141
+ }],
142
+ ["showxdistance", {
143
+ value: false,
144
+ ...base.PROP_BOOLEAN
145
+ }],
146
+ ["showyaxis", {
147
+ value: true,
148
+ ...base.PROP_BOOLEAN
149
+ }],
150
+ ["showydistance", {
151
+ value: false,
152
+ ...base.PROP_BOOLEAN
153
+ }],
154
+ ["staggerlabels", {
155
+ value: false,
156
+ ...base.PROP_BOOLEAN
157
+ }],
158
+ ["subheading", base.PROP_STRING],
159
+ ["theme", base.PROP_STRING],
160
+ ["title", base.PROP_STRING],
161
+ ["tooltips", {
162
+ value: true,
163
+ ...base.PROP_BOOLEAN
164
+ }],
165
+ ["type", base.PROP_STRING],
166
+ ["viewtype", {
167
+ value: "Grouped",
168
+ ...base.PROP_STRING
169
+ }],
170
+ ["xaxisdatakey", base.PROP_STRING],
171
+ ["xaxislabel", base.PROP_STRING],
172
+ ["xaxislabeldistance", {
173
+ value: 12,
174
+ ...base.PROP_NUMBER
175
+ }],
176
+ ["xdateformat", base.PROP_STRING],
177
+ ["xdomain", {
178
+ value: "Default",
179
+ ...base.PROP_STRING
180
+ }],
181
+ ["xnumberformat", base.PROP_STRING],
182
+ ["xunits", base.PROP_STRING],
183
+ ["yaxisdatakey", base.PROP_STRING],
184
+ ["yaxislabel", base.PROP_STRING],
185
+ ["yaxislabeldistance", {
186
+ value: 12,
187
+ ...base.PROP_NUMBER
188
+ }],
189
+ ["ydomain", {
190
+ value: "Default",
191
+ ...base.PROP_STRING
192
+ }],
193
+ ["ynumberformat", base.PROP_STRING],
194
+ ["yunits", base.PROP_STRING]
195
+ ]));
196
+ };
197
+ const moment = momentLib__namespace.default || window["moment"];
198
+ const chartTypes = [
199
+ "Column",
200
+ "Line",
201
+ "Area",
202
+ "Cumulative Line",
203
+ "Bar",
204
+ "Pie",
205
+ "Donut",
206
+ "Bubble"
207
+ ];
208
+ const allShapes = [
209
+ "circle",
210
+ "square",
211
+ "diamond",
212
+ "cross",
213
+ "triangle-up",
214
+ "triangle-down"
215
+ ];
216
+ const dateList = [
217
+ "01/01/2001",
218
+ "01/01/2002",
219
+ "01/01/2003"
220
+ ];
221
+ const themes = {
222
+ "Terrestrial": {
223
+ colors: [
224
+ "#1f77b4",
225
+ "#aec7e8",
226
+ "#ff7f0e",
227
+ "#ffbb78",
228
+ "#2ca02c",
229
+ "#98df8a",
230
+ "#d62728",
231
+ "#ff9896",
232
+ "#9467bd",
233
+ "#c5b0d5",
234
+ "#8c564b",
235
+ "#c49c94",
236
+ "#e377c2",
237
+ "#f7b6d2",
238
+ "#7f7f7f",
239
+ "#c7c7c7",
240
+ "#bcbd22",
241
+ "#dbdb8d",
242
+ "#17becf",
243
+ "#9edae5"
244
+ ],
245
+ tooltip: {
246
+ "backgroundColor": "#de7d28",
247
+ "textColor": "#FFFFFF"
248
+ }
249
+ },
250
+ "Annabelle": {
251
+ colors: [
252
+ "#393b79",
253
+ "#5254a3",
254
+ "#6b6ecf",
255
+ "#9c9ede",
256
+ "#637939",
257
+ "#8ca252",
258
+ "#b5cf6b",
259
+ "#cedb9c",
260
+ "#8c6d31",
261
+ "#bd9e39",
262
+ "#e7ba52",
263
+ "#e7cb94",
264
+ "#843c39",
265
+ "#ad494a",
266
+ "#d6616b",
267
+ "#e7969c",
268
+ "#7b4173",
269
+ "#a55194",
270
+ "#ce6dbd",
271
+ "#de9ed6"
272
+ ],
273
+ tooltip: {
274
+ "backgroundColor": "#2e306f",
275
+ "textColor": "#FFFFFF"
276
+ }
277
+ },
278
+ "Azure": {
279
+ colors: [
280
+ "#3182bd",
281
+ "#6baed6",
282
+ "#9ecae1",
283
+ "#c6dbef",
284
+ "#e6550d",
285
+ "#fd8d3c",
286
+ "#fdae6b",
287
+ "#fdd0a2",
288
+ "#31a354",
289
+ "#74c476",
290
+ "#a1d99b",
291
+ "#c7e9c0",
292
+ "#756bb1",
293
+ "#9e9ac8",
294
+ "#bcbddc",
295
+ "#dadaeb",
296
+ "#636363",
297
+ "#969696",
298
+ "#bdbdbd",
299
+ "#d9d9d9"
300
+ ],
301
+ tooltip: {
302
+ "backgroundColor": "#3182bd",
303
+ "textColor": "#FFFFFF"
304
+ }
305
+ },
306
+ "Retro": {
307
+ colors: [
308
+ "#0ca7a1",
309
+ "#ffa615",
310
+ "#334957",
311
+ "#acc5c2",
312
+ "#988f90",
313
+ "#8accc9",
314
+ "#515151",
315
+ "#f27861",
316
+ "#36c9fd",
317
+ "#794668",
318
+ "#0f709d",
319
+ "#0d2738",
320
+ "#44be78",
321
+ "#4a1839",
322
+ "#6a393f",
323
+ "#557d8b",
324
+ "#6c331c",
325
+ "#1c1c1c",
326
+ "#861500",
327
+ "#09562a"
328
+ ],
329
+ tooltip: {
330
+ "backgroundColor": "#80513a",
331
+ "textColor": "#FFFFFF"
332
+ }
333
+ },
334
+ "Mellow": {
335
+ colors: [
336
+ "#f0dcbf",
337
+ "#88c877",
338
+ "#aeb918",
339
+ "#2e2c23",
340
+ "#ddddd2",
341
+ "#dfe956",
342
+ "#4c963b",
343
+ "#5d3801",
344
+ "#e1eec3",
345
+ "#cd8472",
346
+ "#fcfab3",
347
+ "#9a4635",
348
+ "#9295ad",
349
+ "#2e3f12",
350
+ "#565677",
351
+ "#557d8b",
352
+ "#4f4d02",
353
+ "#0c0c1b",
354
+ "#833324",
355
+ "#24120e"
356
+ ],
357
+ tooltip: {
358
+ "backgroundColor": "#7c9e73",
359
+ "textColor": "#FFFFFF"
360
+ }
361
+ },
362
+ "Orient": {
363
+ colors: [
364
+ "#a80000",
365
+ "#cc6c3c",
366
+ "#f0e400",
367
+ "#000084",
368
+ "#fccc6c",
369
+ "#009c6c",
370
+ "#cc309c",
371
+ "#78cc00",
372
+ "#fc84e4",
373
+ "#48e4fc",
374
+ "#4878d8",
375
+ "#186c0c",
376
+ "#606060",
377
+ "#a8a8a8",
378
+ "#000000",
379
+ "#d7d7d7",
380
+ "#75a06e",
381
+ "#190d0b",
382
+ "#888888",
383
+ "#694b84"
384
+ ],
385
+ tooltip: {
386
+ "backgroundColor": "#c14242",
387
+ "textColor": "#FFFFFF"
388
+ }
389
+ },
390
+ "GrayScale": {
391
+ colors: [
392
+ "#141414",
393
+ "#353535",
394
+ "#5b5b5b",
395
+ "#848484",
396
+ "#a8a8a8",
397
+ "#c3c3c3",
398
+ "#e0e0e0",
399
+ "#c8c8c8",
400
+ "#a5a5a5",
401
+ "#878787",
402
+ "#656565",
403
+ "#4e4e4e",
404
+ "#303030",
405
+ "#1c1c1c",
406
+ "#4f4f4f",
407
+ "#3b3b3b",
408
+ "#757575",
409
+ "#606060",
410
+ "#868686",
411
+ "#c1c1c1"
412
+ ],
413
+ tooltip: {
414
+ "backgroundColor": "#575757",
415
+ "textColor": "#FFFFFF"
416
+ }
417
+ },
418
+ "Flyer": {
419
+ colors: [
420
+ "#3f454c",
421
+ "#5a646e",
422
+ "#848778",
423
+ "#cededf",
424
+ "#74c4dd",
425
+ "#0946ed",
426
+ "#380bb1",
427
+ "#000ff0",
428
+ "#f54a23",
429
+ "#1db262",
430
+ "#bca3aa",
431
+ "#ffa500",
432
+ "#a86b32",
433
+ "#63a18c",
434
+ "#56795e",
435
+ "#934343",
436
+ "#b75f5f",
437
+ "#752d2d",
438
+ "#4e1111",
439
+ "#920606"
440
+ ],
441
+ tooltip: {
442
+ "backgroundColor": "#47637c",
443
+ "textColor": "#FFFFFF"
444
+ }
445
+ },
446
+ "Luminosity": {
447
+ colors: [
448
+ "#FFFFFF",
449
+ "#e4e4e4",
450
+ "#00bcd4",
451
+ "#f0dd2f",
452
+ "#00aabf",
453
+ "#018376",
454
+ "#e91e63",
455
+ "#39e5d4",
456
+ "#ff6d6d",
457
+ "#00ff76",
458
+ "#ff9800",
459
+ "#969696",
460
+ "#ff4200",
461
+ "#e00000",
462
+ "#95cbe5",
463
+ "#5331ff",
464
+ "#fff4a7",
465
+ "#e7a800",
466
+ "#0061e4",
467
+ "#d5e7ff"
468
+ ],
469
+ tooltip: {
470
+ "backgroundColor": "#47637c",
471
+ "textColor": "#FFFFFF"
472
+ }
473
+ }
474
+ };
475
+ const basicProperties = [
476
+ "xaxislabel",
477
+ "yaxislabel",
478
+ "xunits",
479
+ "yunits",
480
+ "xnumberformat",
481
+ "xdateformat",
482
+ "ynumberformat",
483
+ "showvalues",
484
+ "showlabels",
485
+ "viewtype",
486
+ "areaviewtype",
487
+ "staggerlabels",
488
+ "reducexticks",
489
+ "offsettop",
490
+ "offsetbottom",
491
+ "offsetright",
492
+ "offsetleft",
493
+ "barspacing",
494
+ "xaxislabeldistance",
495
+ "yaxislabeldistance",
496
+ "theme",
497
+ "labeltype",
498
+ "donutratio",
499
+ "showlabelsoutside",
500
+ "showxdistance",
501
+ "showydistance",
502
+ "shape",
503
+ "nodatamessage",
504
+ "captions",
505
+ "showxaxis",
506
+ "showyaxis",
507
+ "centerlabel",
508
+ "customcolors",
509
+ "showlegend",
510
+ "legendtype",
511
+ "xdomain",
512
+ "ydomain",
513
+ "tooltips",
514
+ "linethickness",
515
+ "highlightpoints",
516
+ "interpolation",
517
+ "labelthreshold"
518
+ ];
519
+ const barSpacingMap = {
520
+ "small": .3,
521
+ "medium": .5,
522
+ "large": .8
523
+ };
524
+ const donutRatioMap = {
525
+ "small": .3,
526
+ "medium": .6,
527
+ "large": .7
528
+ };
529
+ const barSpacingMapInvert = lodashEs.invert(barSpacingMap);
530
+ const donutRatioMapInvert = lodashEs.invert(donutRatioMap);
531
+ const tickformats = {
532
+ "Thousand": {
533
+ "prefix": "K",
534
+ "divider": 1e3
535
+ },
536
+ "Million": {
537
+ "prefix": "M",
538
+ "divider": 1e6
539
+ },
540
+ "Billion": {
541
+ "prefix": "B",
542
+ "divider": 1e9
543
+ }
544
+ };
545
+ const chartId = "#preview-chart";
546
+ const dataTypeJSON = [
547
+ "Column",
548
+ "Line",
549
+ "Pie",
550
+ "Bar",
551
+ "Donut",
552
+ "Bubble"
553
+ ];
554
+ const lineTypeCharts = [
555
+ "Line",
556
+ "Area",
557
+ "Cumulative Line"
558
+ ];
559
+ const SAMPLE_DATA = {
560
+ "group1": "Europe",
561
+ "group2": "Asia",
562
+ "group3": "America",
563
+ "group4": "Australia"
564
+ };
565
+ const isPieChart = (type) => type === "Pie";
566
+ const isLineChart = (type) => type === "Line";
567
+ const isBarChart = (type) => type === "Bar";
568
+ const isDonutChart = (type) => type === "Donut";
569
+ const isBubbleChart = (type) => type === "Bubble";
570
+ const isColumnChart = (type) => type === "Column";
571
+ const isAreaChart = (type) => type === "Area";
572
+ const isPieType = (type) => isPieChart(type) || isDonutChart(type);
573
+ const isChartDataJSON = (type) => lodashEs.includes(dataTypeJSON, type) || !lodashEs.includes(chartTypes, type);
574
+ const isLineTypeChart = (type) => lodashEs.includes(lineTypeCharts, type);
575
+ const isAxisDomainSupported = (type) => isColumnChart(type) || isAreaChart(type);
576
+ const getBarSpacingValue = (value, prop) => {
577
+ if (prop === "value") return barSpacingMap[value];
578
+ if (prop === "key") return barSpacingMapInvert[value];
579
+ };
580
+ const getRadiusValue = (value, prop) => {
581
+ if (prop === "value") return donutRatioMap[value];
582
+ if (prop === "key") return donutRatioMapInvert[value];
583
+ };
584
+ const getLabelValues = (showlabels, showlabelsoutside, prop) => {
585
+ const labelsConfig = {};
586
+ switch (showlabels) {
587
+ case "hide":
588
+ labelsConfig.showlabels = false;
589
+ break;
590
+ case "inside":
591
+ labelsConfig.showlabels = true;
592
+ labelsConfig.showlabelsoutside = false;
593
+ break;
594
+ case "outside":
595
+ labelsConfig.showlabels = true;
596
+ labelsConfig.showlabelsoutside = true;
597
+ }
598
+ return labelsConfig;
599
+ };
600
+ const constructSampleData = (dataType, yaxisLength, shape) => {
601
+ let first_series = [], second_series = [], third_series = [], first_series_array = [], second_series_array = [], third_series_array = [], first_series_bubble = [], second_series_bubble = [], third_series_bubble = [], data = [];
602
+ switch (dataType) {
603
+ case "jsonFormat":
604
+ first_series = [
605
+ {
606
+ "x": "01/01/2001",
607
+ "y": 4e6
608
+ },
609
+ {
610
+ "x": "01/01/2002",
611
+ "y": 1e6
612
+ },
613
+ {
614
+ "x": "01/01/2003",
615
+ "y": 5e6
616
+ }
617
+ ];
618
+ second_series = [
619
+ {
620
+ "x": "01/01/2001",
621
+ "y": 3e6
622
+ },
623
+ {
624
+ "x": "01/01/2002",
625
+ "y": 4e6
626
+ },
627
+ {
628
+ "x": "01/01/2003",
629
+ "y": 7e6
630
+ }
631
+ ];
632
+ third_series = [
633
+ {
634
+ "x": "01/01/2001",
635
+ "y": 2e6
636
+ },
637
+ {
638
+ "x": "01/01/2002",
639
+ "y": 8e6
640
+ },
641
+ {
642
+ "x": "01/01/2003",
643
+ "y": 6e6
644
+ }
645
+ ];
646
+ data[0] = {
647
+ values: first_series,
648
+ key: SAMPLE_DATA.group1
649
+ };
650
+ if (yaxisLength >= 2) data[1] = {
651
+ values: second_series,
652
+ key: SAMPLE_DATA.group2
653
+ };
654
+ if (yaxisLength >= 3) data[2] = {
655
+ values: third_series,
656
+ key: SAMPLE_DATA.group3
657
+ };
658
+ break;
659
+ case "lineChartFormat":
660
+ first_series = [
661
+ {
662
+ "x": 1,
663
+ "y": 4e6
664
+ },
665
+ {
666
+ "x": 2,
667
+ "y": 1e6
668
+ },
669
+ {
670
+ "x": 3,
671
+ "y": 5e6
672
+ }
673
+ ];
674
+ second_series = [
675
+ {
676
+ "x": 1,
677
+ "y": 3e6
678
+ },
679
+ {
680
+ "x": 2,
681
+ "y": 4e6
682
+ },
683
+ {
684
+ "x": 3,
685
+ "y": 7e6
686
+ }
687
+ ];
688
+ third_series = [
689
+ {
690
+ "x": 1,
691
+ "y": 2e6
692
+ },
693
+ {
694
+ "x": 2,
695
+ "y": 8e6
696
+ },
697
+ {
698
+ "x": 3,
699
+ "y": 6e6
700
+ }
701
+ ];
702
+ data[0] = {
703
+ values: first_series,
704
+ key: SAMPLE_DATA.group1
705
+ };
706
+ if (yaxisLength >= 2) data[1] = {
707
+ values: second_series,
708
+ key: SAMPLE_DATA.group2
709
+ };
710
+ if (yaxisLength >= 3) data[2] = {
711
+ values: third_series,
712
+ key: SAMPLE_DATA.group3
713
+ };
714
+ break;
715
+ case "arrayFormat":
716
+ first_series_array = [
717
+ [1, 4e6],
718
+ [2, 1e6],
719
+ [3, 5e6]
720
+ ];
721
+ second_series_array = [
722
+ [1, 3e6],
723
+ [2, 4e6],
724
+ [3, 7e6]
725
+ ];
726
+ third_series_array = [
727
+ [1, 2e6],
728
+ [2, 8e6],
729
+ [3, 6e6]
730
+ ];
731
+ data[0] = {
732
+ values: first_series_array,
733
+ key: SAMPLE_DATA.group1
734
+ };
735
+ if (yaxisLength >= 2) data[1] = {
736
+ values: second_series_array,
737
+ key: SAMPLE_DATA.group2
738
+ };
739
+ if (yaxisLength >= 3) data[2] = {
740
+ values: third_series_array,
741
+ key: SAMPLE_DATA.group3
742
+ };
743
+ break;
744
+ case "bubbleFormat":
745
+ shape = shape === "random" ? allShapes[Math.floor(Math.random() * allShapes.length)] : shape;
746
+ first_series_bubble = [
747
+ {
748
+ "x": 80.66,
749
+ "y": 33739900,
750
+ "size": 78,
751
+ "shape": shape
752
+ },
753
+ {
754
+ "x": 79.84,
755
+ "y": 81902300,
756
+ "size": 90,
757
+ "shape": shape
758
+ },
759
+ {
760
+ "x": 78.6,
761
+ "y": 5523100,
762
+ "size": 45,
763
+ "shape": shape
764
+ }
765
+ ];
766
+ second_series_bubble = [
767
+ {
768
+ "x": 72.73,
769
+ "y": 79716200,
770
+ "size": 98,
771
+ "shape": shape
772
+ },
773
+ {
774
+ "x": 80.05,
775
+ "y": 61801600,
776
+ "size": 20,
777
+ "shape": shape
778
+ },
779
+ {
780
+ "x": 72.49,
781
+ "y": 73137200,
782
+ "size": 34,
783
+ "shape": shape
784
+ }
785
+ ];
786
+ third_series_bubble = [
787
+ {
788
+ "x": 68.09,
789
+ "y": 33739900,
790
+ "size": 45,
791
+ "shape": shape
792
+ },
793
+ {
794
+ "x": 81.55,
795
+ "y": 7485600,
796
+ "size": 78,
797
+ "shape": shape
798
+ },
799
+ {
800
+ "x": 68.6,
801
+ "y": 14185e4,
802
+ "size": 56,
803
+ "shape": shape
804
+ }
805
+ ];
806
+ data[0] = {
807
+ values: first_series_bubble,
808
+ key: SAMPLE_DATA.group1
809
+ };
810
+ if (yaxisLength >= 2) data[1] = {
811
+ values: second_series_bubble,
812
+ key: SAMPLE_DATA.group2
813
+ };
814
+ if (yaxisLength >= 3) data[2] = {
815
+ values: third_series_bubble,
816
+ key: SAMPLE_DATA.group3
817
+ };
818
+ break;
819
+ case "pieChartFormat": data = [
820
+ {
821
+ "x": SAMPLE_DATA.group1,
822
+ "y": 1e6
823
+ },
824
+ {
825
+ "x": SAMPLE_DATA.group2,
826
+ "y": 2e6
827
+ },
828
+ {
829
+ "x": SAMPLE_DATA.group3,
830
+ "y": 3e6
831
+ },
832
+ {
833
+ "x": SAMPLE_DATA.group4,
834
+ "y": 4e6
835
+ }
836
+ ];
837
+ }
838
+ return data;
839
+ };
840
+ const getDataType = (widgetContext) => {
841
+ const type = widgetContext.type;
842
+ if (isLineChart(type)) return "lineChartFormat";
843
+ if (isPieType(type)) return "pieChartFormat";
844
+ if (isBubbleChart(type)) return "bubbleFormat";
845
+ return isChartDataJSON(type) ? "jsonFormat" : "arrayFormat";
846
+ };
847
+ const getSampleData = (widgetContext) => constructSampleData(getDataType(widgetContext), lodashEs.split(widgetContext.yaxisdatakey, ",").length, widgetContext.shape);
848
+ const isAxisDomainValid = (widgetContext, axis) => {
849
+ if (widgetContext[axis + "domain"] === "Min" && isAxisDomainSupported(widgetContext.type)) return true;
850
+ return false;
851
+ };
852
+ const areMinMaxValuesValid = (values) => {
853
+ if (lodashEs.isFinite(values.min) && lodashEs.isFinite(values.max)) return true;
854
+ return false;
855
+ };
856
+ const getYScaleMinValue = (value) => {
857
+ const _min = Math.floor(value);
858
+ return Math.abs(value) - _min > 0 ? value - .1 : _min - 1;
859
+ };
860
+ const highlightPoints = (id, highlightpoints) => {
861
+ const chartSvg = id ? d3.select("#wmChart" + id + " svg") : d3.select(chartId + " svg");
862
+ if (highlightpoints) chartSvg.selectAll(".nv-point").style("stroke-width", "6px").style("fill-opacity", "0.95").style("stroke-opacity", "0.95");
863
+ else chartSvg.selectAll(".nv-point").style("stroke-width", "0px").style("fill-opacity", "0");
864
+ };
865
+ const setLineThickness = (id, thickness) => {
866
+ const chartSvg = id ? d3.select("#wmChart" + id + " svg") : d3.select(chartId + " svg");
867
+ thickness = thickness || 1.5;
868
+ const lines = chartSvg.selectAll(".nv-line");
869
+ if (lines.size() !== 0) lines.style("stroke-width", thickness);
870
+ };
871
+ const initProperties = (widgetContext, propertyValueMap) => {
872
+ if (!propertyValueMap || i1.isEmptyObject(propertyValueMap)) propertyValueMap = {};
873
+ lodashEs.forEach(basicProperties, (prop) => {
874
+ if (lodashEs.isUndefined(propertyValueMap[prop])) propertyValueMap[prop] = widgetContext[prop];
875
+ });
876
+ return propertyValueMap;
877
+ };
878
+ const getNumberValue = (value, callback) => {
879
+ return isNaN(parseInt(value, 10)) ? callback(value, "value") : value;
880
+ };
881
+ const getDateFormatedData = (dateFormat, d) => {
882
+ dateFormat = dateFormat || "%x";
883
+ if (dateFormat == "%c") dateFormat = "%a %b %e %X %Y";
884
+ return d3.timeFormat(dateFormat)(new Date(moment(moment(d).format()).valueOf()));
885
+ };
886
+ const removeTrailingZeros = (value) => {
887
+ if (!value) return value;
888
+ return (typeof value === "number" ? value.toString() : value).replace(/\.0+([A-Za-z]*)$/, "$1").replace(/\.([1-9]+)0+([A-Za-z]*)$/, ".$1$2");
889
+ };
890
+ const getNumberFormatedData = (numberFormat, d) => {
891
+ let formattedData, divider, prefix;
892
+ if (numberFormat) {
893
+ let numberFormatter;
894
+ if (numberFormat == "Thousand" || numberFormat == "Million" || numberFormat == "Billion") numberFormatter = d3.format(",.2s");
895
+ else if (numberFormat == "%") numberFormatter = d3.format(".2%");
896
+ else if (numberFormat == ".f") numberFormatter = d3.format(".2f");
897
+ else numberFormatter = d3.format(numberFormat);
898
+ formattedData = numberFormatter(d);
899
+ divider = tickformats[numberFormat]?.divider || 0;
900
+ prefix = tickformats[numberFormat]?.prefix;
901
+ if (prefix && divider !== 0) formattedData = d3.format(".2f")(d / divider) + prefix;
902
+ } else formattedData = d >= 1e3 ? d3.format(".1s")(d) : d;
903
+ formattedData = removeTrailingZeros(formattedData);
904
+ return formattedData;
905
+ };
906
+ const isShowLegend = (value) => {
907
+ if (value === "false" || value === false) return false;
908
+ if (value === "true" || value === true) return true;
909
+ return value === "hide" ? false : true;
910
+ };
911
+ const customiseTooltip = (chart, propertyValueMap, widgetContext, label) => {
912
+ d3.selectAll(".nvtooltip").style("opacity", 0);
913
+ chart.tooltip.contentGenerator((key, propValueMap) => {
914
+ let xValue = key.data.x, yValue;
915
+ yValue = getNumberFormatedData(propValueMap?.ynumberformat || widgetContext?.ynumberformat || propertyValueMap?.ynumberformat, key.data.y);
916
+ if (isPieType(widgetContext.type)) {
917
+ label = key.data.x;
918
+ xValue = "";
919
+ }
920
+ return "<table><tbody><tr class=\"value\"><b>" + xValue + "</b></tr><tr><td class=\"legend-color-guide\"><div style=\"background-color:" + key.color + ";\"></div></td><td class=\"key\">" + label + "</td><td class=\"value\">" + yValue + "</td></tr></tbody></table>";
921
+ });
922
+ };
923
+ const initChart = (widgetContext, xDomainValues, yDomainValues, propertyValueMap, isPreview) => {
924
+ propertyValueMap = initProperties(widgetContext, propertyValueMap);
925
+ let chart, colors = [], xaxislabel, yaxislabel, labelConfig, radius, barSpacing, showLegend, xAxisValue, hasMultipleYValues;
926
+ const xValue = {}, yValue = {};
927
+ switch (widgetContext.type) {
928
+ case "Column":
929
+ barSpacing = getNumberValue(propertyValueMap.barspacing, getBarSpacingValue) || barSpacingMap.medium;
930
+ chart = nv.models.multiBarChart().x((d) => d.x).y((d) => d.y).reduceXTicks(propertyValueMap.reducexticks).rotateLabels(0).showControls(false).stacked(propertyValueMap.viewtype === "Stacked" ? true : false).groupSpacing(barSpacing);
931
+ break;
932
+ case "Cumulative Line":
933
+ chart = nv.models.cumulativeLineChart().x((d) => d[0]).y((d) => d[1]).showControls(false).useInteractiveGuideline(propertyValueMap.tooltips).interpolate(propertyValueMap.interpolation);
934
+ break;
935
+ case "Line":
936
+ chart = nv.models.lineChart().useInteractiveGuideline(propertyValueMap.tooltips).interpolate(propertyValueMap.interpolation);
937
+ break;
938
+ case "Area":
939
+ chart = nv.models.stackedAreaChart().x((d) => d.x).y((d) => d.y).clipEdge(true).showControls(false).style(propertyValueMap.areaviewtype).useInteractiveGuideline(propertyValueMap.tooltips).interpolate(propertyValueMap.interpolation);
940
+ break;
941
+ case "Bar":
942
+ barSpacing = getNumberValue(propertyValueMap.barspacing, getBarSpacingValue) || barSpacingMap.medium;
943
+ chart = nv.models.multiBarHorizontalChart().x((d) => d.x).y((d) => d.y).showControls(false).stacked(propertyValueMap.viewtype === "Stacked" ? true : false).showValues(propertyValueMap.showvalues).groupSpacing(barSpacing);
944
+ break;
945
+ case "Pie":
946
+ case "Donut":
947
+ labelConfig = getLabelValues(propertyValueMap.showlabels, propertyValueMap.showlabelsoutside);
948
+ radius = getNumberValue(propertyValueMap.donutratio, getRadiusValue) || donutRatioMap.medium;
949
+ chart = nv.models.pieChart().x((d) => d.x).y((d) => d.y).showLabels(labelConfig.showlabels).labelType(propertyValueMap.labeltype).valueFormat(d3.format("%")).title(propertyValueMap.centerlabel).labelThreshold(propertyValueMap.labelthreshold || .01).labelsOutside(labelConfig.showlabelsoutside);
950
+ if (isDonutChart(widgetContext.type)) chart.donut(true).donutRatio(radius);
951
+ if (propertyValueMap.labeltype === "key-value") chart.labelType((d) => d.data.x + " " + d.data.y);
952
+ break;
953
+ case "Bubble": chart = nv.models.scatterChart().x((d) => d.x).y((d) => d.y).showDistX(propertyValueMap.showxdistance).showDistY(propertyValueMap.showydistance);
954
+ }
955
+ if (xDomainValues) {
956
+ xValue.min = xDomainValues.min.x || xDomainValues.min[0];
957
+ xValue.max = xDomainValues.max.x || xDomainValues.max[0];
958
+ if (areMinMaxValuesValid(xValue)) {
959
+ xValue.min = getYScaleMinValue(xValue.min);
960
+ chart.xDomain([xValue.min, xValue.max]);
961
+ }
962
+ }
963
+ if (yDomainValues) {
964
+ yValue.min = yDomainValues.min.y || yDomainValues.min[1];
965
+ yValue.max = yDomainValues.max.y || yDomainValues.max[1];
966
+ if (areMinMaxValuesValid(yValue)) {
967
+ yValue.min = getYScaleMinValue(yValue.min);
968
+ chart.yDomain([yValue.min, yValue.max]);
969
+ }
970
+ }
971
+ chart.legend.vers(propertyValueMap.legendtype?.toLowerCase() || "furious");
972
+ if (isPieType(widgetContext.type)) {
973
+ if (propertyValueMap.labeltype === "percent") chart.valueFormat(d3.format("%"));
974
+ else chart.valueFormat((d) => getNumberFormatedData(propertyValueMap.ynumberformat, d));
975
+ customiseTooltip(chart, propertyValueMap, widgetContext);
976
+ } else {
977
+ chart.showXAxis(propertyValueMap.showxaxis).showYAxis(propertyValueMap.showyaxis);
978
+ chart.legendPosition(propertyValueMap.showlegend);
979
+ xaxislabel = propertyValueMap.xaxislabel || i1.prettifyLabels(widgetContext.xaxisdatakey) || "x caption";
980
+ yaxislabel = propertyValueMap.yaxislabel || i1.prettifyLabels(widgetContext.yaxisdatakey) || "y caption";
981
+ if (widgetContext.yaxisdatakey && widgetContext.yaxisdatakey.split(",").length > 1) hasMultipleYValues = true;
982
+ if (!hasMultipleYValues && !isBubbleChart(widgetContext.type)) customiseTooltip(chart, propertyValueMap, widgetContext, yaxislabel);
983
+ xaxislabel += propertyValueMap.xunits ? "(" + propertyValueMap.xunits + ")" : "";
984
+ yaxislabel += propertyValueMap.yunits ? "(" + propertyValueMap.yunits + ")" : "";
985
+ chart.xAxis.axisLabel(xaxislabel).axisLabelDistance(propertyValueMap.xaxislabeldistance).staggerLabels(propertyValueMap.staggerlabels);
986
+ if (propertyValueMap.xdateformat || isPreview && !isBubbleChart(widgetContext.type)) {
987
+ if (isLineTypeChart(widgetContext.type)) chart.xAxis.tickFormat((d) => {
988
+ xAxisValue = isPreview ? dateList[d - 1] : widgetContext.xDataKeyArr[d];
989
+ return getDateFormatedData(propertyValueMap.xdateformat, xAxisValue);
990
+ });
991
+ else chart.xAxis.tickFormat((d) => getDateFormatedData(propertyValueMap.xdateformat, d));
992
+ } else if (propertyValueMap.xnumberformat) chart.xAxis.tickFormat((d) => getNumberFormatedData(propertyValueMap.xnumberformat, d));
993
+ else if (isLineTypeChart(widgetContext.type)) chart.xAxis.tickFormat((d) => widgetContext.xDataKeyArr[d]);
994
+ chart.yAxis.axisLabel(yaxislabel).axisLabelDistance(propertyValueMap.yaxislabeldistance).staggerLabels(propertyValueMap.staggerlabels).tickFormat((d) => getNumberFormatedData(propertyValueMap?.ynumberformat, d));
995
+ if (isBarChart(widgetContext.type)) chart.valueFormat((d) => getNumberFormatedData(propertyValueMap?.ynumberformat, d));
996
+ }
997
+ if (lodashEs.isString(propertyValueMap.customcolors) && propertyValueMap.customcolors) colors = lodashEs.split(propertyValueMap.customcolors, ",");
998
+ if (lodashEs.isArray(propertyValueMap.customcolors)) colors = propertyValueMap.customcolors;
999
+ showLegend = isShowLegend(propertyValueMap.showlegend);
1000
+ chart.showLegend(showLegend).margin({
1001
+ top: propertyValueMap.offsettop,
1002
+ right: propertyValueMap.offsetright,
1003
+ bottom: propertyValueMap.offsetbottom,
1004
+ left: propertyValueMap.offsetleft
1005
+ }).color(colors.length ? colors : themes[propertyValueMap.theme].colors);
1006
+ chart.tooltip.enabled(propertyValueMap.tooltips);
1007
+ widgetContext.message = propertyValueMap.nodatamessage || "No data found";
1008
+ chart.noData(widgetContext.message);
1009
+ if (isLineTypeChart(widgetContext.type) && widgetContext.highlightpoints) chart.dispatch.on("stateChange", () => {
1010
+ setTimeout(() => postPlotChartProcess(widgetContext), 100);
1011
+ });
1012
+ if (widgetContext.showlegend && (widgetContext.type === "Donut" || widgetContext.type === "Pie")) {
1013
+ if (widgetContext.showlegend === "right") chart.legendPosition("right");
1014
+ }
1015
+ return chart;
1016
+ };
1017
+ const postPlotChartProcess = (widgetContext, isPreview) => {
1018
+ const id = widgetContext.$id;
1019
+ if (isLineTypeChart(widgetContext.type)) {
1020
+ setLineThickness(id, widgetContext.linethickness);
1021
+ highlightPoints(id, widgetContext.highlightpoints);
1022
+ }
1023
+ };
1024
+ const getDateList = () => dateList;
1025
+ const WIDGET_CONFIG = {
1026
+ widgetType: "wm-chart",
1027
+ hostClass: "app-chart"
1028
+ };
1029
+ const NONE = "none";
1030
+ const advanceDataProps = [
1031
+ "aggregation",
1032
+ "aggregationcolumn",
1033
+ "groupby",
1034
+ "orderby"
1035
+ ];
1036
+ const chartDataPointXpath = {
1037
+ "Column": "rect.nv-bar",
1038
+ "Bar": "g.nv-bar",
1039
+ "Area": ".nv-stackedarea .nv-point",
1040
+ "Cumulative Line": ".nv-cumulativeLine .nv-scatterWrap path.nv-point",
1041
+ "Line": ".nv-lineChart .nv-scatterWrap path.nv-point",
1042
+ "Pie": ".nv-pieChart .nv-slice path",
1043
+ "Donut": ".nv-pieChart .nv-slice path",
1044
+ "Bubble": ".nv-scatterChart .nv-point-paths path"
1045
+ };
1046
+ const styleProps = {
1047
+ "fontunit": "font-size",
1048
+ "fontsize": "font-size",
1049
+ "color": "fill",
1050
+ "fontfamily": "font-family",
1051
+ "fontweight": "font-weight",
1052
+ "fontstyle": "font-style",
1053
+ "textdecoration": "text-decoration"
1054
+ };
1055
+ const aggregationFnMap = {
1056
+ "average": "AVG",
1057
+ "count": "COUNT",
1058
+ "maximum": "MAX",
1059
+ "minimum": "MIN",
1060
+ "sum": "SUM"
1061
+ };
1062
+ const getBooleanValue = (val) => {
1063
+ if (val === true || val === "true") return true;
1064
+ if (val === false || val === "false") return false;
1065
+ return val;
1066
+ };
1067
+ const getLodashOrderByFormat = (orderby) => {
1068
+ let columns;
1069
+ const orderByColumns = [], orders = [];
1070
+ lodashEs.forEach(lodashEs.split(orderby, ","), function(col) {
1071
+ columns = lodashEs.split(col, ":");
1072
+ orderByColumns.push(columns[0]);
1073
+ orders.push(columns[1]);
1074
+ });
1075
+ return {
1076
+ "columns": orderByColumns,
1077
+ "orders": orders
1078
+ };
1079
+ };
1080
+ const getValidAliasName = (aliasName) => aliasName ? aliasName.replace(/\./g, "$") : null;
1081
+ const setTextStyle = (properties, id) => {
1082
+ const charttext = d3.select("#wmChart" + id + " svg").selectAll("text");
1083
+ if (!charttext.empty()) charttext.style(properties);
1084
+ };
1085
+ const angle = (d) => {
1086
+ const a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
1087
+ return a > 90 ? a - 180 : a;
1088
+ };
1089
+ var ChartComponent = class ChartComponent extends base.StylableComponent {
1090
+ static {
1091
+ this.initializeProps = registerProps();
1092
+ }
1093
+ isGroupByEnabled() {
1094
+ return !!(this.groupby && this.groupby !== NONE);
1095
+ }
1096
+ isValidAxis() {
1097
+ return this.binddataset ? this.xaxisdatakey && this.yaxisdatakey : true;
1098
+ }
1099
+ isAggregationEnabled() {
1100
+ return !!(this.isGroupByEnabled() && this.aggregation !== NONE && this.aggregationcolumn);
1101
+ }
1102
+ isDataFilteringEnabled() {
1103
+ return this.isAggregationEnabled() || !this.isVisuallyGrouped && this.orderby;
1104
+ }
1105
+ getxAxisVal(dataObj, xKey, index) {
1106
+ const value = lodashEs.get(dataObj, xKey);
1107
+ if (isLineTypeChart(this.type) && !i1.isNumberType(this.xAxisDataType)) {
1108
+ this.xDataKeyArr.push(value);
1109
+ if (value instanceof Date) return value;
1110
+ else return index;
1111
+ }
1112
+ return value;
1113
+ }
1114
+ getXMinMaxValues(datum) {
1115
+ if (!datum) return;
1116
+ const xValues = {};
1117
+ xValues.min = lodashEs.minBy(datum.values, (dataObject) => dataObject.x || dataObject[0]);
1118
+ xValues.max = lodashEs.maxBy(datum.values, (dataObject) => dataObject.x || dataObject[0]);
1119
+ return xValues;
1120
+ }
1121
+ getYMinMaxValues(datum) {
1122
+ const yValues = {}, minValues = [], maxValues = [];
1123
+ if (!datum) return;
1124
+ lodashEs.forEach(datum, (data) => {
1125
+ minValues.push(lodashEs.minBy(data.values, function(dataObject) {
1126
+ return dataObject.y || dataObject[1];
1127
+ }));
1128
+ maxValues.push(lodashEs.maxBy(data.values, function(dataObject) {
1129
+ return dataObject.y || dataObject[1];
1130
+ }));
1131
+ });
1132
+ yValues.min = lodashEs.minBy(minValues, (dataObject) => dataObject.y || dataObject[1]);
1133
+ yValues.max = lodashEs.maxBy(maxValues, (dataObject) => dataObject.y || dataObject[1]);
1134
+ return yValues;
1135
+ }
1136
+ getValidData(values) {
1137
+ return values.length === 1 && values[0] === void 0 ? [] : values;
1138
+ }
1139
+ valueFinder(dataObj, xKey, yKey, index, shape) {
1140
+ const xVal = this.getxAxisVal(dataObj, xKey, index), value = lodashEs.get(dataObj, yKey), yVal = parseFloat(value) || value, size = parseFloat(dataObj[this.bubblesize]) || 2;
1141
+ let dataPoint = {};
1142
+ if (isChartDataJSON(this.type)) {
1143
+ dataPoint.x = xVal;
1144
+ dataPoint.y = yVal;
1145
+ if (isBubbleChart(this.type)) {
1146
+ dataPoint.size = size;
1147
+ dataPoint.shape = shape || "circle";
1148
+ }
1149
+ } else dataPoint = [xVal, yVal];
1150
+ dataPoint._dataObj = dataObj;
1151
+ return dataPoint;
1152
+ }
1153
+ setErrMsg(message) {
1154
+ if (this.showNoDataMsg) {
1155
+ this.showContentLoadError = true;
1156
+ this.invalidConfig = true;
1157
+ this.errMsg = "";
1158
+ }
1159
+ }
1160
+ processChartData() {
1161
+ this.sampleData = getSampleData(this);
1162
+ this.xDataKeyArr = [];
1163
+ if (!this.binddataset) {
1164
+ this.xDataKeyArr = getDateList();
1165
+ return this.sampleData;
1166
+ }
1167
+ if (!this.chartData?.length) return [];
1168
+ let datum = [], yAxisKey, shapes = [], values = [];
1169
+ const xAxisKey = this.xaxisdatakey, yAxisKeys = this.yaxisdatakey ? this.yaxisdatakey.split(",") : [], dataSet = this.chartData;
1170
+ if (lodashEs.isArray(dataSet)) {
1171
+ if (isPieType(this.type)) {
1172
+ yAxisKey = yAxisKeys[0];
1173
+ datum = lodashEs.map(dataSet, (dataObj, index) => {
1174
+ if (!i1.isEmptyObject(dataSet[index])) return this.valueFinder(dataSet[index], xAxisKey, yAxisKey);
1175
+ });
1176
+ datum = this.getValidData(datum);
1177
+ } else {
1178
+ if (isBubbleChart(this.type)) shapes = this.shape === "random" ? allShapes : this.shape;
1179
+ yAxisKeys.forEach((yAxisKey, series) => {
1180
+ values = lodashEs.map(dataSet, (dataObj, index) => {
1181
+ if (!i1.isEmptyObject(dataSet[index])) return this.valueFinder(dataSet[index], xAxisKey, yAxisKey, index, lodashEs.isArray(shapes) && shapes[series] || this.shape);
1182
+ });
1183
+ values = this.getValidData(values);
1184
+ datum.push({
1185
+ values,
1186
+ key: i1.prettifyLabels(yAxisKey)
1187
+ });
1188
+ });
1189
+ }
1190
+ }
1191
+ return datum;
1192
+ }
1193
+ setChartData(data) {
1194
+ if (data) this._processedData = data;
1195
+ }
1196
+ getChartData() {
1197
+ return this._processedData;
1198
+ }
1199
+ getVisuallyGroupedData(queryResponse, groupingColumn) {
1200
+ let groupData = {}, groupValues = [], orderByDetails, maxLength;
1201
+ const chartData = [], _isAreaChart = isAreaChart(this.type), yAxisKey = lodashEs.first(lodashEs.split(this.yaxisdatakey, ","));
1202
+ this.xDataKeyArr = [];
1203
+ queryResponse = lodashEs.orderBy(queryResponse, lodashEs.split(this.groupby, ","));
1204
+ if (this.orderby) {
1205
+ orderByDetails = getLodashOrderByFormat(this.orderby);
1206
+ queryResponse = lodashEs.orderBy(queryResponse, orderByDetails.columns, orderByDetails.orders);
1207
+ }
1208
+ queryResponse = lodashEs.groupBy(queryResponse, groupingColumn);
1209
+ if (_isAreaChart) maxLength = lodashEs.max(lodashEs.map(queryResponse, (obj) => obj.length));
1210
+ lodashEs.forEach(queryResponse, (values, groupKey) => {
1211
+ groupValues = _isAreaChart ? lodashEs.fill(new Array(maxLength), [0, 0]) : [];
1212
+ lodashEs.forEachRight(values, (value, index) => {
1213
+ groupValues[index] = this.valueFinder(value, this.xaxisdatakey, yAxisKey, index);
1214
+ });
1215
+ groupData = {
1216
+ key: groupKey,
1217
+ values: groupValues
1218
+ };
1219
+ chartData.push(groupData);
1220
+ });
1221
+ return chartData;
1222
+ }
1223
+ getGroupingDetails() {
1224
+ if (this.isGroupByEnabled() && !this.isAggregationEnabled()) {
1225
+ let isVisuallyGrouped = false, visualGroupingColumn, groupingExpression, columns = [], groupingColumnIndex;
1226
+ const groupbyColumns = this.groupby.split(","), yAxisKeys = this.yaxisdatakey ? this.yaxisdatakey.split(",") : [];
1227
+ if (groupbyColumns.length > 1) {
1228
+ groupbyColumns.every((column, index) => {
1229
+ if (this.xaxisdatakey !== column && $.inArray(column, yAxisKeys) === -1) {
1230
+ isVisuallyGrouped = true;
1231
+ visualGroupingColumn = column;
1232
+ groupingColumnIndex = index;
1233
+ groupbyColumns.splice(groupingColumnIndex, 1);
1234
+ return false;
1235
+ }
1236
+ return true;
1237
+ });
1238
+ if (visualGroupingColumn) columns.push(visualGroupingColumn);
1239
+ columns = lodashEs.concat(columns, groupbyColumns);
1240
+ }
1241
+ if (this.xaxisdatakey !== this.aggregationcolumn) columns.push(this.xaxisdatakey);
1242
+ lodashEs.forEach(yAxisKeys, (key) => {
1243
+ if (key !== this.aggregationcolumn) columns.push(key);
1244
+ });
1245
+ groupingExpression = columns.join(",");
1246
+ this.isVisuallyGrouped = isVisuallyGrouped;
1247
+ return {
1248
+ expression: groupingExpression,
1249
+ isVisuallyGrouped,
1250
+ visualGroupingColumn
1251
+ };
1252
+ }
1253
+ return {
1254
+ expression: "",
1255
+ isVisuallyGrouped: false,
1256
+ visualGroupingColumn: ""
1257
+ };
1258
+ }
1259
+ getAggregatedData(callback) {
1260
+ const variable = this.datasource, yAxisKeys = this.yaxisdatakey ? this.yaxisdatakey.split(",") : [], data = {};
1261
+ let sortExpr, columns = [], colAlias, orderByColumns, groupByFields = [];
1262
+ if (!variable) return;
1263
+ if (this.isGroupByEnabled()) groupByFields = lodashEs.split(this.groupby, ",");
1264
+ if (this.orderby) {
1265
+ sortExpr = lodashEs.replace(this.orderby, /:/g, " ");
1266
+ columns = lodashEs.uniq(lodashEs.concat(columns, groupByFields, [this.aggregationcolumn]));
1267
+ orderByColumns = getLodashOrderByFormat(this.orderby).columns;
1268
+ lodashEs.forEach(lodashEs.intersection(columns, orderByColumns), (col) => {
1269
+ colAlias = getValidAliasName(col);
1270
+ sortExpr = lodashEs.replace(sortExpr, col, colAlias);
1271
+ });
1272
+ }
1273
+ if (this.isAggregationEnabled()) {
1274
+ data.groupByFields = groupByFields;
1275
+ data.aggregations = [{
1276
+ "field": this.aggregationcolumn,
1277
+ "type": aggregationFnMap[this.aggregation],
1278
+ "alias": getValidAliasName(this.aggregationcolumn)
1279
+ }];
1280
+ }
1281
+ variable.execute("getAggregatedData", {
1282
+ "aggregations": data,
1283
+ "sort": sortExpr
1284
+ }).then((response) => {
1285
+ const chartData = [], aggregationAlias = getValidAliasName(this.aggregationcolumn), xAxisAliasKey = getValidAliasName(this.xaxisdatakey), yAxisAliasKeys = [];
1286
+ yAxisKeys.forEach((yAxisKey) => yAxisAliasKeys.push(getValidAliasName(yAxisKey)));
1287
+ lodashEs.forEach(response.body.content, (responseContent) => {
1288
+ const obj = {};
1289
+ if (this.isAggregationEnabled()) {
1290
+ obj[this.aggregationcolumn] = responseContent[aggregationAlias];
1291
+ obj[this.aggregationcolumn] = lodashEs.get(responseContent, aggregationAlias) || lodashEs.get(responseContent, this.aggregationcolumn);
1292
+ }
1293
+ obj[this.xaxisdatakey] = lodashEs.get(responseContent, xAxisAliasKey) || lodashEs.get(responseContent, this.xaxisdatakey);
1294
+ yAxisKeys.forEach((yAxisKey, index) => {
1295
+ obj[yAxisKey] = lodashEs.get(responseContent, yAxisAliasKeys[index]) || lodashEs.get(responseContent, yAxisKey);
1296
+ });
1297
+ chartData.push(obj);
1298
+ });
1299
+ this.chartData = chartData;
1300
+ i1.triggerFn(callback);
1301
+ }, () => {
1302
+ this.chartData = [];
1303
+ this.setErrMsg("MESSAGE_ERROR_FETCH_DATA");
1304
+ i1.triggerFn(callback);
1305
+ });
1306
+ }
1307
+ setLabelsMaxWidth() {
1308
+ let xTicks, tickWidth, maxLength, xDist, yDist, totalHeight, maxNoLabels, nthElement, labelsAvailableWidth, barWrapper, yAxisWrapper, svgWrapper;
1309
+ const fontsize = parseInt(this.fontsize, 10) || 12, isBarchart = isBarChart(this.type);
1310
+ xTicks = $("#wmChart" + this.$id + " svg").find("g.nv-x").find("g.tick").find("text");
1311
+ xTicks.each(function() {
1312
+ const xTick = $(this);
1313
+ let xTransform, tickDist;
1314
+ if (xTick.text() && xTick.css("opacity") === "1") {
1315
+ xTransform = xTick.parent().attr("transform").split(",");
1316
+ xDist = parseFloat(xTransform[0].substr(10));
1317
+ yDist = parseFloat(xTransform[1] || "0");
1318
+ if (!isBarchart && xDist > 0) tickDist = xDist;
1319
+ else if (yDist > 0) tickDist = yDist;
1320
+ if (tickWidth) {
1321
+ tickWidth = tickDist - tickWidth;
1322
+ return false;
1323
+ }
1324
+ tickWidth = tickDist;
1325
+ return true;
1326
+ }
1327
+ });
1328
+ if (isBarchart) {
1329
+ barWrapper = $("#wmChart" + this.$id + " svg>g.nv-wrap>g>g.nv-barsWrap")[0];
1330
+ yAxisWrapper = $("#wmChart" + this.$id + " svg>g.nv-wrap>g>g.nv-y")[0];
1331
+ svgWrapper = $("#wmChart" + this.$id + " svg")[0];
1332
+ totalHeight = barWrapper ? barWrapper.getBoundingClientRect().height : 0;
1333
+ labelsAvailableWidth = yAxisWrapper ? svgWrapper.getBoundingClientRect().width - yAxisWrapper.getBoundingClientRect().width : svgWrapper.getBoundingClientRect().width;
1334
+ maxLength = Math.round(labelsAvailableWidth / fontsize);
1335
+ if (tickWidth < fontsize) {
1336
+ maxNoLabels = totalHeight / fontsize;
1337
+ nthElement = Math.ceil(this.chartData.length / maxNoLabels);
1338
+ d3.select("#wmChart" + this.$id + " svg").select("g.nv-x").selectAll("g.tick").select("text").each(function(text, i) {
1339
+ if (i % nthElement !== 0) d3.select(this).attr("opacity", 0);
1340
+ });
1341
+ }
1342
+ } else maxLength = Math.round(tickWidth / fontsize);
1343
+ maxLength = Math.abs(maxLength);
1344
+ xTicks.each(function() {
1345
+ if (this.textContent.length > maxLength) this.textContent = this.textContent.substr(0, maxLength) + "...";
1346
+ });
1347
+ }
1348
+ getDefaultColumns() {
1349
+ let type, stringColumn, i, temp;
1350
+ const defaultColumns = [], columns = this.datasource.execute(i1.DataSource.Operation.GET_PROPERTIES_MAP) || [];
1351
+ for (i = 0; i < columns.length && defaultColumns.length <= 2; i += 1) {
1352
+ type = columns[i].type;
1353
+ if (!columns[i].isRelated && i1.isNumberType(type)) defaultColumns.push(columns[i].fieldName);
1354
+ else if (type === "string" && !stringColumn) stringColumn = columns[i].fieldName;
1355
+ }
1356
+ if (stringColumn && defaultColumns.length > 0 && !isBubbleChart(this.type)) {
1357
+ temp = defaultColumns[0];
1358
+ defaultColumns[0] = stringColumn;
1359
+ defaultColumns[1] = temp;
1360
+ }
1361
+ return defaultColumns;
1362
+ }
1363
+ attachClickEvent() {
1364
+ let dataObj;
1365
+ d3.select("#wmChart" + this.$id + " svg").selectAll(chartDataPointXpath[this.type]).style("pointer-events", "all").on("click", (event, data, index) => {
1366
+ switch (this.type) {
1367
+ case "Column":
1368
+ case "Bar":
1369
+ dataObj = data._dataObj;
1370
+ break;
1371
+ case "Pie":
1372
+ case "Donut":
1373
+ dataObj = data.data._dataObj;
1374
+ break;
1375
+ case "Area":
1376
+ case "Cumulative Line":
1377
+ case "Line":
1378
+ dataObj = data[0]._dataObj;
1379
+ break;
1380
+ case "Bubble": dataObj = data;
1381
+ }
1382
+ this.selecteditem = dataObj;
1383
+ this.invokeEventCallback("select", {
1384
+ $event: event,
1385
+ selectedChartItem: data,
1386
+ selectedItem: this.selecteditem
1387
+ });
1388
+ });
1389
+ }
1390
+ postPlotProcess(chart) {
1391
+ let chartSvg, pieLabels, pieGroups, angleArray;
1392
+ const styleObj = {};
1393
+ const element = this.$element;
1394
+ postPlotChartProcess(this);
1395
+ if (!isPieType(this.type)) this.setLabelsMaxWidth();
1396
+ else if (!this.showlabelsoutside) {
1397
+ chartSvg = d3.select("#wmChart" + this.$id + " svg");
1398
+ pieLabels = chartSvg.select(".nv-pieLabels").selectAll(".nv-label");
1399
+ pieGroups = chartSvg.select(".nv-pie").selectAll(".nv-slice");
1400
+ angleArray = [];
1401
+ if (pieGroups?.length) {
1402
+ pieGroups.each(function() {
1403
+ d3.select(this).attr("transform", function(d) {
1404
+ angleArray.push(angle(d));
1405
+ });
1406
+ });
1407
+ pieLabels.each(function(d, i) {
1408
+ const group = d3.select(this);
1409
+ $(group[0][0]).find("text").attr("transform", "rotate(" + angleArray[i] + ")");
1410
+ });
1411
+ }
1412
+ }
1413
+ lodashEs.forEach(styleProps, (value, key) => {
1414
+ if (key === "fontsize" || key === "fontunit") styleObj[value] = this.fontsize + this.fontunit;
1415
+ else styleObj[value] = this[key];
1416
+ });
1417
+ setTextStyle(styleObj, this.$id);
1418
+ i1.triggerFn(this._resizeFn?.clear);
1419
+ this._resizeFn = nv.utils.windowResize(() => {
1420
+ if (element[0].getBoundingClientRect().height) {
1421
+ chart.update();
1422
+ postPlotChartProcess(this);
1423
+ if (!isPieType(this.type)) this.setLabelsMaxWidth();
1424
+ }
1425
+ });
1426
+ }
1427
+ configureChart() {
1428
+ let xDomainValues;
1429
+ let yDomainValues;
1430
+ let chart;
1431
+ let beforeRenderVal;
1432
+ if (this._processedData.length > 0) {
1433
+ if (isAxisDomainValid(this, "x")) xDomainValues = this.binddataset ? this.getXMinMaxValues(this._processedData[0]) : {
1434
+ "min": { "x": 1 },
1435
+ "max": { "x": 5 }
1436
+ };
1437
+ if (isAxisDomainValid(this, "y")) yDomainValues = this.binddataset ? this.getYMinMaxValues(this._processedData) : {
1438
+ "min": { "y": 1 },
1439
+ "max": { "y": 5 }
1440
+ };
1441
+ }
1442
+ if (isPieType(this.type) && (!this.binddataset || !this.scopedataset)) this._processedData = i1.getClonedObject(this.scopedataset || this._processedData);
1443
+ chart = initChart(this, xDomainValues, yDomainValues, null, !this.binddataset);
1444
+ if (lodashEs.isArray(this._processedData)) {
1445
+ const oldgTicks = $("#wmChart" + this.$id + " svg").find("g.nv-x").find("g.tick");
1446
+ if (oldgTicks?.length) oldgTicks.remove();
1447
+ beforeRenderVal = this.invokeEventCallback("beforerender", { "chartInstance": chart });
1448
+ if (beforeRenderVal) chart = beforeRenderVal;
1449
+ this.chart = chart;
1450
+ d3.select("#wmChart" + this.$id + " svg").datum(this._processedData).call(this.chart);
1451
+ this.postPlotProcess(chart);
1452
+ return chart;
1453
+ }
1454
+ }
1455
+ plotChart() {
1456
+ const element = this.$element;
1457
+ this.chartData = this.invokeEventCallback("transform") || this.chartData;
1458
+ if (this.isVisuallyGrouped && !isPieType(this.type)) this._processedData = this.chartData;
1459
+ else this._processedData = this.processChartData();
1460
+ if (!element[0].getBoundingClientRect().height) return;
1461
+ if (this.clearCanvas) {
1462
+ element.find("svg").replaceWith("<svg></svg>");
1463
+ this.clearCanvas = false;
1464
+ }
1465
+ if (!this.isValidAxis()) this._processedData = [];
1466
+ nv.addGraph(() => this.configureChart(), () => {
1467
+ setTimeout(() => {
1468
+ this.attachClickEvent();
1469
+ }, 600);
1470
+ });
1471
+ this.isLoadInProgress = false;
1472
+ }
1473
+ get isLiveVariable() {
1474
+ const variableObj = this.datasource;
1475
+ return variableObj && variableObj.category === "wm.LiveVariable";
1476
+ }
1477
+ plotChartProxy() {
1478
+ this.showContentLoadError = false;
1479
+ this.invalidConfig = false;
1480
+ this.isLoadInProgress = true;
1481
+ const groupingDetails = this.getGroupingDetails();
1482
+ if (this.binddataset && this.isLiveVariable && (this.filterFields || this.isDataFilteringEnabled())) this.getAggregatedData(() => this.plotChart());
1483
+ else {
1484
+ if (this.dataset && this.isLiveVariable) {
1485
+ this.chartData = this.dataset;
1486
+ if (this.isGroupByEnabled() && groupingDetails.isVisuallyGrouped) this.chartData = this.getVisuallyGroupedData(this.chartData, groupingDetails.visualGroupingColumn);
1487
+ }
1488
+ this.plotChart();
1489
+ }
1490
+ }
1491
+ setDefaultAxisOptions() {
1492
+ const defaultColumns = this.getDefaultColumns();
1493
+ this.xaxisdatakey = defaultColumns[0] || null;
1494
+ this.yaxisdatakey = defaultColumns[1] || null;
1495
+ }
1496
+ getCutomizedOptions(prop, fields) {
1497
+ const groupByColumns = lodashEs.split(this.groupby, ","), aggColumns = lodashEs.split(this.aggregationcolumn, ",");
1498
+ if (!this.binddataset) return fields;
1499
+ if (!this.axisoptions) this.axisoptions = fields;
1500
+ let newOptions;
1501
+ switch (prop) {
1502
+ case "xaxisdatakey":
1503
+ if (this.isGroupByEnabled()) newOptions = groupByColumns;
1504
+ break;
1505
+ case "yaxisdatakey":
1506
+ if (this.isAggregationEnabled()) newOptions = aggColumns;
1507
+ else if (this.isLiveVariable) newOptions = this.numericColumns;
1508
+ break;
1509
+ case "groupby":
1510
+ if (this.isLiveVariable && this.nonPrimaryColumns?.length) newOptions = this.nonPrimaryColumns;
1511
+ break;
1512
+ case "aggregationcolumn":
1513
+ if (this.isLiveVariable && this.isAggregationEnabled() && this.aggregation !== "count") newOptions = this.numericColumns;
1514
+ break;
1515
+ case "orderby":
1516
+ if (this.isLiveVariable && this.isAggregationEnabled()) newOptions = lodashEs.uniq(lodashEs.concat(groupByColumns, aggColumns));
1517
+ break;
1518
+ case "bubblesize": if (this.numericColumns?.length) newOptions = this.numericColumns;
1519
+ }
1520
+ return newOptions || fields || this.axisoptions;
1521
+ }
1522
+ setNumericandNonPrimaryColumns() {
1523
+ this.datasource.execute(i1.DataSource.Operation.GET_PROPERTIES_MAP);
1524
+ this.numericColumns = [];
1525
+ this.nonPrimaryColumns = [];
1526
+ }
1527
+ handleDataSet(newVal) {
1528
+ this.errMsg = "";
1529
+ if (!newVal && !this.binddataset) {
1530
+ this.isVisuallyGrouped = false;
1531
+ this.axisoptions = null;
1532
+ }
1533
+ this.chartData = this.isLiveVariable ? newVal || "" : newVal && newVal.dataValue === "" && lodashEs.keys(newVal).length === 1 ? "" : newVal;
1534
+ if (!lodashEs.isArray(this.chartData) && lodashEs.isObject(this.chartData)) this.chartData = [this.chartData];
1535
+ if (newVal?.filterFields) this.filterFields = newVal.filterFields;
1536
+ if (this.chartData) this._plotChartProxy();
1537
+ }
1538
+ setDonutCenterLabel(labelValue) {
1539
+ let chartSvg, pieGroups;
1540
+ chartSvg = d3.select("#wmChart" + this.$id + " svg");
1541
+ pieGroups = chartSvg.select(".nv-wrap.nv-pie").select(".nv-pie");
1542
+ pieGroups.text("");
1543
+ pieGroups.append("text").attr("dy", ".35em").attr("text-anchor", "middle").attr("class", "nv-pie-title").text(labelValue).each(function(d) {
1544
+ const d3text = d3.select(this), circ = d3.select(this.parentElement), availWidth = Number(circ.node().getBoundingClientRect().width) - 30, textWidth = this.getComputedTextLength();
1545
+ d3text.attr("data-scale", availWidth / textWidth);
1546
+ }).style("font-size", function() {
1547
+ const fontSize = 16 * d3.select(this).attr("data-scale");
1548
+ return fontSize > 24 ? 24 : fontSize + "px";
1549
+ });
1550
+ }
1551
+ onPropertyChange(key, newVal, oldVal) {
1552
+ super.onPropertyChange(key, newVal, oldVal);
1553
+ switch (key) {
1554
+ case "dataset":
1555
+ this.handleDataSet(newVal);
1556
+ break;
1557
+ case "centerlabel":
1558
+ if (this.chart) {
1559
+ this.chart.title(newVal);
1560
+ this.setDonutCenterLabel(newVal);
1561
+ }
1562
+ break;
1563
+ case "type":
1564
+ if (isPieType(this.type)) {
1565
+ this.offsettop = 20;
1566
+ this.offsetright = 0;
1567
+ this.offsetbottom = 0;
1568
+ this.offsetleft = 0;
1569
+ } else if (oldVal === "Pie" || oldVal === "Donut") {
1570
+ this.offsettop = 25;
1571
+ this.offsetright = 25;
1572
+ this.offsetbottom = 55;
1573
+ this.offsetleft = 75;
1574
+ }
1575
+ if (oldVal !== newVal) this.clearCanvas = true;
1576
+ this._plotChartProxy();
1577
+ break;
1578
+ default: this._plotChartProxy();
1579
+ }
1580
+ if (lodashEs.includes(advanceDataProps, key)) this._plotChartProxy();
1581
+ }
1582
+ handleLoading(data) {
1583
+ const dataSource = this.datasource;
1584
+ if (dataSource?.execute(i1.DataSource.Operation.IS_API_AWARE) && i1.isDataSourceEqual(data.variable, dataSource)) {
1585
+ this.variableInflight = data.active;
1586
+ this.isLoadInProgress = data.active;
1587
+ }
1588
+ }
1589
+ hideTooltip() {
1590
+ d3.selectAll(".nvtooltip").style("opacity", 0);
1591
+ }
1592
+ onStyleChange(key, newVal, oldVal) {
1593
+ const styleObj = {};
1594
+ super.onStyleChange(key, newVal, oldVal);
1595
+ switch (key) {
1596
+ case "fontsize":
1597
+ case "fontunit":
1598
+ case "color":
1599
+ case "fontfamily":
1600
+ case "fontweight":
1601
+ case "fontstyle":
1602
+ case "textdecoration":
1603
+ styleObj[styleProps[key]] = key === "fontsize" || key === "fontunit" ? this.fontsize + this.fontunit : newVal;
1604
+ setTextStyle(styleObj, this.$id);
1605
+ }
1606
+ }
1607
+ constructor(inj, app, explicitContext) {
1608
+ super(inj, WIDGET_CONFIG, explicitContext);
1609
+ this.app = app;
1610
+ this.iconclass = "";
1611
+ this.nonPrimaryColumns = [];
1612
+ this.xDataKeyArr = [];
1613
+ this.chartData = [];
1614
+ this._processedData = [];
1615
+ this._subsciptions = [];
1616
+ this._plotChartProxy = lodashEs.debounce(this.plotChartProxy.bind(this), 100);
1617
+ this.redraw = this._plotChartProxy.bind(this);
1618
+ base.styler(this.nativeElement, this, base.APPLY_STYLES_TYPE.CONTAINER, [
1619
+ "fontsize",
1620
+ "fontunit",
1621
+ "color",
1622
+ "fontfamily",
1623
+ "fontweight",
1624
+ "fontstyle",
1625
+ "textdecoration"
1626
+ ]);
1627
+ this.$id = this.widgetId;
1628
+ i1.removeAttr(this.nativeElement, "title");
1629
+ this.chartReady = false;
1630
+ this.binddataset = this.nativeElement.getAttribute("dataset.bind");
1631
+ this._subsciptions.push(this.app.subscribe("toggle-variable-state", this.handleLoading.bind(this)));
1632
+ this._subsciptions.push(this.app.subscribe("iscroll-start", () => {
1633
+ this.hideTooltip();
1634
+ }));
1635
+ }
1636
+ ngAfterViewInit() {
1637
+ super.ngAfterViewInit();
1638
+ if (!lodashEs.includes([
1639
+ "outside",
1640
+ "inside",
1641
+ "hide"
1642
+ ], this.showlabels)) {
1643
+ this.showlabels = getBooleanValue(this.showlabels);
1644
+ this.showlabelsoutside = getBooleanValue(this.showlabelsoutside);
1645
+ this.showlabels = this.showlabels ? this.showlabelsoutside ? "outside" : "inside" : "hide";
1646
+ }
1647
+ if (!this.theme) this.theme = isPieType(this.type) ? "Azure" : "Terrestrial";
1648
+ this.nativeElement.setAttribute("id", "wmChart" + this.$id);
1649
+ if (!this.binddataset && !this.nativeElement.getAttribute("scopedataset")) this._plotChartProxy();
1650
+ }
1651
+ ngOnDestroy() {
1652
+ this.hideTooltip();
1653
+ if (this._subsciptions) {
1654
+ this._subsciptions.forEach((subscription) => {
1655
+ subscription();
1656
+ });
1657
+ this._subsciptions = [];
1658
+ }
1659
+ if (this.chart) this.chart = null;
1660
+ if (this._resizeFn) this._resizeFn = null;
1661
+ this.chartData = [];
1662
+ this._processedData = [];
1663
+ this.sampleData = [];
1664
+ this.xDataKeyArr = [];
1665
+ this.nonPrimaryColumns = [];
1666
+ super.ngOnDestroy();
1667
+ }
1668
+ static {
1669
+ this.ɵfac = i0__namespace.ɵɵngDeclareFactory({
1670
+ minVersion: "12.0.0",
1671
+ version: "22.2.1",
1672
+ ngImport: i0__namespace,
1673
+ type: ChartComponent,
1674
+ deps: [
1675
+ { token: i0__namespace.Injector },
1676
+ { token: i1__namespace.App },
1677
+ {
1678
+ token: "EXPLICIT_CONTEXT",
1679
+ optional: true
1680
+ }
1681
+ ],
1682
+ target: i0__namespace.ɵɵFactoryTarget.Component
1683
+ });
1684
+ }
1685
+ static {
1686
+ this.ɵcmp = i0__namespace.ɵɵngDeclareComponent({
1687
+ minVersion: "17.0.0",
1688
+ version: "22.2.1",
1689
+ type: ChartComponent,
1690
+ isStandalone: true,
1691
+ selector: "div[wmChart]",
1692
+ host: { properties: { "class.panel": "this.title" } },
1693
+ providers: [base.provideAsWidgetRef(ChartComponent)],
1694
+ usesInheritance: true,
1695
+ ngImport: i0__namespace,
1696
+ template: "@if (title) {\n <div class=\"panel-heading\">\n <h3 class=\"panel-title\">\n <div class=\"pull-left\">\n <wm-app-icon [iconclass]=\"iconclass\" [iconurl]=\"iconurl\" iconClasses=\"panel-icon\" alt=\"Chart icon\"></wm-app-icon>\n </div>\n <div class=\"heading\" [innerHTML]=\"title\"></div>\n @if (subheading) {\n <div class=\"description\" [innerHTML]=\"subheading\"></div>\n }\n </h3>\n </div>\n}\n<div class=\"app-chart-inner\" [ngClass]=\"{'loading':isLoadInProgress, 'panel-body': title}\">\n <svg></svg>\n @if (showContentLoadError && showNoDataMsg) {\n <div class=\"wm-content-info readonly-wrapper\">\n <p class=\"wm-message\" [title]=\"hintMsg\" [ngClass]=\"{'error': invalidConfig}\" [innerText]=\"errMsg\"></p>\n </div>\n }\n <div wmSpinner show.bind=\"isLoadInProgress\" caption.bind=\"loadingdatamsg\"></div>\n</div>\n",
1697
+ styles: [".nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3 .nv-interactiveGuideLine,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue,.nvtooltip{pointer-events:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero,.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .nv-axisMaxMin text,.nvtooltip table td.key.total{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-bars rect.hover,.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-scatter .nv-point.hover,.nvd3.nv-bullet .nv-measure:hover,.nvd3.nv-linePlusBar .nv-bar rect:hover,.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:#0000}.nvd3 .nv-bars .hover text{fill:#000}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:#000;stroke:#0000}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-markerLine{stroke:#000;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick,.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover,.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect,.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect,.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick,.with-transitions .nvd3 .nv-groups .nv-point{-webkit-transition:stroke-width .25s linear,stroke-opacity .25s linear;transition:stroke-width .25s linear,stroke-opacity .25s linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nv-force-node{stroke:#fff;stroke-width:1.5px}.nv-force-link{stroke:#999;stroke-opacity:.6}.nv-force-node text{stroke-width:0}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-hoverArea,.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check,.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3 .nv-groups path.nv-line,.nvd3.nv-sparkline path{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-ms-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px #0003;border-radius:5px}.nvd3 text{font:12px Arial,sans-serif}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3 .title{font:700 14px Arial,sans-serif}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .selection{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .handle path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .selection{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}@media print{.nvd3 text{stroke-width:0;fill-opacity:1}}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#eee;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .selection{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:#13c4f996}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-opacity .25s linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:#fff;color:#000;padding:1px;border:1px solid rgba(0,0,0,.5);z-index:10000;display:block;font-family:Arial,sans-serif;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-ms-user-select:none;user-select:none;background:#fffc;border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{-webkit-transition:opacity 50ms linear .2s;transition:opacity 50ms linear .2s}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:#f7f7f7bf;color:#000;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table td.percent{color:#a9a9a9}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}\n"],
1698
+ dependencies: [
1699
+ {
1700
+ kind: "ngmodule",
1701
+ type: i2.CommonModule
1702
+ },
1703
+ {
1704
+ kind: "directive",
1705
+ type: i2__namespace.NgClass,
1706
+ selector: "[ngClass]",
1707
+ inputs: ["class", "ngClass"]
1708
+ },
1709
+ {
1710
+ kind: "component",
1711
+ type: spinner.SpinnerComponent,
1712
+ selector: "[wmSpinner]",
1713
+ exportAs: ["wmSpinner"]
1714
+ },
1715
+ {
1716
+ kind: "component",
1717
+ type: base.WmAppIconComponent,
1718
+ selector: "wm-app-icon",
1719
+ inputs: [
1720
+ "icon",
1721
+ "iconclass",
1722
+ "iconurl",
1723
+ "defaultIconClass",
1724
+ "defaultClasses",
1725
+ "iconStyle",
1726
+ "alt"
1727
+ ]
1728
+ }
1729
+ ],
1730
+ changeDetection: i0__namespace.ChangeDetectionStrategy.Eager,
1731
+ encapsulation: i0__namespace.ViewEncapsulation.None
1732
+ });
1733
+ }
1734
+ };
1735
+ i0__namespace.ɵɵngDeclareClassMetadata({
1736
+ minVersion: "12.0.0",
1737
+ version: "22.2.1",
1738
+ ngImport: i0__namespace,
1739
+ type: ChartComponent,
1740
+ decorators: [{
1741
+ type: i0.Component,
1742
+ args: [{
1743
+ changeDetection: i0.ChangeDetectionStrategy.Eager,
1744
+ standalone: true,
1745
+ imports: [
1746
+ i2.CommonModule,
1747
+ spinner.SpinnerComponent,
1748
+ base.WmAppIconComponent
1749
+ ],
1750
+ selector: "div[wmChart]",
1751
+ providers: [base.provideAsWidgetRef(ChartComponent)],
1752
+ encapsulation: i0.ViewEncapsulation.None,
1753
+ template: "@if (title) {\n <div class=\"panel-heading\">\n <h3 class=\"panel-title\">\n <div class=\"pull-left\">\n <wm-app-icon [iconclass]=\"iconclass\" [iconurl]=\"iconurl\" iconClasses=\"panel-icon\" alt=\"Chart icon\"></wm-app-icon>\n </div>\n <div class=\"heading\" [innerHTML]=\"title\"></div>\n @if (subheading) {\n <div class=\"description\" [innerHTML]=\"subheading\"></div>\n }\n </h3>\n </div>\n}\n<div class=\"app-chart-inner\" [ngClass]=\"{'loading':isLoadInProgress, 'panel-body': title}\">\n <svg></svg>\n @if (showContentLoadError && showNoDataMsg) {\n <div class=\"wm-content-info readonly-wrapper\">\n <p class=\"wm-message\" [title]=\"hintMsg\" [ngClass]=\"{'error': invalidConfig}\" [innerText]=\"errMsg\"></p>\n </div>\n }\n <div wmSpinner show.bind=\"isLoadInProgress\" caption.bind=\"loadingdatamsg\"></div>\n</div>\n",
1754
+ styles: [".nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3 .nv-interactiveGuideLine,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue,.nvtooltip{pointer-events:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero,.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .nv-axisMaxMin text,.nvtooltip table td.key.total{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-bars rect.hover,.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-scatter .nv-point.hover,.nvd3.nv-bullet .nv-measure:hover,.nvd3.nv-linePlusBar .nv-bar rect:hover,.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:#0000}.nvd3 .nv-bars .hover text{fill:#000}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:#000;stroke:#0000}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-markerLine{stroke:#000;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick,.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover,.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect,.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect,.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick,.with-transitions .nvd3 .nv-groups .nv-point{-webkit-transition:stroke-width .25s linear,stroke-opacity .25s linear;transition:stroke-width .25s linear,stroke-opacity .25s linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nv-force-node{stroke:#fff;stroke-width:1.5px}.nv-force-link{stroke:#999;stroke-opacity:.6}.nv-force-node text{stroke-width:0}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-hoverArea,.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check,.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3 .nv-groups path.nv-line,.nvd3.nv-sparkline path{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-ms-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px #0003;border-radius:5px}.nvd3 text{font:12px Arial,sans-serif}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3 .title{font:700 14px Arial,sans-serif}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .selection{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .handle path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .selection{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}@media print{.nvd3 text{stroke-width:0;fill-opacity:1}}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#eee;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .selection{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:#13c4f996}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-opacity .25s linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:#fff;color:#000;padding:1px;border:1px solid rgba(0,0,0,.5);z-index:10000;display:block;font-family:Arial,sans-serif;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-ms-user-select:none;user-select:none;background:#fffc;border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{-webkit-transition:opacity 50ms linear .2s;transition:opacity 50ms linear .2s}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:#f7f7f7bf;color:#000;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table td.percent{color:#a9a9a9}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}\n"]
1755
+ }]
1756
+ }],
1757
+ ctorParameters: () => [
1758
+ { type: i0__namespace.Injector },
1759
+ { type: i1__namespace.App },
1760
+ {
1761
+ type: void 0,
1762
+ decorators: [{
1763
+ type: i0.Inject,
1764
+ args: ["EXPLICIT_CONTEXT"]
1765
+ }, { type: i0.Optional }]
1766
+ }
1767
+ ],
1768
+ propDecorators: { title: [{
1769
+ type: i0.HostBinding,
1770
+ args: ["class.panel"]
1771
+ }] }
1772
+ });
95
1773
 
96
- const moment = momentLib__namespace.default || window['moment'];
97
- const chartTypes = ['Column', 'Line', 'Area', 'Cumulative Line', 'Bar', 'Pie', 'Donut', 'Bubble'], allShapes = ['circle', 'square', 'diamond', 'cross', 'triangle-up', 'triangle-down'];
98
- const dateList = ['01/01/2001', '01/01/2002', '01/01/2003'], themes = {
99
- 'Terrestrial': {
100
- colors: ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'],
101
- tooltip: {
102
- 'backgroundColor': '#de7d28',
103
- 'textColor': '#FFFFFF'
104
- }
105
- },
106
- 'Annabelle': {
107
- colors: ['#393b79', '#5254a3', '#6b6ecf', '#9c9ede', '#637939', '#8ca252', '#b5cf6b', '#cedb9c', '#8c6d31', '#bd9e39', '#e7ba52', '#e7cb94', '#843c39', '#ad494a', '#d6616b', '#e7969c', '#7b4173', '#a55194', '#ce6dbd', '#de9ed6'],
108
- tooltip: {
109
- 'backgroundColor': '#2e306f',
110
- 'textColor': '#FFFFFF'
111
- }
112
- },
113
- 'Azure': {
114
- colors: ['#3182bd', '#6baed6', '#9ecae1', '#c6dbef', '#e6550d', '#fd8d3c', '#fdae6b', '#fdd0a2', '#31a354', '#74c476', '#a1d99b', '#c7e9c0', '#756bb1', '#9e9ac8', '#bcbddc', '#dadaeb', '#636363', '#969696', '#bdbdbd', '#d9d9d9'],
115
- tooltip: {
116
- 'backgroundColor': '#3182bd',
117
- 'textColor': '#FFFFFF'
118
- }
119
- },
120
- 'Retro': {
121
- colors: ['#0ca7a1', '#ffa615', '#334957', '#acc5c2', '#988f90', '#8accc9', '#515151', '#f27861', '#36c9fd', '#794668', '#0f709d', '#0d2738', '#44be78', '#4a1839', '#6a393f', '#557d8b', '#6c331c', '#1c1c1c', '#861500', '#09562a'],
122
- tooltip: {
123
- 'backgroundColor': '#80513a',
124
- 'textColor': '#FFFFFF'
125
- }
126
- },
127
- 'Mellow': {
128
- colors: ['#f0dcbf', '#88c877', '#aeb918', '#2e2c23', '#ddddd2', '#dfe956', '#4c963b', '#5d3801', '#e1eec3', '#cd8472', '#fcfab3', '#9a4635', '#9295ad', '#2e3f12', '#565677', '#557d8b', '#4f4d02', '#0c0c1b', '#833324', '#24120e'],
129
- tooltip: {
130
- 'backgroundColor': '#7c9e73',
131
- 'textColor': '#FFFFFF'
132
- }
133
- },
134
- 'Orient': {
135
- colors: ['#a80000', '#cc6c3c', '#f0e400', '#000084', '#fccc6c', '#009c6c', '#cc309c', '#78cc00', '#fc84e4', '#48e4fc', '#4878d8', '#186c0c', '#606060', '#a8a8a8', '#000000', '#d7d7d7', '#75a06e', '#190d0b', '#888888', '#694b84'],
136
- tooltip: {
137
- 'backgroundColor': '#c14242',
138
- 'textColor': '#FFFFFF'
139
- }
140
- },
141
- 'GrayScale': {
142
- colors: ['#141414', '#353535', '#5b5b5b', '#848484', '#a8a8a8', '#c3c3c3', '#e0e0e0', '#c8c8c8', '#a5a5a5', '#878787', '#656565', '#4e4e4e', '#303030', '#1c1c1c', '#4f4f4f', '#3b3b3b', '#757575', '#606060', '#868686', '#c1c1c1'],
143
- tooltip: {
144
- 'backgroundColor': '#575757',
145
- 'textColor': '#FFFFFF'
146
- }
147
- },
148
- 'Flyer': {
149
- colors: ['#3f454c', '#5a646e', '#848778', '#cededf', '#74c4dd', '#0946ed', '#380bb1', '#000ff0', '#f54a23', '#1db262', '#bca3aa', '#ffa500', '#a86b32', '#63a18c', '#56795e', '#934343', '#b75f5f', '#752d2d', '#4e1111', '#920606'],
150
- tooltip: {
151
- 'backgroundColor': '#47637c',
152
- 'textColor': '#FFFFFF'
153
- }
154
- },
155
- 'Luminosity': {
156
- colors: ['#FFFFFF', '#e4e4e4', '#00bcd4', '#f0dd2f', '#00aabf', '#018376', '#e91e63', '#39e5d4', '#ff6d6d', '#00ff76', '#ff9800', '#969696', '#ff4200', '#e00000', '#95cbe5', '#5331ff', '#fff4a7', '#e7a800', '#0061e4', '#d5e7ff'],
157
- tooltip: {
158
- 'backgroundColor': '#47637c',
159
- 'textColor': '#FFFFFF'
160
- }
161
- }
162
- }, basicProperties = ['xaxislabel', 'yaxislabel', 'xunits', 'yunits', 'xnumberformat', 'xdateformat', 'ynumberformat',
163
- 'showvalues', 'showlabels', 'viewtype', 'areaviewtype', 'staggerlabels', 'reducexticks', 'offsettop', 'offsetbottom', 'offsetright', 'offsetleft',
164
- 'barspacing', 'xaxislabeldistance', 'yaxislabeldistance', 'theme', 'labeltype', 'donutratio', 'showlabelsoutside', 'showxdistance', 'showydistance', 'shape', 'nodatamessage', 'captions', 'showxaxis', 'showyaxis',
165
- 'centerlabel', 'customcolors', 'showlegend', 'legendtype', 'xdomain', 'ydomain', 'tooltips', 'linethickness', 'highlightpoints', 'interpolation', 'labelthreshold'], barSpacingMap = {
166
- 'small': 0.3,
167
- 'medium': 0.5,
168
- 'large': 0.8
169
- }, donutRatioMap = {
170
- 'small': 0.3,
171
- 'medium': 0.6,
172
- 'large': 0.7
173
- }, barSpacingMapInvert = lodashEs.invert(barSpacingMap), donutRatioMapInvert = lodashEs.invert(donutRatioMap), tickformats = {
174
- 'Thousand': {
175
- 'prefix': 'K',
176
- 'divider': 1000
177
- },
178
- 'Million': {
179
- 'prefix': 'M',
180
- 'divider': 1000000
181
- },
182
- 'Billion': {
183
- 'prefix': 'B',
184
- 'divider': 1000000000
185
- }
186
- }, chartId = '#preview-chart', dataTypeJSON = ['Column', 'Line', 'Pie', 'Bar', 'Donut', 'Bubble'], // Charts that supports the data to be JSON;
187
- lineTypeCharts = ['Line', 'Area', 'Cumulative Line'], // Charts that does not supports the string type of data in the xaxis in the nvd3;
188
- dataTypeArray = ['Cumulative Line', 'Area'], // Charts that supports the data to be Array
189
- SAMPLE_DATA = {
190
- 'group1': 'Europe',
191
- 'group2': 'Asia',
192
- 'group3': 'America',
193
- 'group4': 'Australia'
194
- };
195
- // returns true if chart type is pie
196
- const isPieChart = type => type === 'Pie';
197
- // returns true if chart type is line
198
- const isLineChart = type => type === 'Line';
199
- // returns true if chart type is bar
200
- const isBarChart = type => type === 'Bar';
201
- // returns true if chart type is donut
202
- const isDonutChart = type => type === 'Donut';
203
- // returns true if chart type is bubble
204
- const isBubbleChart = type => type === 'Bubble';
205
- // returns true if chart type is column
206
- const isColumnChart = type => type === 'Column';
207
- // returns true if chart type is area
208
- const isAreaChart = type => type === 'Area';
209
- // returns true if chart type is area
210
- const isPieType = type => isPieChart(type) || isDonutChart(type);
211
- // The format of chart data is array of json objects in case of the following types of chart
212
- const isChartDataJSON = type => lodashEs.includes(dataTypeJSON, type) || !lodashEs.includes(chartTypes, type);
213
- // The format of chart data is array of objects in case of the following types of chart
214
- const isChartDataArray = type => lodashEs.includes(dataTypeArray, type);
215
- // returns true is the chart type is 'line', 'area' or 'cumulative line' else false
216
- const isLineTypeChart = type => lodashEs.includes(lineTypeCharts, type);
217
- // X/Y Domain properties are supported only for Column and Area charts
218
- const isAxisDomainSupported = type => isColumnChart(type) || isAreaChart(type);
219
- // Returns bar spacing value
220
- const getBarSpacingValue = (value, prop) => {
221
- if (prop === 'value') {
222
- return barSpacingMap[value];
223
- }
224
- if (prop === 'key') {
225
- return barSpacingMapInvert[value];
226
- }
227
- };
228
- // Returns radius value
229
- const getRadiusValue = (value, prop) => {
230
- if (prop === 'value') {
231
- return donutRatioMap[value];
232
- }
233
- if (prop === 'key') {
234
- return donutRatioMapInvert[value];
235
- }
236
- };
237
- // Returns labels config
238
- const getLabelValues = (showlabels, showlabelsoutside, prop) => {
239
- const labelsConfig = {};
240
- switch (showlabels) {
241
- case 'hide':
242
- labelsConfig.showlabels = false;
243
- break;
244
- case 'inside':
245
- labelsConfig.showlabels = true;
246
- labelsConfig.showlabelsoutside = false;
247
- break;
248
- case 'outside':
249
- labelsConfig.showlabels = true;
250
- labelsConfig.showlabelsoutside = true;
251
- break;
252
- }
253
- return labelsConfig;
254
- };
255
- // Construct the sample data
256
- const constructSampleData = (dataType, yaxisLength, shape) => {
257
- let first_series = [], second_series = [], third_series = [], first_series_array = [], second_series_array = [], third_series_array = [], first_series_bubble = [], second_series_bubble = [], third_series_bubble = [], data = [];
258
- switch (dataType) {
259
- case 'jsonFormat':
260
- first_series = [
261
- { 'x': '01/01/2001', 'y': 4000000 },
262
- { 'x': '01/01/2002', 'y': 1000000 },
263
- { 'x': '01/01/2003', 'y': 5000000 }
264
- ];
265
- second_series = [
266
- { 'x': '01/01/2001', 'y': 3000000 },
267
- { 'x': '01/01/2002', 'y': 4000000 },
268
- { 'x': '01/01/2003', 'y': 7000000 }
269
- ];
270
- third_series = [
271
- { 'x': '01/01/2001', 'y': 2000000 },
272
- { 'x': '01/01/2002', 'y': 8000000 },
273
- { 'x': '01/01/2003', 'y': 6000000 }
274
- ];
275
- data[0] = {
276
- values: first_series,
277
- key: SAMPLE_DATA.group1
278
- };
279
- if (yaxisLength >= 2) {
280
- data[1] = {
281
- values: second_series,
282
- key: SAMPLE_DATA.group2
283
- };
284
- }
285
- if (yaxisLength >= 3) {
286
- data[2] = {
287
- values: third_series,
288
- key: SAMPLE_DATA.group3
289
- };
290
- }
291
- break;
292
- case 'lineChartFormat':
293
- first_series = [
294
- { 'x': 1, 'y': 4000000 },
295
- { 'x': 2, 'y': 1000000 },
296
- { 'x': 3, 'y': 5000000 }
297
- ];
298
- second_series = [
299
- { 'x': 1, 'y': 3000000 },
300
- { 'x': 2, 'y': 4000000 },
301
- { 'x': 3, 'y': 7000000 }
302
- ];
303
- third_series = [
304
- { 'x': 1, 'y': 2000000 },
305
- { 'x': 2, 'y': 8000000 },
306
- { 'x': 3, 'y': 6000000 }
307
- ];
308
- data[0] = {
309
- values: first_series,
310
- key: SAMPLE_DATA.group1
311
- };
312
- if (yaxisLength >= 2) {
313
- data[1] = {
314
- values: second_series,
315
- key: SAMPLE_DATA.group2
316
- };
317
- }
318
- if (yaxisLength >= 3) {
319
- data[2] = {
320
- values: third_series,
321
- key: SAMPLE_DATA.group3
322
- };
323
- }
324
- break;
325
- case 'arrayFormat':
326
- first_series_array = [
327
- [1, 4000000],
328
- [2, 1000000],
329
- [3, 5000000]
330
- ];
331
- second_series_array = [
332
- [1, 3000000],
333
- [2, 4000000],
334
- [3, 7000000]
335
- ];
336
- third_series_array = [
337
- [1, 2000000],
338
- [2, 8000000],
339
- [3, 6000000]
340
- ];
341
- data[0] = {
342
- values: first_series_array,
343
- key: SAMPLE_DATA.group1
344
- };
345
- if (yaxisLength >= 2) {
346
- data[1] = {
347
- values: second_series_array,
348
- key: SAMPLE_DATA.group2
349
- };
350
- }
351
- if (yaxisLength >= 3) {
352
- data[2] = {
353
- values: third_series_array,
354
- key: SAMPLE_DATA.group3
355
- };
356
- }
357
- break;
358
- case 'bubbleFormat':
359
- shape = shape === 'random' ? allShapes[Math.floor(Math.random() * allShapes.length)] : shape;
360
- first_series_bubble = [
361
- { 'x': 80.66, 'y': 33739900, 'size': 78, 'shape': shape },
362
- { 'x': 79.84, 'y': 81902300, 'size': 90, 'shape': shape },
363
- { 'x': 78.6, 'y': 5523100, 'size': 45, 'shape': shape }
364
- ];
365
- second_series_bubble = [
366
- { 'x': 72.73, 'y': 79716200, 'size': 98, 'shape': shape },
367
- { 'x': 80.05, 'y': 61801600, 'size': 20, 'shape': shape },
368
- { 'x': 72.49, 'y': 73137200, 'size': 34, 'shape': shape }
369
- ];
370
- third_series_bubble = [
371
- { 'x': 68.09, 'y': 33739900, 'size': 45, 'shape': shape },
372
- { 'x': 81.55, 'y': 7485600, 'size': 78, 'shape': shape },
373
- { 'x': 68.60, 'y': 141850000, 'size': 56, 'shape': shape }
374
- ];
375
- data[0] = {
376
- values: first_series_bubble,
377
- key: SAMPLE_DATA.group1
378
- };
379
- if (yaxisLength >= 2) {
380
- data[1] = {
381
- values: second_series_bubble,
382
- key: SAMPLE_DATA.group2
383
- };
384
- }
385
- if (yaxisLength >= 3) {
386
- data[2] = {
387
- values: third_series_bubble,
388
- key: SAMPLE_DATA.group3
389
- };
390
- }
391
- break;
392
- case 'pieChartFormat':
393
- data = [
394
- { 'x': SAMPLE_DATA.group1, 'y': 1000000 },
395
- { 'x': SAMPLE_DATA.group2, 'y': 2000000 },
396
- { 'x': SAMPLE_DATA.group3, 'y': 3000000 },
397
- { 'x': SAMPLE_DATA.group4, 'y': 4000000 }
398
- ];
399
- break;
400
- }
401
- return data;
402
- };
403
- const getDataType = widgetContext => {
404
- const type = widgetContext.type;
405
- if (isLineChart(type)) {
406
- return 'lineChartFormat';
407
- }
408
- if (isPieType(type)) {
409
- return 'pieChartFormat';
410
- }
411
- if (isBubbleChart(type)) {
412
- return 'bubbleFormat';
413
- }
414
- return isChartDataJSON(type) ? 'jsonFormat' : 'arrayFormat';
415
- };
416
- // Sample data to populate when no data is bound
417
- const getSampleData = widgetContext => constructSampleData(getDataType(widgetContext), lodashEs.split(widgetContext.yaxisdatakey, ',').length, widgetContext.shape);
418
- // Check whether X/Y Domain was set to Min and is supported for the present chart
419
- const isAxisDomainValid = (widgetContext, axis) => {
420
- if (widgetContext[axis + 'domain'] === 'Min' && (isAxisDomainSupported(widgetContext.type))) {
421
- return true;
422
- }
423
- return false;
424
- };
425
- // Check whether min and max values are finite or not
426
- const areMinMaxValuesValid = values => {
427
- if (lodashEs.isFinite(values.min) && lodashEs.isFinite(values.max)) {
428
- return true;
429
- }
430
- return false;
431
- };
432
- const getYScaleMinValue = value => {
433
- const _min = Math.floor(value);
434
- /* If the number has a) decimal part returning floor value - 0.1
435
- b) no decimal part returning floor value - 1 */
436
- return Math.abs(value) - _min > 0 ? value - 0.1 : _min - 1;
437
- };
438
- // Chooses the data points of line/cumulative line/area chart and highlights them
439
- const highlightPoints = (id, highlightpoints) => {
440
- const chartSvg = id ? d3.select('#wmChart' + id + ' svg') : d3.select(chartId + ' svg');
441
- if (highlightpoints) {
442
- chartSvg.selectAll('.nv-point')
443
- .style('stroke-width', '6px')
444
- .style('fill-opacity', '0.95')
445
- .style('stroke-opacity', '0.95');
446
- }
447
- else {
448
- chartSvg.selectAll('.nv-point')
449
- .style('stroke-width', '0px')
450
- .style('fill-opacity', '0');
451
- }
452
- };
453
- // Chooses the line of line/cumulative line and increases the thickness of it
454
- const setLineThickness = (id, thickness) => {
455
- const chartSvg = id ? d3.select('#wmChart' + id + ' svg') : d3.select(chartId + ' svg');
456
- thickness = thickness || 1.5;
457
- const lines = chartSvg.selectAll('.nv-line');
458
- if (lines.size() !== 0) {
459
- lines.style('stroke-width', thickness);
460
- }
461
- };
462
- // Constructing a common key value map for preview and canvas mode
463
- const initProperties = (widgetContext, propertyValueMap) => {
464
- if (!propertyValueMap || i1.isEmptyObject(propertyValueMap)) {
465
- propertyValueMap = {};
466
- }
467
- lodashEs.forEach(basicProperties, prop => {
468
- if (lodashEs.isUndefined(propertyValueMap[prop])) {
469
- propertyValueMap[prop] = widgetContext[prop];
470
- }
471
- });
472
- return propertyValueMap;
473
- };
474
- const getNumberValue = (value, callback) => {
475
- return isNaN(parseInt(value, 10)) ? callback(value, 'value') : value;
476
- };
477
- // Formats the given value according to date format
478
- const getDateFormatedData = (dateFormat, d) => {
479
- dateFormat = dateFormat || '%x';
480
- /**
481
- * if date value is string "20-05-2019" then new Date(value) return 20May2019 with current time in India,
482
- * whereas this will return 19May2019 with time lagging for few hours.
483
- * This is because it returns UTC time i.e. Coordinated Universal Time (UTC).
484
- * To create date in local time use moment
485
- */
486
- if (dateFormat == '%c') {
487
- dateFormat = '%a %b %e %X %Y';
488
- }
489
- return d3.timeFormat(dateFormat)(new Date(moment(moment(d).format()).valueOf()));
490
- };
491
- const removeTrailingZeros = value => {
492
- if (!value) {
493
- return value;
494
- }
495
- // Convert value to a string if it's a number
496
- const stringValue = typeof value === 'number' ? value.toString() : value;
497
- // Remove trailing zeros
498
- return stringValue.replace(/\.0+([A-Za-z]*)$/, '$1').replace(/\.([1-9]+)0+([A-Za-z]*)$/, '.$1$2');
499
- };
500
- // Formats the given value according to number format
501
- const getNumberFormatedData = (numberFormat, d) => {
502
- let formattedData, divider, prefix;
503
- // formatting the data based on number format selected
504
- if (numberFormat) {
505
- let numberFormatter;
506
- if (numberFormat == 'Thousand' || numberFormat == 'Million' || numberFormat == 'Billion') {
507
- numberFormatter = d3.format(',.2s');
508
- }
509
- else if (numberFormat == '%') {
510
- numberFormatter = d3.format('.2%');
511
- }
512
- else if (numberFormat == '.f') {
513
- numberFormatter = d3.format('.2f');
514
- }
515
- else {
516
- numberFormatter = d3.format(numberFormat);
517
- }
518
- formattedData = numberFormatter(d);
519
- // Getting the respective divider[1000,1000000,1000000000] based on the number format choosen
520
- divider = (tickformats[numberFormat]?.divider) || 0;
521
- prefix = tickformats[numberFormat]?.prefix;
522
- if (prefix && divider !== 0) {
523
- formattedData = d3.format('.2f')(d / divider) + prefix;
524
- }
525
- }
526
- else {
527
- // Auto formatting the data when no formating option is chosen
528
- formattedData = d >= 1000 ? d3.format('.1s')(d) : d;
529
- }
530
- formattedData = removeTrailingZeros(formattedData);
531
- return formattedData;
532
- };
533
- // Returns value if legend need to shown or not
534
- const isShowLegend = value => {
535
- // Old projects will have either true or false
536
- if (value === 'false' || value === false) {
537
- return false;
538
- }
539
- if (value === 'true' || value === true) {
540
- return true;
541
- }
542
- // New projects will have either 'Hide Legend', 'Show Top', 'Show Bottom'
543
- return value === 'hide' ? false : true;
544
- };
545
- /**
546
- * Customise the tooltip for donut & pie charts and also for charts having only one value attached to yaxis
547
- * @param key
548
- * @param label
549
- */
550
- const customiseTooltip = (chart, propertyValueMap, widgetContext, label) => {
551
- d3.selectAll('.nvtooltip').style('opacity', 0);
552
- chart.tooltip.contentGenerator((key, propValueMap) => {
553
- let xValue = key.data.x, yValue;
554
- yValue = getNumberFormatedData(propValueMap?.ynumberformat || widgetContext?.ynumberformat || propertyValueMap?.ynumberformat, key.data.y);
555
- if (isPieType(widgetContext.type)) {
556
- label = key.data.x;
557
- xValue = '';
558
- }
559
- return '<table>' +
560
- '<tbody>' +
561
- '<tr class="value"><b>' + xValue +
562
- '</b></tr>' +
563
- '<tr>' +
564
- '<td class="legend-color-guide"><div style="background-color:' + key.color + ';"></div></td>' +
565
- '<td class="key">' + label + '</td>' +
566
- '<td class="value">' + yValue + '</td>' +
567
- '</tr>' +
568
- '</tbody>' +
569
- '</table>';
570
- });
571
- };
572
- // intializes the chart obejct
573
- const initChart = (widgetContext, xDomainValues, yDomainValues, propertyValueMap, isPreview) => {
574
- propertyValueMap = initProperties(widgetContext, propertyValueMap);
575
- let chart, colors = [], xaxislabel, yaxislabel, labelConfig, radius, barSpacing, showLegend, xAxisValue, hasMultipleYValues;
576
- const xValue = {}, yValue = {};
577
- switch (widgetContext.type) {
578
- case 'Column':
579
- barSpacing = getNumberValue(propertyValueMap.barspacing, getBarSpacingValue) || barSpacingMap.medium;
580
- chart = nv.models.multiBarChart()
581
- .x(d => d.x)
582
- .y(d => d.y)
583
- .reduceXTicks(propertyValueMap.reducexticks)
584
- .rotateLabels(0)
585
- .showControls(false)
586
- .stacked(propertyValueMap.viewtype === 'Stacked' ? true : false)
587
- .groupSpacing(barSpacing);
588
- break;
589
- case 'Cumulative Line':
590
- chart = nv.models.cumulativeLineChart()
591
- .x(d => d[0])
592
- .y(d => d[1])
593
- .showControls(false)
594
- .useInteractiveGuideline(propertyValueMap.tooltips)
595
- .interpolate(propertyValueMap.interpolation);
596
- break;
597
- case 'Line':
598
- chart = nv.models.lineChart()
599
- .useInteractiveGuideline(propertyValueMap.tooltips)
600
- .interpolate(propertyValueMap.interpolation);
601
- break;
602
- case 'Area':
603
- chart = nv.models.stackedAreaChart()
604
- .x(d => d.x)
605
- .y(d => d.y)
606
- .clipEdge(true)
607
- .showControls(false)
608
- .style(propertyValueMap.areaviewtype)
609
- .useInteractiveGuideline(propertyValueMap.tooltips)
610
- .interpolate(propertyValueMap.interpolation);
611
- break;
612
- case 'Bar':
613
- barSpacing = getNumberValue(propertyValueMap.barspacing, getBarSpacingValue) || barSpacingMap.medium;
614
- chart = nv.models.multiBarHorizontalChart()
615
- .x(d => d.x)
616
- .y(d => d.y)
617
- .showControls(false)
618
- .stacked(propertyValueMap.viewtype === 'Stacked' ? true : false)
619
- .showValues(propertyValueMap.showvalues)
620
- .groupSpacing(barSpacing);
621
- break;
622
- case 'Pie':
623
- case 'Donut':
624
- labelConfig = getLabelValues(propertyValueMap.showlabels, propertyValueMap.showlabelsoutside);
625
- radius = getNumberValue(propertyValueMap.donutratio, getRadiusValue) || donutRatioMap.medium;
626
- chart = nv.models.pieChart()
627
- .x(d => d.x)
628
- .y(d => d.y)
629
- .showLabels(labelConfig.showlabels)
630
- .labelType(propertyValueMap.labeltype)
631
- .valueFormat(d3.format('%'))
632
- .title(propertyValueMap.centerlabel)
633
- .labelThreshold(propertyValueMap.labelthreshold || 0.01)
634
- .labelsOutside(labelConfig.showlabelsoutside);
635
- if (isDonutChart(widgetContext.type)) {
636
- chart.donut(true)
637
- .donutRatio(radius);
638
- }
639
- if (propertyValueMap.labeltype === 'key-value') {
640
- chart.labelType(d => d.data.x + ' ' + d.data.y);
641
- }
642
- break;
643
- case 'Bubble':
644
- chart = nv.models.scatterChart()
645
- .x(d => d.x)
646
- .y(d => d.y)
647
- .showDistX(propertyValueMap.showxdistance)
648
- .showDistY(propertyValueMap.showydistance);
649
- break;
650
- }
651
- if (xDomainValues) {
652
- xValue.min = xDomainValues.min.x || xDomainValues.min[0];
653
- xValue.max = xDomainValues.max.x || xDomainValues.max[0];
654
- // If the values on the x axis are string then min max values gives Infinity
655
- if (areMinMaxValuesValid(xValue)) {
656
- // Reducing the min value to 0.1 so the min value is not missed out
657
- xValue.min = getYScaleMinValue(xValue.min);
658
- chart.xDomain([xValue.min, xValue.max]);
659
- }
660
- }
661
- if (yDomainValues) {
662
- // Reducing the min value to 1 so the min value is not missed out
663
- yValue.min = yDomainValues.min.y || yDomainValues.min[1];
664
- yValue.max = yDomainValues.max.y || yDomainValues.max[1];
665
- // If the values on the y axis are string or invalid then min max values gives Infinity
666
- if (areMinMaxValuesValid(yValue)) {
667
- // Reducing the min value to 1 so the min value is not missed out
668
- yValue.min = getYScaleMinValue(yValue.min);
669
- chart.yDomain([yValue.min, yValue.max]);
670
- }
671
- }
672
- // Setting the legend type choosen by user or default it will be furious
673
- chart.legend.vers((propertyValueMap.legendtype?.toLowerCase()) || 'furious');
674
- if (!lodashEs.includes(chartTypes, widgetContext.type)) {
675
- chart = nv.models.multiBarChart()
676
- .x(d => d.x)
677
- .y(d => d.y);
678
- }
679
- if (isPieType(widgetContext.type)) {
680
- // In case of pie/donut chart formatting the values of it
681
- if (propertyValueMap.labeltype === 'percent') {
682
- chart.valueFormat(d3.format('%'));
683
- }
684
- else {
685
- chart.valueFormat(d => getNumberFormatedData(propertyValueMap.ynumberformat, d));
686
- }
687
- // Customizing the tooltips in case of the pie and donut when labelType is value
688
- customiseTooltip(chart, propertyValueMap, widgetContext);
689
- }
690
- else {
691
- chart.showXAxis(propertyValueMap.showxaxis)
692
- .showYAxis(propertyValueMap.showyaxis);
693
- chart.legendPosition(propertyValueMap.showlegend);
694
- // Setting the labels if they are specified explicitly or taking the axiskeys chosen
695
- xaxislabel = propertyValueMap.xaxislabel || i1.prettifyLabels(widgetContext.xaxisdatakey) || 'x caption';
696
- yaxislabel = propertyValueMap.yaxislabel || i1.prettifyLabels(widgetContext.yaxisdatakey) || 'y caption';
697
- // Checking if y axis has multiple values
698
- if (widgetContext.yaxisdatakey && widgetContext.yaxisdatakey.split(',').length > 1) {
699
- hasMultipleYValues = true;
700
- }
701
- // Customizing the tooltip to show yaxislabel, only if the y axis contains one value
702
- if (!hasMultipleYValues && !isBubbleChart(widgetContext.type)) {
703
- customiseTooltip(chart, propertyValueMap, widgetContext, yaxislabel);
704
- }
705
- // Adding the units to the captions if they are specified
706
- xaxislabel += propertyValueMap.xunits ? '(' + propertyValueMap.xunits + ')' : '';
707
- yaxislabel += propertyValueMap.yunits ? '(' + propertyValueMap.yunits + ')' : '';
708
- chart.xAxis
709
- .axisLabel(xaxislabel)
710
- .axisLabelDistance(propertyValueMap.xaxislabeldistance)
711
- .staggerLabels(propertyValueMap.staggerlabels);
712
- // If date format set format based date format
713
- if (propertyValueMap.xdateformat || (isPreview && !isBubbleChart(widgetContext.type))) {
714
- if (isLineTypeChart(widgetContext.type)) {
715
- chart.xAxis.tickFormat(d => {
716
- // get the actual value
717
- xAxisValue = isPreview ? dateList[d - 1] : widgetContext.xDataKeyArr[d];
718
- return getDateFormatedData(propertyValueMap.xdateformat, xAxisValue);
719
- });
720
- }
721
- else {
722
- chart.xAxis.tickFormat(d => getDateFormatedData(propertyValueMap.xdateformat, d));
723
- }
724
- }
725
- else if (propertyValueMap.xnumberformat) {
726
- chart.xAxis.tickFormat(d => getNumberFormatedData(propertyValueMap.xnumberformat, d));
727
- }
728
- else if (isLineTypeChart(widgetContext.type)) {
729
- // get the actual value
730
- chart.xAxis.tickFormat(d => widgetContext.xDataKeyArr[d]);
731
- }
732
- chart.yAxis
733
- .axisLabel(yaxislabel)
734
- .axisLabelDistance(propertyValueMap.yaxislabeldistance)
735
- .staggerLabels(propertyValueMap.staggerlabels)
736
- .tickFormat(d => getNumberFormatedData(propertyValueMap?.ynumberformat, d));
737
- if (isBarChart(widgetContext.type)) {
738
- chart.valueFormat(d => getNumberFormatedData(propertyValueMap?.ynumberformat, d));
739
- }
740
- }
741
- // Support for custom colors if user gives direct string of colors in text box
742
- if (lodashEs.isString(propertyValueMap.customcolors) && propertyValueMap.customcolors) {
743
- colors = lodashEs.split(propertyValueMap.customcolors, ',');
744
- }
745
- if (lodashEs.isArray(propertyValueMap.customcolors)) {
746
- colors = propertyValueMap.customcolors;
747
- }
748
- showLegend = isShowLegend(propertyValueMap.showlegend);
749
- chart.showLegend(showLegend)
750
- .margin({ top: propertyValueMap.offsettop, right: propertyValueMap.offsetright, bottom: propertyValueMap.offsetbottom, left: propertyValueMap.offsetleft })
751
- .color(colors.length ? colors : themes[propertyValueMap.theme].colors);
752
- chart.tooltip.enabled(propertyValueMap.tooltips);
753
- widgetContext.message = propertyValueMap.nodatamessage || 'No data found';
754
- // setting the no data message
755
- chart.noData(widgetContext.message);
756
- if (isLineTypeChart(widgetContext.type) && widgetContext.highlightpoints) {
757
- chart.dispatch.on('stateChange', () => {
758
- setTimeout(() => postPlotChartProcess(widgetContext), 100);
759
- });
760
- }
761
- if (widgetContext.showlegend && (widgetContext.type === 'Donut' || widgetContext.type === 'Pie')) {
762
- if (widgetContext.showlegend === 'right') {
763
- chart.legendPosition('right');
764
- }
765
- }
766
- return chart;
767
- };
768
- // @ts-ignore
769
- const postPlotChartProcess = (widgetContext, isPreview) => {
770
- const id = widgetContext.$id;
771
- // If user sets to highlight the data points and increase the thickness of the line
772
- if (isLineTypeChart(widgetContext.type)) {
773
- setLineThickness(id, widgetContext.linethickness);
774
- highlightPoints(id, widgetContext.highlightpoints);
775
- }
776
- // Modifying the legend position only when legend is shown
777
- // if (widgetContext.showlegend) {
778
- // modifyLegendPosition(widgetContext, widgetContext.showlegend, id);
779
- // }
780
- };
781
- // @ts-ignore
782
- const getDateList = () => dateList;
783
-
784
- const WIDGET_CONFIG = { widgetType: 'wm-chart', hostClass: 'app-chart' };
785
- const NONE = 'none', advanceDataProps = ['aggregation', 'aggregationcolumn', 'groupby', 'orderby'],
786
- // XPaths to get actual data of data points in charts
787
- chartDataPointXpath = {
788
- 'Column': 'rect.nv-bar',
789
- 'Bar': 'g.nv-bar',
790
- 'Area': '.nv-stackedarea .nv-point',
791
- 'Cumulative Line': '.nv-cumulativeLine .nv-scatterWrap path.nv-point',
792
- 'Line': '.nv-lineChart .nv-scatterWrap path.nv-point',
793
- 'Pie': '.nv-pieChart .nv-slice path',
794
- 'Donut': '.nv-pieChart .nv-slice path',
795
- 'Bubble': '.nv-scatterChart .nv-point-paths path'
796
- },
797
- styleProps = {
798
- 'fontunit': 'font-size',
799
- 'fontsize': 'font-size',
800
- 'color': 'fill',
801
- 'fontfamily': 'font-family',
802
- 'fontweight': 'font-weight',
803
- 'fontstyle': 'font-style',
804
- 'textdecoration': 'text-decoration'
805
- },
806
- // Getting the relevant aggregation function based on the selected option
807
- aggregationFnMap = {
808
- 'average': 'AVG',
809
- 'count': 'COUNT',
810
- 'maximum': 'MAX',
811
- 'minimum': 'MIN',
812
- 'sum': 'SUM'
813
- };
814
- const getBooleanValue = val => {
815
- if (val === true || val === 'true') {
816
- return true;
817
- }
818
- if (val === false || val === 'false') {
819
- return false;
820
- }
821
- return val;
822
- };
823
- // returns orderby columns and their orders in two separate arrays
824
- const getLodashOrderByFormat = orderby => {
825
- let columns;
826
- const orderByColumns = [], orders = [];
827
- lodashEs.forEach(lodashEs.split(orderby, ','), function (col) {
828
- columns = lodashEs.split(col, ':');
829
- orderByColumns.push(columns[0]);
830
- orders.push(columns[1]);
831
- });
832
- return {
833
- 'columns': orderByColumns,
834
- 'orders': orders
835
- };
836
- };
837
- // Replacing the '.' by the '$' because '.' is not supported in the alias names
838
- const getValidAliasName = aliasName => aliasName ? aliasName.replace(/\./g, '$') : null;
839
- // Applying the font related styles for the chart
840
- const setTextStyle = (properties, id) => {
841
- const charttext = d3.select('#wmChart' + id + ' svg').selectAll('text');
842
- if (!charttext.empty()) {
843
- charttext.style(properties);
844
- }
845
- };
846
- const angle = d => {
847
- const a = (d.startAngle + d.endAngle) * 90 / Math.PI - 90;
848
- return a > 90 ? a - 180 : a;
849
- };
850
- class ChartComponent extends base.StylableComponent {
851
- static { this.initializeProps = registerProps(); }
852
- isGroupByEnabled() {
853
- return !!(this.groupby && this.groupby !== NONE);
854
- }
855
- // Check if x and y axis that are chosen are valid to plot chart
856
- isValidAxis() {
857
- // Check if x axis and y axis are chosen and are not equal
858
- return this.binddataset ? (this.xaxisdatakey && this.yaxisdatakey) : true;
859
- }
860
- // Check if aggregation is chosen
861
- isAggregationEnabled() {
862
- return !!((this.isGroupByEnabled() && this.aggregation !== NONE && this.aggregationcolumn));
863
- }
864
- // Check if either groupby, aggregation or orderby is chosen
865
- isDataFilteringEnabled() {
866
- /*Query need to be triggered if any of the following cases satisfy
867
- * 1. Group By and aggregation both chosen
868
- * 2. Only Order By is chosen
869
- * */
870
- return this.isAggregationEnabled() || (!this.isVisuallyGrouped && this.orderby);
871
- }
872
- /*Charts like Line,Area,Cumulative Line does not support any other datatype
873
- other than integer unlike the column and bar.It is a nvd3 issue. Inorder to
874
- support that this is a fix*/
875
- getxAxisVal(dataObj, xKey, index) {
876
- const value = lodashEs.get(dataObj, xKey);
877
- // If x axis is other than number type then add indexes
878
- if (isLineTypeChart(this.type) && !i1.isNumberType(this.xAxisDataType)) {
879
- // Verification to get the unique data keys
880
- this.xDataKeyArr.push(value);
881
- // Check if it is of type Date
882
- if (value instanceof Date) {
883
- return value;
884
- }
885
- else {
886
- return index;
887
- }
888
- }
889
- return value;
890
- }
891
- // Getting the min and max values among all the x values
892
- getXMinMaxValues(datum) {
893
- if (!datum) {
894
- return;
895
- }
896
- const xValues = {};
897
- /*
898
- compute the min x value
899
- eg: When data has objects
900
- input: [{x:1, y:2}, {x:2, y:3}, {x:3, y:4}]
901
- min x: 1
902
- eg: When data has arrays
903
- input: [[10, 20], [20, 30], [30, 40]];
904
- min x: 10
905
- */
906
- xValues.min = lodashEs.minBy(datum.values, dataObject => dataObject.x || dataObject[0]);
907
- /*
908
- compute the max x value
909
- eg: When data has objects
910
- input: [{x:1, y:2}, {x:2, y:3}, {x:3, y:4}]
911
- max x: 3
912
- eg: When data has arrays
913
- input: [[10, 20], [20, 30], [30, 40]];
914
- max x: 30
915
- */
916
- xValues.max = lodashEs.maxBy(datum.values, dataObject => dataObject.x || dataObject[0]);
917
- return xValues;
918
- }
919
- // Getting the min and max values among all the y values
920
- getYMinMaxValues(datum) {
921
- const yValues = {}, minValues = [], maxValues = [];
922
- if (!datum) {
923
- return;
924
- }
925
- /*
926
- Getting the min and max y values among all the series of data
927
- compute the min y value
928
- eg: When data has objects
929
- input: [[{x:1, y:2}, {x:2, y:3}, {x:3, y:4}], [{x:2, y:3}, {x:3, y:4}, {x:4, y:5}]]
930
- min y values : '2'(among first set) & '3'(among second set)
931
- max y values : '4'(among first set) & '5'(among second set)
932
-
933
- eg: When data has arrays
934
- input: [[[10, 20], [20, 30], [30, 40]], [[20, 30], [30, 40], [40, 50]]]
935
- min y values : '20'(among first set) & '30'(among second set)
936
- max y values : '40'(among first set) & '50'(among second set)
937
- */
938
- lodashEs.forEach(datum, data => {
939
- minValues.push(lodashEs.minBy(data.values, function (dataObject) {
940
- return dataObject.y || dataObject[1];
941
- }));
942
- maxValues.push(lodashEs.maxBy(data.values, function (dataObject) {
943
- return dataObject.y || dataObject[1];
944
- }));
945
- });
946
- // Gets the least and highest values among all the min and max values of respective series of data
947
- yValues.min = lodashEs.minBy(minValues, dataObject => dataObject.y || dataObject[1]);
948
- yValues.max = lodashEs.maxBy(maxValues, dataObject => dataObject.y || dataObject[1]);
949
- return yValues;
950
- }
951
- // If the x-axis values are undefined, we return empty array else we return the values
952
- getValidData(values) {
953
- return (values.length === 1 && values[0] === undefined) ? [] : values;
954
- }
955
- // Returns the single data point based on the type of the data chart accepts
956
- valueFinder(dataObj, xKey, yKey, index, shape) {
957
- const xVal = this.getxAxisVal(dataObj, xKey, index), value = lodashEs.get(dataObj, yKey), yVal = parseFloat(value) || value, size = parseFloat(dataObj[this.bubblesize]) || 2;
958
- let dataPoint = {};
959
- if (isChartDataJSON(this.type)) {
960
- dataPoint.x = xVal;
961
- dataPoint.y = yVal;
962
- // only Bubble chart has the third dimension
963
- if (isBubbleChart(this.type)) {
964
- dataPoint.size = size;
965
- dataPoint.shape = shape || 'circle';
966
- }
967
- }
968
- else if (isChartDataArray(this.type)) {
969
- dataPoint = [xVal, yVal];
970
- }
971
- // Adding actual unwrapped data to chart data to use at the time of selected data point of chart event
972
- dataPoint._dataObj = dataObj;
973
- return dataPoint;
974
- }
975
- // Setting appropriate error messages
976
- setErrMsg(message) {
977
- if (this.showNoDataMsg) {
978
- this.showContentLoadError = true;
979
- this.invalidConfig = true;
980
- // TODO: Set the locale from the message
981
- this.errMsg = ''; // $rootScope.locale[message];
982
- }
983
- }
984
- processChartData() {
985
- this.sampleData = getSampleData(this);
986
- // scope variables used to keep the actual key values for x-axis
987
- this.xDataKeyArr = [];
988
- // Plotting the chart with sample data when the chart dataset is not bound
989
- if (!this.binddataset) {
990
- this.xDataKeyArr = getDateList();
991
- return this.sampleData;
992
- }
993
- if (!this.chartData?.length) {
994
- return [];
995
- }
996
- let datum = [], yAxisKey, shapes = [], values = [];
997
- const xAxisKey = this.xaxisdatakey, yAxisKeys = this.yaxisdatakey ? this.yaxisdatakey.split(',') : [], dataSet = this.chartData;
998
- if (lodashEs.isArray(dataSet)) {
999
- if (isPieType(this.type)) {
1000
- yAxisKey = yAxisKeys[0];
1001
- datum = lodashEs.map(dataSet, (dataObj, index) => {
1002
- if (!i1.isEmptyObject(dataSet[index])) {
1003
- return this.valueFinder(dataSet[index], xAxisKey, yAxisKey);
1004
- }
1005
- });
1006
- datum = this.getValidData(datum);
1007
- }
1008
- else {
1009
- if (isBubbleChart(this.type)) {
1010
- shapes = this.shape === 'random' ? allShapes : this.shape;
1011
- }
1012
- yAxisKeys.forEach((yAxisKey, series) => {
1013
- values = lodashEs.map(dataSet, (dataObj, index) => {
1014
- if (!i1.isEmptyObject(dataSet[index])) {
1015
- return this.valueFinder(dataSet[index], xAxisKey, yAxisKey, index, (lodashEs.isArray(shapes) && shapes[series]) || this.shape);
1016
- }
1017
- });
1018
- values = this.getValidData(values);
1019
- datum.push({
1020
- values: values,
1021
- key: i1.prettifyLabels(yAxisKey)
1022
- });
1023
- });
1024
- }
1025
- }
1026
- return datum;
1027
- }
1028
- setChartData(data) {
1029
- if (data) {
1030
- this._processedData = data;
1031
- }
1032
- }
1033
- getChartData() {
1034
- return this._processedData;
1035
- }
1036
- // constructing the grouped data based on the selection of orderby, x & y axis
1037
- getVisuallyGroupedData(queryResponse, groupingColumn) {
1038
- let groupData = {}, groupValues = [], orderByDetails, maxLength;
1039
- const chartData = [], _isAreaChart = isAreaChart(this.type), yAxisKey = lodashEs.first(lodashEs.split(this.yaxisdatakey, ','));
1040
- this.xDataKeyArr = [];
1041
- queryResponse = lodashEs.orderBy(queryResponse, lodashEs.split(this.groupby, ','));
1042
- if (this.orderby) {
1043
- orderByDetails = getLodashOrderByFormat(this.orderby);
1044
- queryResponse = lodashEs.orderBy(queryResponse, orderByDetails.columns, orderByDetails.orders);
1045
- }
1046
- queryResponse = lodashEs.groupBy(queryResponse, groupingColumn);
1047
- // In case of area chart all the series data should be of same length
1048
- if (_isAreaChart) {
1049
- maxLength = lodashEs.max(lodashEs.map(queryResponse, obj => obj.length));
1050
- }
1051
- lodashEs.forEach(queryResponse, (values, groupKey) => {
1052
- groupValues = isAreaChart ? lodashEs.fill(new Array(maxLength), [0, 0]) : [];
1053
- lodashEs.forEachRight(values, (value, index) => {
1054
- groupValues[index] = this.valueFinder(value, this.xaxisdatakey, yAxisKey, index);
1055
- });
1056
- groupData = {
1057
- key: groupKey,
1058
- values: groupValues
1059
- };
1060
- chartData.push(groupData);
1061
- });
1062
- return chartData;
1063
- }
1064
- /*Decides whether the data should be visually grouped or not
1065
- Visually grouped when a different column is choosen in the group by other than x and y axis and aggregation is not chosen*/
1066
- getGroupingDetails() {
1067
- if (this.isGroupByEnabled() && !this.isAggregationEnabled()) {
1068
- let isVisuallyGrouped = false, visualGroupingColumn, groupingExpression, columns = [], groupingColumnIndex;
1069
- const groupbyColumns = this.groupby && this.groupby !== NONE ? this.groupby.split(',') : [], yAxisKeys = this.yaxisdatakey ? this.yaxisdatakey.split(',') : [];
1070
- if (groupbyColumns.length > 1) {
1071
- /*Getting the group by column which is not selected either in x or y axis*/
1072
- groupbyColumns.every((column, index) => {
1073
- if (this.xaxisdatakey !== column && $.inArray(column, yAxisKeys) === -1) {
1074
- isVisuallyGrouped = true;
1075
- visualGroupingColumn = column;
1076
- groupingColumnIndex = index;
1077
- groupbyColumns.splice(groupingColumnIndex, 1);
1078
- return false;
1079
- }
1080
- return true;
1081
- });
1082
- // Constructing the groupby expression
1083
- if (visualGroupingColumn) {
1084
- columns.push(visualGroupingColumn);
1085
- }
1086
- if (groupbyColumns.length) {
1087
- columns = lodashEs.concat(columns, groupbyColumns);
1088
- }
1089
- }
1090
- // If x and y axis are not included in aggregation need to be included in groupby
1091
- if (this.xaxisdatakey !== this.aggregationcolumn) {
1092
- columns.push(this.xaxisdatakey);
1093
- }
1094
- lodashEs.forEach(yAxisKeys, key => {
1095
- if (key !== this.aggregationcolumn) {
1096
- columns.push(key);
1097
- }
1098
- });
1099
- groupingExpression = columns.join(',');
1100
- // set isVisuallyGrouped flag in scope for later use
1101
- this.isVisuallyGrouped = isVisuallyGrouped;
1102
- return {
1103
- expression: groupingExpression,
1104
- isVisuallyGrouped: isVisuallyGrouped,
1105
- visualGroupingColumn: visualGroupingColumn
1106
- };
1107
- }
1108
- return {
1109
- expression: '',
1110
- isVisuallyGrouped: false,
1111
- visualGroupingColumn: ''
1112
- };
1113
- }
1114
- // Function to get the aggregated data after applying the aggregation & group by or order by operations.
1115
- getAggregatedData(callback) {
1116
- const variable = this.datasource, yAxisKeys = this.yaxisdatakey ? this.yaxisdatakey.split(',') : [], data = {};
1117
- let sortExpr, columns = [], colAlias, orderByColumns, groupByFields = [];
1118
- if (!variable) {
1119
- return;
1120
- }
1121
- if (this.isGroupByEnabled()) {
1122
- groupByFields = lodashEs.split(this.groupby, ',');
1123
- }
1124
- if (this.orderby) {
1125
- sortExpr = lodashEs.replace(this.orderby, /:/g, ' ');
1126
- columns = lodashEs.uniq(lodashEs.concat(columns, groupByFields, [this.aggregationcolumn]));
1127
- orderByColumns = getLodashOrderByFormat(this.orderby).columns;
1128
- // If the orderby column is chosen either in groupby or orderby then replace . with $ for that column
1129
- lodashEs.forEach(lodashEs.intersection(columns, orderByColumns), col => {
1130
- colAlias = getValidAliasName(col);
1131
- // @ts-ignore
1132
- sortExpr = lodashEs.replace(sortExpr, col, colAlias);
1133
- });
1134
- }
1135
- if (this.isAggregationEnabled()) {
1136
- // Send the group by in the aggregations api only if aggregation is also chosen
1137
- data.groupByFields = groupByFields;
1138
- data.aggregations = [
1139
- {
1140
- 'field': this.aggregationcolumn,
1141
- 'type': aggregationFnMap[this.aggregation],
1142
- 'alias': getValidAliasName(this.aggregationcolumn)
1143
- }
1144
- ];
1145
- }
1146
- // Execute the query.
1147
- variable.execute('getAggregatedData', {
1148
- 'aggregations': data,
1149
- 'sort': sortExpr
1150
- }).then(response => {
1151
- // Transform the result into a format supported by the chart.
1152
- const chartData = [], aggregationAlias = getValidAliasName(this.aggregationcolumn), xAxisAliasKey = getValidAliasName(this.xaxisdatakey), yAxisAliasKeys = [];
1153
- yAxisKeys.forEach(yAxisKey => yAxisAliasKeys.push(getValidAliasName(yAxisKey)));
1154
- lodashEs.forEach(response.body.content, (responseContent) => {
1155
- const obj = {};
1156
- // Set the response in the chartData based on 'aggregationColumn', 'xAxisDataKey' & 'yAxisDataKey'.
1157
- if (this.isAggregationEnabled()) {
1158
- obj[this.aggregationcolumn] = responseContent[aggregationAlias];
1159
- obj[this.aggregationcolumn] = lodashEs.get(responseContent, aggregationAlias) || lodashEs.get(responseContent, this.aggregationcolumn);
1160
- }
1161
- obj[this.xaxisdatakey] = lodashEs.get(responseContent, xAxisAliasKey) || lodashEs.get(responseContent, this.xaxisdatakey);
1162
- yAxisKeys.forEach((yAxisKey, index) => {
1163
- obj[yAxisKey] = lodashEs.get(responseContent, yAxisAliasKeys[index]) || lodashEs.get(responseContent, yAxisKey);
1164
- });
1165
- chartData.push(obj);
1166
- });
1167
- this.chartData = chartData;
1168
- i1.triggerFn(callback);
1169
- }, () => {
1170
- this.chartData = [];
1171
- this.setErrMsg('MESSAGE_ERROR_FETCH_DATA');
1172
- i1.triggerFn(callback);
1173
- });
1174
- }
1175
- // This function sets maximum width for the labels that can be displayed.This will helpful when they are overlapping
1176
- setLabelsMaxWidth() {
1177
- let xTicks, tickWidth, maxLength, xDist, yDist, totalHeight, maxNoLabels, nthElement, labelsAvailableWidth, barWrapper, yAxisWrapper, svgWrapper;
1178
- const fontsize = parseInt(this.fontsize, 10) || 12, isBarchart = isBarChart(this.type);
1179
- // getting the x ticks in the chart
1180
- xTicks = $('#wmChart' + this.$id + ' svg').find('g.nv-x').find('g.tick').find('text');
1181
- // getting the distance between the two visible ticks associated with visible text
1182
- xTicks.each(function () {
1183
- const xTick = $(this);
1184
- let xTransform, tickDist;
1185
- if (xTick.text() && xTick.css('opacity') === '1') {
1186
- xTransform = xTick.parent().attr('transform').split(',');
1187
- xDist = parseFloat(xTransform[0].substr(10));
1188
- yDist = parseFloat(xTransform[1] || '0');
1189
- if (!isBarchart && xDist > 0) {
1190
- tickDist = xDist;
1191
- }
1192
- else if (yDist > 0) {
1193
- tickDist = yDist;
1194
- }
1195
- if (tickWidth) {
1196
- tickWidth = tickDist - tickWidth;
1197
- return false;
1198
- }
1199
- tickWidth = tickDist;
1200
- return true;
1201
- }
1202
- });
1203
- // In case of bar chart getting the available space for the labels to be displayed
1204
- if (isBarchart) {
1205
- barWrapper = $('#wmChart' + this.$id + ' svg>g.nv-wrap>g>g.nv-barsWrap')[0];
1206
- yAxisWrapper = $('#wmChart' + this.$id + ' svg>g.nv-wrap>g>g.nv-y')[0];
1207
- svgWrapper = $('#wmChart' + this.$id + ' svg')[0];
1208
- // getting the total height of the chart
1209
- totalHeight = barWrapper ? barWrapper.getBoundingClientRect().height : 0;
1210
- // getting the labels available space
1211
- labelsAvailableWidth = yAxisWrapper ? svgWrapper.getBoundingClientRect().width - yAxisWrapper.getBoundingClientRect().width : svgWrapper.getBoundingClientRect().width;
1212
- // Setting the max length for the label
1213
- maxLength = Math.round(labelsAvailableWidth / fontsize);
1214
- // if available space for each label is less than the font-size
1215
- // then limiting the labels to be displayed
1216
- if (tickWidth < fontsize) {
1217
- // calculate the maximum no of labels to be fitted
1218
- maxNoLabels = totalHeight / fontsize;
1219
- // showing only the nth element
1220
- nthElement = Math.ceil(this.chartData.length / maxNoLabels);
1221
- // showing up only some labels
1222
- d3.select('#wmChart' + this.$id + ' svg').select('g.nv-x').selectAll('g.tick').select('text').each(function (text, i) {
1223
- // hiding every non nth element
1224
- if (i % nthElement !== 0) {
1225
- d3.select(this).attr('opacity', 0);
1226
- }
1227
- });
1228
- }
1229
- }
1230
- else {
1231
- // Setting the max length for the label
1232
- maxLength = Math.round(tickWidth / fontsize);
1233
- }
1234
- // maxLength should always be a positive number
1235
- maxLength = Math.abs(maxLength);
1236
- // Validating if every label exceeds the max length and if so limiting the length and adding ellipsis
1237
- xTicks.each(function () {
1238
- if (this.textContent.length > maxLength) {
1239
- this.textContent = this.textContent.substr(0, maxLength) + '...';
1240
- }
1241
- });
1242
- }
1243
- // Returns the columns of that can be choosen in the x and y axis
1244
- getDefaultColumns() {
1245
- let type, stringColumn, i, temp;
1246
- const defaultColumns = [], columns = this.datasource.execute(i1.DataSource.Operation.GET_PROPERTIES_MAP) || [];
1247
- for (i = 0; i < columns.length && defaultColumns.length <= 2; i += 1) {
1248
- type = columns[i].type;
1249
- if (!columns[i].isRelated && (i1.isNumberType(type))) {
1250
- defaultColumns.push(columns[i].fieldName);
1251
- }
1252
- else if (type === 'string' && !stringColumn) {
1253
- stringColumn = columns[i].fieldName;
1254
- }
1255
- }
1256
- // Other than bubble chart x: string type y: number type
1257
- // Bubble chart x: number type y: number type
1258
- if (stringColumn && defaultColumns.length > 0 && !isBubbleChart(this.type)) {
1259
- temp = defaultColumns[0];
1260
- defaultColumns[0] = stringColumn;
1261
- defaultColumns[1] = temp;
1262
- }
1263
- return defaultColumns;
1264
- }
1265
- // Call user defined javascript function when user links it to click event of the widget.
1266
- attachClickEvent() {
1267
- let dataObj;
1268
- d3.select('#wmChart' + this.$id + ' svg').selectAll(chartDataPointXpath[this.type]).style('pointer-events', 'all')
1269
- .on('click', (event, data, index) => {
1270
- switch (this.type) {
1271
- case 'Column':
1272
- case 'Bar':
1273
- dataObj = data._dataObj;
1274
- break;
1275
- case 'Pie':
1276
- case 'Donut':
1277
- dataObj = data.data._dataObj;
1278
- break;
1279
- case 'Area':
1280
- case 'Cumulative Line':
1281
- case 'Line':
1282
- dataObj = data[0]._dataObj;
1283
- break;
1284
- case 'Bubble':
1285
- dataObj = data;
1286
- break;
1287
- }
1288
- this.selecteditem = dataObj;
1289
- this.invokeEventCallback('select', {
1290
- $event: event,
1291
- selectedChartItem: data,
1292
- selectedItem: this.selecteditem
1293
- });
1294
- });
1295
- }
1296
- /* Returns Y Scale min value
1297
- Ex: Input : 8.97
1298
- Output : 8.87
1299
-
1300
- Input : 8
1301
- Output : 7
1302
- */
1303
- postPlotProcess(chart) {
1304
- let chartSvg, pieLabels, pieGroups, angleArray;
1305
- const styleObj = {};
1306
- const element = this.$element;
1307
- postPlotChartProcess(this);
1308
- if (!isPieType(this.type)) {
1309
- this.setLabelsMaxWidth();
1310
- }
1311
- else if (!this.showlabelsoutside) {
1312
- /** Nvd3 has a issue in rotating text. So we will use this as a temp fix.
1313
- * If the issue is resolved there, we can remove this.*/
1314
- /* If it is a donut chart, then rotate the text and position them*/
1315
- chartSvg = d3.select('#wmChart' + this.$id + ' svg');
1316
- pieLabels = chartSvg.select('.nv-pieLabels').selectAll('.nv-label');
1317
- pieGroups = chartSvg.select('.nv-pie').selectAll('.nv-slice');
1318
- angleArray = [];
1319
- if (pieGroups?.length) {
1320
- pieGroups.each(function () {
1321
- d3.select(this).attr('transform', function (d) {
1322
- angleArray.push(angle(d));
1323
- });
1324
- });
1325
- pieLabels.each(function (d, i) {
1326
- const group = d3.select(this);
1327
- $(group[0][0]).find('text').attr('transform', 'rotate(' + angleArray[i] + ')');
1328
- });
1329
- }
1330
- }
1331
- // prepare text style props object and set
1332
- lodashEs.forEach(styleProps, (value, key) => {
1333
- if (key === 'fontsize' || key === 'fontunit') {
1334
- styleObj[value] = this.fontsize + this.fontunit;
1335
- }
1336
- else {
1337
- styleObj[value] = this[key];
1338
- }
1339
- });
1340
- setTextStyle(styleObj, this.$id);
1341
- /*
1342
- * allow window-resize functionality, for only-run mode as
1343
- * updating chart is being handled by watchers of height & width in studio-mode
1344
- * */
1345
- i1.triggerFn(this._resizeFn?.clear);
1346
- this._resizeFn = nv.utils.windowResize(() => {
1347
- if (element[0].getBoundingClientRect().height) {
1348
- chart.update();
1349
- postPlotChartProcess(this);
1350
- if (!isPieType(this.type)) {
1351
- this.setLabelsMaxWidth();
1352
- }
1353
- }
1354
- });
1355
- }
1356
- // prepares and configures the chart properties
1357
- configureChart() {
1358
- // Copy the data only in case of pie chart with default data
1359
- // Reason : when multiple pie charts are bound to same data, first chart theme will be applied to all charts
1360
- let xDomainValues;
1361
- let yDomainValues;
1362
- let chart;
1363
- let beforeRenderVal;
1364
- if (this._processedData.length > 0) {
1365
- if (isAxisDomainValid(this, 'x')) {
1366
- xDomainValues = this.binddataset ? this.getXMinMaxValues(this._processedData[0]) : { 'min': { 'x': 1 }, 'max': { 'x': 5 } };
1367
- }
1368
- if (isAxisDomainValid(this, 'y')) {
1369
- yDomainValues = this.binddataset ? this.getYMinMaxValues(this._processedData) : { 'min': { 'y': 1 }, 'max': { 'y': 5 } };
1370
- }
1371
- }
1372
- if (isPieType(this.type) && (!this.binddataset || !this.scopedataset)) {
1373
- this._processedData = i1.getClonedObject(this.scopedataset || this._processedData);
1374
- }
1375
- // get the chart object
1376
- chart = initChart(this, xDomainValues, yDomainValues, null, !this.binddataset);
1377
- if (lodashEs.isArray(this._processedData)) {
1378
- // WMS-19499: To remove chart X-axis old ticks when chart data loaded dynamically.
1379
- const oldgTicks = $('#wmChart' + this.$id + ' svg').find('g.nv-x').find('g.tick');
1380
- if (oldgTicks?.length) {
1381
- oldgTicks.remove();
1382
- }
1383
- beforeRenderVal = this.invokeEventCallback('beforerender', { 'chartInstance': chart });
1384
- if (beforeRenderVal) {
1385
- chart = beforeRenderVal;
1386
- }
1387
- this.chart = chart;
1388
- // changing the default no data message
1389
- d3.select('#wmChart' + this.$id + ' svg')
1390
- .datum(this._processedData)
1391
- .call(this.chart);
1392
- this.postPlotProcess(chart);
1393
- return chart;
1394
- }
1395
- }
1396
- // Plotting the chart with set of the properties set to it
1397
- plotChart() {
1398
- const element = this.$element;
1399
- // call user-transformed function
1400
- this.chartData = (this.invokeEventCallback('transform')) || this.chartData;
1401
- // Getting the order by data only in run mode. The order by applies for all the charts other than pie and donut charts
1402
- if (this.isVisuallyGrouped && !isPieType(this.type)) {
1403
- this._processedData = this.chartData;
1404
- }
1405
- else {
1406
- this._processedData = this.processChartData();
1407
- }
1408
- // checking the parent container before plotting the chart
1409
- if (!element[0].getBoundingClientRect().height) {
1410
- return;
1411
- }
1412
- if (this.clearCanvas) {
1413
- // empty svg to add-new chart
1414
- element.find('svg').replaceWith('<svg></svg>');
1415
- this.clearCanvas = false;
1416
- }
1417
- // In case of invalid axis show no data available message
1418
- if (!this.isValidAxis()) {
1419
- this._processedData = [];
1420
- }
1421
- nv.addGraph(() => this.configureChart(), () => {
1422
- /*Bubble chart has an time out delay of 300ms in their implementation due to which we
1423
- * won't be getting required data points on attaching events
1424
- * hence delaying it 600ms*/
1425
- setTimeout(() => {
1426
- this.attachClickEvent();
1427
- }, 600);
1428
- });
1429
- this.isLoadInProgress = false;
1430
- }
1431
- // TODO: Need way to figure out if the datasource is a live source
1432
- get isLiveVariable() {
1433
- // setting the flag for the live variable in the scope for the checks
1434
- const variableObj = this.datasource;
1435
- return variableObj && variableObj.category === 'wm.LiveVariable';
1436
- }
1437
- plotChartProxy() {
1438
- this.showContentLoadError = false;
1439
- this.invalidConfig = false;
1440
- // Checking if x and y axis are chosen
1441
- this.isLoadInProgress = true;
1442
- const groupingDetails = this.getGroupingDetails();
1443
- // If aggregation/group by/order by properties have been set, then get the aggregated data and plot the result in the chart.
1444
- // TODO: datasource for live variable detection
1445
- if (this.binddataset && this.isLiveVariable && (this.filterFields || this.isDataFilteringEnabled())) {
1446
- this.getAggregatedData(() => this.plotChart());
1447
- }
1448
- else { // Else, simply plot the chart.
1449
- // In case of live variable resetting the aggregated data to the normal dataset when the aggregation has been removed
1450
- if (this.dataset && this.isLiveVariable) {
1451
- this.chartData = this.dataset;
1452
- if (this.isGroupByEnabled() && groupingDetails.isVisuallyGrouped) {
1453
- this.chartData = this.getVisuallyGroupedData(this.chartData, groupingDetails.visualGroupingColumn);
1454
- }
1455
- }
1456
- this.plotChart();
1457
- }
1458
- }
1459
- // sets the default x and y axis options
1460
- setDefaultAxisOptions() {
1461
- const defaultColumns = this.getDefaultColumns();
1462
- // If we get the valid default columns then assign them as the x and y axis
1463
- // In case of service variable we may not get the valid columns because we cannot know the datatypes
1464
- this.xaxisdatakey = defaultColumns[0] || null;
1465
- this.yaxisdatakey = defaultColumns[1] || null;
1466
- }
1467
- getCutomizedOptions(prop, fields) {
1468
- const groupByColumns = lodashEs.split(this.groupby, ','), aggColumns = lodashEs.split(this.aggregationcolumn, ',');
1469
- if (!this.binddataset) {
1470
- return fields;
1471
- }
1472
- if (!this.axisoptions) {
1473
- this.axisoptions = fields;
1474
- }
1475
- let newOptions;
1476
- switch (prop) {
1477
- case 'xaxisdatakey':
1478
- // If group by enabled, columns chosen in groupby will be populated in x axis options
1479
- if (this.isGroupByEnabled()) {
1480
- newOptions = groupByColumns;
1481
- }
1482
- break;
1483
- case 'yaxisdatakey':
1484
- // If aggregation by enabled, columns chosen in aggregation will be populated in y axis options
1485
- if (this.isAggregationEnabled()) {
1486
- newOptions = aggColumns;
1487
- }
1488
- else if (this.isLiveVariable) {
1489
- // In case of live variable populating only numeric columns
1490
- newOptions = this.numericColumns;
1491
- }
1492
- break;
1493
- case 'groupby':
1494
- // Filtering only non primary key columns
1495
- if (this.isLiveVariable && this.nonPrimaryColumns?.length) {
1496
- newOptions = this.nonPrimaryColumns;
1497
- }
1498
- break;
1499
- case 'aggregationcolumn':
1500
- // Set the 'aggregationColumn' to show all keys in case of aggregation function is count or to numeric keys in all other cases.
1501
- if (this.isLiveVariable && this.isAggregationEnabled() && this.aggregation !== 'count') {
1502
- newOptions = this.numericColumns;
1503
- }
1504
- break;
1505
- case 'orderby':
1506
- // Set the 'aggregationColumn' to show all keys in case of aggregation function is count or to numeric keys in all other cases.
1507
- if (this.isLiveVariable && this.isAggregationEnabled()) {
1508
- newOptions = lodashEs.uniq(lodashEs.concat(groupByColumns, aggColumns));
1509
- }
1510
- break;
1511
- case 'bubblesize':
1512
- if (this.numericColumns?.length) {
1513
- newOptions = this.numericColumns;
1514
- }
1515
- break;
1516
- }
1517
- return newOptions || fields || this.axisoptions;
1518
- }
1519
- // Function that iterates through all the columns and then fetching the numeric and non primary columns among them
1520
- setNumericandNonPrimaryColumns() {
1521
- let columns, type;
1522
- const propertiesMap = this.datasource.execute(i1.DataSource.Operation.GET_PROPERTIES_MAP);
1523
- this.numericColumns = [];
1524
- this.nonPrimaryColumns = [];
1525
- // Fetching all the columns
1526
- if (this.dataset && !lodashEs.isEmpty(propertiesMap)) {
1527
- columns = []; // TODO: fetchPropertiesMapColumns(propertiesMap);
1528
- }
1529
- if (columns) {
1530
- // Iterating through all the columns and fetching the numeric and non primary key columns
1531
- lodashEs.forEach(Object.keys(columns), (key) => {
1532
- type = columns[key].type;
1533
- if (i1.isNumberType(type)) {
1534
- this.numericColumns.push(key);
1535
- }
1536
- // Hiding only table's primary key
1537
- if (columns[key].isRelatedPk === 'true' || !columns[key].isPrimaryKey) {
1538
- this.nonPrimaryColumns.push(key);
1539
- }
1540
- });
1541
- this.numericColumns = this.numericColumns.sort();
1542
- this.nonPrimaryColumns = this.nonPrimaryColumns.sort();
1543
- }
1544
- }
1545
- // plot the chart
1546
- handleDataSet(newVal) {
1547
- this.errMsg = '';
1548
- // Resetting the flag to false when the binding was removed
1549
- if (!newVal && !this.binddataset) {
1550
- this.isVisuallyGrouped = false;
1551
- this.axisoptions = null;
1552
- }
1553
- // liveVariables contain data in 'data' property' of the variable
1554
- this.chartData = this.isLiveVariable ? newVal || '' : (newVal && newVal.dataValue === '' && lodashEs.keys(newVal).length === 1) ? '' : newVal;
1555
- // if the data returned is an object make it an array of object
1556
- if (!lodashEs.isArray(this.chartData) && lodashEs.isObject(this.chartData)) {
1557
- this.chartData = [this.chartData];
1558
- }
1559
- if (newVal?.filterFields) {
1560
- this.filterFields = newVal.filterFields;
1561
- }
1562
- // plotchart for only valid data and only after bound variable returns data
1563
- if (this.chartData) {
1564
- this._plotChartProxy();
1565
- }
1566
- }
1567
- // sets the center label for donut chart type
1568
- setDonutCenterLabel(labelValue) {
1569
- let chartSvg, pieGroups;
1570
- chartSvg = d3.select('#wmChart' + this.$id + ' svg');
1571
- pieGroups = chartSvg.select('.nv-wrap.nv-pie').select('.nv-pie');
1572
- pieGroups.text('');
1573
- pieGroups.append('text')
1574
- .attr('dy', '.35em')
1575
- .attr('text-anchor', 'middle')
1576
- .attr('class', 'nv-pie-title')
1577
- .text(labelValue)
1578
- .each(function (d) {
1579
- const d3text = d3.select(this), circ = d3.select(this.parentElement), totalWidth = Number(circ.node().getBoundingClientRect().width),
1580
- // minus the ring width from total width
1581
- availWidth = totalWidth - 30, textWidth = this.getComputedTextLength();
1582
- d3text.attr("data-scale", availWidth / textWidth);
1583
- }).style("font-size", function () {
1584
- // 16 is the default font size to multiply with the scaled value and 24 is the maximum font size that can be applied
1585
- const fontSize = 16 * d3.select(this).attr("data-scale");
1586
- return fontSize > 24 ? 24 : fontSize + "px";
1587
- });
1588
- }
1589
- onPropertyChange(key, newVal, oldVal) {
1590
- super.onPropertyChange(key, newVal, oldVal);
1591
- switch (key) {
1592
- case 'dataset':
1593
- this.handleDataSet(newVal);
1594
- break;
1595
- case 'centerlabel':
1596
- if (this.chart) {
1597
- this.chart.title(newVal);
1598
- this.setDonutCenterLabel(newVal);
1599
- }
1600
- break;
1601
- case 'type':
1602
- // Based on the change in type deciding the default margins
1603
- if (isPieType(this.type)) {
1604
- this.offsettop = 20;
1605
- this.offsetright = 0;
1606
- this.offsetbottom = 0;
1607
- this.offsetleft = 0;
1608
- }
1609
- else if (oldVal === 'Pie' || oldVal === 'Donut') {
1610
- this.offsettop = 25;
1611
- this.offsetright = 25;
1612
- this.offsetbottom = 55;
1613
- this.offsetleft = 75;
1614
- }
1615
- if (oldVal !== newVal) {
1616
- this.clearCanvas = true;
1617
- }
1618
- // In studio mode, configure properties dependent on chart type
1619
- this._plotChartProxy();
1620
- break;
1621
- default:
1622
- // In RunMode, the plotchart method will not be called for all property change
1623
- this._plotChartProxy();
1624
- break;
1625
- }
1626
- if (lodashEs.includes(advanceDataProps, key)) {
1627
- this._plotChartProxy();
1628
- }
1629
- }
1630
- handleLoading(data) {
1631
- const dataSource = this.datasource;
1632
- if (dataSource?.execute(i1.DataSource.Operation.IS_API_AWARE) && i1.isDataSourceEqual(data.variable, dataSource)) {
1633
- this.variableInflight = data.active;
1634
- this.isLoadInProgress = data.active;
1635
- }
1636
- }
1637
- hideTooltip() {
1638
- d3.selectAll('.nvtooltip').style('opacity', 0);
1639
- }
1640
- onStyleChange(key, newVal, oldVal) {
1641
- const styleObj = {};
1642
- super.onStyleChange(key, newVal, oldVal);
1643
- switch (key) {
1644
- case 'fontsize':
1645
- case 'fontunit':
1646
- case 'color':
1647
- case 'fontfamily':
1648
- case 'fontweight':
1649
- case 'fontstyle':
1650
- case 'textdecoration':
1651
- styleObj[styleProps[key]] = (key === 'fontsize' || key === 'fontunit') ? this.fontsize + this.fontunit : newVal;
1652
- setTextStyle(styleObj, this.$id);
1653
- break;
1654
- }
1655
- }
1656
- constructor(inj, app, explicitContext) {
1657
- super(inj, WIDGET_CONFIG, explicitContext);
1658
- this.app = app;
1659
- this.iconclass = '';
1660
- this.nonPrimaryColumns = [];
1661
- this.xDataKeyArr = [];
1662
- this.chartData = [];
1663
- this._processedData = [];
1664
- this._subsciptions = [];
1665
- this._plotChartProxy = lodashEs.debounce(this.plotChartProxy.bind(this), 100);
1666
- this.redraw = this._plotChartProxy.bind(this);
1667
- base.styler(this.nativeElement, this, base.APPLY_STYLES_TYPE.CONTAINER, ['fontsize', 'fontunit', 'color', 'fontfamily', 'fontweight', 'fontstyle', 'textdecoration']);
1668
- // generate unique id for the component
1669
- this.$id = this.widgetId || Math.random();
1670
- // remove title attribute as the element on hover shows you the hint through-out the element
1671
- i1.removeAttr(this.nativeElement, 'title');
1672
- this.chartReady = false;
1673
- this.binddataset = this.nativeElement.getAttribute('dataset.bind');
1674
- // Show loading status based on the variable life cycle
1675
- this._subsciptions.push(this.app.subscribe('toggle-variable-state', this.handleLoading.bind(this)));
1676
- // Will hide tolltip of a chart in mobile when the user scrolls.
1677
- this._subsciptions.push(this.app.subscribe('iscroll-start', () => { this.hideTooltip(); }));
1678
- }
1679
- ngAfterViewInit() {
1680
- super.ngAfterViewInit();
1681
- // For old projects
1682
- if (!lodashEs.includes(['outside', 'inside', 'hide'], this.showlabels)) {
1683
- this.showlabels = getBooleanValue(this.showlabels);
1684
- this.showlabelsoutside = getBooleanValue(this.showlabelsoutside);
1685
- this.showlabels = this.showlabels ? (this.showlabelsoutside ? 'outside' : 'inside') : 'hide';
1686
- }
1687
- if (!this.theme) {
1688
- // Default theme for pie/donut is Azure and for other it is Terrestrial
1689
- this.theme = isPieType(this.type) ? 'Azure' : 'Terrestrial';
1690
- }
1691
- this.nativeElement.setAttribute('id', 'wmChart' + this.$id);
1692
- // When there is not value binding, then plot the chart with sample data
1693
- if (!this.binddataset && !this.nativeElement.getAttribute('scopedataset')) {
1694
- this._plotChartProxy();
1695
- }
1696
- }
1697
- ngOnDestroy() {
1698
- // destroy all subscriptions to prevent memory leak.
1699
- this.hideTooltip();
1700
- // MEMORY LEAK FIX: Unsubscribe from all subscriptions
1701
- if (this._subsciptions) {
1702
- this._subsciptions.forEach((subscription) => {
1703
- subscription();
1704
- });
1705
- this._subsciptions = [];
1706
- }
1707
- // MEMORY LEAK FIX: Clear chart instance
1708
- if (this.chart) {
1709
- this.chart = null;
1710
- }
1711
- // MEMORY LEAK FIX: Remove resize handler if exists
1712
- if (this._resizeFn) {
1713
- this._resizeFn = null;
1714
- }
1715
- // MEMORY LEAK FIX: Clear array references
1716
- this.chartData = [];
1717
- this._processedData = [];
1718
- this.sampleData = [];
1719
- this.xDataKeyArr = [];
1720
- this.nonPrimaryColumns = [];
1721
- super.ngOnDestroy();
1722
- }
1723
- static { this.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0__namespace, type: ChartComponent, deps: [{ token: i0__namespace.Injector }, { token: i1__namespace.App }, { token: 'EXPLICIT_CONTEXT', optional: true }], target: i0__namespace.ɵɵFactoryTarget.Component }); }
1724
- static { this.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.21", type: ChartComponent, isStandalone: true, selector: "div[wmChart]", host: { properties: { "class.panel": "this.title" } }, providers: [
1725
- base.provideAsWidgetRef(ChartComponent)
1726
- ], usesInheritance: true, ngImport: i0__namespace, template: "@if (title) {\n <div class=\"panel-heading\">\n <h3 class=\"panel-title\">\n <div class=\"pull-left\">\n <wm-app-icon [iconclass]=\"iconclass\" [iconurl]=\"iconurl\" iconClasses=\"panel-icon\" alt=\"Chart icon\"></wm-app-icon>\n </div>\n <div class=\"heading\" [innerHTML]=\"title\"></div>\n @if (subheading) {\n <div class=\"description\" [innerHTML]=\"subheading\"></div>\n }\n </h3>\n </div>\n}\n<div class=\"app-chart-inner\" [ngClass]=\"{'loading':isLoadInProgress, 'panel-body': title}\">\n <svg></svg>\n @if (showContentLoadError && showNoDataMsg) {\n <div class=\"wm-content-info readonly-wrapper\">\n <p class=\"wm-message\" [title]=\"hintMsg\" [ngClass]=\"{'error': invalidConfig}\" [innerText]=\"errMsg\"></p>\n </div>\n }\n <div wmSpinner show.bind=\"isLoadInProgress\" caption.bind=\"loadingdatamsg\"></div>\n</div>\n", styles: [".nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3 .nv-interactiveGuideLine,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue,.nvtooltip{pointer-events:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero,.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .nv-axisMaxMin text,.nvtooltip table td.key.total{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-bars rect.hover,.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-scatter .nv-point.hover,.nvd3.nv-bullet .nv-measure:hover,.nvd3.nv-linePlusBar .nv-bar rect:hover,.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:#0000}.nvd3 .nv-bars .hover text{fill:#000}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:#000;stroke:#0000}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-markerLine{stroke:#000;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick,.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover,.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect,.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect,.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick,.with-transitions .nvd3 .nv-groups .nv-point{-webkit-transition:stroke-width .25s linear,stroke-opacity .25s linear;transition:stroke-width .25s linear,stroke-opacity .25s linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nv-force-node{stroke:#fff;stroke-width:1.5px}.nv-force-link{stroke:#999;stroke-opacity:.6}.nv-force-node text{stroke-width:0}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-hoverArea,.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check,.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3 .nv-groups path.nv-line,.nvd3.nv-sparkline path{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-ms-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px #0003;border-radius:5px}.nvd3 text{font:12px Arial,sans-serif}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3 .title{font:700 14px Arial,sans-serif}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .selection{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .handle path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .selection{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}@media print{.nvd3 text{stroke-width:0;fill-opacity:1}}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#eee;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .selection{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:#13c4f996}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-opacity .25s linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:#fff;color:#000;padding:1px;border:1px solid rgba(0,0,0,.5);z-index:10000;display:block;font-family:Arial,sans-serif;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-ms-user-select:none;user-select:none;background:#fffc;border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{-webkit-transition:opacity 50ms linear .2s;transition:opacity 50ms linear .2s}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:#f7f7f7bf;color:#000;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table td.percent{color:#a9a9a9}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}\n"], dependencies: [{ kind: "ngmodule", type: i2.CommonModule }, { kind: "directive", type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: spinner.SpinnerComponent, selector: "[wmSpinner]", exportAs: ["wmSpinner"] }, { kind: "component", type: base.WmAppIconComponent, selector: "wm-app-icon", inputs: ["icon", "iconclass", "iconurl", "defaultIconClass", "defaultClasses", "iconStyle", "alt"] }], encapsulation: i0__namespace.ViewEncapsulation.None }); }
1727
- }
1728
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0__namespace, type: ChartComponent, decorators: [{
1729
- type: i0.Component,
1730
- args: [{ standalone: true, imports: [i2.CommonModule, spinner.SpinnerComponent, base.WmAppIconComponent], selector: 'div[wmChart]', providers: [
1731
- base.provideAsWidgetRef(ChartComponent)
1732
- ], encapsulation: i0.ViewEncapsulation.None, template: "@if (title) {\n <div class=\"panel-heading\">\n <h3 class=\"panel-title\">\n <div class=\"pull-left\">\n <wm-app-icon [iconclass]=\"iconclass\" [iconurl]=\"iconurl\" iconClasses=\"panel-icon\" alt=\"Chart icon\"></wm-app-icon>\n </div>\n <div class=\"heading\" [innerHTML]=\"title\"></div>\n @if (subheading) {\n <div class=\"description\" [innerHTML]=\"subheading\"></div>\n }\n </h3>\n </div>\n}\n<div class=\"app-chart-inner\" [ngClass]=\"{'loading':isLoadInProgress, 'panel-body': title}\">\n <svg></svg>\n @if (showContentLoadError && showNoDataMsg) {\n <div class=\"wm-content-info readonly-wrapper\">\n <p class=\"wm-message\" [title]=\"hintMsg\" [ngClass]=\"{'error': invalidConfig}\" [innerText]=\"errMsg\"></p>\n </div>\n }\n <div wmSpinner show.bind=\"isLoadInProgress\" caption.bind=\"loadingdatamsg\"></div>\n</div>\n", styles: [".nvtooltip h3,.nvtooltip p{margin:0;text-align:center}.nv-distx,.nv-disty,.nv-noninteractive,.nvd3 .nv-axis,.nvd3 .nv-interactiveGuideLine,.nvd3.nv-pie .nv-label,.nvd3.nv-sparklineplus g.nv-hoverValue,.nvtooltip{pointer-events:none}.nvd3 .nv-axis{opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero,.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .nv-axisMaxMin text,.nvtooltip table td.key.total{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled,.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-bars rect.hover,.nvd3 .nv-boxplot circle:hover,.nvd3 .nv-boxplot rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover,.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-scatter .nv-point.hover,.nvd3.nv-bullet .nv-measure:hover,.nvd3.nv-linePlusBar .nv-bar rect:hover,.nvd3.nv-pie .hover path{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:#0000}.nvd3 .nv-bars .hover text{fill:#000}.nvd3 .nv-discretebar .nv-groups rect,.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear;transition:fill-opacity .25s linear}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:#000;stroke:#0000}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-markerLine{stroke:#000;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick,.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover,.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect,.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect,.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick,.with-transitions .nvd3 .nv-groups .nv-point{-webkit-transition:stroke-width .25s linear,stroke-opacity .25s linear;transition:stroke-width .25s linear,stroke-opacity .25s linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nv-force-node{stroke:#fff;stroke-width:1.5px}.nv-force-link{stroke:#999;stroke-opacity:.6}.nv-force-node text{stroke-width:0}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-hoverArea,.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check,.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3 .nv-groups path.nv-line,.nvd3.nv-sparkline path{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.nvd3 .nv-groups .nv-point.hover,.nvd3.nv-scatter .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-user-select:none;-ms-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px #0003;border-radius:5px}.nvd3 text{font:12px Arial,sans-serif}.nvtooltip h3,.nvtooltip table td.key{font-weight:400}.nvd3 .title{font:700 14px Arial,sans-serif}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .selection{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .handle path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .selection{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}@media print{.nvd3 text{stroke-width:0;fill-opacity:1}}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#eee;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .selection{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-width .25s linear,stroke-opacity .25s linear;stroke:#fff;stroke-width:1px;stroke-opacity:1;fill-opacity:.7}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:#13c4f996}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;-webkit-transition:fill-opacity .25s linear,stroke-opacity .25s linear;transition:fill-opacity .25s linear,stroke-opacity .25s linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:#fff;color:#000;padding:1px;border:1px solid rgba(0,0,0,.5);z-index:10000;display:block;font-family:Arial,sans-serif;font-size:13px;text-align:left;white-space:nowrap;-webkit-user-select:none;-ms-user-select:none;user-select:none;background:#fffc;border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{-webkit-transition:opacity 50ms linear .2s;transition:opacity 50ms linear .2s}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{padding:4px 14px;line-height:18px;background-color:#f7f7f7bf;color:#000;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.nvtooltip p{padding:5px 14px}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table td.percent{color:#a9a9a9}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{vertical-align:middle;width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 line.nv-guideline{stroke:#ccc}\n"] }]
1733
- }], ctorParameters: () => [{ type: i0__namespace.Injector }, { type: i1__namespace.App }, { type: undefined, decorators: [{
1734
- type: i0.Inject,
1735
- args: ['EXPLICIT_CONTEXT']
1736
- }, {
1737
- type: i0.Optional
1738
- }] }], propDecorators: { title: [{
1739
- type: i0.HostBinding,
1740
- args: ['class.panel']
1741
- }] } });
1742
-
1743
- exports.ChartComponent = ChartComponent;
1774
+ exports.ChartComponent = ChartComponent;
1744
1775
 
1745
1776
  }));