@pioneer-code/pioneer-charts 1.0.2 → 1.0.3

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 (253) hide show
  1. package/README.md +27 -50
  2. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.mjs +272 -0
  3. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.mjs +47 -0
  4. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.mjs +2 -0
  5. package/esm2022/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.mjs +20 -0
  6. package/esm2022/lib/bar-chart/bar-horizontal-chart/public_api.mjs +5 -0
  7. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.mjs +284 -0
  8. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.mjs +47 -0
  9. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.mjs +2 -0
  10. package/esm2022/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.mjs +20 -0
  11. package/esm2022/lib/bar-chart/bar-vertical-chart/public_api.mjs +5 -0
  12. package/esm2022/lib/core/axis.builder.mjs +58 -0
  13. package/esm2022/lib/core/chart.mjs +90 -0
  14. package/esm2022/lib/core/chart.model.mjs +7 -0
  15. package/esm2022/lib/core/color.service.mjs +74 -0
  16. package/esm2022/lib/core/grid.builder.mjs +40 -0
  17. package/esm2022/lib/core/index.mjs +2 -0
  18. package/esm2022/lib/core/public_api.mjs +8 -0
  19. package/esm2022/lib/core/tooltip.builder.mjs +42 -0
  20. package/esm2022/lib/core/transition.service.mjs +19 -0
  21. package/esm2022/lib/line-area-chart/line-area-chart-effects.builders.mjs +117 -0
  22. package/esm2022/lib/line-area-chart/line-area-chart.builder.mjs +206 -0
  23. package/esm2022/lib/line-area-chart/line-area-chart.component.mjs +47 -0
  24. package/esm2022/lib/line-area-chart/line-area-chart.model.mjs +2 -0
  25. package/esm2022/lib/line-area-chart/line-area-chart.module.mjs +24 -0
  26. package/esm2022/lib/line-area-chart/public_api.mjs +5 -0
  27. package/esm2022/lib/pie-chart/pie-chart.builder.mjs +99 -0
  28. package/esm2022/lib/pie-chart/pie-chart.component.mjs +47 -0
  29. package/esm2022/lib/pie-chart/pie-chart.model.mjs +2 -0
  30. package/esm2022/lib/pie-chart/pie-chart.module.mjs +24 -0
  31. package/esm2022/lib/pie-chart/public_api.mjs +5 -0
  32. package/esm2022/pioneer-code-pioneer-charts.mjs +5 -0
  33. package/esm2022/public-api.mjs +9 -0
  34. package/fesm2022/pioneer-code-pioneer-charts.mjs +1493 -0
  35. package/fesm2022/pioneer-code-pioneer-charts.mjs.map +1 -0
  36. package/index.d.ts +5 -0
  37. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.d.ts +41 -39
  38. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.d.ts +21 -18
  39. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.d.ts +15 -15
  40. package/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.d.ts +7 -2
  41. package/lib/bar-chart/bar-horizontal-chart/public_api.d.ts +4 -4
  42. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.d.ts +42 -40
  43. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.d.ts +21 -18
  44. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.d.ts +15 -15
  45. package/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.d.ts +7 -2
  46. package/lib/bar-chart/bar-vertical-chart/public_api.d.ts +4 -4
  47. package/lib/core/axis.builder.d.ts +21 -18
  48. package/lib/core/chart.d.ts +55 -52
  49. package/lib/core/chart.model.d.ts +21 -21
  50. package/lib/core/color.service.d.ts +32 -29
  51. package/lib/core/grid.builder.d.ts +22 -19
  52. package/lib/core/index.d.ts +1 -1
  53. package/lib/core/public_api.d.ts +7 -8
  54. package/lib/core/tooltip.builder.d.ts +10 -11
  55. package/lib/core/transition.service.d.ts +7 -4
  56. package/lib/line-area-chart/line-area-chart-effects.builders.d.ts +27 -27
  57. package/lib/line-area-chart/line-area-chart.builder.d.ts +39 -38
  58. package/lib/line-area-chart/line-area-chart.component.d.ts +21 -18
  59. package/lib/line-area-chart/line-area-chart.model.d.ts +9 -9
  60. package/lib/line-area-chart/line-area-chart.module.d.ts +8 -2
  61. package/lib/line-area-chart/public_api.d.ts +4 -4
  62. package/lib/pie-chart/pie-chart.builder.d.ts +33 -34
  63. package/lib/pie-chart/pie-chart.component.d.ts +21 -18
  64. package/lib/pie-chart/pie-chart.model.d.ts +4 -4
  65. package/lib/pie-chart/pie-chart.module.d.ts +8 -2
  66. package/lib/pie-chart/public_api.d.ts +4 -4
  67. package/package.json +21 -19
  68. package/public-api.d.ts +5 -0
  69. package/scss/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.scss +19 -0
  70. package/scss/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.scss +8 -0
  71. package/scss/{core → lib/core}/theme/imports.scss +12 -12
  72. package/scss/lib/line-area-chart/line-area-chart.component.scss +35 -0
  73. package/scss/{pie-chart → lib/pie-chart}/pie-chart.component.scss +10 -10
  74. package/scss/{core/core.scss → lib/pioneer-charts.scss} +26 -13
  75. package/themes/pioneer-charts.css +22 -0
  76. package/themes/pioneer-charts.css.map +10 -0
  77. package/themes/pioneer-charts.min.css +3 -0
  78. package/themes/pioneer-charts.min.css.map +10 -0
  79. package/bundles/pioneer-code-pioneer-charts.umd.js +0 -3700
  80. package/bundles/pioneer-code-pioneer-charts.umd.js.map +0 -1
  81. package/bundles/pioneer-code-pioneer-charts.umd.min.js +0 -2
  82. package/bundles/pioneer-code-pioneer-charts.umd.min.js.map +0 -1
  83. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.js +0 -486
  84. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.js +0 -89
  85. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.js +0 -37
  86. package/esm2015/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.js +0 -19
  87. package/esm2015/lib/bar-chart/bar-horizontal-chart/index.js +0 -6
  88. package/esm2015/lib/bar-chart/bar-horizontal-chart/public_api.js +0 -9
  89. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.js +0 -518
  90. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.js +0 -89
  91. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.js +0 -37
  92. package/esm2015/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.js +0 -19
  93. package/esm2015/lib/bar-chart/bar-vertical-chart/index.js +0 -6
  94. package/esm2015/lib/bar-chart/bar-vertical-chart/public_api.js +0 -9
  95. package/esm2015/lib/core/axis.builder.js +0 -99
  96. package/esm2015/lib/core/chart.js +0 -144
  97. package/esm2015/lib/core/chart.model.js +0 -39
  98. package/esm2015/lib/core/color.service.js +0 -149
  99. package/esm2015/lib/core/core.module.js +0 -24
  100. package/esm2015/lib/core/grid.builder.js +0 -88
  101. package/esm2015/lib/core/index.js +0 -6
  102. package/esm2015/lib/core/public_api.js +0 -13
  103. package/esm2015/lib/core/tooltip.builder.js +0 -74
  104. package/esm2015/lib/core/transition.service.js +0 -23
  105. package/esm2015/lib/dialog/dialog.component.js +0 -50
  106. package/esm2015/lib/dialog/dialog.module.js +0 -23
  107. package/esm2015/lib/dialog/index.js +0 -6
  108. package/esm2015/lib/dialog/public_api.js +0 -7
  109. package/esm2015/lib/header/header.component.js +0 -21
  110. package/esm2015/lib/header/header.model.js +0 -13
  111. package/esm2015/lib/header/header.module.js +0 -19
  112. package/esm2015/lib/header/index.js +0 -6
  113. package/esm2015/lib/header/public_api.js +0 -8
  114. package/esm2015/lib/line-area-chart/index.js +0 -6
  115. package/esm2015/lib/line-area-chart/line-area-chart-effects.builders.js +0 -236
  116. package/esm2015/lib/line-area-chart/line-area-chart.builder.js +0 -386
  117. package/esm2015/lib/line-area-chart/line-area-chart.component.js +0 -89
  118. package/esm2015/lib/line-area-chart/line-area-chart.model.js +0 -23
  119. package/esm2015/lib/line-area-chart/line-area-chart.module.js +0 -19
  120. package/esm2015/lib/line-area-chart/public_api.js +0 -9
  121. package/esm2015/lib/pagination/index.js +0 -6
  122. package/esm2015/lib/pagination/pagination.component.js +0 -144
  123. package/esm2015/lib/pagination/pagination.model.js +0 -48
  124. package/esm2015/lib/pagination/pagination.module.js +0 -25
  125. package/esm2015/lib/pagination/public_api.js +0 -8
  126. package/esm2015/lib/pie-chart/index.js +0 -6
  127. package/esm2015/lib/pie-chart/pie-chart.builder.js +0 -221
  128. package/esm2015/lib/pie-chart/pie-chart.component.js +0 -89
  129. package/esm2015/lib/pie-chart/pie-chart.model.js +0 -13
  130. package/esm2015/lib/pie-chart/pie-chart.module.js +0 -19
  131. package/esm2015/lib/pie-chart/public_api.js +0 -9
  132. package/esm2015/lib/spinner/index.js +0 -6
  133. package/esm2015/lib/spinner/public_api.js +0 -7
  134. package/esm2015/lib/spinner/spinner.component.js +0 -28
  135. package/esm2015/lib/spinner/spinner.module.js +0 -23
  136. package/esm2015/lib/table/index.js +0 -6
  137. package/esm2015/lib/table/public_api.js +0 -8
  138. package/esm2015/lib/table/table-sort.service.js +0 -95
  139. package/esm2015/lib/table/table.component.js +0 -232
  140. package/esm2015/lib/table/table.model.js +0 -51
  141. package/esm2015/lib/table/table.module.js +0 -23
  142. package/esm2015/pioneer-code-pioneer-charts.js +0 -10
  143. package/esm2015/public_api.js +0 -18
  144. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.builder.js +0 -550
  145. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.js +0 -102
  146. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.model.js +0 -37
  147. package/esm5/lib/bar-chart/bar-horizontal-chart/bar-horizontal-chart.module.js +0 -23
  148. package/esm5/lib/bar-chart/bar-horizontal-chart/index.js +0 -6
  149. package/esm5/lib/bar-chart/bar-horizontal-chart/public_api.js +0 -9
  150. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.builder.js +0 -582
  151. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.component.js +0 -102
  152. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.model.js +0 -37
  153. package/esm5/lib/bar-chart/bar-vertical-chart/bar-vertical-chart.module.js +0 -23
  154. package/esm5/lib/bar-chart/bar-vertical-chart/index.js +0 -6
  155. package/esm5/lib/bar-chart/bar-vertical-chart/public_api.js +0 -9
  156. package/esm5/lib/core/axis.builder.js +0 -117
  157. package/esm5/lib/core/chart.js +0 -182
  158. package/esm5/lib/core/chart.model.js +0 -39
  159. package/esm5/lib/core/color.service.js +0 -199
  160. package/esm5/lib/core/core.module.js +0 -28
  161. package/esm5/lib/core/grid.builder.js +0 -100
  162. package/esm5/lib/core/index.js +0 -6
  163. package/esm5/lib/core/public_api.js +0 -13
  164. package/esm5/lib/core/tooltip.builder.js +0 -92
  165. package/esm5/lib/core/transition.service.js +0 -28
  166. package/esm5/lib/dialog/dialog.component.js +0 -58
  167. package/esm5/lib/dialog/dialog.module.js +0 -27
  168. package/esm5/lib/dialog/index.js +0 -6
  169. package/esm5/lib/dialog/public_api.js +0 -7
  170. package/esm5/lib/header/header.component.js +0 -25
  171. package/esm5/lib/header/header.model.js +0 -13
  172. package/esm5/lib/header/header.module.js +0 -23
  173. package/esm5/lib/header/index.js +0 -6
  174. package/esm5/lib/header/public_api.js +0 -8
  175. package/esm5/lib/line-area-chart/index.js +0 -6
  176. package/esm5/lib/line-area-chart/line-area-chart-effects.builders.js +0 -280
  177. package/esm5/lib/line-area-chart/line-area-chart.builder.js +0 -439
  178. package/esm5/lib/line-area-chart/line-area-chart.component.js +0 -102
  179. package/esm5/lib/line-area-chart/line-area-chart.model.js +0 -23
  180. package/esm5/lib/line-area-chart/line-area-chart.module.js +0 -23
  181. package/esm5/lib/line-area-chart/public_api.js +0 -9
  182. package/esm5/lib/pagination/index.js +0 -6
  183. package/esm5/lib/pagination/pagination.component.js +0 -182
  184. package/esm5/lib/pagination/pagination.model.js +0 -48
  185. package/esm5/lib/pagination/pagination.module.js +0 -29
  186. package/esm5/lib/pagination/public_api.js +0 -8
  187. package/esm5/lib/pie-chart/index.js +0 -6
  188. package/esm5/lib/pie-chart/pie-chart.builder.js +0 -242
  189. package/esm5/lib/pie-chart/pie-chart.component.js +0 -102
  190. package/esm5/lib/pie-chart/pie-chart.model.js +0 -13
  191. package/esm5/lib/pie-chart/pie-chart.module.js +0 -23
  192. package/esm5/lib/pie-chart/public_api.js +0 -9
  193. package/esm5/lib/spinner/index.js +0 -6
  194. package/esm5/lib/spinner/public_api.js +0 -7
  195. package/esm5/lib/spinner/spinner.component.js +0 -30
  196. package/esm5/lib/spinner/spinner.module.js +0 -27
  197. package/esm5/lib/table/index.js +0 -6
  198. package/esm5/lib/table/public_api.js +0 -8
  199. package/esm5/lib/table/table-sort.service.js +0 -119
  200. package/esm5/lib/table/table.component.js +0 -299
  201. package/esm5/lib/table/table.model.js +0 -51
  202. package/esm5/lib/table/table.module.js +0 -27
  203. package/esm5/pioneer-code-pioneer-charts.js +0 -10
  204. package/esm5/public_api.js +0 -18
  205. package/fesm2015/pioneer-code-pioneer-charts.js +0 -3077
  206. package/fesm2015/pioneer-code-pioneer-charts.js.map +0 -1
  207. package/fesm5/pioneer-code-pioneer-charts.js +0 -3665
  208. package/fesm5/pioneer-code-pioneer-charts.js.map +0 -1
  209. package/lib/bar-chart/bar-horizontal-chart/index.d.ts +0 -1
  210. package/lib/bar-chart/bar-vertical-chart/index.d.ts +0 -1
  211. package/lib/core/core.module.d.ts +0 -2
  212. package/lib/dialog/dialog.component.d.ts +0 -9
  213. package/lib/dialog/dialog.module.d.ts +0 -2
  214. package/lib/dialog/index.d.ts +0 -1
  215. package/lib/dialog/public_api.d.ts +0 -2
  216. package/lib/header/header.component.d.ts +0 -4
  217. package/lib/header/header.model.d.ts +0 -3
  218. package/lib/header/header.module.d.ts +0 -2
  219. package/lib/header/index.d.ts +0 -1
  220. package/lib/header/public_api.d.ts +0 -3
  221. package/lib/line-area-chart/index.d.ts +0 -1
  222. package/lib/pagination/index.d.ts +0 -1
  223. package/lib/pagination/pagination.component.d.ts +0 -20
  224. package/lib/pagination/pagination.model.d.ts +0 -28
  225. package/lib/pagination/pagination.module.d.ts +0 -2
  226. package/lib/pagination/public_api.d.ts +0 -3
  227. package/lib/pie-chart/index.d.ts +0 -1
  228. package/lib/spinner/index.d.ts +0 -1
  229. package/lib/spinner/public_api.d.ts +0 -2
  230. package/lib/spinner/spinner.component.d.ts +0 -4
  231. package/lib/spinner/spinner.module.d.ts +0 -2
  232. package/lib/table/index.d.ts +0 -1
  233. package/lib/table/public_api.d.ts +0 -3
  234. package/lib/table/table-sort.service.d.ts +0 -10
  235. package/lib/table/table.component.d.ts +0 -51
  236. package/lib/table/table.model.d.ts +0 -28
  237. package/lib/table/table.module.d.ts +0 -2
  238. package/pioneer-code-pioneer-charts.d.ts +0 -5
  239. package/pioneer-code-pioneer-charts.metadata.json +0 -1
  240. package/public_api.d.ts +0 -10
  241. package/scss/bar-chart/bar-horizontal-chart/bar-horizontal-chart.component.scss +0 -7
  242. package/scss/bar-chart/bar-vertical-chart/bar-vertical-chart.component.scss +0 -7
  243. package/scss/dialog/dialog.component.scss +0 -42
  244. package/scss/header/header.component.scss +0 -8
  245. package/scss/line-area-chart/line-area-chart.component.scss +0 -28
  246. package/scss/pagination/pagination.component.scss +0 -94
  247. package/scss/pcac.scss +0 -61
  248. package/scss/spinner/spinner.component.scss +0 -34
  249. package/scss/table/table.component.scss +0 -143
  250. package/themes/pcac.css +0 -291
  251. package/themes/pcac.css.map +0 -19
  252. package/themes/pcac.min.css +0 -3
  253. package/themes/pcac.min.css.map +0 -19
