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