@@ -1,3665 +0,0 @@
1
- import { axisLeft, axisBottom } from 'd3-axis';
2
- import { format } from 'd3-format';
3
- import { event, select, mouse } from 'd3-selection';
4
- import { Injectable, NgModule, Component, Input, ChangeDetectorRef, Output, ViewChild, ViewChildren, HostListener, EventEmitter } from '@angular/core';
5
- import { BrowserModule } from '@angular/platform-browser';
6
- import { __extends } from 'tslib';
7
- import { scaleLinear, scaleBand } from 'd3-scale';
8
- import { color } from 'd3-color';
9
- import { transition } from 'd3-transition';
10
- import { Subject } from 'rxjs';
11
- import { arc, pie, line, area } from 'd3-shape';
12
- import { interpolate } from 'd3-interpolate';
13
- import { range } from 'd3-array';
14
- import { CommonModule } from '@angular/common';
15
- import { FormsModule } from '@angular/forms';
16
-
17
- /**
18
- * @fileoverview added by tsickle
19
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
20
- */
21
- /** @enum {string} */
22
- var PcacTickFormatEnum = {
23
- None: 'none',
24
- Percentage: 'percentage',
25
- Minutes: 'minutes',
26
- };
27
-
28
- /**
29
- * @fileoverview added by tsickle
30
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
31
- */
32
- var PcacAxisBuilder = /** @class */ (function () {
33
- function PcacAxisBuilder() {
34
- }
35
- /**
36
- * @param {?} config
37
- * @return {?}
38
- */
39
- PcacAxisBuilder.prototype.drawAxis = /**
40
- * @param {?} config
41
- * @return {?}
42
- */
43
- function (config) {
44
- if (!config.hideXAxis) {
45
- this.drawXAxis(config);
46
- }
47
- if (!config.hideYAxis) {
48
- this.drawYAxis(config);
49
- }
50
- };
51
- /**
52
- * @private
53
- * @param {?} config
54
- * @return {?}
55
- */
56
- PcacAxisBuilder.prototype.drawYAxis = /**
57
- * @private
58
- * @param {?} config
59
- * @return {?}
60
- */
61
- function (config) {
62
- /** @type {?} */
63
- var yAxis = axisLeft(config.yScale).ticks(config.numberOfTicks);
64
- if (config.yFormat) {
65
- switch (config.yFormat.toLocaleLowerCase()) {
66
- case PcacTickFormatEnum.Percentage:
67
- yAxis.tickFormat(format('.0%'));
68
- break;
69
- case PcacTickFormatEnum.Minutes:
70
- yAxis.tickFormat((/**
71
- * @param {?} d
72
- * @return {?}
73
- */
74
- function (d) { return d + 'm'; }));
75
- break;
76
- }
77
- }
78
- config.svg.append('g')
79
- .attr('class', 'pcac-y-axis')
80
- .call(yAxis);
81
- };
82
- /**
83
- * @private
84
- * @param {?} config
85
- * @return {?}
86
- */
87
- PcacAxisBuilder.prototype.drawXAxis = /**
88
- * @private
89
- * @param {?} config
90
- * @return {?}
91
- */
92
- function (config) {
93
- /** @type {?} */
94
- var xAxis = axisBottom(config.xScale).ticks(config.numberOfTicks);
95
- if (config.xFormat) {
96
- switch (config.xFormat.toLocaleLowerCase()) {
97
- case PcacTickFormatEnum.Percentage:
98
- xAxis.tickFormat(format('.0%'));
99
- break;
100
- case PcacTickFormatEnum.Minutes:
101
- xAxis.tickFormat((/**
102
- * @param {?} d
103
- * @return {?}
104
- */
105
- function (d) { return d + 'm'; }));
106
- break;
107
- }
108
- }
109
- config.svg.append('g')
110
- .attr('class', 'pcac-x-axis')
111
- .attr('transform', 'translate(0,' + config.height + ')')
112
- .call(xAxis);
113
- };
114
- return PcacAxisBuilder;
115
- }());
116
-
117
- /**
118
- * @fileoverview added by tsickle
119
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
120
- */
121
- var PcacGridBuilder = /** @class */ (function () {
122
- function PcacGridBuilder() {
123
- }
124
- /**
125
- * @param {?} config
126
- * @return {?}
127
- */
128
- PcacGridBuilder.prototype.drawVerticalGrid = /**
129
- * @param {?} config
130
- * @return {?}
131
- */
132
- function (config) {
133
- config.svg.append('g')
134
- .attr('class', 'pcac-grid')
135
- .selectAll('g.rule')
136
- .data(config.xScale.ticks(5))
137
- .enter().append('svg:g')
138
- .attr('class', 'pcac-grid-rule')
139
- .attr('transform', (/**
140
- * @param {?} d
141
- * @return {?}
142
- */
143
- function (d) { return ("translate(" + config.xScale(d) + ", 0)"); }))
144
- .append('svg:line')
145
- .attr('y1', 0)
146
- .attr('y2', config.height)
147
- .attr('class', (/**
148
- * @param {?} d
149
- * @param {?} i
150
- * @return {?}
151
- */
152
- function (d, i) { return (i === 0 ? 'pcac-grid-rule-last' : ''); }));
153
- };
154
- /**
155
- * @param {?} config
156
- * @return {?}
157
- */
158
- PcacGridBuilder.prototype.drawHorizontalGrid = /**
159
- * @param {?} config
160
- * @return {?}
161
- */
162
- function (config) {
163
- config.svg.append('g')
164
- .attr('class', 'pcac-grid')
165
- .selectAll('g.pcac-grid-rule')
166
- .data(config.yScale.ticks(config.numberOfTicks))
167
- .enter().append('svg:g')
168
- .attr('class', 'pcac-grid-rule')
169
- .append('svg:line')
170
- .attr('y1', (/**
171
- * @param {?} d
172
- * @return {?}
173
- */
174
- function (d) { return config.yScale(d); }))
175
- .attr('y2', (/**
176
- * @param {?} d
177
- * @return {?}
178
- */
179
- function (d) { return config.yScale(d); }))
180
- .attr('x1', 0)
181
- .attr('x2', config.width)
182
- .attr('class', (/**
183
- * @param {?} d
184
- * @param {?} i
185
- * @return {?}
186
- */
187
- function (d, i) { return (i === 0 ? 'pcac-grid-rule-last' : ''); }));
188
- };
189
- return PcacGridBuilder;
190
- }());
191
-
192
- /**
193
- * @fileoverview added by tsickle
194
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
195
- */
196
- var PcacColorService = /** @class */ (function () {
197
- function PcacColorService() {
198
- this.primary = '#43425d';
199
- this.primaryLight = '#a3a1fb';
200
- this.success = '#5ee2a0';
201
- this.danger = '#ff6565';
202
- this.warning = '#fec163';
203
- this.orange = '#ffa177';
204
- this.blue = '#55d8fe';
205
- this.scale = (/** @type {?} */ ([
206
- this.primaryLight,
207
- this.success,
208
- this.danger,
209
- this.warning,
210
- this.orange,
211
- this.blue
212
- ]));
213
- this.alert = 'red';
214
- }
215
- /**
216
- * Get a scale of colors dynamically
217
- * @param numberOfNodes Number of items in dynamically build collection of colors
218
- */
219
- /**
220
- * Get a scale of colors dynamically
221
- * @param {?} numberOfNodes Number of items in dynamically build collection of colors
222
- * @return {?}
223
- */
224
- PcacColorService.prototype.getColorScale = /**
225
- * Get a scale of colors dynamically
226
- * @param {?} numberOfNodes Number of items in dynamically build collection of colors
227
- * @return {?}
228
- */
229
- function (numberOfNodes) {
230
- /** @type {?} */
231
- var pallette = (/** @type {?} */ ([]));
232
- for (var i = 0; i < numberOfNodes; i++) {
233
- /** @type {?} */
234
- var mark = i % this.scale.length;
235
- pallette.push(this.scale[mark]);
236
- }
237
- return pallette;
238
- };
239
- /**
240
- * @return {?}
241
- */
242
- PcacColorService.prototype.getAlert = /**
243
- * @return {?}
244
- */
245
- function () {
246
- return this.alert;
247
- };
248
- /**
249
- * Set the scale that charts use to set colors of data[x] on the UI.
250
- * @param colors A collection of hex values
251
- */
252
- /**
253
- * Set the scale that charts use to set colors of data[x] on the UI.
254
- * @param {?} colors A collection of hex values
255
- * @return {?}
256
- */
257
- PcacColorService.prototype.setScale = /**
258
- * Set the scale that charts use to set colors of data[x] on the UI.
259
- * @param {?} colors A collection of hex values
260
- * @return {?}
261
- */
262
- function (colors) {
263
- this.scale = colors;
264
- };
265
- /**
266
- * @param {?} color
267
- * @return {?}
268
- */
269
- PcacColorService.prototype.setPrimary = /**
270
- * @param {?} color
271
- * @return {?}
272
- */
273
- function (color) {
274
- this.primary = color;
275
- };
276
- /**
277
- * @param {?} color
278
- * @return {?}
279
- */
280
- PcacColorService.prototype.setPrimaryLight = /**
281
- * @param {?} color
282
- * @return {?}
283
- */
284
- function (color) {
285
- this.primaryLight = color;
286
- };
287
- /**
288
- * @param {?} color
289
- * @return {?}
290
- */
291
- PcacColorService.prototype.setSuccess = /**
292
- * @param {?} color
293
- * @return {?}
294
- */
295
- function (color) {
296
- this.success = color;
297
- };
298
- /**
299
- * @param {?} color
300
- * @return {?}
301
- */
302
- PcacColorService.prototype.setDanger = /**
303
- * @param {?} color
304
- * @return {?}
305
- */
306
- function (color) {
307
- this.danger = color;
308
- };
309
- /**
310
- * @param {?} color
311
- * @return {?}
312
- */
313
- PcacColorService.prototype.setOrange = /**
314
- * @param {?} color
315
- * @return {?}
316
- */
317
- function (color) {
318
- this.orange = color;
319
- };
320
- /**
321
- * @param {?} color
322
- * @return {?}
323
- */
324
- PcacColorService.prototype.setBlue = /**
325
- * @param {?} color
326
- * @return {?}
327
- */
328
- function (color) {
329
- this.blue = color;
330
- };
331
- /**
332
- * @return {?}
333
- */
334
- PcacColorService.prototype.setAlert = /**
335
- * @return {?}
336
- */
337
- function () {
338
- return this.alert;
339
- };
340
- return PcacColorService;
341
- }());
342
-
343
- /**
344
- * @fileoverview added by tsickle
345
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
346
- */
347
- var PcacTransitionService = /** @class */ (function () {
348
- function PcacTransitionService() {
349
- this.transitionDuration = 750;
350
- }
351
- /**
352
- * @return {?}
353
- */
354
- PcacTransitionService.prototype.getTransitionDuration = /**
355
- * @return {?}
356
- */
357
- function () {
358
- return this.transitionDuration;
359
- };
360
- return PcacTransitionService;
361
- }());
362
-
363
- /**
364
- * @fileoverview added by tsickle
365
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
366
- */
367
- var PcacTooltipBuilder = /** @class */ (function () {
368
- function PcacTooltipBuilder() {
369
- this.tooltip = (/** @type {?} */ (select('body').append('div').attr('class', 'pcac-d3-tooltip'))); // TODO: Strongly type
370
- }
371
- // TODO: Strongly type
372
- /**
373
- * @param {?} data
374
- * @param {?=} tickFormat
375
- * @return {?}
376
- */
377
- PcacTooltipBuilder.prototype.showBarTooltip =
378
- // TODO: Strongly type
379
- /**
380
- * @param {?} data
381
- * @param {?=} tickFormat
382
- * @return {?}
383
- */
384
- function (data, tickFormat) {
385
- this.tooltip.style('left', event.pageX - 50 + 'px')
386
- .style('top', event.pageY - 70 + 'px')
387
- .style('display', 'inline-block')
388
- .html(this.getBarTipData(data, tickFormat));
389
- };
390
- /**
391
- * @return {?}
392
- */
393
- PcacTooltipBuilder.prototype.hideTooltip = /**
394
- * @return {?}
395
- */
396
- function () {
397
- this.tooltip.style('display', 'none');
398
- };
399
- /**
400
- * @private
401
- * @param {?} data
402
- * @param {?=} tickFormat
403
- * @return {?}
404
- */
405
- PcacTooltipBuilder.prototype.getBarTipData = /**
406
- * @private
407
- * @param {?} data
408
- * @param {?=} tickFormat
409
- * @return {?}
410
- */
411
- function (data, tickFormat) {
412
- /** @type {?} */
413
- var value = data.value;
414
- if (tickFormat) {
415
- switch (tickFormat.toLocaleLowerCase()) {
416
- case PcacTickFormatEnum.Percentage:
417
- value = (/** @type {?} */ (value)) * 100 + '%';
418
- break;
419
- case PcacTickFormatEnum.Minutes:
420
- break;
421
- }
422
- }
423
- return data.key ? data.key + '</br>' + value.toString() : value.toString();
424
- };
425
- PcacTooltipBuilder.decorators = [
426
- { type: Injectable }
427
- ];
428
- return PcacTooltipBuilder;
429
- }());
430
-
431
- /**
432
- * @fileoverview added by tsickle
433
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
434
- */
435
- var PcacChart = /** @class */ (function () {
436
- function PcacChart(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
437
- this.axisBuilder = axisBuilder;
438
- this.gridBuilder = gridBuilder;
439
- this.transitionService = transitionService;
440
- this.tooltipBuilder = tooltipBuilder;
441
- this.colorService = colorService;
442
- this.margin = { top: 8, right: 16, bottom: 20, left: 40 };
443
- this.width = 400;
444
- this.height = 400;
445
- this.colors = (/** @type {?} */ ([]));
446
- this.startData = (/** @type {?} */ ([])); // TODO: Strongly type
447
- // TODO: Strongly type
448
- this.endData = (/** @type {?} */ ([])); // TODO: Strongly type
449
- }
450
- /**
451
- * Prior to building a chart, we need to initialize the state of the chart
452
- * @param chartElm Reference to SVG on dom
453
- * @param config Chart specific configuration
454
- */
455
- /**
456
- * Prior to building a chart, we need to initialize the state of the chart
457
- * @param {?} chartElm Reference to SVG on dom
458
- * @param {?} config Chart specific configuration
459
- * @return {?}
460
- */
461
- PcacChart.prototype.initializeChartState = /**
462
- * Prior to building a chart, we need to initialize the state of the chart
463
- * @param {?} chartElm Reference to SVG on dom
464
- * @param {?} config Chart specific configuration
465
- * @return {?}
466
- */
467
- function (chartElm, config) {
468
- select(chartElm.nativeElement).select('g').remove();
469
- this.width = chartElm.nativeElement.parentNode.clientWidth - this.margin.left - this.margin.right;
470
- this.height = config.height;
471
- this.colors = this.colorService.getColorScale(Math.max(config.data.length, config.data[0].data ? config.data[0].data.length : 0));
472
- };
473
- /**
474
- * 1) Set the width and height of the SVG
475
- * 2) Add a group and translate it to state of {{center}} option
476
- * @param chartElm Reference to SVG on dom
477
- * @param center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
478
- */
479
- /**
480
- * 1) Set the width and height of the SVG
481
- * 2) Add a group and translate it to state of {{center}} option
482
- * @param {?} chartElm Reference to SVG on dom
483
- * @param {?=} center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
484
- * @return {?}
485
- */
486
- PcacChart.prototype.buildContainer = /**
487
- * 1) Set the width and height of the SVG
488
- * 2) Add a group and translate it to state of {{center}} option
489
- * @param {?} chartElm Reference to SVG on dom
490
- * @param {?=} center Are we pinning x,y to the top,left, or are we centering our drawing group inside the SVG.
491
- * @return {?}
492
- */
493
- function (chartElm, center) {
494
- if (center === void 0) { center = false; }
495
- /** @type {?} */
496
- var combinedHeight = this.height + this.margin.top + this.margin.bottom;
497
- /** @type {?} */
498
- var combinedWidth = this.width + this.margin.left + this.margin.right;
499
- this.svg = select(chartElm.nativeElement)
500
- .attr('width', combinedWidth)
501
- .attr('height', combinedHeight);
502
- if (center) {
503
- this.svg = this.svg
504
- .append('g')
505
- .attr('transform', 'translate(' + combinedWidth / 2 + ',' + combinedHeight / 2 + ')');
506
- return;
507
- }
508
- this.svg = this.svg
509
- .append('g')
510
- .attr('transform', 'translate(' + this.margin.left + ',' + this.margin.top + ')');
511
- };
512
- /**
513
- * Most charts share a default margin(s) state.
514
- * In some cases, that state needs to be calculated based on the content that resides in that margin.
515
- * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
516
- * chart axis construction.
517
- * @param chartElm Reference to SVG on dom
518
- * @param data Generic multi-dimensional IPcacData structure
519
- * @param yScale D3 scale transformation object (d3.ScaleBand)
520
- */
521
- /**
522
- * Most charts share a default margin(s) state.
523
- * In some cases, that state needs to be calculated based on the content that resides in that margin.
524
- * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
525
- * chart axis construction.
526
- * @param {?} chartElm Reference to SVG on dom
527
- * @param {?} data Generic multi-dimensional IPcacData structure
528
- * @param {?} yScale D3 scale transformation object (d3.ScaleBand)
529
- * @return {?}
530
- */
531
- PcacChart.prototype.setHorizontalMarginsBasedOnContent = /**
532
- * Most charts share a default margin(s) state.
533
- * In some cases, that state needs to be calculated based on the content that resides in that margin.
534
- * For example, labels on a horizontal bar chart are dynamic and such the margin needs to be calculated ahead of
535
- * chart axis construction.
536
- * @param {?} chartElm Reference to SVG on dom
537
- * @param {?} data Generic multi-dimensional IPcacData structure
538
- * @param {?} yScale D3 scale transformation object (d3.ScaleBand)
539
- * @return {?}
540
- */
541
- function (chartElm, data, yScale) {
542
- /** @type {?} */
543
- var axisY = axisLeft(yScale).ticks(5);
544
- /** @type {?} */
545
- var max = 0;
546
- select(chartElm.nativeElement).append('g')
547
- .call(axisY)
548
- .each((/**
549
- * @param {?} d
550
- * @param {?} i
551
- * @param {?} n
552
- * @return {?}
553
- */
554
- function (d, i, n) {
555
- if (n[i].getBBox().width > max) {
556
- max = n[i].getBBox().width;
557
- }
558
- }))
559
- .remove();
560
- this.margin.left = max;
561
- this.margin.bottom = this.margin.bottom;
562
- this.width = this.width - this.margin.left;
563
- };
564
- PcacChart.decorators = [
565
- { type: Injectable }
566
- ];
567
- /** @nocollapse */
568
- PcacChart.ctorParameters = function () { return [
569
- { type: PcacAxisBuilder },
570
- { type: PcacGridBuilder },
571
- { type: PcacTransitionService },
572
- { type: PcacTooltipBuilder },
573
- { type: PcacColorService }
574
- ]; };
575
- return PcacChart;
576
- }());
577
-
578
- /**
579
- * @fileoverview added by tsickle
580
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
581
- */
582
- var PcacCoreModule = /** @class */ (function () {
583
- function PcacCoreModule() {
584
- }
585
- PcacCoreModule.decorators = [
586
- { type: NgModule, args: [{
587
- providers: [
588
- PcacColorService,
589
- PcacTransitionService,
590
- PcacGridBuilder,
591
- PcacAxisBuilder,
592
- PcacTooltipBuilder
593
- ]
594
- },] }
595
- ];
596
- return PcacCoreModule;
597
- }());
598
-
599
- /**
600
- * @fileoverview added by tsickle
601
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
602
- */
603
-
604
- /**
605
- * @fileoverview added by tsickle
606
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
607
- */
608
-
609
- /**
610
- * @fileoverview added by tsickle
611
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
612
- */
613
- var PcacHeaderComponent = /** @class */ (function () {
614
- function PcacHeaderComponent() {
615
- }
616
- PcacHeaderComponent.decorators = [
617
- { type: Component, args: [{
618
- selector: 'pcac-header',
619
- template: "<section class=\"pcac-font-family pcac-header\">\r\n <div class=\"clearfix\">\r\n <div class=\"float-left\">\r\n <h3>{{config?.title}}</h3>\r\n </div>\r\n </div>\r\n</section>\r\n"
620
- }] }
621
- ];
622
- PcacHeaderComponent.propDecorators = {
623
- config: [{ type: Input }]
624
- };
625
- return PcacHeaderComponent;
626
- }());
627
-
628
- /**
629
- * @fileoverview added by tsickle
630
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
631
- */
632
-
633
- /**
634
- * @fileoverview added by tsickle
635
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
636
- */
637
- var PcacHeaderModule = /** @class */ (function () {
638
- function PcacHeaderModule() {
639
- }
640
- PcacHeaderModule.decorators = [
641
- { type: NgModule, args: [{
642
- exports: [
643
- PcacHeaderComponent
644
- ],
645
- declarations: [
646
- PcacHeaderComponent
647
- ]
648
- },] }
649
- ];
650
- return PcacHeaderModule;
651
- }());
652
-
653
- /**
654
- * @fileoverview added by tsickle
655
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
656
- */
657
-
658
- /**
659
- * @fileoverview added by tsickle
660
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
661
- */
662
-
663
- /**
664
- * @fileoverview added by tsickle
665
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
666
- */
667
- /** @enum {string} */
668
- var PcacTableSortIconsEnum = {
669
- Sort: 'pcac-icon pcac-icon-sort',
670
- SortAsc: 'pcac-icon pcac-icon-sort-asc',
671
- SortDesc: 'pcac-icon pcac-icon-sort-desc',
672
- };
673
-
674
- /**
675
- * @fileoverview added by tsickle
676
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
677
- */
678
- var TableSortService = /** @class */ (function () {
679
- function TableSortService() {
680
- }
681
- /**
682
- * @param {?} data
683
- * @param {?} columnIndex
684
- * @param {?} direction
685
- * @return {?}
686
- */
687
- TableSortService.prototype.sort = /**
688
- * @param {?} data
689
- * @param {?} columnIndex
690
- * @param {?} direction
691
- * @return {?}
692
- */
693
- function (data, columnIndex, direction) {
694
- if (data) {
695
- this.sortData(data, columnIndex, direction);
696
- }
697
- };
698
- /**
699
- * @private
700
- * @param {?} data
701
- * @param {?} columnIndex
702
- * @param {?} direction
703
- * @return {?}
704
- */
705
- TableSortService.prototype.sortData = /**
706
- * @private
707
- * @param {?} data
708
- * @param {?} columnIndex
709
- * @param {?} direction
710
- * @return {?}
711
- */
712
- function (data, columnIndex, direction) {
713
- var _this = this;
714
- data.sort((/**
715
- * @param {?} a
716
- * @param {?} b
717
- * @return {?}
718
- */
719
- function (a, b) {
720
- /** @type {?} */
721
- var comparison = (direction === PcacTableSortIconsEnum.SortAsc)
722
- ? -_this.orderByComparer(a.data[columnIndex].value, b.data[columnIndex].value)
723
- : _this.orderByComparer(a.data[columnIndex].value, b.data[columnIndex].value);
724
- if (comparison !== 0) {
725
- return comparison;
726
- }
727
- // equal each other
728
- return 0;
729
- }));
730
- };
731
- /**
732
- * @private
733
- * @param {?} a
734
- * @param {?} b
735
- * @return {?}
736
- */
737
- TableSortService.prototype.orderByComparer = /**
738
- * @private
739
- * @param {?} a
740
- * @param {?} b
741
- * @return {?}
742
- */
743
- function (a, b) {
744
- if (a === null || typeof a === 'undefined') {
745
- a = 0;
746
- }
747
- if (b === null || typeof b === 'undefined') {
748
- b = 0;
749
- }
750
- if ((isNaN(parseFloat(a)) || !isFinite(a)) || (isNaN(parseFloat(b)) || !isFinite(b))) {
751
- // is not a number so lowercase the string to properly compare
752
- if (a.toLowerCase() < b.toLowerCase()) {
753
- return -1;
754
- }
755
- if (a.toLowerCase() > b.toLowerCase()) {
756
- return 1;
757
- }
758
- }
759
- else {
760
- // parse strings as numbers to compare properly
761
- if (parseFloat(a) < parseFloat(b)) {
762
- return -1;
763
- }
764
- if (parseFloat(a) > parseFloat(b)) {
765
- return 1;
766
- }
767
- }
768
- // equal each other
769
- return 0;
770
- };
771
- TableSortService.decorators = [
772
- { type: Injectable }
773
- ];
774
- return TableSortService;
775
- }());
776
-
777
- /**
778
- * @fileoverview added by tsickle
779
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
780
- */
781
- var PcacTableComponent = /** @class */ (function () {
782
- function PcacTableComponent(sortService, changeDetector) {
783
- this.sortService = sortService;
784
- this.changeDetector = changeDetector;
785
- this.config = (/** @type {?} */ ({ height: 400 }));
786
- this.deleteClicked = new EventEmitter();
787
- this.editClicked = new EventEmitter();
788
- this.historyClicked = new EventEmitter();
789
- this.columnWidths = (/** @type {?} */ ([]));
790
- this.headers = (/** @type {?} */ ([]));
791
- this.rowData = (/** @type {?} */ ([]));
792
- this.adjustedHeight = 200;
793
- }
794
- /**
795
- * @return {?}
796
- */
797
- PcacTableComponent.prototype.ngAfterViewInit = /**
798
- * @return {?}
799
- */
800
- function () {
801
- var _this = this;
802
- this.initTableUi();
803
- // @ngFor rows finished
804
- this.rows.changes.subscribe((/**
805
- * @return {?}
806
- */
807
- function () {
808
- if (_this.config.enableStickyHeader || _this.config.enableStickyFooter) {
809
- _this.calculateColumnWidths();
810
- }
811
- }));
812
- };
813
- /**
814
- * @return {?}
815
- */
816
- PcacTableComponent.prototype.ngOnChanges = /**
817
- * @return {?}
818
- */
819
- function () {
820
- this.initTableUi();
821
- };
822
- /**
823
- * @param {?} row
824
- * @return {?}
825
- */
826
- PcacTableComponent.prototype.onEditClicked = /**
827
- * @param {?} row
828
- * @return {?}
829
- */
830
- function (row) {
831
- this.editClicked.emit(row);
832
- };
833
- /**
834
- * @param {?} row
835
- * @return {?}
836
- */
837
- PcacTableComponent.prototype.onDeleteClicked = /**
838
- * @param {?} row
839
- * @return {?}
840
- */
841
- function (row) {
842
- this.deleteClicked.emit(row);
843
- };
844
- /**
845
- * @param {?} row
846
- * @return {?}
847
- */
848
- PcacTableComponent.prototype.onHistoryClicked = /**
849
- * @param {?} row
850
- * @return {?}
851
- */
852
- function (row) {
853
- this.historyClicked.emit(row);
854
- };
855
- /**
856
- * @private
857
- * @return {?}
858
- */
859
- PcacTableComponent.prototype.initTableUi = /**
860
- * @private
861
- * @return {?}
862
- */
863
- function () {
864
- if (this.config && this.config.data && this.config.data.length > 0) {
865
- this.adjustedHeight = this.config.height + 28;
866
- if (this.config.enableStickyHeader || this.config.enableStickyFooter) {
867
- this.calculateColumnWidths();
868
- }
869
- this.setHeaders();
870
- this.setRows();
871
- }
872
- };
873
- /**
874
- * When dealing with sticky header/footer, we need to calc widths of absolute positioned
875
- * table columns.
876
- */
877
- /**
878
- * When dealing with sticky header/footer, we need to calc widths of absolute positioned
879
- * table columns.
880
- * @private
881
- * @return {?}
882
- */
883
- PcacTableComponent.prototype.calculateColumnWidths = /**
884
- * When dealing with sticky header/footer, we need to calc widths of absolute positioned
885
- * table columns.
886
- * @private
887
- * @return {?}
888
- */
889
- function () {
890
- if (this.tableBody.nativeElement.rows[0]) {
891
- /** @type {?} */
892
- var cells = this.tableBody.nativeElement.rows[0].cells;
893
- this.columnWidths = (/** @type {?} */ ([]));
894
- for (var i = 0; i < cells.length; i++) {
895
- this.columnWidths.push(cells[i].clientWidth);
896
- }
897
- // https://stackoverflow.com/questions/44922384/angular4-change-detection-expressionchangedafterithasbeencheckederror
898
- this.changeDetector.detectChanges();
899
- }
900
- };
901
- /**
902
- * Set internal cache of headers to ease template manipulation and apply icon
903
- */
904
- /**
905
- * Set internal cache of headers to ease template manipulation and apply icon
906
- * @private
907
- * @return {?}
908
- */
909
- PcacTableComponent.prototype.setHeaders = /**
910
- * Set internal cache of headers to ease template manipulation and apply icon
911
- * @private
912
- * @return {?}
913
- */
914
- function () {
915
- this.headers = (/** @type {?} */ ([]));
916
- for (var i = 0; i < this.config.data[0].data.length; i++) {
917
- this.headers.push((/** @type {?} */ ({
918
- key: this.config.data[0].data[i].key,
919
- value: this.config.data[0].data[i].value,
920
- icon: PcacTableSortIconsEnum.Sort
921
- })));
922
- }
923
- };
924
- /**
925
- * Deep copy of rows to ease template manipulation and sorting
926
- */
927
- /**
928
- * Deep copy of rows to ease template manipulation and sorting
929
- * @private
930
- * @return {?}
931
- */
932
- PcacTableComponent.prototype.setRows = /**
933
- * Deep copy of rows to ease template manipulation and sorting
934
- * @private
935
- * @return {?}
936
- */
937
- function () {
938
- this.rowData = JSON.parse(JSON.stringify(this.config.data)).slice(1);
939
- };
940
- /**
941
- * On header click, sort column.
942
- */
943
- /**
944
- * On header click, sort column.
945
- * @param {?} columnIndex
946
- * @return {?}
947
- */
948
- PcacTableComponent.prototype.sortTable = /**
949
- * On header click, sort column.
950
- * @param {?} columnIndex
951
- * @return {?}
952
- */
953
- function (columnIndex) {
954
- /** @type {?} */
955
- var direction = this.headers[columnIndex].icon === PcacTableSortIconsEnum.SortAsc ?
956
- PcacTableSortIconsEnum.SortDesc :
957
- PcacTableSortIconsEnum.SortAsc;
958
- this.clearStateExceptCurrent(columnIndex);
959
- this.sortService.sort(this.rowData, columnIndex, direction);
960
- this.headers[columnIndex].icon = direction;
961
- };
962
- /**
963
- * @private
964
- * @param {?} columnIndex
965
- * @return {?}
966
- */
967
- PcacTableComponent.prototype.clearStateExceptCurrent = /**
968
- * @private
969
- * @param {?} columnIndex
970
- * @return {?}
971
- */
972
- function (columnIndex) {
973
- for (var i = 0; i < this.headers.length; i++) {
974
- if (i !== columnIndex) {
975
- this.headers[i].icon = PcacTableSortIconsEnum.Sort;
976
- }
977
- }
978
- };
979
- /**
980
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
981
- */
982
- /**
983
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
984
- * @return {?}
985
- */
986
- PcacTableComponent.prototype.onResize = /**
987
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
988
- * @return {?}
989
- */
990
- function () {
991
- /** @type {?} */
992
- var self = this;
993
- clearTimeout(this.resizeWindowTimeout);
994
- this.resizeWindowTimeout = setTimeout((/**
995
- * @return {?}
996
- */
997
- function () {
998
- self.initTableUi();
999
- }), 300);
1000
- };
1001
- PcacTableComponent.decorators = [
1002
- { type: Component, args: [{
1003
- selector: 'pcac-table',
1004
- template: "<section class=\"pcac-table-container pcac-font-family\" [style.max-height.px]=\"adjustedHeight\"\r\n [ngClass]=\"{'hide-first-column':config?.hideColumnOne}\">\r\n <table class=\"pcac-table\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let header of headers; let i = index\" (click)=\"sortTable(i)\">\r\n <i [ngClass]=\"header.icon\"></i>\r\n {{header.value}}\r\n </th>\r\n <th *ngIf=\"config?.enableDeleteAction || config?.enableEditAction || config?.enableHistoryAction\"></th>\r\n </tr>\r\n </thead>\r\n <tbody #tableBody>\r\n <tr *ngFor=\"let row of rowData\" #rows>\r\n <td *ngFor=\"let cell of row.data\">{{cell.value}}</td>\r\n <td *ngIf=\"config?.enableDeleteAction || config?.enableEditAction || config?.enableHistoryAction\">\r\n <section class=\"action-list\">\r\n <div (click)=\"onHistoryClicked(row)\" *ngIf=\"config?.enableHistoryAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M504 255.531c.253 136.64-111.18 248.372-247.82 248.468-59.015.042-113.223-20.53-155.822-54.911-11.077-8.94-11.905-25.541-1.839-35.607l11.267-11.267c8.609-8.609 22.353-9.551 31.891-1.984C173.062 425.135 212.781 440 256 440c101.705 0 184-82.311 184-184 0-101.705-82.311-184-184-184-48.814 0-93.149 18.969-126.068 49.932l50.754 50.754c10.08 10.08 2.941 27.314-11.313 27.314H24c-8.837 0-16-7.163-16-16V38.627c0-14.254 17.234-21.393 27.314-11.314l49.372 49.372C129.209 34.136 189.552 8 256 8c136.81 0 247.747 110.78 248 247.531zm-180.912 78.784l9.823-12.63c8.138-10.463 6.253-25.542-4.21-33.679L288 256.349V152c0-13.255-10.745-24-24-24h-16c-13.255 0-24 10.745-24 24v135.651l65.409 50.874c10.463 8.137 25.541 6.253 33.679-4.21z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onEditClicked(row)\" *ngIf=\"config?.enableEditAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onDeleteClicked(row)\" *ngIf=\"config?.enableDeleteAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M0 84V56c0-13.3 10.7-24 24-24h112l9.4-18.7c4-8.2 12.3-13.3 21.4-13.3h114.3c9.1 0 17.4 5.1 21.5 13.3L312 32h112c13.3 0 24 10.7 24 24v28c0 6.6-5.4 12-12 12H12C5.4 96 0 90.6 0 84zm415.2 56.7L394.8 467c-1.6 25.3-22.6 45-47.9 45H101.1c-25.3 0-46.3-19.7-47.9-45L32.8 140.7c-.4-6.9 5.1-12.7 12-12.7h358.5c6.8 0 12.3 5.8 11.9 12.7z\">\r\n </path>\r\n </svg>\r\n </div>\r\n </section>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n <div *ngIf=\"config?.enableStickyHeader\" class=\"header\">\r\n <table class=\"pcac-table\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let header of headers; let i = index\" class=\"sortable\" [style.width.px]=\"columnWidths[i]\"\r\n (click)=\"sortTable(i)\">\r\n <i [ngClass]=\"header.icon\"></i>\r\n {{header.value}}\r\n </th>\r\n <th [style.width.px]=\"columnWidths[columnWidths.length - 1]\"\r\n *ngIf=\"config?.enableDeleteAction || config?.enableEditAction\"></th>\r\n </tr>\r\n </thead>\r\n </table>\r\n </div>\r\n <div *ngIf=\"config?.enableStickyFooter && config?.data.length > 0\" class=\"footer\" #tableFooter>\r\n <table class=\"pcac-table\">\r\n <tfoot>\r\n <tr>\r\n <td *ngFor=\"let data of config?.data[config?.data.length - 1].data; let i = index\"\r\n [style.width.px]=\"columnWidths[i]\" class=\"sticky-resize\">{{data.value}}</td>\r\n <td [style.width.px]=\"columnWidths[columnWidths.length - 1]\"\r\n *ngIf=\"config?.enableDeleteAction || config?.enableEditAction || config?.enableHistoryAction\">\r\n <section class=\"action-list action-footer\">\r\n <div (click)=\"onHistoryClicked(config?.data[config?.data.length - 1])\" *ngIf=\"config?.enableHistoryAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M504 255.531c.253 136.64-111.18 248.372-247.82 248.468-59.015.042-113.223-20.53-155.822-54.911-11.077-8.94-11.905-25.541-1.839-35.607l11.267-11.267c8.609-8.609 22.353-9.551 31.891-1.984C173.062 425.135 212.781 440 256 440c101.705 0 184-82.311 184-184 0-101.705-82.311-184-184-184-48.814 0-93.149 18.969-126.068 49.932l50.754 50.754c10.08 10.08 2.941 27.314-11.313 27.314H24c-8.837 0-16-7.163-16-16V38.627c0-14.254 17.234-21.393 27.314-11.314l49.372 49.372C129.209 34.136 189.552 8 256 8c136.81 0 247.747 110.78 248 247.531zm-180.912 78.784l9.823-12.63c8.138-10.463 6.253-25.542-4.21-33.679L288 256.349V152c0-13.255-10.745-24-24-24h-16c-13.255 0-24 10.745-24 24v135.651l65.409 50.874c10.463 8.137 25.541 6.253 33.679-4.21z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onEditClicked(config?.data[config?.data.length - 1])\" *ngIf=\"config?.enableEditAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path\r\n d=\"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z\">\r\n </path>\r\n </svg>\r\n </div>\r\n <div (click)=\"onDeleteClicked(config?.data[config?.data.length - 1])\" *ngIf=\"config?.enableDeleteAction\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\">\r\n <path\r\n d=\"M0 84V56c0-13.3 10.7-24 24-24h112l9.4-18.7c4-8.2 12.3-13.3 21.4-13.3h114.3c9.1 0 17.4 5.1 21.5 13.3L312 32h112c13.3 0 24 10.7 24 24v28c0 6.6-5.4 12-12 12H12C5.4 96 0 90.6 0 84zm415.2 56.7L394.8 467c-1.6 25.3-22.6 45-47.9 45H101.1c-25.3 0-46.3-19.7-47.9-45L32.8 140.7c-.4-6.9 5.1-12.7 12-12.7h358.5c6.8 0 12.3 5.8 11.9 12.7z\">\r\n </path>\r\n </svg>\r\n </div>\r\n </section>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n </div>\r\n</section>\r\n",
1005
- providers: [
1006
- TableSortService
1007
- ],
1008
- styles: ["pcac-table{position:relative;width:100%;display:block}pcac-table .footer,pcac-table table.pcac-table,pcac-table tbody,pcac-table td,pcac-table tfoot,pcac-table th,pcac-table thead,pcac-table tr .header{box-sizing:border-box}pcac-table table.pcac-table{border-collapse:collapse;width:100%;border-radius:3px;line-height:18px;margin:0}pcac-table table.pcac-table tbody,pcac-table table.pcac-table tfoot,pcac-table table.pcac-table thead{background-color:#fff}pcac-table table.pcac-table caption{padding:.5rem .625rem .625rem;font-weight:700}pcac-table table.pcac-table thead{background:#f8f9fa;color:#24282e}pcac-table table.pcac-table thead i{margin:0 0 -2px;width:10px}pcac-table table.pcac-table tfoot{background:#24282e;color:#fff}pcac-table table.pcac-table tfoot tr,pcac-table table.pcac-table thead tr{background:0 0}pcac-table table.pcac-table tfoot td,pcac-table table.pcac-table tfoot th,pcac-table table.pcac-table thead td,pcac-table table.pcac-table thead th{padding:.5rem .625rem .625rem;font-weight:700;text-align:left}pcac-table table.pcac-table tbody td,pcac-table table.pcac-table tbody th{padding:.5rem .625rem .625rem}pcac-table table.pcac-table tbody tr:nth-child(even){border-bottom:0;background-color:#e9ecef}pcac-table table.pcac-table thead th{cursor:pointer;transition:background-color .25s}pcac-table table.pcac-table thead th:hover{transition:background-color .25s;background-color:#e9ecef}pcac-table .header{position:absolute;top:0}pcac-table .footer{position:absolute;bottom:0}pcac-table .action-list{display:flex;align-items:center;justify-content:flex-end}pcac-table .action-list div{margin-left:.5rem;width:12px}pcac-table .action-list svg path{fill:#adb5bd}pcac-table .action-list svg{cursor:pointer}pcac-table .action-list svg:hover path{transition:.25s;fill:#495057}pcac-table .action-list.action-footer svg path{fill:#e9ecef}pcac-table .action-list.action-footer svg path:hover{fill:#fff}.pcac-table-container{overflow:auto}.pcac-table-container.hide-first-column td:first-child,.pcac-table-container.hide-first-column th:first-child{display:none}"]
1009
- }] }
1010
- ];
1011
- /** @nocollapse */
1012
- PcacTableComponent.ctorParameters = function () { return [
1013
- { type: TableSortService },
1014
- { type: ChangeDetectorRef }
1015
- ]; };
1016
- PcacTableComponent.propDecorators = {
1017
- config: [{ type: Input }],
1018
- deleteClicked: [{ type: Output }],
1019
- editClicked: [{ type: Output }],
1020
- historyClicked: [{ type: Output }],
1021
- tableBody: [{ type: ViewChild, args: ['tableBody', { static: true },] }],
1022
- tableFooter: [{ type: ViewChild, args: ['tableFooter', { static: true },] }],
1023
- rows: [{ type: ViewChildren, args: ['rows',] }],
1024
- onResize: [{ type: HostListener, args: ['window:resize',] }]
1025
- };
1026
- return PcacTableComponent;
1027
- }());
1028
-
1029
- /**
1030
- * @fileoverview added by tsickle
1031
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1032
- */
1033
- var PcacTableModule = /** @class */ (function () {
1034
- function PcacTableModule() {
1035
- }
1036
- PcacTableModule.decorators = [
1037
- { type: NgModule, args: [{
1038
- imports: [
1039
- BrowserModule
1040
- ],
1041
- exports: [
1042
- PcacTableComponent
1043
- ],
1044
- declarations: [
1045
- PcacTableComponent
1046
- ]
1047
- },] }
1048
- ];
1049
- return PcacTableModule;
1050
- }());
1051
-
1052
- /**
1053
- * @fileoverview added by tsickle
1054
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1055
- */
1056
-
1057
- /**
1058
- * @fileoverview added by tsickle
1059
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1060
- */
1061
-
1062
- /**
1063
- * @fileoverview added by tsickle
1064
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1065
- */
1066
- var BarVerticalChartBuilder = /** @class */ (function (_super) {
1067
- __extends(BarVerticalChartBuilder, _super);
1068
- function BarVerticalChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
1069
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
1070
- _this.axisBuilder = axisBuilder;
1071
- _this.gridBuilder = gridBuilder;
1072
- _this.transitionService = transitionService;
1073
- _this.tooltipBuilder = tooltipBuilder;
1074
- _this.colorService = colorService;
1075
- _this.barClickedSource = new Subject();
1076
- _this.barClicked$ = _this.barClickedSource.asObservable();
1077
- return _this;
1078
- }
1079
- /**
1080
- * @param {?} chartElm
1081
- * @param {?} config
1082
- * @return {?}
1083
- */
1084
- BarVerticalChartBuilder.prototype.buildChart = /**
1085
- * @param {?} chartElm
1086
- * @param {?} config
1087
- * @return {?}
1088
- */
1089
- function (chartElm, config) {
1090
- if (config.colorOverride && config.colorOverride.colors) {
1091
- this.colors = config.colorOverride.colors;
1092
- }
1093
- if (config.hideAxis) {
1094
- this.adjustForHiddenAxis(config);
1095
- }
1096
- this.initializeChartState(chartElm, config);
1097
- if (config.colorOverride && config.colorOverride.colors) {
1098
- this.colors = config.colorOverride.colors.reverse();
1099
- }
1100
- this.buildScales(config);
1101
- this.drawChart(chartElm, config);
1102
- };
1103
- /**
1104
- * @private
1105
- * @param {?} config
1106
- * @return {?}
1107
- */
1108
- BarVerticalChartBuilder.prototype.adjustForHiddenAxis = /**
1109
- * @private
1110
- * @param {?} config
1111
- * @return {?}
1112
- */
1113
- function (config) {
1114
- /** @type {?} */
1115
- var hasGroupLabel = this.hasGroupLabel(config);
1116
- config.height = config.height + this.margin.top;
1117
- if (!hasGroupLabel) {
1118
- config.height = config.height + this.margin.bottom;
1119
- }
1120
- this.margin.top = 0;
1121
- this.margin.bottom = hasGroupLabel ? this.margin.bottom : 0;
1122
- this.margin.left = 0;
1123
- this.margin.right = 0;
1124
- };
1125
- /**
1126
- * @private
1127
- * @param {?} config
1128
- * @return {?}
1129
- */
1130
- BarVerticalChartBuilder.prototype.hasGroupLabel = /**
1131
- * @private
1132
- * @param {?} config
1133
- * @return {?}
1134
- */
1135
- function (config) {
1136
- /** @type {?} */
1137
- var hasGroupLabel = false;
1138
- config.data.forEach((/**
1139
- * @param {?} node
1140
- * @return {?}
1141
- */
1142
- function (node) {
1143
- if (node.key) {
1144
- hasGroupLabel = true;
1145
- }
1146
- }));
1147
- return hasGroupLabel;
1148
- };
1149
- /**
1150
- * @private
1151
- * @param {?} config
1152
- * @return {?}
1153
- */
1154
- BarVerticalChartBuilder.prototype.buildScales = /**
1155
- * @private
1156
- * @param {?} config
1157
- * @return {?}
1158
- */
1159
- function (config) {
1160
- this.yScale = scaleLinear()
1161
- .rangeRound([0, config.height])
1162
- .domain([config.domainMax, 0]);
1163
- this.xScaleStacked = scaleBand()
1164
- .domain(config.data.map((/**
1165
- * @param {?} d
1166
- * @return {?}
1167
- */
1168
- function (d) { return (/** @type {?} */ (d.key)); })))
1169
- .rangeRound([0, this.width])
1170
- .padding(0.1);
1171
- this.xScaleGrouped = scaleBand()
1172
- .padding(0.2)
1173
- .rangeRound([0, this.xScaleStacked.bandwidth()])
1174
- .domain(config.data[0].data.map((/**
1175
- * @param {?} d
1176
- * @return {?}
1177
- */
1178
- function (d) { return (/** @type {?} */ (d.key)); })));
1179
- };
1180
- /**
1181
- * @private
1182
- * @param {?} chartElm
1183
- * @param {?} config
1184
- * @return {?}
1185
- */
1186
- BarVerticalChartBuilder.prototype.drawChart = /**
1187
- * @private
1188
- * @param {?} chartElm
1189
- * @param {?} config
1190
- * @return {?}
1191
- */
1192
- function (chartElm, config) {
1193
- this.buildContainer(chartElm);
1194
- this.axisBuilder.drawAxis({
1195
- svg: this.svg,
1196
- numberOfTicks: config.numberOfTicks || 5,
1197
- height: this.height,
1198
- xScale: this.xScaleStacked,
1199
- yScale: this.yScale,
1200
- xFormat: PcacTickFormatEnum.None,
1201
- yFormat: config.tickFormat || PcacTickFormatEnum.None,
1202
- hideYAxis: config.hideAxis
1203
- });
1204
- if (!config.hideGrid) {
1205
- this.gridBuilder.drawHorizontalGrid({
1206
- svg: this.svg,
1207
- numberOfTicks: config.numberOfTicks || 5,
1208
- width: this.width,
1209
- xScale: this.xScaleStacked,
1210
- yScale: this.yScale
1211
- });
1212
- }
1213
- this.addGroups(config);
1214
- };
1215
- /**
1216
- * @private
1217
- * @param {?} config
1218
- * @return {?}
1219
- */
1220
- BarVerticalChartBuilder.prototype.addGroups = /**
1221
- * @private
1222
- * @param {?} config
1223
- * @return {?}
1224
- */
1225
- function (config) {
1226
- var _this = this;
1227
- /** @type {?} */
1228
- var groupsContainer = this.svg.append('g')
1229
- .attr('class', 'pcac-bars')
1230
- .selectAll('g')
1231
- .data(config.data)
1232
- .enter().append('g')
1233
- .attr('class', 'pcac-bar-group')
1234
- .attr('data-group-id', (/**
1235
- * @param {?} d
1236
- * @param {?} i
1237
- * @return {?}
1238
- */
1239
- function (d, i) {
1240
- return i;
1241
- }))
1242
- .attr('transform', (/**
1243
- * @param {?} d
1244
- * @param {?} i
1245
- * @return {?}
1246
- */
1247
- function (d, i) {
1248
- return 'translate(' + _this.xScaleStacked((/** @type {?} */ (d.key))) + ',0)';
1249
- }));
1250
- /** @type {?} */
1251
- var group = groupsContainer.selectAll('rect')
1252
- .data((/**
1253
- * @param {?} d
1254
- * @param {?} i
1255
- * @return {?}
1256
- */
1257
- function (d, i) {
1258
- return d.data;
1259
- }));
1260
- this.drawBarsPerGroup(group, config);
1261
- // We have no thresholds to draw
1262
- if (!config.thresholds) {
1263
- return;
1264
- }
1265
- // Draw threshold across entire chart
1266
- if (config.thresholds.length === 1 && !config.thresholds[0].data) {
1267
- this.drawThresholdAcrossChart(config);
1268
- }
1269
- // Draw threshold across each group
1270
- if (config.thresholds.length > 1 && (!config.thresholds[0].data || config.isStacked)) {
1271
- this.drawThresholdsPerGroup(group, config);
1272
- }
1273
- // Draw threshold across each bar in group
1274
- if (config.thresholds.length > 1 && config.thresholds[0].data && !config.isStacked) {
1275
- this.drawThresholdsPerBarInGroup(group, config);
1276
- }
1277
- };
1278
- /**
1279
- * @private
1280
- * @param {?} group
1281
- * @param {?} config
1282
- * @return {?}
1283
- */
1284
- BarVerticalChartBuilder.prototype.drawBarsPerGroup = /**
1285
- * @private
1286
- * @param {?} group
1287
- * @param {?} config
1288
- * @return {?}
1289
- */
1290
- function (group, config) {
1291
- var _this = this;
1292
- /** @type {?} */
1293
- var self = this;
1294
- group.enter().append('rect')
1295
- .attr('class', 'pcac-bar')
1296
- .attr('x', (/**
1297
- * @param {?} d
1298
- * @param {?} i
1299
- * @return {?}
1300
- */
1301
- function (d, i) {
1302
- return !config.isStacked ? _this.xScaleGrouped((/** @type {?} */ (d.key))) : _this.xScaleStacked((/** @type {?} */ (d.key)));
1303
- }))
1304
- .style('fill', (/**
1305
- * @param {?} d
1306
- * @param {?} i
1307
- * @param {?} n
1308
- * @return {?}
1309
- */
1310
- function (d, i, n) {
1311
- if (config.spreadColorsPerGroup) {
1312
- /** @type {?} */
1313
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1314
- return _this.colors[groupIndex];
1315
- }
1316
- return _this.colors[i];
1317
- }))
1318
- .attr('y', (/**
1319
- * @return {?}
1320
- */
1321
- function () {
1322
- return _this.height;
1323
- }))
1324
- .attr('height', 0)
1325
- .on('mouseover', (/**
1326
- * @param {?} d
1327
- * @param {?} i
1328
- * @param {?} n
1329
- * @return {?}
1330
- */
1331
- function (d, i, n) {
1332
- select(this).transition(transition()
1333
- .duration(self.transitionService.getTransitionDuration() / 5))
1334
- .style('fill', (/**
1335
- * @return {?}
1336
- */
1337
- function () {
1338
- if (config.spreadColorsPerGroup) {
1339
- /** @type {?} */
1340
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1341
- return color(self.colors[groupIndex]).darker(1).toString();
1342
- }
1343
- return color(self.colors[i]).darker(1).toString();
1344
- }));
1345
- }))
1346
- .on('mousemove', (/**
1347
- * @param {?} d
1348
- * @param {?} i
1349
- * @return {?}
1350
- */
1351
- function (d, i) {
1352
- self.tooltipBuilder.showBarTooltip(d, config.tickFormat || PcacTickFormatEnum.None);
1353
- }))
1354
- .on('mouseout', (/**
1355
- * @param {?} d
1356
- * @param {?} i
1357
- * @param {?} n
1358
- * @return {?}
1359
- */
1360
- function (d, i, n) {
1361
- self.tooltipBuilder.hideTooltip();
1362
- select(this).transition(transition()
1363
- .duration(self.transitionService.getTransitionDuration() / 5))
1364
- .style('fill', (/**
1365
- * @return {?}
1366
- */
1367
- function () {
1368
- if (config.spreadColorsPerGroup) {
1369
- /** @type {?} */
1370
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1371
- return self.colors[groupIndex];
1372
- }
1373
- return self.colors[i];
1374
- }));
1375
- }))
1376
- .on('click', (/**
1377
- * @param {?} d
1378
- * @param {?} i
1379
- * @return {?}
1380
- */
1381
- function (d, i) {
1382
- _this.barClickedSource.next(d);
1383
- }))
1384
- .transition(transition()
1385
- .duration(this.transitionService.getTransitionDuration()))
1386
- .attr('width', !config.isStacked ? this.xScaleGrouped.bandwidth() : this.xScaleStacked.bandwidth())
1387
- .attr('y', (/**
1388
- * @param {?} d
1389
- * @return {?}
1390
- */
1391
- function (d) {
1392
- return _this.yScale((/** @type {?} */ (d.value)));
1393
- }))
1394
- .attr('height', (/**
1395
- * @param {?} d
1396
- * @return {?}
1397
- */
1398
- function (d) {
1399
- return _this.height - _this.yScale((/** @type {?} */ (d.value)));
1400
- }));
1401
- };
1402
- /**
1403
- * @private
1404
- * @param {?} config
1405
- * @return {?}
1406
- */
1407
- BarVerticalChartBuilder.prototype.drawThresholdAcrossChart = /**
1408
- * @private
1409
- * @param {?} config
1410
- * @return {?}
1411
- */
1412
- function (config) {
1413
- var _this = this;
1414
- this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'), config)
1415
- .attr('width', this.width)
1416
- .on('mousemove', (/**
1417
- * @param {?} d
1418
- * @param {?} i
1419
- * @return {?}
1420
- */
1421
- function (d, i) {
1422
- _this.tooltipBuilder.showBarTooltip(config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
1423
- }))
1424
- .transition(transition()
1425
- .duration(this.transitionService.getTransitionDuration()))
1426
- .attr('y', (/**
1427
- * @param {?} d
1428
- * @param {?} i
1429
- * @return {?}
1430
- */
1431
- function (d, i) {
1432
- return _this.yScale((/** @type {?} */ (config.thresholds[i].value)));
1433
- }));
1434
- };
1435
- /**
1436
- * @private
1437
- * @param {?} group
1438
- * @param {?} config
1439
- * @return {?}
1440
- */
1441
- BarVerticalChartBuilder.prototype.drawThresholdsPerGroup = /**
1442
- * @private
1443
- * @param {?} group
1444
- * @param {?} config
1445
- * @return {?}
1446
- */
1447
- function (group, config) {
1448
- var _this = this;
1449
- this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect'), config)
1450
- .attr('width', this.xScaleStacked.bandwidth())
1451
- .on('mousemove', (/**
1452
- * @param {?} d
1453
- * @param {?} i
1454
- * @return {?}
1455
- */
1456
- function (d, i) {
1457
- _this.tooltipBuilder.showBarTooltip(config.isStacked ?
1458
- config.thresholds[i].data[0] :
1459
- config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
1460
- }))
1461
- .transition(transition()
1462
- .duration(this.transitionService.getTransitionDuration()))
1463
- .attr('y', (/**
1464
- * @param {?} d
1465
- * @param {?} i
1466
- * @return {?}
1467
- */
1468
- function (d, i) {
1469
- return _this.yScale(config.isStacked ? (/** @type {?} */ (config.thresholds[i].data[0].value)) : (/** @type {?} */ (config.thresholds[i].value)));
1470
- }));
1471
- };
1472
- /**
1473
- * @private
1474
- * @param {?} group
1475
- * @param {?} config
1476
- * @return {?}
1477
- */
1478
- BarVerticalChartBuilder.prototype.drawThresholdsPerBarInGroup = /**
1479
- * @private
1480
- * @param {?} group
1481
- * @param {?} config
1482
- * @return {?}
1483
- */
1484
- function (group, config) {
1485
- var _this = this;
1486
- this.applyPreTransitionThresholdStyles(group.enter().append('rect'), config)
1487
- .on('mousemove', (/**
1488
- * @param {?} d
1489
- * @param {?} i
1490
- * @param {?} n
1491
- * @return {?}
1492
- */
1493
- function (d, i, n) {
1494
- _this.tooltipBuilder.showBarTooltip(config.thresholds[n[0].parentElement.dataset['groupId']].data[i], config.tickFormat || PcacTickFormatEnum.None);
1495
- }))
1496
- .attr('width', this.xScaleGrouped.bandwidth())
1497
- .transition(transition()
1498
- .duration(this.transitionService.getTransitionDuration()))
1499
- .attr('y', (/**
1500
- * @param {?} d
1501
- * @param {?} i
1502
- * @param {?} n
1503
- * @return {?}
1504
- */
1505
- function (d, i, n) {
1506
- return _this.yScale((/** @type {?} */ (config.thresholds[n[0].parentElement.dataset['groupId']].data[i].value)));
1507
- }));
1508
- };
1509
- /**
1510
- * @private
1511
- * @param {?} elm
1512
- * @param {?} config
1513
- * @return {?}
1514
- */
1515
- BarVerticalChartBuilder.prototype.applyPreTransitionThresholdStyles = /**
1516
- * @private
1517
- * @param {?} elm
1518
- * @param {?} config
1519
- * @return {?}
1520
- */
1521
- function (elm, config) {
1522
- var _this = this;
1523
- return elm.attr('class', 'pcac-threshold')
1524
- .attr('x', (/**
1525
- * @param {?} d
1526
- * @return {?}
1527
- */
1528
- function (d) {
1529
- return _this.xScaleGrouped(d ? (/** @type {?} */ (d.key)) : '');
1530
- }))
1531
- .attr('y', (/**
1532
- * @return {?}
1533
- */
1534
- function () {
1535
- return _this.height;
1536
- }))
1537
- .attr('height', 0)
1538
- .style('fill', (/**
1539
- * @return {?}
1540
- */
1541
- function () {
1542
- return _this.colorService.getAlert();
1543
- }))
1544
- .style('stroke', (/**
1545
- * @return {?}
1546
- */
1547
- function () {
1548
- return _this.colorService.getAlert();
1549
- }))
1550
- .style('stroke-width', (/**
1551
- * @return {?}
1552
- */
1553
- function () {
1554
- return 2;
1555
- }))
1556
- .on('mouseout', (/**
1557
- * @return {?}
1558
- */
1559
- function () {
1560
- _this.tooltipBuilder.hideTooltip();
1561
- }))
1562
- .attr('height', (/**
1563
- * @return {?}
1564
- */
1565
- function () {
1566
- return '3px';
1567
- }));
1568
- };
1569
- BarVerticalChartBuilder.decorators = [
1570
- { type: Injectable }
1571
- ];
1572
- /** @nocollapse */
1573
- BarVerticalChartBuilder.ctorParameters = function () { return [
1574
- { type: PcacAxisBuilder },
1575
- { type: PcacGridBuilder },
1576
- { type: PcacTransitionService },
1577
- { type: PcacTooltipBuilder },
1578
- { type: PcacColorService }
1579
- ]; };
1580
- return BarVerticalChartBuilder;
1581
- }(PcacChart));
1582
-
1583
- /**
1584
- * @fileoverview added by tsickle
1585
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1586
- */
1587
- var PcacBarVerticalChartComponent = /** @class */ (function () {
1588
- function PcacBarVerticalChartComponent(chartBuilder) {
1589
- var _this = this;
1590
- this.chartBuilder = chartBuilder;
1591
- this.barClicked = new EventEmitter();
1592
- this.chartBuilder.barClicked$.subscribe((/**
1593
- * @param {?} data
1594
- * @return {?}
1595
- */
1596
- function (data) {
1597
- _this.barClicked.emit(data);
1598
- }));
1599
- }
1600
- /**
1601
- * @return {?}
1602
- */
1603
- PcacBarVerticalChartComponent.prototype.ngOnChanges = /**
1604
- * @return {?}
1605
- */
1606
- function () {
1607
- this.buildChart();
1608
- };
1609
- /**
1610
- * @return {?}
1611
- */
1612
- PcacBarVerticalChartComponent.prototype.buildChart = /**
1613
- * @return {?}
1614
- */
1615
- function () {
1616
- if (this.config && this.config.data && this.config.data.length > 0) {
1617
- this.chartBuilder.buildChart(this.chartElm, this.config);
1618
- }
1619
- };
1620
- /**
1621
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1622
- */
1623
- /**
1624
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1625
- * @return {?}
1626
- */
1627
- PcacBarVerticalChartComponent.prototype.onResize = /**
1628
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
1629
- * @return {?}
1630
- */
1631
- function () {
1632
- /** @type {?} */
1633
- var self = this;
1634
- clearTimeout(this.resizeWindowTimeout);
1635
- this.resizeWindowTimeout = setTimeout((/**
1636
- * @return {?}
1637
- */
1638
- function () {
1639
- self.buildChart();
1640
- }), 300);
1641
- };
1642
- PcacBarVerticalChartComponent.decorators = [
1643
- { type: Component, args: [{
1644
- selector: 'pcac-bar-vertical-chart',
1645
- template: "<section class=\"pcac-bar-vertical-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n",
1646
- providers: [
1647
- BarVerticalChartBuilder
1648
- ]
1649
- }] }
1650
- ];
1651
- /** @nocollapse */
1652
- PcacBarVerticalChartComponent.ctorParameters = function () { return [
1653
- { type: BarVerticalChartBuilder }
1654
- ]; };
1655
- PcacBarVerticalChartComponent.propDecorators = {
1656
- config: [{ type: Input }],
1657
- chartElm: [{ type: ViewChild, args: ['chart', { static: true },] }],
1658
- barClicked: [{ type: Output }],
1659
- onResize: [{ type: HostListener, args: ['window:resize',] }]
1660
- };
1661
- return PcacBarVerticalChartComponent;
1662
- }());
1663
-
1664
- /**
1665
- * @fileoverview added by tsickle
1666
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1667
- */
1668
-
1669
- /**
1670
- * @fileoverview added by tsickle
1671
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1672
- */
1673
- var PcacBarVerticalChartModule = /** @class */ (function () {
1674
- function PcacBarVerticalChartModule() {
1675
- }
1676
- PcacBarVerticalChartModule.decorators = [
1677
- { type: NgModule, args: [{
1678
- exports: [
1679
- PcacBarVerticalChartComponent
1680
- ],
1681
- declarations: [
1682
- PcacBarVerticalChartComponent
1683
- ]
1684
- },] }
1685
- ];
1686
- return PcacBarVerticalChartModule;
1687
- }());
1688
-
1689
- /**
1690
- * @fileoverview added by tsickle
1691
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1692
- */
1693
-
1694
- /**
1695
- * @fileoverview added by tsickle
1696
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1697
- */
1698
-
1699
- /**
1700
- * @fileoverview added by tsickle
1701
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1702
- */
1703
- var BarHorizontalChartBuilder = /** @class */ (function (_super) {
1704
- __extends(BarHorizontalChartBuilder, _super);
1705
- function BarHorizontalChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
1706
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
1707
- _this.axisBuilder = axisBuilder;
1708
- _this.gridBuilder = gridBuilder;
1709
- _this.transitionService = transitionService;
1710
- _this.tooltipBuilder = tooltipBuilder;
1711
- _this.colorService = colorService;
1712
- _this.barClickedSource = new Subject();
1713
- _this.barClicked$ = _this.barClickedSource.asObservable();
1714
- return _this;
1715
- }
1716
- /**
1717
- * @param {?} chartElm
1718
- * @param {?} config
1719
- * @return {?}
1720
- */
1721
- BarHorizontalChartBuilder.prototype.buildChart = /**
1722
- * @param {?} chartElm
1723
- * @param {?} config
1724
- * @return {?}
1725
- */
1726
- function (chartElm, config) {
1727
- this.config = JSON.parse(JSON.stringify(config));
1728
- if (this.config.hideAxis) {
1729
- this.adjustForHiddenAxis();
1730
- }
1731
- this.initializeChartState(chartElm, this.config);
1732
- if (config.colorOverride && config.colorOverride.colors) {
1733
- this.colors = config.colorOverride.colors.reverse();
1734
- }
1735
- this.buildScales(chartElm, this.config);
1736
- this.drawChart(chartElm, this.config);
1737
- };
1738
- /**
1739
- * @private
1740
- * @return {?}
1741
- */
1742
- BarHorizontalChartBuilder.prototype.adjustForHiddenAxis = /**
1743
- * @private
1744
- * @return {?}
1745
- */
1746
- function () {
1747
- if (!this.cachedMargins) {
1748
- this.cachedMargins = JSON.parse(JSON.stringify(this.margin));
1749
- }
1750
- this.margin = JSON.parse(JSON.stringify(this.cachedMargins));
1751
- this.config.height = this.config.height + this.margin.top + this.margin.bottom;
1752
- this.margin.top = 0;
1753
- this.margin.bottom = 0;
1754
- this.margin.left = 0;
1755
- this.margin.right = 0;
1756
- };
1757
- /**
1758
- * @private
1759
- * @param {?} data
1760
- * @return {?}
1761
- */
1762
- BarHorizontalChartBuilder.prototype.setStartState = /**
1763
- * @private
1764
- * @param {?} data
1765
- * @return {?}
1766
- */
1767
- function (data) {
1768
- if (data && data.data) {
1769
- for (var i = 0, l = data.data.length; i < l; ++i) {
1770
- data.data[i].value = 0;
1771
- this.setStartState(data.data[i]);
1772
- }
1773
- }
1774
- };
1775
- /**
1776
- * @private
1777
- * @param {?} chartElm
1778
- * @param {?} config
1779
- * @return {?}
1780
- */
1781
- BarHorizontalChartBuilder.prototype.buildScales = /**
1782
- * @private
1783
- * @param {?} chartElm
1784
- * @param {?} config
1785
- * @return {?}
1786
- */
1787
- function (chartElm, config) {
1788
- config.data[0].data.map((/**
1789
- * @param {?} d
1790
- * @return {?}
1791
- */
1792
- function (d) {
1793
- return d.value;
1794
- }));
1795
- this.xScale = scaleLinear()
1796
- .domain([0, config.domainMax]);
1797
- this.yScaleStacked = scaleBand()
1798
- .domain(config.data.map((/**
1799
- * @param {?} d
1800
- * @return {?}
1801
- */
1802
- function (d) { return (/** @type {?} */ (d.key)); })))
1803
- .range([this.height, 0])
1804
- .padding(0.1);
1805
- this.yScaleGrouped = scaleBand()
1806
- .padding(0.05)
1807
- .rangeRound([0, this.yScaleStacked.bandwidth()])
1808
- .domain(config.data[0].data.map((/**
1809
- * @param {?} d
1810
- * @return {?}
1811
- */
1812
- function (d) { return (/** @type {?} */ (d.key)); })));
1813
- this.setHorizontalMarginsBasedOnContent(chartElm, config.data, this.yScaleStacked);
1814
- this.xScale.range([0, this.width]);
1815
- };
1816
- /**
1817
- * @private
1818
- * @param {?} chartElm
1819
- * @param {?} config
1820
- * @return {?}
1821
- */
1822
- BarHorizontalChartBuilder.prototype.drawChart = /**
1823
- * @private
1824
- * @param {?} chartElm
1825
- * @param {?} config
1826
- * @return {?}
1827
- */
1828
- function (chartElm, config) {
1829
- this.buildContainer(chartElm);
1830
- this.axisBuilder.drawAxis({
1831
- svg: this.svg,
1832
- numberOfTicks: config.numberOfTicks || 5,
1833
- height: this.height,
1834
- xScale: this.xScale,
1835
- yScale: this.yScaleStacked,
1836
- xFormat: config.tickFormat || PcacTickFormatEnum.None,
1837
- yFormat: PcacTickFormatEnum.None,
1838
- hideXAxis: config.hideAxis
1839
- });
1840
- if (!config.hideGrid) {
1841
- this.gridBuilder.drawVerticalGrid({
1842
- svg: this.svg,
1843
- numberOfTicks: config.numberOfTicks || 5,
1844
- height: this.height,
1845
- xScale: this.xScale,
1846
- yScale: this.yScaleStacked
1847
- });
1848
- }
1849
- this.addGroups(config);
1850
- };
1851
- /**
1852
- * @private
1853
- * @param {?} config
1854
- * @return {?}
1855
- */
1856
- BarHorizontalChartBuilder.prototype.addGroups = /**
1857
- * @private
1858
- * @param {?} config
1859
- * @return {?}
1860
- */
1861
- function (config) {
1862
- var _this = this;
1863
- /** @type {?} */
1864
- var groupsContainer = this.svg.append('g')
1865
- .attr('class', 'pcac-bars')
1866
- .selectAll('g')
1867
- .data(config.data)
1868
- .enter().append('g')
1869
- .attr('class', 'pcac-bar-group')
1870
- .attr('data-group-id', (/**
1871
- * @param {?} d
1872
- * @param {?} i
1873
- * @return {?}
1874
- */
1875
- function (d, i) {
1876
- return i;
1877
- }))
1878
- .attr('transform', (/**
1879
- * @param {?} d
1880
- * @return {?}
1881
- */
1882
- function (d) { return 'translate(0,' + _this.yScaleStacked((/** @type {?} */ (d.key))) + ')'; }));
1883
- /** @type {?} */
1884
- var group = groupsContainer.selectAll('rect')
1885
- .data((/**
1886
- * @param {?} d
1887
- * @return {?}
1888
- */
1889
- function (d) {
1890
- return d.data;
1891
- }));
1892
- this.drawBarsPerGroup(group, config);
1893
- // We have no thresholds to draw
1894
- if (!config.thresholds) {
1895
- return;
1896
- }
1897
- // Draw threshold across entire chart
1898
- if (config.thresholds.length === 1 && !config.thresholds[0].data) {
1899
- this.drawThresholdAcrossChart(config);
1900
- }
1901
- // Draw threshold across each group
1902
- if (config.thresholds.length > 1 && (!config.thresholds[0].data || config.isStacked)) {
1903
- this.drawThresholdsPerGroup(group, config);
1904
- }
1905
- // Draw threshold across each bar in group
1906
- if (config.thresholds.length > 1 && config.thresholds[0].data && !config.isStacked) {
1907
- this.drawThresholdsPerBarInGroup(group, config);
1908
- }
1909
- };
1910
- /**
1911
- * @private
1912
- * @param {?} groups
1913
- * @param {?} config
1914
- * @return {?}
1915
- */
1916
- BarHorizontalChartBuilder.prototype.drawBarsPerGroup = /**
1917
- * @private
1918
- * @param {?} groups
1919
- * @param {?} config
1920
- * @return {?}
1921
- */
1922
- function (groups, config) {
1923
- var _this = this;
1924
- /** @type {?} */
1925
- var self = this;
1926
- groups.enter().append('rect')
1927
- .attr('class', 'pcac-bar')
1928
- .attr('x', 0)
1929
- .attr('y', (/**
1930
- * @param {?} d
1931
- * @return {?}
1932
- */
1933
- function (d) {
1934
- return !config.isStacked ? _this.yScaleGrouped((/** @type {?} */ (d.key))) : _this.yScaleStacked((/** @type {?} */ (d.key)));
1935
- }))
1936
- .attr('height', !config.isStacked ? this.yScaleGrouped.bandwidth() : this.yScaleStacked.bandwidth())
1937
- .style('fill', (/**
1938
- * @param {?} d
1939
- * @param {?} i
1940
- * @param {?} n
1941
- * @return {?}
1942
- */
1943
- function (d, i, n) {
1944
- if (config.spreadColorsPerGroup) {
1945
- /** @type {?} */
1946
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1947
- return _this.colors[groupIndex];
1948
- }
1949
- return _this.colors[i];
1950
- }))
1951
- .attr('width', 0)
1952
- .on('mouseover', (/**
1953
- * @param {?} d
1954
- * @param {?} i
1955
- * @param {?} n
1956
- * @return {?}
1957
- */
1958
- function (d, i, n) {
1959
- select(this).transition(transition()
1960
- .duration(self.transitionService.getTransitionDuration() / 7.5))
1961
- .style('fill', (/**
1962
- * @return {?}
1963
- */
1964
- function () {
1965
- if (config.spreadColorsPerGroup) {
1966
- /** @type {?} */
1967
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1968
- return color(self.colors[groupIndex]).darker(1).toString();
1969
- }
1970
- return color(self.colors[i]).darker(1).toString();
1971
- }));
1972
- }))
1973
- .on('mousemove', (/**
1974
- * @param {?} d
1975
- * @param {?} i
1976
- * @return {?}
1977
- */
1978
- function (d, i) {
1979
- self.tooltipBuilder.showBarTooltip(d, config.tickFormat || PcacTickFormatEnum.None);
1980
- }))
1981
- .on('mouseout', (/**
1982
- * @param {?} d
1983
- * @param {?} i
1984
- * @param {?} n
1985
- * @return {?}
1986
- */
1987
- function (d, i, n) {
1988
- self.tooltipBuilder.hideTooltip();
1989
- select(this).transition(transition()
1990
- .duration(self.transitionService.getTransitionDuration() / 5))
1991
- .style('fill', (/**
1992
- * @return {?}
1993
- */
1994
- function () {
1995
- if (config.spreadColorsPerGroup) {
1996
- /** @type {?} */
1997
- var groupIndex = parseInt(n[0].parentNode.getAttribute('data-group-id'), 10);
1998
- return self.colors[groupIndex];
1999
- }
2000
- return self.colors[i];
2001
- }));
2002
- }))
2003
- .on('click', (/**
2004
- * @param {?} d
2005
- * @param {?} i
2006
- * @return {?}
2007
- */
2008
- function (d, i) {
2009
- _this.barClickedSource.next(d);
2010
- }))
2011
- .transition(transition()
2012
- .duration(this.transitionService.getTransitionDuration()))
2013
- .attr('width', (/**
2014
- * @param {?} d
2015
- * @return {?}
2016
- */
2017
- function (d) {
2018
- return _this.xScale((/** @type {?} */ (d.value)));
2019
- }));
2020
- };
2021
- /**
2022
- * @private
2023
- * @param {?} config
2024
- * @return {?}
2025
- */
2026
- BarHorizontalChartBuilder.prototype.drawThresholdAcrossChart = /**
2027
- * @private
2028
- * @param {?} config
2029
- * @return {?}
2030
- */
2031
- function (config) {
2032
- var _this = this;
2033
- this.applyPreTransitionThresholdStyles(this.svg.select('.pcac-bars').append('rect'), config)
2034
- .attr('height', this.height)
2035
- .on('mousemove', (/**
2036
- * @param {?} d
2037
- * @param {?} i
2038
- * @return {?}
2039
- */
2040
- function (d, i) {
2041
- _this.tooltipBuilder.showBarTooltip(config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
2042
- }))
2043
- .transition(transition()
2044
- .duration(this.transitionService.getTransitionDuration()))
2045
- .attr('x', (/**
2046
- * @param {?} d
2047
- * @param {?} i
2048
- * @return {?}
2049
- */
2050
- function (d, i) {
2051
- return _this.xScale((/** @type {?} */ (config.thresholds[i].value)));
2052
- }));
2053
- };
2054
- /**
2055
- * @private
2056
- * @param {?} group
2057
- * @param {?} config
2058
- * @return {?}
2059
- */
2060
- BarHorizontalChartBuilder.prototype.drawThresholdsPerGroup = /**
2061
- * @private
2062
- * @param {?} group
2063
- * @param {?} config
2064
- * @return {?}
2065
- */
2066
- function (group, config) {
2067
- var _this = this;
2068
- this.applyPreTransitionThresholdStyles(this.svg.selectAll('.pcac-bar-group').append('rect'), config)
2069
- .attr('height', this.yScaleStacked.bandwidth())
2070
- .on('mousemove', (/**
2071
- * @param {?} d
2072
- * @param {?} i
2073
- * @return {?}
2074
- */
2075
- function (d, i) {
2076
- _this.tooltipBuilder.showBarTooltip(config.isStacked ?
2077
- config.thresholds[i].data[0] :
2078
- config.thresholds[i], config.tickFormat || PcacTickFormatEnum.None);
2079
- }))
2080
- .transition(transition()
2081
- .duration(this.transitionService.getTransitionDuration()))
2082
- .attr('x', (/**
2083
- * @param {?} d
2084
- * @param {?} i
2085
- * @return {?}
2086
- */
2087
- function (d, i) {
2088
- return _this.xScale(config.isStacked ? (/** @type {?} */ (config.thresholds[i].data[0].value)) : (/** @type {?} */ (config.thresholds[i].value)));
2089
- }));
2090
- };
2091
- /**
2092
- * @private
2093
- * @param {?} group
2094
- * @param {?} config
2095
- * @return {?}
2096
- */
2097
- BarHorizontalChartBuilder.prototype.drawThresholdsPerBarInGroup = /**
2098
- * @private
2099
- * @param {?} group
2100
- * @param {?} config
2101
- * @return {?}
2102
- */
2103
- function (group, config) {
2104
- var _this = this;
2105
- this.applyPreTransitionThresholdStyles(group.enter().append('rect'), config)
2106
- .attr('height', this.yScaleGrouped.bandwidth())
2107
- .on('mousemove', (/**
2108
- * @param {?} d
2109
- * @param {?} i
2110
- * @param {?} n
2111
- * @return {?}
2112
- */
2113
- function (d, i, n) {
2114
- _this.tooltipBuilder.showBarTooltip(config.thresholds[n[0].parentElement.dataset['groupId']].data[i], config.tickFormat || PcacTickFormatEnum.None);
2115
- }))
2116
- .transition(transition()
2117
- .duration(this.transitionService.getTransitionDuration()))
2118
- .attr('y', (/**
2119
- * @param {?} d
2120
- * @return {?}
2121
- */
2122
- function (d) {
2123
- return _this.yScaleGrouped((/** @type {?} */ (d.key)));
2124
- }))
2125
- .attr('x', (/**
2126
- * @param {?} d
2127
- * @param {?} i
2128
- * @param {?} n
2129
- * @return {?}
2130
- */
2131
- function (d, i, n) {
2132
- return _this.xScale((/** @type {?} */ (config.thresholds[n[0].parentElement.dataset['groupId']].data[i].value)));
2133
- }));
2134
- };
2135
- /**
2136
- * @private
2137
- * @param {?} elm
2138
- * @param {?} config
2139
- * @return {?}
2140
- */
2141
- BarHorizontalChartBuilder.prototype.applyPreTransitionThresholdStyles = /**
2142
- * @private
2143
- * @param {?} elm
2144
- * @param {?} config
2145
- * @return {?}
2146
- */
2147
- function (elm, config) {
2148
- var _this = this;
2149
- return elm.attr('class', 'pcac-threshold')
2150
- .style('fill', (/**
2151
- * @return {?}
2152
- */
2153
- function () {
2154
- return _this.colorService.getAlert();
2155
- }))
2156
- .style('stroke', (/**
2157
- * @return {?}
2158
- */
2159
- function () {
2160
- return _this.colorService.getAlert();
2161
- }))
2162
- .style('stroke-width', (/**
2163
- * @return {?}
2164
- */
2165
- function () {
2166
- return 2;
2167
- }))
2168
- .attr('width', '3px')
2169
- .on('mouseout', (/**
2170
- * @return {?}
2171
- */
2172
- function () {
2173
- _this.tooltipBuilder.hideTooltip();
2174
- }));
2175
- };
2176
- BarHorizontalChartBuilder.decorators = [
2177
- { type: Injectable }
2178
- ];
2179
- /** @nocollapse */
2180
- BarHorizontalChartBuilder.ctorParameters = function () { return [
2181
- { type: PcacAxisBuilder },
2182
- { type: PcacGridBuilder },
2183
- { type: PcacTransitionService },
2184
- { type: PcacTooltipBuilder },
2185
- { type: PcacColorService }
2186
- ]; };
2187
- return BarHorizontalChartBuilder;
2188
- }(PcacChart));
2189
-
2190
- /**
2191
- * @fileoverview added by tsickle
2192
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2193
- */
2194
- var PcacBarChartHorizontalComponent = /** @class */ (function () {
2195
- function PcacBarChartHorizontalComponent(chartBuilder) {
2196
- var _this = this;
2197
- this.chartBuilder = chartBuilder;
2198
- this.barClicked = new EventEmitter();
2199
- this.chartBuilder.barClicked$.subscribe((/**
2200
- * @param {?} data
2201
- * @return {?}
2202
- */
2203
- function (data) {
2204
- _this.barClicked.emit(data);
2205
- }));
2206
- }
2207
- /**
2208
- * @return {?}
2209
- */
2210
- PcacBarChartHorizontalComponent.prototype.ngOnChanges = /**
2211
- * @return {?}
2212
- */
2213
- function () {
2214
- this.buildChart();
2215
- };
2216
- /**
2217
- * @return {?}
2218
- */
2219
- PcacBarChartHorizontalComponent.prototype.buildChart = /**
2220
- * @return {?}
2221
- */
2222
- function () {
2223
- if (this.config && this.config.data && this.config.data.length > 0) {
2224
- this.chartBuilder.buildChart(this.chartElm, this.config);
2225
- }
2226
- };
2227
- /**
2228
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2229
- */
2230
- /**
2231
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2232
- * @return {?}
2233
- */
2234
- PcacBarChartHorizontalComponent.prototype.onResize = /**
2235
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2236
- * @return {?}
2237
- */
2238
- function () {
2239
- /** @type {?} */
2240
- var self = this;
2241
- clearTimeout(this.resizeWindowTimeout);
2242
- this.resizeWindowTimeout = setTimeout((/**
2243
- * @return {?}
2244
- */
2245
- function () {
2246
- self.buildChart();
2247
- }), 300);
2248
- };
2249
- PcacBarChartHorizontalComponent.decorators = [
2250
- { type: Component, args: [{
2251
- selector: 'pcac-bar-horizontal-chart',
2252
- template: "<section class=\"pcac-bar-horizontal-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n",
2253
- providers: [
2254
- BarHorizontalChartBuilder
2255
- ]
2256
- }] }
2257
- ];
2258
- /** @nocollapse */
2259
- PcacBarChartHorizontalComponent.ctorParameters = function () { return [
2260
- { type: BarHorizontalChartBuilder }
2261
- ]; };
2262
- PcacBarChartHorizontalComponent.propDecorators = {
2263
- config: [{ type: Input }],
2264
- chartElm: [{ type: ViewChild, args: ['chart', { static: true },] }],
2265
- barClicked: [{ type: Output }],
2266
- onResize: [{ type: HostListener, args: ['window:resize',] }]
2267
- };
2268
- return PcacBarChartHorizontalComponent;
2269
- }());
2270
-
2271
- /**
2272
- * @fileoverview added by tsickle
2273
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2274
- */
2275
-
2276
- /**
2277
- * @fileoverview added by tsickle
2278
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2279
- */
2280
- var PcacBarHorizontalChartModule = /** @class */ (function () {
2281
- function PcacBarHorizontalChartModule() {
2282
- }
2283
- PcacBarHorizontalChartModule.decorators = [
2284
- { type: NgModule, args: [{
2285
- exports: [
2286
- PcacBarChartHorizontalComponent
2287
- ],
2288
- declarations: [
2289
- PcacBarChartHorizontalComponent
2290
- ]
2291
- },] }
2292
- ];
2293
- return PcacBarHorizontalChartModule;
2294
- }());
2295
-
2296
- /**
2297
- * @fileoverview added by tsickle
2298
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2299
- */
2300
-
2301
- /**
2302
- * @fileoverview added by tsickle
2303
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2304
- */
2305
-
2306
- /**
2307
- * @fileoverview added by tsickle
2308
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2309
- */
2310
- var PieChartBuilder = /** @class */ (function (_super) {
2311
- __extends(PieChartBuilder, _super);
2312
- function PieChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
2313
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
2314
- _this.axisBuilder = axisBuilder;
2315
- _this.gridBuilder = gridBuilder;
2316
- _this.transitionService = transitionService;
2317
- _this.tooltipBuilder = tooltipBuilder;
2318
- _this.colorService = colorService;
2319
- _this.sliceClickedSource = new Subject();
2320
- _this.sliceClicked$ = _this.sliceClickedSource.asObservable();
2321
- return _this;
2322
- }
2323
- /**
2324
- * @param {?} chartElm
2325
- * @param {?} config
2326
- * @return {?}
2327
- */
2328
- PieChartBuilder.prototype.buildChart = /**
2329
- * @param {?} chartElm
2330
- * @param {?} config
2331
- * @return {?}
2332
- */
2333
- function (chartElm, config) {
2334
- this.initializeChartState(chartElm, config);
2335
- this.radius = Math.min(Math.min(this.height, this.width), Math.min(this.height, this.width)) / 2;
2336
- this.buildShapes(config);
2337
- this.drawChart(chartElm, config);
2338
- };
2339
- /**
2340
- * @private
2341
- * @param {?} config
2342
- * @return {?}
2343
- */
2344
- PieChartBuilder.prototype.buildShapes = /**
2345
- * @private
2346
- * @param {?} config
2347
- * @return {?}
2348
- */
2349
- function (config) {
2350
- /** @type {?} */
2351
- var radiusOffset = 10;
2352
- this.arcShape = arc()
2353
- .innerRadius(0)
2354
- .outerRadius(this.radius - radiusOffset);
2355
- this.arcOverShape = arc()
2356
- .innerRadius(0)
2357
- .outerRadius(this.radius - radiusOffset + radiusOffset);
2358
- this.pieAngles = pie()
2359
- .sort(null)
2360
- .value((/**
2361
- * @param {?} d
2362
- * @return {?}
2363
- */
2364
- function (d) { return d.value; })); // TODO: Strongly type
2365
- };
2366
- /**
2367
- * @private
2368
- * @param {?} chartElm
2369
- * @param {?} config
2370
- * @return {?}
2371
- */
2372
- PieChartBuilder.prototype.drawChart = /**
2373
- * @private
2374
- * @param {?} chartElm
2375
- * @param {?} config
2376
- * @return {?}
2377
- */
2378
- function (chartElm, config) {
2379
- var _this = this;
2380
- this.buildContainer(chartElm, true);
2381
- /** @type {?} */
2382
- var self = this;
2383
- this.svg.selectAll('.pcac-arc')
2384
- .data(this.pieAngles(config.data))
2385
- .enter().append('g')
2386
- .attr('class', 'pcac-arc')
2387
- .append('path')
2388
- .style('fill', (/**
2389
- * @param {?} d
2390
- * @param {?} i
2391
- * @return {?}
2392
- */
2393
- function (d, i) {
2394
- return _this.colors[i];
2395
- }))
2396
- .on('mouseover', (/**
2397
- * @param {?} d
2398
- * @param {?} i
2399
- * @return {?}
2400
- */
2401
- function (d, i) {
2402
- select(this).transition(transition()
2403
- .duration(self.transitionService.getTransitionDuration() / 3))
2404
- .attr('d', self.arcOverShape)
2405
- .style('fill', color(self.colors[i]).darker(1).toString());
2406
- }))
2407
- .on('mousemove', (/**
2408
- * @param {?} d
2409
- * @return {?}
2410
- */
2411
- function (d) {
2412
- self.tooltipBuilder.showBarTooltip(d.data);
2413
- }))
2414
- .on('mouseout', (/**
2415
- * @param {?} d
2416
- * @param {?} i
2417
- * @return {?}
2418
- */
2419
- function (d, i) {
2420
- self.tooltipBuilder.hideTooltip();
2421
- select(this).transition(transition()
2422
- .duration(self.transitionService.getTransitionDuration() / 3))
2423
- .attr('d', self.arcShape)
2424
- .style('fill', self.colors[i]);
2425
- }))
2426
- .on('click', (/**
2427
- * @param {?} d
2428
- * @param {?} i
2429
- * @return {?}
2430
- */
2431
- function (d, i) {
2432
- _this.sliceClickedSource.next(d.data);
2433
- }))
2434
- .transition(transition()
2435
- .duration(this.transitionService.getTransitionDuration()))
2436
- .attrTween('d', (/**
2437
- * @param {?} b
2438
- * @return {?}
2439
- */
2440
- function (b) {
2441
- return _this.tweenChart(b);
2442
- }));
2443
- };
2444
- /**
2445
- * @private
2446
- * @param {?} b
2447
- * @return {?}
2448
- */
2449
- PieChartBuilder.prototype.tweenChart = /**
2450
- * @private
2451
- * @param {?} b
2452
- * @return {?}
2453
- */
2454
- function (b) {
2455
- var _this = this;
2456
- b.innerRadius = 0;
2457
- /** @type {?} */
2458
- var i = interpolate({ startAngle: 0, endAngle: 0 }, b);
2459
- return (/**
2460
- * @param {?} t
2461
- * @return {?}
2462
- */
2463
- function (t) { return _this.arcShape(i(t)); }); // TODO: Strongly type
2464
- };
2465
- PieChartBuilder.decorators = [
2466
- { type: Injectable }
2467
- ];
2468
- /** @nocollapse */
2469
- PieChartBuilder.ctorParameters = function () { return [
2470
- { type: PcacAxisBuilder },
2471
- { type: PcacGridBuilder },
2472
- { type: PcacTransitionService },
2473
- { type: PcacTooltipBuilder },
2474
- { type: PcacColorService }
2475
- ]; };
2476
- return PieChartBuilder;
2477
- }(PcacChart));
2478
-
2479
- /**
2480
- * @fileoverview added by tsickle
2481
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2482
- */
2483
- var PcacPieChartComponent = /** @class */ (function () {
2484
- function PcacPieChartComponent(chartBuilder) {
2485
- var _this = this;
2486
- this.chartBuilder = chartBuilder;
2487
- this.sliceClicked = new EventEmitter();
2488
- this.chartBuilder.sliceClicked$.subscribe((/**
2489
- * @param {?} data
2490
- * @return {?}
2491
- */
2492
- function (data) {
2493
- _this.sliceClicked.emit(data);
2494
- }));
2495
- }
2496
- /**
2497
- * @return {?}
2498
- */
2499
- PcacPieChartComponent.prototype.ngOnChanges = /**
2500
- * @return {?}
2501
- */
2502
- function () {
2503
- this.buildChart();
2504
- };
2505
- /**
2506
- * @return {?}
2507
- */
2508
- PcacPieChartComponent.prototype.buildChart = /**
2509
- * @return {?}
2510
- */
2511
- function () {
2512
- if (this.config && this.config.data && this.config.data.length > 0) {
2513
- this.chartBuilder.buildChart(this.chartElm, this.config);
2514
- }
2515
- };
2516
- /**
2517
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2518
- */
2519
- /**
2520
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2521
- * @return {?}
2522
- */
2523
- PcacPieChartComponent.prototype.onResize = /**
2524
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
2525
- * @return {?}
2526
- */
2527
- function () {
2528
- /** @type {?} */
2529
- var self = this;
2530
- clearTimeout(this.resizeWindowTimeout);
2531
- this.resizeWindowTimeout = setTimeout((/**
2532
- * @return {?}
2533
- */
2534
- function () {
2535
- self.buildChart();
2536
- }), 300);
2537
- };
2538
- PcacPieChartComponent.decorators = [
2539
- { type: Component, args: [{
2540
- selector: 'pcac-pie-chart',
2541
- template: "<section class=\"pcac-pie-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n\r\n",
2542
- providers: [
2543
- PieChartBuilder
2544
- ]
2545
- }] }
2546
- ];
2547
- /** @nocollapse */
2548
- PcacPieChartComponent.ctorParameters = function () { return [
2549
- { type: PieChartBuilder }
2550
- ]; };
2551
- PcacPieChartComponent.propDecorators = {
2552
- config: [{ type: Input }],
2553
- chartElm: [{ type: ViewChild, args: ['chart', { static: true },] }],
2554
- sliceClicked: [{ type: Output }],
2555
- onResize: [{ type: HostListener, args: ['window:resize',] }]
2556
- };
2557
- return PcacPieChartComponent;
2558
- }());
2559
-
2560
- /**
2561
- * @fileoverview added by tsickle
2562
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2563
- */
2564
-
2565
- /**
2566
- * @fileoverview added by tsickle
2567
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2568
- */
2569
- var PcacPieChartModule = /** @class */ (function () {
2570
- function PcacPieChartModule() {
2571
- }
2572
- PcacPieChartModule.decorators = [
2573
- { type: NgModule, args: [{
2574
- exports: [
2575
- PcacPieChartComponent
2576
- ],
2577
- declarations: [
2578
- PcacPieChartComponent
2579
- ]
2580
- },] }
2581
- ];
2582
- return PcacPieChartModule;
2583
- }());
2584
-
2585
- /**
2586
- * @fileoverview added by tsickle
2587
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2588
- */
2589
-
2590
- /**
2591
- * @fileoverview added by tsickle
2592
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2593
- */
2594
-
2595
- /**
2596
- * @fileoverview added by tsickle
2597
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2598
- */
2599
- var LineAreaChartEffectsBuilder = /** @class */ (function () {
2600
- function LineAreaChartEffectsBuilder() {
2601
- this.lines = (/** @type {?} */ ([]));
2602
- }
2603
- /**
2604
- * @param {?} config
2605
- * @return {?}
2606
- */
2607
- LineAreaChartEffectsBuilder.prototype.buildEffects = /**
2608
- * @param {?} config
2609
- * @return {?}
2610
- */
2611
- function (config) {
2612
- var _this = this;
2613
- this.config = config;
2614
- this.lines = (/** @type {?} */ ([]));
2615
- this.config.svg.selectAll('.line').each((/**
2616
- * @param {?} d
2617
- * @param {?} i
2618
- * @param {?} n
2619
- * @return {?}
2620
- */
2621
- function (d, i, n) {
2622
- _this.lines.push(n[i]);
2623
- }));
2624
- this.buildCollection();
2625
- this.buildCanvas();
2626
- };
2627
- /**
2628
- * @private
2629
- * @return {?}
2630
- */
2631
- LineAreaChartEffectsBuilder.prototype.buildCollection = /**
2632
- * @private
2633
- * @return {?}
2634
- */
2635
- function () {
2636
- var _this = this;
2637
- /** @type {?} */
2638
- var collection = this.config.svg.append('g')
2639
- .attr('class', 'effects');
2640
- collection.append('path')
2641
- .attr('class', 'effect-line');
2642
- /** @type {?} */
2643
- var mousePerLine = collection.selectAll('.effect-group')
2644
- .data(this.config.data.filter((/**
2645
- * @param {?} elm
2646
- * @return {?}
2647
- */
2648
- function (elm) {
2649
- return elm.data.length > 0;
2650
- })))
2651
- .enter().append('g')
2652
- .attr('class', 'effect-group');
2653
- mousePerLine.append('circle')
2654
- .attr('r', 7)
2655
- .attr('class', 'effect-circle')
2656
- .style('stroke', (/**
2657
- * @param {?} d
2658
- * @param {?} i
2659
- * @return {?}
2660
- */
2661
- function (d, i) {
2662
- return _this.config.colors[i];
2663
- }));
2664
- mousePerLine.append('text')
2665
- .attr('class', 'effect-text')
2666
- .attr('y', 1.5)
2667
- .attr('transform', 'translate(10,3)');
2668
- };
2669
- /**
2670
- * @private
2671
- * @return {?}
2672
- */
2673
- LineAreaChartEffectsBuilder.prototype.buildCanvas = /**
2674
- * @private
2675
- * @return {?}
2676
- */
2677
- function () {
2678
- var _this = this;
2679
- this.config.svg.append('rect')
2680
- .attr('class', 'effects-canvas')
2681
- .attr('width', this.config.width)
2682
- .attr('height', this.config.height)
2683
- .attr('pointer-events', 'all')
2684
- .on('mouseout', (/**
2685
- * @return {?}
2686
- */
2687
- function () {
2688
- _this.hideEffects();
2689
- }))
2690
- .on('mouseover', (/**
2691
- * @return {?}
2692
- */
2693
- function () {
2694
- _this.showEffects();
2695
- }))
2696
- .on('mousemove', (/**
2697
- * @param {?} d
2698
- * @param {?} i
2699
- * @param {?} nodes
2700
- * @return {?}
2701
- */
2702
- function (d, i, nodes) {
2703
- _this.onMouseMove(d, i, nodes);
2704
- }));
2705
- };
2706
- /**
2707
- * @private
2708
- * @return {?}
2709
- */
2710
- LineAreaChartEffectsBuilder.prototype.showEffects = /**
2711
- * @private
2712
- * @return {?}
2713
- */
2714
- function () {
2715
- this.config.svg.select('.effect-line')
2716
- .style('opacity', '1');
2717
- this.config.svg.selectAll('.effect-group circle')
2718
- .style('opacity', '1');
2719
- this.config.svg.selectAll('.effect-group text')
2720
- .style('opacity', '1');
2721
- };
2722
- /**
2723
- * @private
2724
- * @return {?}
2725
- */
2726
- LineAreaChartEffectsBuilder.prototype.hideEffects = /**
2727
- * @private
2728
- * @return {?}
2729
- */
2730
- function () {
2731
- this.config.svg.select('.effect-line')
2732
- .style('opacity', '0');
2733
- this.config.svg.selectAll('.effect-group circle')
2734
- .style('opacity', '0');
2735
- this.config.svg.selectAll('.effect-group text')
2736
- .style('opacity', '0');
2737
- };
2738
- /**
2739
- * @private
2740
- * @param {?} d
2741
- * @param {?} i
2742
- * @param {?} nodes
2743
- * @return {?}
2744
- */
2745
- LineAreaChartEffectsBuilder.prototype.onMouseMove = /**
2746
- * @private
2747
- * @param {?} d
2748
- * @param {?} i
2749
- * @param {?} nodes
2750
- * @return {?}
2751
- */
2752
- function (d, i, nodes) {
2753
- /** @type {?} */
2754
- var mousePos = mouse(nodes[i]);
2755
- this.updateLine(mousePos);
2756
- this.updateEffects(mousePos);
2757
- };
2758
- /**
2759
- * @private
2760
- * @param {?} mousePos
2761
- * @return {?}
2762
- */
2763
- LineAreaChartEffectsBuilder.prototype.updateLine = /**
2764
- * @private
2765
- * @param {?} mousePos
2766
- * @return {?}
2767
- */
2768
- function (mousePos) {
2769
- var _this = this;
2770
- this.config.svg.select('.effect-line')
2771
- .attr('d', (/**
2772
- * @return {?}
2773
- */
2774
- function () {
2775
- return 'M' + mousePos[0] + ',' + _this.config.height + ' ' + mousePos[0] + ',' + 0;
2776
- }));
2777
- };
2778
- /**
2779
- * @private
2780
- * @param {?} mousePos
2781
- * @return {?}
2782
- */
2783
- LineAreaChartEffectsBuilder.prototype.updateEffects = /**
2784
- * @private
2785
- * @param {?} mousePos
2786
- * @return {?}
2787
- */
2788
- function (mousePos) {
2789
- var _this = this;
2790
- this.config.svg.selectAll('.effect-group')
2791
- .attr('transform', (/**
2792
- * @param {?} data
2793
- * @param {?} index
2794
- * @param {?} nodes
2795
- * @return {?}
2796
- */
2797
- function (data, index, nodes) {
2798
- /** @type {?} */
2799
- var beginning = 0;
2800
- /** @type {?} */
2801
- var end = _this.lines[index].getTotalLength();
2802
- /** @type {?} */
2803
- var target = 0;
2804
- /** @type {?} */
2805
- var pos;
2806
- while (true) {
2807
- target = Math.floor((beginning + end) / 2);
2808
- pos = _this.lines[index].getPointAtLength(target);
2809
- if ((target === end || target === beginning) && pos.x !== mousePos[0]) {
2810
- break;
2811
- }
2812
- if (pos.x > mousePos[0]) {
2813
- end = target;
2814
- }
2815
- else if (pos.x < mousePos[0]) {
2816
- beginning = target;
2817
- }
2818
- else {
2819
- break;
2820
- }
2821
- }
2822
- select(nodes[index]).select('text')
2823
- .text(_this.config.y.invert(pos.y).toFixed(0));
2824
- return 'translate(' + mousePos[0] + ',' + pos.y + ')';
2825
- }));
2826
- };
2827
- return LineAreaChartEffectsBuilder;
2828
- }());
2829
-
2830
- /**
2831
- * @fileoverview added by tsickle
2832
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2833
- */
2834
- var LineAreaChartBuilder = /** @class */ (function (_super) {
2835
- __extends(LineAreaChartBuilder, _super);
2836
- function LineAreaChartBuilder(axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) {
2837
- var _this = _super.call(this, axisBuilder, gridBuilder, transitionService, tooltipBuilder, colorService) || this;
2838
- _this.axisBuilder = axisBuilder;
2839
- _this.gridBuilder = gridBuilder;
2840
- _this.transitionService = transitionService;
2841
- _this.tooltipBuilder = tooltipBuilder;
2842
- _this.colorService = colorService;
2843
- _this.dotClickedSource = new Subject();
2844
- _this.dotClicked$ = _this.dotClickedSource.asObservable();
2845
- return _this;
2846
- }
2847
- /**
2848
- * @param {?} chartElm
2849
- * @param {?} config
2850
- * @return {?}
2851
- */
2852
- LineAreaChartBuilder.prototype.buildChart = /**
2853
- * @param {?} chartElm
2854
- * @param {?} config
2855
- * @return {?}
2856
- */
2857
- function (chartElm, config) {
2858
- this.config = JSON.parse(JSON.stringify(config));
2859
- this.startData = range(this.config.data[0].data.length).map((/**
2860
- * @param {?} d
2861
- * @return {?}
2862
- */
2863
- function (d) {
2864
- return {
2865
- value: 0,
2866
- key: ''
2867
- };
2868
- }));
2869
- if (this.config.hideAxis) {
2870
- this.adjustForHiddenAxis();
2871
- }
2872
- this.initializeChartState(chartElm, this.config);
2873
- this.buildScales(this.config);
2874
- this.drawChart(chartElm, this.config);
2875
- };
2876
- /**
2877
- * @private
2878
- * @return {?}
2879
- */
2880
- LineAreaChartBuilder.prototype.adjustForHiddenAxis = /**
2881
- * @private
2882
- * @return {?}
2883
- */
2884
- function () {
2885
- this.config.height = this.config.height + 12;
2886
- this.margin.top = 8;
2887
- this.margin.bottom = 8;
2888
- this.margin.left = 8;
2889
- this.margin.right = 8;
2890
- };
2891
- /**
2892
- * @private
2893
- * @param {?} config
2894
- * @return {?}
2895
- */
2896
- LineAreaChartBuilder.prototype.buildScales = /**
2897
- * @private
2898
- * @param {?} config
2899
- * @return {?}
2900
- */
2901
- function (config) {
2902
- var _this = this;
2903
- this.xScale = scaleLinear()
2904
- .domain([0, config.data[0].data.length - 1])
2905
- .range([0, this.width]);
2906
- this.yScale = scaleLinear()
2907
- .domain([0, config.domainMax])
2908
- .range([this.height, 0]);
2909
- this.line = line()
2910
- .x((/**
2911
- * @param {?} d
2912
- * @param {?} i
2913
- * @return {?}
2914
- */
2915
- function (d, i) {
2916
- return _this.xScale(i);
2917
- }))
2918
- .y((/**
2919
- * @param {?} d
2920
- * @return {?}
2921
- */
2922
- function (d) {
2923
- return _this.yScale(d.value);
2924
- }));
2925
- this.area = area()
2926
- .x((/**
2927
- * @param {?} d
2928
- * @param {?} i
2929
- * @return {?}
2930
- */
2931
- function (d, i) {
2932
- return _this.xScale(i);
2933
- }))
2934
- .y0(this.height)
2935
- .y1((/**
2936
- * @param {?} d
2937
- * @return {?}
2938
- */
2939
- function (d) {
2940
- return _this.yScale(d.value);
2941
- }));
2942
- };
2943
- /**
2944
- * @private
2945
- * @param {?} chartElm
2946
- * @param {?} config
2947
- * @return {?}
2948
- */
2949
- LineAreaChartBuilder.prototype.drawChart = /**
2950
- * @private
2951
- * @param {?} chartElm
2952
- * @param {?} config
2953
- * @return {?}
2954
- */
2955
- function (chartElm, config) {
2956
- this.buildContainer(chartElm);
2957
- if (!config.hideAxis) {
2958
- this.axisBuilder.drawAxis({
2959
- svg: this.svg,
2960
- numberOfTicks: config.numberOfTicks || 5,
2961
- height: this.height,
2962
- xScale: this.xScale,
2963
- yScale: this.yScale
2964
- });
2965
- }
2966
- if (!config.hideGrid) {
2967
- this.gridBuilder.drawHorizontalGrid({
2968
- svg: this.svg,
2969
- numberOfTicks: config.numberOfTicks || 5,
2970
- width: this.width,
2971
- xScale: this.xScale,
2972
- yScale: this.yScale
2973
- });
2974
- }
2975
- this.drawLineArea(config);
2976
- if (config.enableEffects) {
2977
- this.drawEffects(config);
2978
- }
2979
- this.drawDots(config);
2980
- };
2981
- /**
2982
- * @private
2983
- * @param {?} config
2984
- * @return {?}
2985
- */
2986
- LineAreaChartBuilder.prototype.drawLineArea = /**
2987
- * @private
2988
- * @param {?} config
2989
- * @return {?}
2990
- */
2991
- function (config) {
2992
- for (var i = 0; i < config.data.length; i++) {
2993
- if (config.isArea) {
2994
- this.drawArea(config.data[i].data, i);
2995
- }
2996
- this.drawLine(config.data[i].data, i);
2997
- }
2998
- };
2999
- /**
3000
- * @private
3001
- * @param {?} lineData
3002
- * @param {?} index
3003
- * @return {?}
3004
- */
3005
- LineAreaChartBuilder.prototype.drawLine = /**
3006
- * @private
3007
- * @param {?} lineData
3008
- * @param {?} index
3009
- * @return {?}
3010
- */
3011
- function (lineData, index) {
3012
- var _this = this;
3013
- this.svg.append('g')
3014
- .attr('class', 'lines')
3015
- .append('path')
3016
- .datum(lineData)
3017
- .attr('class', 'line')
3018
- .attr('d', this.line(this.startData))
3019
- .transition(transition()
3020
- .duration(this.transitionService.getTransitionDuration()))
3021
- .attr('d', (/** @type {?} */ (this.line))) // TODO: strongly type
3022
- .attr('stroke', (/**
3023
- * @return {?}
3024
- */
3025
- function () {
3026
- return _this.colors[index];
3027
- }))
3028
- .attr('fill', 'none');
3029
- };
3030
- /**
3031
- * @private
3032
- * @param {?} lineData
3033
- * @param {?} index
3034
- * @return {?}
3035
- */
3036
- LineAreaChartBuilder.prototype.drawArea = /**
3037
- * @private
3038
- * @param {?} lineData
3039
- * @param {?} index
3040
- * @return {?}
3041
- */
3042
- function (lineData, index) {
3043
- var _this = this;
3044
- this.svg.append('g')
3045
- .attr('class', 'areas')
3046
- .append('path')
3047
- .datum(lineData)
3048
- .attr('class', 'area')
3049
- .style('opacity', 0.5)
3050
- .style('fill', (/**
3051
- * @return {?}
3052
- */
3053
- function () {
3054
- return _this.colors[index]; // TODO: strongly type
3055
- }))
3056
- .attr('d', this.line(this.startData))
3057
- .transition(transition()
3058
- .duration(this.transitionService.getTransitionDuration()))
3059
- .attr('d', (/** @type {?} */ (this.area))); // TODO: strongly type
3060
- };
3061
- /**
3062
- * @private
3063
- * @param {?} config
3064
- * @return {?}
3065
- */
3066
- LineAreaChartBuilder.prototype.drawEffects = /**
3067
- * @private
3068
- * @param {?} config
3069
- * @return {?}
3070
- */
3071
- function (config) {
3072
- if (config.enableEffects) {
3073
- /** @type {?} */
3074
- var effectsBuilder = new LineAreaChartEffectsBuilder();
3075
- effectsBuilder.buildEffects({
3076
- svg: this.svg,
3077
- height: this.height,
3078
- width: this.width,
3079
- data: config.data,
3080
- colors: this.colors,
3081
- x: this.xScale,
3082
- y: this.yScale
3083
- });
3084
- }
3085
- };
3086
- /**
3087
- * @private
3088
- * @param {?} config
3089
- * @return {?}
3090
- */
3091
- LineAreaChartBuilder.prototype.drawDots = /**
3092
- * @private
3093
- * @param {?} config
3094
- * @return {?}
3095
- */
3096
- function (config) {
3097
- var _this = this;
3098
- /** @type {?} */
3099
- var self = this;
3100
- var _loop_1 = function (index) {
3101
- this_1.svg.append('g')
3102
- .attr('class', 'dots')
3103
- .selectAll('.dot')
3104
- .data(config.data[index].data)
3105
- .enter().append('circle')
3106
- .attr('class', 'dot')
3107
- .attr('stroke', (/**
3108
- * @param {?} d
3109
- * @return {?}
3110
- */
3111
- function (d) {
3112
- return _this.colors[index];
3113
- }))
3114
- .attr('cx', (/**
3115
- * @param {?} d
3116
- * @param {?} i
3117
- * @return {?}
3118
- */
3119
- function (d, i) {
3120
- return _this.xScale(i);
3121
- }))
3122
- .attr('cy', (/**
3123
- * @param {?} d
3124
- * @return {?}
3125
- */
3126
- function (d) {
3127
- return _this.yScale(0);
3128
- }))
3129
- .attr('fill', '#fff')
3130
- .on('mouseover', (/**
3131
- * @param {?} d
3132
- * @return {?}
3133
- */
3134
- function (d) {
3135
- self.tooltipBuilder.showBarTooltip(d);
3136
- select(this).transition(transition()
3137
- .duration(self.transitionService.getTransitionDuration() / 3))
3138
- .attr('r', 6)
3139
- .attr('fill', self.colors[index]);
3140
- }))
3141
- .on('mouseout', (/**
3142
- * @return {?}
3143
- */
3144
- function () {
3145
- self.tooltipBuilder.hideTooltip();
3146
- select(this).transition(transition()
3147
- .duration(self.transitionService.getTransitionDuration() / 3))
3148
- .attr('r', 4)
3149
- .attr('fill', '#fff');
3150
- }))
3151
- .on('click', (/**
3152
- * @param {?} d
3153
- * @param {?} i
3154
- * @return {?}
3155
- */
3156
- function (d, i) {
3157
- _this.dotClickedSource.next(d);
3158
- }))
3159
- .transition(transition()
3160
- .duration(this_1.transitionService.getTransitionDuration()))
3161
- .attr('cy', (/**
3162
- * @param {?} d
3163
- * @return {?}
3164
- */
3165
- function (d) {
3166
- return _this.yScale((/** @type {?} */ (d.value)));
3167
- }))
3168
- .attr('r', 4);
3169
- };
3170
- var this_1 = this;
3171
- for (var index = 0; index < config.data.length; index++) {
3172
- _loop_1(index);
3173
- }
3174
- };
3175
- LineAreaChartBuilder.decorators = [
3176
- { type: Injectable }
3177
- ];
3178
- /** @nocollapse */
3179
- LineAreaChartBuilder.ctorParameters = function () { return [
3180
- { type: PcacAxisBuilder },
3181
- { type: PcacGridBuilder },
3182
- { type: PcacTransitionService },
3183
- { type: PcacTooltipBuilder },
3184
- { type: PcacColorService }
3185
- ]; };
3186
- return LineAreaChartBuilder;
3187
- }(PcacChart));
3188
-
3189
- /**
3190
- * @fileoverview added by tsickle
3191
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3192
- */
3193
- var PcacLineAreaChartComponent = /** @class */ (function () {
3194
- function PcacLineAreaChartComponent(chartBuilder) {
3195
- var _this = this;
3196
- this.chartBuilder = chartBuilder;
3197
- this.dotClicked = new EventEmitter();
3198
- this.chartBuilder.dotClicked$.subscribe((/**
3199
- * @param {?} data
3200
- * @return {?}
3201
- */
3202
- function (data) {
3203
- _this.dotClicked.emit(data);
3204
- }));
3205
- }
3206
- /**
3207
- * @return {?}
3208
- */
3209
- PcacLineAreaChartComponent.prototype.ngOnChanges = /**
3210
- * @return {?}
3211
- */
3212
- function () {
3213
- this.buildChart();
3214
- };
3215
- /**
3216
- * @return {?}
3217
- */
3218
- PcacLineAreaChartComponent.prototype.buildChart = /**
3219
- * @return {?}
3220
- */
3221
- function () {
3222
- if (this.config && this.config.data && this.config.data.length > 0) {
3223
- this.chartBuilder.buildChart(this.chartElm, this.config);
3224
- }
3225
- };
3226
- /**
3227
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
3228
- */
3229
- /**
3230
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
3231
- * @return {?}
3232
- */
3233
- PcacLineAreaChartComponent.prototype.onResize = /**
3234
- * Opting against fromEvent due to incompatibility with rxjs 5 => 6
3235
- * @return {?}
3236
- */
3237
- function () {
3238
- /** @type {?} */
3239
- var self = this;
3240
- clearTimeout(this.resizeWindowTimeout);
3241
- this.resizeWindowTimeout = setTimeout((/**
3242
- * @return {?}
3243
- */
3244
- function () {
3245
- self.buildChart();
3246
- }), 300);
3247
- };
3248
- PcacLineAreaChartComponent.decorators = [
3249
- { type: Component, args: [{
3250
- selector: 'pcac-line-area-chart',
3251
- template: "<section class=\"pcac-line-area-chart\">\r\n <svg #chart></svg>\r\n</section>\r\n\r\n",
3252
- providers: [
3253
- LineAreaChartBuilder
3254
- ]
3255
- }] }
3256
- ];
3257
- /** @nocollapse */
3258
- PcacLineAreaChartComponent.ctorParameters = function () { return [
3259
- { type: LineAreaChartBuilder }
3260
- ]; };
3261
- PcacLineAreaChartComponent.propDecorators = {
3262
- config: [{ type: Input }],
3263
- chartElm: [{ type: ViewChild, args: ['chart', { static: true },] }],
3264
- dotClicked: [{ type: Output }],
3265
- onResize: [{ type: HostListener, args: ['window:resize',] }]
3266
- };
3267
- return PcacLineAreaChartComponent;
3268
- }());
3269
-
3270
- /**
3271
- * @fileoverview added by tsickle
3272
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3273
- */
3274
-
3275
- /**
3276
- * @fileoverview added by tsickle
3277
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3278
- */
3279
- var PcacLineAreaChartModule = /** @class */ (function () {
3280
- function PcacLineAreaChartModule() {
3281
- }
3282
- PcacLineAreaChartModule.decorators = [
3283
- { type: NgModule, args: [{
3284
- exports: [
3285
- PcacLineAreaChartComponent
3286
- ],
3287
- declarations: [
3288
- PcacLineAreaChartComponent
3289
- ]
3290
- },] }
3291
- ];
3292
- return PcacLineAreaChartModule;
3293
- }());
3294
-
3295
- /**
3296
- * @fileoverview added by tsickle
3297
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3298
- */
3299
-
3300
- /**
3301
- * @fileoverview added by tsickle
3302
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3303
- */
3304
-
3305
- /**
3306
- * @fileoverview added by tsickle
3307
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3308
- */
3309
- var PcacDialogComponent = /** @class */ (function () {
3310
- function PcacDialogComponent() {
3311
- this.width = '50%';
3312
- this.closed = new EventEmitter();
3313
- this.opened = new EventEmitter();
3314
- this.show = false;
3315
- }
3316
- /**
3317
- * @return {?}
3318
- */
3319
- PcacDialogComponent.prototype.close = /**
3320
- * @return {?}
3321
- */
3322
- function () {
3323
- this.show = false;
3324
- this.closed.emit();
3325
- };
3326
- /**
3327
- * @return {?}
3328
- */
3329
- PcacDialogComponent.prototype.open = /**
3330
- * @return {?}
3331
- */
3332
- function () {
3333
- this.show = true;
3334
- this.opened.emit();
3335
- };
3336
- PcacDialogComponent.decorators = [
3337
- { type: Component, args: [{
3338
- selector: 'pcac-dialog',
3339
- template: "<div class=\"pcac-modal\" *ngIf=\"show\">\r\n <div class=\"pcac-modal-overlay\" (click)=\"close()\"></div>\r\n <div class=\"pcac-modal-dialog\" ng-style=\"dialogStyle\" [style.width]=\"width\">\r\n <div class=\"pcac-modal-dialog-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</div>\r\n",
3340
- styles: [".pcac-modal{position:fixed;z-index:9999;top:0;left:0;width:100%;height:100%;border:1px solid #212529}.pcac-modal-overlay{position:absolute;z-index:9000;top:0;left:0;width:100%;height:100%;background-color:#212529;opacity:.8}.pcac-modal-dialog{z-index:9999;position:absolute;top:50%;left:50%;width:50%;overflow-x:hidden;overflow-y:auto;max-height:95%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#fff;box-shadow:4px 4px 80px #212529;padding:1rem}.pcac-modal-dialog-content{position:relative;overflow:hidden;height:100%}"]
3341
- }] }
3342
- ];
3343
- PcacDialogComponent.propDecorators = {
3344
- width: [{ type: Input }],
3345
- closed: [{ type: Output }],
3346
- opened: [{ type: Output }]
3347
- };
3348
- return PcacDialogComponent;
3349
- }());
3350
-
3351
- /**
3352
- * @fileoverview added by tsickle
3353
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3354
- */
3355
- var PcacDialogModule = /** @class */ (function () {
3356
- function PcacDialogModule() {
3357
- }
3358
- PcacDialogModule.decorators = [
3359
- { type: NgModule, args: [{
3360
- imports: [
3361
- CommonModule
3362
- ],
3363
- exports: [
3364
- PcacDialogComponent
3365
- ],
3366
- declarations: [
3367
- PcacDialogComponent
3368
- ]
3369
- },] }
3370
- ];
3371
- return PcacDialogModule;
3372
- }());
3373
-
3374
- /**
3375
- * @fileoverview added by tsickle
3376
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3377
- */
3378
-
3379
- /**
3380
- * @fileoverview added by tsickle
3381
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3382
- */
3383
-
3384
- /**
3385
- * @fileoverview added by tsickle
3386
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3387
- */
3388
- var PcacSpinnerComponent = /** @class */ (function () {
3389
- function PcacSpinnerComponent() {
3390
- this.showSpinner = true;
3391
- this.showOverlay = true;
3392
- }
3393
- PcacSpinnerComponent.decorators = [
3394
- { type: Component, args: [{
3395
- selector: 'pcac-spinner',
3396
- template: "<section *ngIf=\"showSpinner\" class=\"pcac-spinner\">\r\n <div class=\"overlay\" *ngIf=\"showOverlay\"></div>\r\n <div class=\"wrapper\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\r\n <path d=\"M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z\"></path>\r\n </svg>\r\n </div>\r\n</section>\r\n"
3397
- }] }
3398
- ];
3399
- PcacSpinnerComponent.propDecorators = {
3400
- showSpinner: [{ type: Input }],
3401
- showOverlay: [{ type: Input }]
3402
- };
3403
- return PcacSpinnerComponent;
3404
- }());
3405
-
3406
- /**
3407
- * @fileoverview added by tsickle
3408
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3409
- */
3410
- var PcacSpinnerModule = /** @class */ (function () {
3411
- function PcacSpinnerModule() {
3412
- }
3413
- PcacSpinnerModule.decorators = [
3414
- { type: NgModule, args: [{
3415
- imports: [
3416
- CommonModule
3417
- ],
3418
- exports: [
3419
- PcacSpinnerComponent
3420
- ],
3421
- declarations: [
3422
- PcacSpinnerComponent
3423
- ]
3424
- },] }
3425
- ];
3426
- return PcacSpinnerModule;
3427
- }());
3428
-
3429
- /**
3430
- * @fileoverview added by tsickle
3431
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3432
- */
3433
-
3434
- /**
3435
- * @fileoverview added by tsickle
3436
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3437
- */
3438
-
3439
- /**
3440
- * @fileoverview added by tsickle
3441
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3442
- */
3443
- /** @enum {number} */
3444
- var PcacPaginationPageSizeEnum = {
3445
- Ten: 10,
3446
- TwentyFive: 25,
3447
- Fifty: 50,
3448
- OneHundred: 100,
3449
- };
3450
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.Ten] = 'Ten';
3451
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.TwentyFive] = 'TwentyFive';
3452
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.Fifty] = 'Fifty';
3453
- PcacPaginationPageSizeEnum[PcacPaginationPageSizeEnum.OneHundred] = 'OneHundred';
3454
-
3455
- /**
3456
- * @fileoverview added by tsickle
3457
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3458
- */
3459
- var PaginationComponent = /** @class */ (function () {
3460
- function PaginationComponent() {
3461
- this.config = (/** @type {?} */ ({
3462
- currentPageIndex: 1,
3463
- countPerPage: PcacPaginationPageSizeEnum.Ten,
3464
- totalItemsInCollection: 10,
3465
- show: false,
3466
- isCompactView: false
3467
- }));
3468
- this.perPageChanged = new EventEmitter();
3469
- this.startClicked = new EventEmitter();
3470
- this.leftClicked = new EventEmitter();
3471
- this.rightClicked = new EventEmitter();
3472
- this.endClicked = new EventEmitter();
3473
- }
3474
- Object.defineProperty(PaginationComponent.prototype, "leftIsActive", {
3475
- get: /**
3476
- * @return {?}
3477
- */
3478
- function () {
3479
- return this.config.currentPageIndex !== 1;
3480
- },
3481
- enumerable: true,
3482
- configurable: true
3483
- });
3484
- Object.defineProperty(PaginationComponent.prototype, "rightIsActive", {
3485
- get: /**
3486
- * @return {?}
3487
- */
3488
- function () {
3489
- return this.config.currentPageIndex !== Math.ceil(this.config.totalItemsInCollection / this.config.countPerPage);
3490
- },
3491
- enumerable: true,
3492
- configurable: true
3493
- });
3494
- Object.defineProperty(PaginationComponent.prototype, "currentRangeText", {
3495
- get: /**
3496
- * @return {?}
3497
- */
3498
- function () {
3499
- /** @type {?} */
3500
- var text = this.getStartingRangeText() + "-" + this.getEndingRangeText();
3501
- if (!this.config.isCompactView) {
3502
- text = text + (" of " + this.config.totalItemsInCollection);
3503
- }
3504
- return text;
3505
- },
3506
- enumerable: true,
3507
- configurable: true
3508
- });
3509
- /**
3510
- * @param {?} count
3511
- * @return {?}
3512
- */
3513
- PaginationComponent.prototype.onPerPageChanged = /**
3514
- * @param {?} count
3515
- * @return {?}
3516
- */
3517
- function (count) {
3518
- this.config.countPerPage = parseInt(count, 10);
3519
- this.perPageChanged.emit(this.config.countPerPage);
3520
- };
3521
- /**
3522
- * @return {?}
3523
- */
3524
- PaginationComponent.prototype.onStartClicked = /**
3525
- * @return {?}
3526
- */
3527
- function () {
3528
- if (this.leftIsActive) {
3529
- this.config.currentPageIndex = 1;
3530
- this.startClicked.emit(1);
3531
- }
3532
- };
3533
- /**
3534
- * @return {?}
3535
- */
3536
- PaginationComponent.prototype.onLeftClicked = /**
3537
- * @return {?}
3538
- */
3539
- function () {
3540
- if (this.leftIsActive) {
3541
- this.config.currentPageIndex = this.config.currentPageIndex - 1;
3542
- this.leftClicked.emit(this.config.currentPageIndex);
3543
- }
3544
- };
3545
- /**
3546
- * @return {?}
3547
- */
3548
- PaginationComponent.prototype.onRightClicked = /**
3549
- * @return {?}
3550
- */
3551
- function () {
3552
- if (this.rightIsActive) {
3553
- this.config.currentPageIndex = this.config.currentPageIndex + 1;
3554
- this.rightClicked.emit(this.config.currentPageIndex);
3555
- }
3556
- };
3557
- /**
3558
- * @return {?}
3559
- */
3560
- PaginationComponent.prototype.onEndClicked = /**
3561
- * @return {?}
3562
- */
3563
- function () {
3564
- if (this.rightIsActive) {
3565
- this.config.currentPageIndex = Math.ceil(this.config.totalItemsInCollection / this.config.countPerPage);
3566
- this.endClicked.emit(this.config.currentPageIndex);
3567
- }
3568
- };
3569
- /**
3570
- * @private
3571
- * @return {?}
3572
- */
3573
- PaginationComponent.prototype.getStartingRangeText = /**
3574
- * @private
3575
- * @return {?}
3576
- */
3577
- function () {
3578
- return this.config.countPerPage * (this.config.currentPageIndex - 1) + 1;
3579
- };
3580
- /**
3581
- * @private
3582
- * @return {?}
3583
- */
3584
- PaginationComponent.prototype.getEndingRangeText = /**
3585
- * @private
3586
- * @return {?}
3587
- */
3588
- function () {
3589
- /** @type {?} */
3590
- var totalPossiblePage = Math.ceil(this.config.totalItemsInCollection / this.config.countPerPage);
3591
- if (totalPossiblePage === 1) {
3592
- return this.config.totalItemsInCollection;
3593
- }
3594
- if (totalPossiblePage === this.config.currentPageIndex) {
3595
- /** @type {?} */
3596
- var total = this.config.countPerPage * (this.config.currentPageIndex - 1);
3597
- /** @type {?} */
3598
- var modulus = this.config.totalItemsInCollection % total;
3599
- return total + modulus;
3600
- }
3601
- return this.config.countPerPage * this.config.currentPageIndex;
3602
- };
3603
- PaginationComponent.decorators = [
3604
- { type: Component, args: [{
3605
- selector: 'pcac-pagination',
3606
- template: "<section class=\"pcac-pager\" *ngIf=\"config?.show\">\r\n <div class=\"per-page\">\r\n <div *ngIf=\"!config.isCompactView\">\r\n Per Page:\r\n </div>\r\n <div>\r\n <select [(ngModel)]=\"config.countPerPage\" (change)=\"onPerPageChanged($event.target.value)\">\r\n <option value=\"10\">10</option>\r\n <option value=\"25\">25</option>\r\n <option value=\"50\">50</option>\r\n <option value=\"100\">100</option>\r\n </select>\r\n </div>\r\n </div>\r\n <div class=\"range-text\">\r\n {{currentRangeText}}\r\n </div>\r\n <div class=\"direction left-end\" [ngClass]=\"{'active': leftIsActive}\" (click)=\"onStartClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z\"></path>\r\n </svg>\r\n <svg class=\"pcac-icon pull-left\" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z\"></path>\r\n </svg>\r\n </div>\r\n <div class=\"direction left\" [ngClass]=\"{'active': leftIsActive}\" (click)=\"onLeftClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z\"></path>\r\n </svg>\r\n </div>\r\n <div class=\"direction right\" [ngClass]=\"{'active': rightIsActive}\" (click)=\"onRightClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z\"></path>\r\n </svg>\r\n </div>\r\n <div class=\"direction right-end\" [ngClass]=\"{'active': rightIsActive}\" (click)=\"onEndClicked()\">\r\n <svg class=\"pcac-icon \" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z\"></path>\r\n </svg>\r\n <svg class=\"pcac-icon pull-left\" viewBox=\"0 0 20 20\">\r\n <path fill=\"none\" d=\"M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z\"></path>\r\n </svg>\r\n </div>\r\n</section>\r\n"
3607
- }] }
3608
- ];
3609
- PaginationComponent.propDecorators = {
3610
- config: [{ type: Input }],
3611
- perPageChanged: [{ type: Output }],
3612
- startClicked: [{ type: Output }],
3613
- leftClicked: [{ type: Output }],
3614
- rightClicked: [{ type: Output }],
3615
- endClicked: [{ type: Output }]
3616
- };
3617
- return PaginationComponent;
3618
- }());
3619
-
3620
- /**
3621
- * @fileoverview added by tsickle
3622
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3623
- */
3624
- var PcacPaginationModule = /** @class */ (function () {
3625
- function PcacPaginationModule() {
3626
- }
3627
- PcacPaginationModule.decorators = [
3628
- { type: NgModule, args: [{
3629
- imports: [
3630
- CommonModule,
3631
- FormsModule
3632
- ],
3633
- exports: [
3634
- PaginationComponent
3635
- ],
3636
- declarations: [
3637
- PaginationComponent
3638
- ]
3639
- },] }
3640
- ];
3641
- return PcacPaginationModule;
3642
- }());
3643
-
3644
- /**
3645
- * @fileoverview added by tsickle
3646
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3647
- */
3648
-
3649
- /**
3650
- * @fileoverview added by tsickle
3651
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3652
- */
3653
-
3654
- /**
3655
- * @fileoverview added by tsickle
3656
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3657
- */
3658
-
3659
- /**
3660
- * @fileoverview added by tsickle
3661
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3662
- */
3663
-
3664
- export { BarHorizontalChartBuilder, BarVerticalChartBuilder, LineAreaChartBuilder, PaginationComponent, PcacAxisBuilder, PcacBarChartHorizontalComponent, PcacBarHorizontalChartModule, PcacBarVerticalChartComponent, PcacBarVerticalChartModule, PcacChart, PcacColorService, PcacCoreModule, PcacDialogComponent, PcacDialogModule, PcacGridBuilder, PcacHeaderComponent, PcacHeaderModule, PcacLineAreaChartComponent, PcacLineAreaChartModule, PcacPaginationModule, PcacPaginationPageSizeEnum, PcacPieChartComponent, PcacPieChartModule, PcacSpinnerComponent, PcacSpinnerModule, PcacTableComponent, PcacTableModule, PcacTableSortIconsEnum, PcacTickFormatEnum, PcacTooltipBuilder, PcacTransitionService, PieChartBuilder, TableSortService as ɵa };
3665
- //# sourceMappingURL=pioneer-code-pioneer-charts.js.map