@carbon/charts 0.41.103 → 0.44.0

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 (215) hide show
  1. package/CHANGELOG.md +63 -134
  2. package/axis-chart.d.ts +2 -2
  3. package/axis-chart.js +1 -1
  4. package/axis-chart.js.map +1 -1
  5. package/build/demo/data/CHART_TYPES.d.ts +5 -0
  6. package/build/demo/data/bar.d.ts +20 -0
  7. package/build/demo/data/circle-pack.d.ts +2 -2
  8. package/build/demo/data/histogram.d.ts +63 -0
  9. package/build/demo/data/index.d.ts +1 -0
  10. package/build/src/axis-chart.d.ts +2 -2
  11. package/build/src/chart.d.ts +1 -1
  12. package/build/src/charts/boxplot.d.ts +1 -1
  13. package/build/src/charts/circle-pack.d.ts +1 -1
  14. package/build/src/charts/gauge.d.ts +1 -1
  15. package/build/src/charts/histogram.d.ts +8 -0
  16. package/build/src/charts/index.d.ts +1 -0
  17. package/build/src/charts/meter.d.ts +1 -1
  18. package/build/src/charts/pie.d.ts +1 -1
  19. package/build/src/components/axes/axis.d.ts +1 -1
  20. package/build/src/components/axes/chart-clip.d.ts +1 -1
  21. package/build/src/components/axes/ruler-binned.d.ts +7 -0
  22. package/build/src/components/axes/ruler.d.ts +2 -3
  23. package/build/src/components/axes/zoom-bar.d.ts +1 -1
  24. package/build/src/components/component.d.ts +1 -1
  25. package/build/src/components/essentials/modal.d.ts +1 -7
  26. package/build/src/components/essentials/threshold.d.ts +1 -1
  27. package/build/src/components/essentials/tooltip-histogram.d.ts +26 -0
  28. package/build/src/components/essentials/tooltip.d.ts +1 -1
  29. package/build/src/components/graphs/histogram.d.ts +12 -0
  30. package/build/src/components/index.d.ts +3 -0
  31. package/build/src/components/layout/layout.d.ts +1 -1
  32. package/build/src/configuration-non-customizable.d.ts +3 -0
  33. package/build/src/configuration.d.ts +2 -1
  34. package/build/src/interfaces/axis-scales.d.ts +53 -17
  35. package/build/src/interfaces/charts.d.ts +25 -2
  36. package/build/src/model/binned-charts.d.ts +7 -0
  37. package/build/src/{model-boxplot.d.ts → model/boxplot.d.ts} +1 -1
  38. package/build/src/{model-cartesian-charts.d.ts → model/cartesian-charts.d.ts} +2 -0
  39. package/build/src/{model-circle-pack.d.ts → model/circle-pack.d.ts} +1 -1
  40. package/build/src/{model-gauge.d.ts → model/gauge.d.ts} +0 -0
  41. package/build/src/{model-meter.d.ts → model/meter.d.ts} +0 -0
  42. package/build/src/{model.d.ts → model/model.d.ts} +17 -3
  43. package/build/src/{model-pie.d.ts → model/pie.d.ts} +0 -0
  44. package/build/src/services/service.d.ts +1 -1
  45. package/build/src/services/zoom.d.ts +1 -1
  46. package/build/src/tools.d.ts +1 -0
  47. package/bundle.js +1 -1
  48. package/chart.d.ts +1 -1
  49. package/chart.js +1 -1
  50. package/chart.js.map +1 -1
  51. package/charts/bar-stacked.js +2 -1
  52. package/charts/bar-stacked.js.map +1 -1
  53. package/charts/boxplot.d.ts +1 -1
  54. package/charts/boxplot.js +1 -1
  55. package/charts/boxplot.js.map +1 -1
  56. package/charts/circle-pack.d.ts +1 -1
  57. package/charts/circle-pack.js +1 -1
  58. package/charts/circle-pack.js.map +1 -1
  59. package/charts/gauge.d.ts +1 -1
  60. package/charts/gauge.js +1 -1
  61. package/charts/gauge.js.map +1 -1
  62. package/charts/histogram.d.ts +8 -0
  63. package/charts/histogram.js +48 -0
  64. package/charts/histogram.js.map +1 -0
  65. package/charts/index.d.ts +1 -0
  66. package/charts/index.js +1 -0
  67. package/charts/index.js.map +1 -1
  68. package/charts/line.js +2 -1
  69. package/charts/line.js.map +1 -1
  70. package/charts/meter.d.ts +1 -1
  71. package/charts/meter.js +1 -1
  72. package/charts/meter.js.map +1 -1
  73. package/charts/pie.d.ts +1 -1
  74. package/charts/pie.js +1 -1
  75. package/charts/pie.js.map +1 -1
  76. package/charts/wordcloud.js.map +1 -1
  77. package/components/axes/axis.d.ts +1 -1
  78. package/components/axes/axis.js.map +1 -1
  79. package/components/axes/chart-clip.d.ts +1 -1
  80. package/components/axes/chart-clip.js.map +1 -1
  81. package/components/axes/ruler-binned.d.ts +7 -0
  82. package/components/axes/ruler-binned.js +136 -0
  83. package/components/axes/ruler-binned.js.map +1 -0
  84. package/components/axes/ruler.d.ts +2 -3
  85. package/components/axes/ruler.js +4 -4
  86. package/components/axes/ruler.js.map +1 -1
  87. package/components/axes/zoom-bar.d.ts +1 -1
  88. package/components/axes/zoom-bar.js.map +1 -1
  89. package/components/component.d.ts +1 -1
  90. package/components/component.js.map +1 -1
  91. package/components/essentials/modal.d.ts +1 -7
  92. package/components/essentials/modal.js +8 -69
  93. package/components/essentials/modal.js.map +1 -1
  94. package/components/essentials/threshold.d.ts +1 -1
  95. package/components/essentials/threshold.js.map +1 -1
  96. package/components/essentials/tooltip-axis.js +2 -2
  97. package/components/essentials/tooltip-axis.js.map +1 -1
  98. package/components/essentials/tooltip-histogram.d.ts +26 -0
  99. package/components/essentials/tooltip-histogram.js +154 -0
  100. package/components/essentials/tooltip-histogram.js.map +1 -0
  101. package/components/essentials/tooltip.d.ts +1 -1
  102. package/components/essentials/tooltip.js.map +1 -1
  103. package/components/graphs/bar-grouped.js +4 -4
  104. package/components/graphs/bar-grouped.js.map +1 -1
  105. package/components/graphs/bar-stacked.js +19 -5
  106. package/components/graphs/bar-stacked.js.map +1 -1
  107. package/components/graphs/circle-pack.js +6 -3
  108. package/components/graphs/circle-pack.js.map +1 -1
  109. package/components/graphs/histogram.d.ts +12 -0
  110. package/components/graphs/histogram.js +207 -0
  111. package/components/graphs/histogram.js.map +1 -0
  112. package/components/graphs/skeleton.js +3 -1
  113. package/components/graphs/skeleton.js.map +1 -1
  114. package/components/index.d.ts +3 -0
  115. package/components/index.js +3 -0
  116. package/components/index.js.map +1 -1
  117. package/components/layout/layout.d.ts +1 -1
  118. package/components/layout/layout.js.map +1 -1
  119. package/configuration-non-customizable.d.ts +3 -0
  120. package/configuration-non-customizable.js +3 -0
  121. package/configuration-non-customizable.js.map +1 -1
  122. package/configuration.d.ts +2 -1
  123. package/configuration.js +17 -4
  124. package/configuration.js.map +1 -1
  125. package/demo/data/CHART_TYPES.d.ts +5 -0
  126. package/demo/data/CHART_TYPES.js +5 -0
  127. package/demo/data/CHART_TYPES.js.map +1 -1
  128. package/demo/data/bar.d.ts +20 -0
  129. package/demo/data/bar.js +25 -0
  130. package/demo/data/bar.js.map +1 -1
  131. package/demo/data/bundle.js +1 -1
  132. package/demo/data/circle-pack.d.ts +2 -2
  133. package/demo/data/circle-pack.js +2 -2
  134. package/demo/data/circle-pack.js.map +1 -1
  135. package/demo/data/histogram.d.ts +63 -0
  136. package/demo/data/histogram.js +312 -0
  137. package/demo/data/histogram.js.map +1 -0
  138. package/demo/data/index.d.ts +1 -0
  139. package/demo/data/index.js +27 -0
  140. package/demo/data/index.js.map +1 -1
  141. package/demo/data/line.js +6 -6
  142. package/demo/data/line.js.map +1 -1
  143. package/demo/styles.css +540 -8
  144. package/demo/styles.css.map +1 -1
  145. package/demo/styles.min.css +1 -1
  146. package/demo/styles.min.css.map +1 -1
  147. package/demo/tsconfig.tsbuildinfo +23 -9
  148. package/interfaces/axis-scales.d.ts +53 -17
  149. package/interfaces/axis-scales.js.map +1 -1
  150. package/interfaces/charts.d.ts +25 -2
  151. package/interfaces/charts.js.map +1 -1
  152. package/model/binned-charts.d.ts +7 -0
  153. package/model/binned-charts.js +52 -0
  154. package/model/binned-charts.js.map +1 -0
  155. package/{model-boxplot.d.ts → model/boxplot.d.ts} +1 -1
  156. package/{model-boxplot.js → model/boxplot.js} +4 -4
  157. package/model/boxplot.js.map +1 -0
  158. package/{model-cartesian-charts.d.ts → model/cartesian-charts.d.ts} +2 -0
  159. package/{model-cartesian-charts.js → model/cartesian-charts.js} +80 -20
  160. package/model/cartesian-charts.js.map +1 -0
  161. package/{model-circle-pack.d.ts → model/circle-pack.d.ts} +1 -1
  162. package/{model-circle-pack.js → model/circle-pack.js} +3 -3
  163. package/model/circle-pack.js.map +1 -0
  164. package/{model-gauge.d.ts → model/gauge.d.ts} +0 -0
  165. package/{model-gauge.js → model/gauge.js} +1 -1
  166. package/model/gauge.js.map +1 -0
  167. package/{model-meter.d.ts → model/meter.d.ts} +0 -0
  168. package/{model-meter.js → model/meter.js} +3 -3
  169. package/model/meter.js.map +1 -0
  170. package/{model.d.ts → model/model.d.ts} +17 -3
  171. package/{model.js → model/model.js} +126 -14
  172. package/model/model.js.map +1 -0
  173. package/{model-pie.d.ts → model/pie.d.ts} +0 -0
  174. package/{model-pie.js → model/pie.js} +1 -1
  175. package/model/pie.js.map +1 -0
  176. package/package.json +1 -1
  177. package/services/essentials/dom-utils.js +18 -0
  178. package/services/essentials/dom-utils.js.map +1 -1
  179. package/services/scales-cartesian.js +31 -7
  180. package/services/scales-cartesian.js.map +1 -1
  181. package/services/service.d.ts +1 -1
  182. package/services/service.js.map +1 -1
  183. package/services/zoom.d.ts +1 -1
  184. package/services/zoom.js.map +1 -1
  185. package/styles/_chart-holder.scss +5 -2
  186. package/styles/colors.scss +2 -0
  187. package/styles/components/_ruler.scss +2 -1
  188. package/styles/styles.scss +4 -0
  189. package/styles-g10.css +135 -2
  190. package/styles-g10.css.map +1 -1
  191. package/styles-g10.min.css +1 -1
  192. package/styles-g10.min.css.map +1 -1
  193. package/styles-g100.css +135 -2
  194. package/styles-g100.css.map +1 -1
  195. package/styles-g100.min.css +1 -1
  196. package/styles-g100.min.css.map +1 -1
  197. package/styles-g90.css +135 -2
  198. package/styles-g90.css.map +1 -1
  199. package/styles-g90.min.css +1 -1
  200. package/styles-g90.min.css.map +1 -1
  201. package/styles.css +135 -2
  202. package/styles.css.map +1 -1
  203. package/styles.min.css +1 -1
  204. package/styles.min.css.map +1 -1
  205. package/tools.d.ts +1 -0
  206. package/tools.js +2 -1
  207. package/tools.js.map +1 -1
  208. package/tsconfig.tsbuildinfo +260 -149
  209. package/model-boxplot.js.map +0 -1
  210. package/model-cartesian-charts.js.map +0 -1
  211. package/model-circle-pack.js.map +0 -1
  212. package/model-gauge.js.map +0 -1
  213. package/model-meter.js.map +0 -1
  214. package/model-pie.js.map +0 -1
  215. package/model.js.map +0 -1
@@ -126,8 +126,8 @@
126
126
  "signature": "3d9e5316680ca3163403bb963136ed04c4b8f779c480c1e12174c0d12811562b"
127
127
  },
128
128
  "../../demo/data/CHART_TYPES.ts": {
129
- "version": "8fc36906c2b4c6ff7c27d7ea6b8af63cf1d99be21269205a168b2ca5c9f7ccdd",
130
- "signature": "dc82003052f2174851c9392d33fce1134b3c262a07478817d6792a69ba4ee74a"
129
+ "version": "ea9fc5a8a3efca460b03082582ff21712038a2decae01525f65ae77e811af269",
130
+ "signature": "059af5f1f0a6249613d38a37eb0bc6468919e71dd68acb08cff39468b011ae0b"
131
131
  },
132
132
  "../../demo/data/area.ts": {
133
133
  "version": "4f676e8abc4eff31e4106018e42a5e60660e3caf053c2a76487380fbeee70c0b",
@@ -142,8 +142,8 @@
142
142
  "signature": "37dce3c308ecb1ef88ddf7c9f9346d64c2b09a36eb7dcd4fe9d9736f5608107f"
143
143
  },
144
144
  "../../demo/data/bar.ts": {
145
- "version": "6a69e274d2fa26a0f5abeffd7146f5c555dfee28ab476e2ac0f964a13cbee724",
146
- "signature": "ef84b3dead11c8a96ce83048687cd65b060c872777622208b04b4a1f7cc36d27"
145
+ "version": "a9567148b3372323811c49b4460fd8ee4fcef7dbd392b0a0656c669a2320305e",
146
+ "signature": "fa5b31d8839524cf0e90d4fb59eba73739cf3b51eef76be2598e03cefdd9b5fa"
147
147
  },
148
148
  "../../demo/data/boxplot.ts": {
149
149
  "version": "829b5bce144ea2f835021047e37ab51f821a90432e23f75932e92caecdef8e6e",
@@ -154,7 +154,7 @@
154
154
  "signature": "2d1e2ab4c35296ccd2ee425603ff93de7af2b5be11243e7055ea74ae4e1e1331"
155
155
  },
156
156
  "../../demo/data/line.ts": {
157
- "version": "f0f4e9cb397e5acecc71592c585810b7b9abdbdb70d1be9816f5d3920f99d903",
157
+ "version": "07d596042350c23e1cda6d77e3181eaf4143726715b5f52ec4ae0dfc255f9759",
158
158
  "signature": "83faca010c88a9390fd27ebac7674a06ef0456131e1d3e3bf6b7e92b96f0824c"
159
159
  },
160
160
  "../../demo/data/bubble.ts": {
@@ -166,8 +166,8 @@
166
166
  "signature": "e3c0096afbbbe8f52f7c04bc1247c816f0dac99224230da02922713863487848"
167
167
  },
168
168
  "../../demo/data/circle-pack.ts": {
169
- "version": "f80f3c4949fbffd3147a32500e25f18f3eeb7c32fcfc56c5c75f1eff2eeeeea8",
170
- "signature": "1d859bcea235dfb76ce5403b6a11019c4b5d97b778925e834c7e4a8352fe40d3"
169
+ "version": "a24011462b444886427626676785f6a09fd384fcbac8bbd5b360b5f7a544204e",
170
+ "signature": "b2bdfa0a230eabe364e7b78a21de3872166852dc8d8ae7755ccec3ef522a35c3"
171
171
  },
172
172
  "../../demo/data/combo.ts": {
173
173
  "version": "b8d59a88e89f82c77a516f5f3db692065f2ca6cc6fc925a3beb08cedb4c00a3f",
@@ -209,6 +209,10 @@
209
209
  "version": "b6c39cbb34c10ce96a35fca717550faf326a5ff2cc0e666cdcac57ac58376bf3",
210
210
  "signature": "870dd81d6d88d8f2bee2361e9252854a7e439de4460eddf57fe246942254d6bf"
211
211
  },
212
+ "../../demo/data/histogram.ts": {
213
+ "version": "2791c7ffa5178fbc9b915d35f47a98cc12ba4f15bd245e87c8bf12ae1dc8a4ed",
214
+ "signature": "270cb957b1dc50e7521dd98b958c0c680077e8ab3fc8aed4a78610bdc6c5b07b"
215
+ },
212
216
  "../../demo/data/lollipop.ts": {
213
217
  "version": "cae55d63c37ad1168ccceab9c034b99d98a226626494e2766c7c854039b4c58d",
214
218
  "signature": "99a070f9cdcdd7d94f2287f3c742f60aa9210b8194a61b2ee10763caf7fdb09d"
@@ -234,8 +238,8 @@
234
238
  "signature": "d673d937720b7b8f8161e266762631615606bcd7214281ceb62ba79b15b38690"
235
239
  },
236
240
  "../../demo/data/index.ts": {
237
- "version": "d6a98b4effa8ec29c71534a8785c818479860e7618cc2ee4801b330f31284e59",
238
- "signature": "26f158214772f689165fa688ef06a16782574ae491d7ed0f2b731f7a09f70af5"
241
+ "version": "bf16d9e0e159731e76a7a5f66081a737cb3844544bce52940da8c7949124f434",
242
+ "signature": "44a50fd4e2f04927a1a650c963c904411d251c694b4e3cfa897abffffbfc285a"
239
243
  },
240
244
  "../../node_modules/@types/node/globals.d.ts": {
241
245
  "version": "6cf62fbc792aa81fa62f99dab5cc692c5315ecd5da09dd35f1ccc82778c4d5bc",
@@ -843,6 +847,13 @@
843
847
  "../../node_modules/@types/node/util.d.ts",
844
848
  "../../node_modules/@types/node/ts3.2/util.d.ts"
845
849
  ],
850
+ "../../demo/data/histogram.ts": [
851
+ "../../../../node_modules/date-fns/typings.d.ts",
852
+ "../../node_modules/@types/node/fs.d.ts",
853
+ "../../node_modules/@types/node/ts3.2/fs.d.ts",
854
+ "../../node_modules/@types/node/util.d.ts",
855
+ "../../node_modules/@types/node/ts3.2/util.d.ts"
856
+ ],
846
857
  "../../demo/data/lollipop.ts": [
847
858
  "../../../../node_modules/date-fns/typings.d.ts",
848
859
  "../../node_modules/@types/node/fs.d.ts",
@@ -896,6 +907,7 @@
896
907
  "../../demo/data/combo.ts",
897
908
  "../../demo/data/donut.ts",
898
909
  "../../demo/data/gauge.ts",
910
+ "../../demo/data/histogram.ts",
899
911
  "../../demo/data/line.ts",
900
912
  "../../demo/data/lollipop.ts",
901
913
  "../../demo/data/meter.ts",
@@ -1556,6 +1568,7 @@
1556
1568
  "../../demo/data/combo.ts",
1557
1569
  "../../demo/data/donut.ts",
1558
1570
  "../../demo/data/gauge.ts",
1571
+ "../../demo/data/histogram.ts",
1559
1572
  "../../demo/data/line.ts",
1560
1573
  "../../demo/data/lollipop.ts",
1561
1574
  "../../demo/data/meter.ts",
@@ -2042,6 +2055,7 @@
2042
2055
  "../../demo/data/time-series-axis.ts",
2043
2056
  "../../demo/data/zoom-bar.ts",
2044
2057
  "../../demo/data/high-scale.ts",
2058
+ "../../demo/data/histogram.ts",
2045
2059
  "../../demo/data/lollipop.ts",
2046
2060
  "../../demo/data/meter.ts",
2047
2061
  "../../demo/data/radar.ts",
@@ -3,22 +3,11 @@ import { ThresholdOptions } from './components';
3
3
  import { TruncationOptions } from './truncation';
4
4
  import { AxisDomain } from 'd3-axis';
5
5
  import { Locale } from 'date-fns';
6
- /**
7
- * options to configure a scale. not all options are used by all scales
8
- */
9
- export interface AxisOptions {
6
+ export interface BasedAxisOptions {
10
7
  /**
11
8
  * type of the scale used on axis
12
9
  */
13
10
  scaleType?: ScaleTypes;
14
- /**
15
- * option for stacked axis
16
- */
17
- stacked?: boolean;
18
- /**
19
- * option for percentage axis scale
20
- */
21
- percentage?: boolean;
22
11
  /**
23
12
  * Whether the Axis should use the specified domain
24
13
  * instead of it being dynamically generated based on data extents.
@@ -103,6 +92,53 @@ export interface AxisOptions {
103
92
  * is axis visible or not
104
93
  */
105
94
  visible?: boolean;
95
+ /**
96
+ * Bins to display (Histogram)
97
+ * bins: 20
98
+ * bins: [0, 20, 40, 60]
99
+ * bins: [new Date(...), new Date(...), ...]
100
+ */
101
+ bins?: number | any[];
102
+ /**
103
+ * limit the visible axis domain to only the binned area
104
+ */
105
+ limitDomainToBins?: boolean;
106
+ /**
107
+ * should be set to `true` on the domain
108
+ * axis that's being broken into bins
109
+ */
110
+ binned?: boolean;
111
+ }
112
+ /**
113
+ * options to configure a scale. not all options are used by all scales
114
+ */
115
+ export interface AxisOptions extends BasedAxisOptions {
116
+ /**
117
+ * option for stacked axis
118
+ */
119
+ stacked?: boolean;
120
+ /**
121
+ * option for percentage axis scale
122
+ */
123
+ percentage?: boolean;
124
+ }
125
+ export interface BinnedAxisOptions {
126
+ /**
127
+ * should be set to `true` on the domain
128
+ * axis that's being broken into bins
129
+ */
130
+ binned?: boolean;
131
+ /**
132
+ * Bins to display (Histogram)
133
+ * bins: 20
134
+ * bins: [0, 20, 40, 60]
135
+ * bins: [new Date(...), new Date(...), ...]
136
+ */
137
+ bins?: number | any[];
138
+ /**
139
+ * limit the visible axis domain to only the binned area
140
+ */
141
+ limitDomainToBins?: boolean;
106
142
  }
107
143
  /**
108
144
  * customize time series scales
@@ -146,9 +182,9 @@ export interface TimeIntervalFormats {
146
182
  /**
147
183
  * customize the axes components
148
184
  */
149
- export interface AxesOptions {
150
- left?: AxisOptions;
151
- bottom?: AxisOptions;
152
- right?: AxisOptions;
153
- top?: AxisOptions;
185
+ export interface AxesOptions<AxesOptionType> {
186
+ left?: AxesOptionType;
187
+ bottom?: AxesOptionType;
188
+ right?: AxesOptionType;
189
+ top?: AxesOptionType;
154
190
  }
@@ -1 +1 @@
1
- {"version":3,"file":"axis-scales.js","sourceRoot":"","sources":["axis-scales.ts"],"names":[],"mappings":"","sourcesContent":["import { ScaleTypes, TickRotations, AxisTitleOrientations } from './enums';\nimport { ThresholdOptions } from './components';\nimport { TruncationOptions } from './truncation';\n\nimport { AxisDomain } from 'd3-axis';\nimport { Locale } from 'date-fns';\n\n/**\n * options to configure a scale. not all options are used by all scales\n */\nexport interface AxisOptions {\n\t/**\n\t * type of the scale used on axis\n\t */\n\tscaleType?: ScaleTypes;\n\t/**\n\t * option for stacked axis\n\t */\n\tstacked?: boolean;\n\t/**\n\t * option for percentage axis scale\n\t */\n\tpercentage?: boolean;\n\t/**\n\t * Whether the Axis should use the specified domain\n\t * instead of it being dynamically generated based on data extents.\n\t * The type of values should depend on the scale type.\n\t * Example for continuous axis scale: [-100, 100]\n\t * Example for discrete axis scale: ['Qty', 'More', 'Sold']\n\t * No need to define domain for percentage axis scale\n\t */\n\tdomain?: AxisDomain[];\n\t/**\n\t * an additional key from the charting data that is used to\n\t * extend the domain of an axis by\n\t * (e.g. in the bullet graph we need both the marker &\n\t * the data values to define the domain of the linear scale)\n\t */\n\textendLinearDomainBy?: string;\n\t/**\n\t * Whether the Axis should be forced to include 0 as a starting point\n\t * (or ending point, in case of all negative axis).\n\t * Default: true\n\t */\n\tincludeZero?: boolean;\n\t/**\n\t * identifies what key within the data the axis values would map to\n\t */\n\tmapsTo?: string;\n\t/**\n\t * optional title for the scales\n\t */\n\ttitle?: string;\n\t/**\n\t * Override for the orientation of the title (for vertical axes).\n\t * The title string can be overrided to be rotated left or right.\n\t */\n\ttitleOrientation?: AxisTitleOrientations;\n\t/**\n\t * thresholds\n\t * Example:\n\t * [\n\t *\t\t{value: 10000},\n\t *\t\t{value: 40020, valueFormatter: (x) => x},\n\t *\t\t{value: 55000, label: \"Custom label\", fillColor: \"#03a9f4\"},\n\t * ]\n\t */\n\tthresholds?: ThresholdOptions[];\n\t/**\n\t * tick configuration\n\t */\n\tticks?: {\n\t\t/**\n\t\t * number of ticks to show\n\t\t */\n\t\tnumber?: number;\n\t\t/**\n\t\t * minimum tick value\n\t\t */\n\t\tmin?: number;\n\t\t/**\n\t\t * maximum tick value\n\t\t */\n\t\tmax?: number;\n\t\t/**\n\t\t * minimum width of a tick\n\t\t * before getting rotated (in pixels)\n\t\t */\n\t\trotateIfSmallerThan?: number;\n\t\t/**\n\t\t * when to rotate ticks\n\t\t */\n\t\trotation?: TickRotations;\n\t\t/**\n\t\t * function to format the ticks\n\t\t */\n\t\tformatter?: Function;\n\t\t/**\n\t\t * optional custom array of tick values that is within the domain of data\n\t\t */\n\t\tvalues?: any[];\n\t};\n\ttruncation?: TruncationOptions;\n\t/**\n\t * is axis visible or not\n\t */\n\tvisible?: boolean;\n}\n\n/**\n * customize time series scales\n */\nexport interface TimeScaleOptions {\n\taddSpaceOnEdges?: number;\n\t/**\n\t * if it's true, days are shown as mon-sun,\n\t * otherwise days are shown as number 1-31\n\t */\n\tshowDayName?: boolean;\n\t/**\n\t * formats for each time interval\n\t */\n\ttimeIntervalFormats?: TimeIntervalFormats;\n\t/**\n\t * locale object, for more information see https://date-fns.org/v2.11.0/docs/Locale.\n\t * example: `import enUSLocaleObject from \"date-fns/locale/en-US/index\"`.\n\t * available locale objects are: https://github.com/date-fns/date-fns/tree/master/src/locale\n\t */\n\tlocaleObject?: Locale;\n}\n\n/**\n * time scales: customize ticks format for different time intervals\n */\nexport interface TickFormats {\n\tprimary?: string;\n\tsecondary?: string;\n}\n\nexport interface TimeIntervalFormats {\n\t'15seconds'?: TickFormats;\n\tminute?: TickFormats;\n\t'30minutes'?: TickFormats;\n\thourly?: TickFormats;\n\tdaily?: TickFormats;\n\tweekly?: TickFormats;\n\tmonthly?: TickFormats;\n\tquarterly?: TickFormats;\n\tyearly?: TickFormats;\n}\n\n/**\n * customize the axes components\n */\nexport interface AxesOptions {\n\tleft?: AxisOptions;\n\tbottom?: AxisOptions;\n\tright?: AxisOptions;\n\ttop?: AxisOptions;\n}\n"]}
1
+ {"version":3,"file":"axis-scales.js","sourceRoot":"","sources":["axis-scales.ts"],"names":[],"mappings":"","sourcesContent":["import { ScaleTypes, TickRotations, AxisTitleOrientations } from './enums';\nimport { ThresholdOptions } from './components';\nimport { TruncationOptions } from './truncation';\n\nimport { AxisDomain } from 'd3-axis';\nimport { Locale } from 'date-fns';\n\nexport interface BasedAxisOptions {\n\t/**\n\t * type of the scale used on axis\n\t */\n\tscaleType?: ScaleTypes;\n\t/**\n\t * Whether the Axis should use the specified domain\n\t * instead of it being dynamically generated based on data extents.\n\t * The type of values should depend on the scale type.\n\t * Example for continuous axis scale: [-100, 100]\n\t * Example for discrete axis scale: ['Qty', 'More', 'Sold']\n\t * No need to define domain for percentage axis scale\n\t */\n\tdomain?: AxisDomain[];\n\t/**\n\t * an additional key from the charting data that is used to\n\t * extend the domain of an axis by\n\t * (e.g. in the bullet graph we need both the marker &\n\t * the data values to define the domain of the linear scale)\n\t */\n\textendLinearDomainBy?: string;\n\t/**\n\t * Whether the Axis should be forced to include 0 as a starting point\n\t * (or ending point, in case of all negative axis).\n\t * Default: true\n\t */\n\tincludeZero?: boolean;\n\t/**\n\t * identifies what key within the data the axis values would map to\n\t */\n\tmapsTo?: string;\n\t/**\n\t * optional title for the scales\n\t */\n\ttitle?: string;\n\t/**\n\t * Override for the orientation of the title (for vertical axes).\n\t * The title string can be overrided to be rotated left or right.\n\t */\n\ttitleOrientation?: AxisTitleOrientations;\n\t/**\n\t * thresholds\n\t * Example:\n\t * [\n\t *\t\t{value: 10000},\n\t *\t\t{value: 40020, valueFormatter: (x) => x},\n\t *\t\t{value: 55000, label: \"Custom label\", fillColor: \"#03a9f4\"},\n\t * ]\n\t */\n\tthresholds?: ThresholdOptions[];\n\t/**\n\t * tick configuration\n\t */\n\tticks?: {\n\t\t/**\n\t\t * number of ticks to show\n\t\t */\n\t\tnumber?: number;\n\t\t/**\n\t\t * minimum tick value\n\t\t */\n\t\tmin?: number;\n\t\t/**\n\t\t * maximum tick value\n\t\t */\n\t\tmax?: number;\n\t\t/**\n\t\t * minimum width of a tick\n\t\t * before getting rotated (in pixels)\n\t\t */\n\t\trotateIfSmallerThan?: number;\n\t\t/**\n\t\t * when to rotate ticks\n\t\t */\n\t\trotation?: TickRotations;\n\t\t/**\n\t\t * function to format the ticks\n\t\t */\n\t\tformatter?: Function;\n\t\t/**\n\t\t * optional custom array of tick values that is within the domain of data\n\t\t */\n\t\tvalues?: any[];\n\t};\n\ttruncation?: TruncationOptions;\n\t/**\n\t * is axis visible or not\n\t */\n\tvisible?: boolean;\n\t/**\n\t * Bins to display (Histogram)\n\t * bins: 20\n\t * bins: [0, 20, 40, 60]\n\t * bins: [new Date(...), new Date(...), ...]\n\t */\n\tbins?: number | any[];\n\t/**\n\t * limit the visible axis domain to only the binned area\n\t */\n\tlimitDomainToBins?: boolean;\n\t/**\n\t * should be set to `true` on the domain\n\t * axis that's being broken into bins\n\t */\n\tbinned?: boolean;\n}\n\n/**\n * options to configure a scale. not all options are used by all scales\n */\nexport interface AxisOptions extends BasedAxisOptions {\n\t/**\n\t * option for stacked axis\n\t */\n\tstacked?: boolean;\n\t/**\n\t * option for percentage axis scale\n\t */\n\tpercentage?: boolean;\n}\n\nexport interface BinnedAxisOptions {\n\t/**\n\t * should be set to `true` on the domain\n\t * axis that's being broken into bins\n\t */\n\tbinned?: boolean;\n\t/**\n\t * Bins to display (Histogram)\n\t * bins: 20\n\t * bins: [0, 20, 40, 60]\n\t * bins: [new Date(...), new Date(...), ...]\n\t */\n\tbins?: number | any[];\n\t/**\n\t * limit the visible axis domain to only the binned area\n\t */\n\tlimitDomainToBins?: boolean;\n}\n\n/**\n * customize time series scales\n */\nexport interface TimeScaleOptions {\n\taddSpaceOnEdges?: number;\n\t/**\n\t * if it's true, days are shown as mon-sun,\n\t * otherwise days are shown as number 1-31\n\t */\n\tshowDayName?: boolean;\n\t/**\n\t * formats for each time interval\n\t */\n\ttimeIntervalFormats?: TimeIntervalFormats;\n\t/**\n\t * locale object, for more information see https://date-fns.org/v2.11.0/docs/Locale.\n\t * example: `import enUSLocaleObject from \"date-fns/locale/en-US/index\"`.\n\t * available locale objects are: https://github.com/date-fns/date-fns/tree/master/src/locale\n\t */\n\tlocaleObject?: Locale;\n}\n\n/**\n * time scales: customize ticks format for different time intervals\n */\nexport interface TickFormats {\n\tprimary?: string;\n\tsecondary?: string;\n}\n\nexport interface TimeIntervalFormats {\n\t'15seconds'?: TickFormats;\n\tminute?: TickFormats;\n\t'30minutes'?: TickFormats;\n\thourly?: TickFormats;\n\tdaily?: TickFormats;\n\tweekly?: TickFormats;\n\tmonthly?: TickFormats;\n\tquarterly?: TickFormats;\n\tyearly?: TickFormats;\n}\n\n/**\n * customize the axes components\n */\nexport interface AxesOptions<AxesOptionType> {\n\tleft?: AxesOptionType;\n\tbottom?: AxesOptionType;\n\tright?: AxesOptionType;\n\ttop?: AxesOptionType;\n}\n\n"]}
@@ -1,7 +1,7 @@
1
1
  import { GaugeTypes, Statuses, ArrowDirections, Alignments, ChartTypes } from './enums';
2
2
  import { LegendOptions, TooltipOptions, GridOptions, AxesOptions, ZoomBarsOptions } from './index';
3
3
  import { BarOptions, StackedBarOptions, ToolbarOptions } from './components';
4
- import { TimeScaleOptions } from './axis-scales';
4
+ import { AxisOptions, BinnedAxisOptions, TimeScaleOptions } from './axis-scales';
5
5
  /**
6
6
  * Base chart options common to any chart
7
7
  */
@@ -107,7 +107,19 @@ export interface BaseChartOptions {
107
107
  * Options common to any chart with an axis
108
108
  */
109
109
  export interface AxisChartOptions extends BaseChartOptions {
110
- axes?: AxesOptions;
110
+ axes?: AxesOptions<AxisOptions>;
111
+ grid?: GridOptions;
112
+ timeScale?: TimeScaleOptions;
113
+ /**
114
+ * zoombar configuration
115
+ */
116
+ zoomBar?: ZoomBarsOptions;
117
+ }
118
+ /**
119
+ * Options common to binned charts with an axis
120
+ */
121
+ export interface BinnedAxisChartOptions extends AxisChartOptions {
122
+ axes?: AxesOptions<BinnedAxisOptions>;
111
123
  grid?: GridOptions;
112
124
  timeScale?: TimeScaleOptions;
113
125
  /**
@@ -196,6 +208,17 @@ export interface BulletChartOptions extends AxisChartOptions {
196
208
  performanceAreaTitles?: string[];
197
209
  };
198
210
  }
211
+ /**
212
+ * options specific to histogram charts
213
+ */
214
+ export interface HistogramChartOptions extends AxisChartOptions {
215
+ /**
216
+ * options related to bins
217
+ */
218
+ bins?: {
219
+ rangeLabel?: string;
220
+ };
221
+ }
199
222
  /**
200
223
  * options specific to line charts
201
224
  */
@@ -1 +1 @@
1
- {"version":3,"file":"charts.js","sourceRoot":"","sources":["charts.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tGaugeTypes,\n\tStatuses,\n\tArrowDirections,\n\tAlignments,\n\tChartTypes,\n} from './enums';\nimport {\n\tLegendOptions,\n\tTooltipOptions,\n\tGridOptions,\n\tAxesOptions,\n\tZoomBarsOptions,\n} from './index';\nimport { BarOptions, StackedBarOptions, ToolbarOptions } from './components';\nimport { TimeScaleOptions } from './axis-scales';\n\n/**\n * Base chart options common to any chart\n */\nexport interface BaseChartOptions {\n\t/**\n\t * Optionally specify a title for the chart\n\t */\n\ttitle?: string;\n\t/**\n\t * boolean to disable animations (enabled by default)\n\t */\n\tanimations?: boolean;\n\t/**\n\t * boolean to prevent the container from resizing\n\t */\n\tresizable?: boolean;\n\t/**\n\t * Optionally specify a width for the chart\n\t */\n\twidth?: string;\n\t/**\n\t * Optionally specify a height for the chart\n\t */\n\theight?: string;\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: TooltipOptions;\n\t/**\n\t * legend configuration\n\t */\n\tlegend?: LegendOptions;\n\t/**\n\t * toolbar configurations\n\t */\n\ttoolbar?: ToolbarOptions;\n\t/**\n\t * Optional function to determine whether is filled based on datasetLabel, label, and/or data\n\t */\n\tgetIsFilled?: (\n\t\tdatasetLabel: any,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultFilled?: boolean\n\t) => boolean;\n\t/**\n\t * Optional function to generate the fill color based on datasetLabel, label, and/or data\n\t */\n\tgetFillColor?: (\n\t\tgroup: string,\n\t\tlabel?: string,\n\t\tdata?: any,\n\t\tdefaultFillColor?: string\n\t) => string;\n\t/**\n\t * Optional function to generate the stroke color based on datasetLabel, label, and/or data\n\t * (note) - not all chart types support the stroke color (e.g. wordcloud)\n\t */\n\tgetStrokeColor?: (\n\t\tgroup: string,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultStrokeColor?: string\n\t) => string;\n\t/**\n\t * stylesheet options\n\t */\n\tstyle?: {\n\t\t/**\n\t\t * optional prefixing string for css classes (defaults to 'cc')\n\t\t */\n\t\tprefix?: string;\n\t};\n\t/**\n\t * options related to charting data\n\t */\n\tdata?: {\n\t\t/**\n\t\t * identifier for data groups\n\t\t */\n\t\tgroupMapsTo?: string;\n\t\t/**\n\t\t * used to simulate data loading in skeleton way\n\t\t */\n\t\tloading?: boolean;\n\t\t/**\n\t\t * options related to pre-selected data groups\n\t\t * Remains empty if every legend item is active or dataset doesn't have the data groups.\n\t\t */\n\t\tselectedGroups?: string[];\n\t};\n\t/**\n\t * options related to color scales\n\t */\n\tcolor?: {\n\t\t/**\n\t\t * e.g. { 'Dataset 1': 'blue' }\n\t\t */\n\t\tscale?: object;\n\t\t/**\n\t\t * use a carbon dataviz preset color palette\n\t\t * put the index (selection of which variant)\n\t\t */\n\t\tpairing?: {\n\t\t\t/**\n\t\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t\t */\n\t\t\tnumberOfVariants?: number;\n\t\t\t/**\n\t\t\t * the option number of the color paring\n\t\t\t */\n\t\t\toption?: number;\n\t\t};\n\t\t/*\n\t\t * options related to gradient\n\t\t * e.g. { enabled: true }\n\t\t */\n\t\tgradient?: object;\n\t};\n}\n\n/**\n * Options common to any chart with an axis\n */\nexport interface AxisChartOptions extends BaseChartOptions {\n\taxes?: AxesOptions;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * options specific to boxplot charts\n */\nexport interface BoxplotChartOptions extends AxisChartOptions {}\n\n/**\n * options specific to bar charts\n */\nexport interface BarChartOptions extends AxisChartOptions {\n\tbars?: BarOptions;\n}\n\n/**\n * options specific to stacked bar charts\n */\nexport interface StackedBarChartOptions extends BarChartOptions {\n\tbars?: StackedBarOptions;\n}\n\n/**\n * options specific to scatter charts\n */\nexport interface ScatterChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the points\n\t */\n\tpoints?: {\n\t\t/**\n\t\t * sets the radius of the point\n\t\t */\n\t\tradius: number;\n\t\tfillOpacity?: number;\n\t\tfilled?: boolean;\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to lollipop charts\n */\nexport interface LollipopChartOptions extends ScatterChartOptions {}\n\n/**\n * options specific to bubble charts\n */\nexport interface BubbleChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bubbles\n\t */\n\tbubble?: {\n\t\t/**\n\t\t * the key to lookup in charting data for the bubble radius value\n\t\t */\n\t\tradiusMapsTo?: string;\n\t\t/**\n\t\t * options for what the bubble radius value maps to\n\t\t */\n\t\tradiusLabel?: string;\n\t\t/**\n\t\t * A function that would determine the range of the bubble radius to use\n\t\t * Returns an array with the 1st value being the min and the 2nd value being the max radius\n\t\t */\n\t\tradiusRange?: Function;\n\t\t/**\n\t\t * Opacity of the fills used within each circle\n\t\t */\n\t\tfillOpacity?: number;\n\t\t/**\n\t\t * enabled scatter dot or not\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to bullet charts\n */\nexport interface BulletChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bullets\n\t */\n\tbullet?: {\n\t\tperformanceAreaTitles?: string[];\n\t};\n}\n\n/**\n * options specific to line charts\n */\nexport interface LineChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n}\n\n/**\n * options specific to area charts\n */\nexport interface AreaChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n\t/**\n\t * options to bound the area of the chart\n\t */\n\tbounds?: {\n\t\tupperBoundMapsTo?: string;\n\t\tlowerBoundMapsTo?: string;\n\t};\n}\n\n/**\n * options specific to area charts\n */\nexport interface StackedAreaChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n}\n\n/**\n * options specific to world cloud charts\n */\nexport interface WordCloudChartTooltipOptions extends TooltipOptions {\n\t/** the label that shows up by the highlighted word in the tooltip */\n\twordLabel?: string;\n\t/** the label that shows up by the value of the highlighted word in the tooltip */\n\tvalueLabel?: string;\n}\n\nexport interface WorldCloudChartOptions extends BaseChartOptions {\n\twordCloud?: {\n\t\t/** what key in your charting data will the font sizes map to? */\n\t\tfontSizeMapsTo?: string;\n\t\t/** a function (chartSize, data) => {} that'll decide the range of font sizes, e.g. [10, 80] */\n\t\tfontSizeRange?: Function;\n\t\t/** what key in your charting data will the words map to? */\n\t\twordMapsTo?: string;\n\t};\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: WordCloudChartTooltipOptions;\n}\n\n/**\n * options specific to pie charts\n */\nexport interface PieChartOptions extends BaseChartOptions {\n\tpie?: {\n\t\tlabels?: {\n\t\t\tformatter?: Function;\n\t\t\tenabled?: Boolean;\n\t\t};\n\t\talignment?: Alignments;\n\t\tsortFunction?: (a: any, b: any) => number;\n\t};\n}\n\n/**\n * options specific to gauge charts\n */\nexport interface GaugeChartOptions extends BaseChartOptions {\n\tgauge?: {\n\t\tarcWidth?: number;\n\t\tdeltaArrow?: {\n\t\t\tdirection?: ArrowDirections;\n\t\t\tsize?: Function;\n\t\t\tenabled: Boolean;\n\t\t};\n\t\tshowPercentageSymbol?: Boolean;\n\t\tstatus?: Statuses;\n\t\tdeltaFontSize?: Function;\n\t\tnumberSpacing?: number;\n\t\tnumberFormatter?: Function;\n\t\tvalueFontSize?: Function;\n\t\ttype?: GaugeTypes;\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to donut charts\n */\nexport interface DonutChartOptions extends PieChartOptions {\n\tdonut?: {\n\t\tcenter?: {\n\t\t\tlabel?: string;\n\t\t\tnumber?: number;\n\t\t\tnumberFontSize?: Function;\n\t\t\ttitleFontSize?: Function;\n\t\t\ttitleYPosition?: Function;\n\t\t\tnumberFormatter?: Function;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\nexport interface MeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tpeak?: number;\n\t\tstatus?: {\n\t\t\tranges: Array<{\n\t\t\t\trange: [number, number];\n\t\t\t\tstatus: Statuses;\n\t\t\t}>;\n\t\t};\n\t\theight?: number;\n\t\ttitle?: {\n\t\t\tpercentageIndicator?: {\n\t\t\t\t/**\n\t\t\t\t * rendering of the percentage value relative to the dataset within title\n\t\t\t\t */\n\t\t\t\tenabled?: boolean;\n\t\t\t};\n\t\t};\n\t};\n}\n\n/**\n * options specific to radar charts\n */\nexport interface RadarChartOptions extends BaseChartOptions {\n\tradar?: {\n\t\taxes: {\n\t\t\tangle: string;\n\t\t\tvalue: string;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to combo charts\n */\nexport interface ComboChartOptions extends AxisChartOptions {\n\tcomboChartTypes: Array<{\n\t\ttype: ChartTypes | any;\n\t\toptions?: object;\n\t\tcorrespondingDatasets: Array<string>;\n\t}>;\n}\n\n/*\n * options specific to treemap charts\n */\nexport interface TreemapChartOptions extends BaseChartOptions {}\n\n/*\n * options specific to circle pack charts\n */\nexport interface CirclePackChartOptions extends BaseChartOptions {\n\tcirclePack?: {\n\t\tcircles: {\n\t\t\tfillOpacity: number;\n\t\t};\n\t\t// depth of nodes to display\n\t\thierachyLevel: number;\n\t\tpadding?: {\n\t\t\touter?: number;\n\t\t\tinner?: number;\n\t\t};\n\t};\n}\n"]}
1
+ {"version":3,"file":"charts.js","sourceRoot":"","sources":["charts.ts"],"names":[],"mappings":"","sourcesContent":["import {\n\tGaugeTypes,\n\tStatuses,\n\tArrowDirections,\n\tAlignments,\n\tChartTypes,\n} from './enums';\nimport {\n\tLegendOptions,\n\tTooltipOptions,\n\tGridOptions,\n\tAxesOptions,\n\tZoomBarsOptions,\n} from './index';\nimport { BarOptions, StackedBarOptions, ToolbarOptions } from './components';\nimport {\n\tAxisOptions,\n\tBinnedAxisOptions,\n\tTimeScaleOptions,\n} from './axis-scales';\n\n/**\n * Base chart options common to any chart\n */\nexport interface BaseChartOptions {\n\t/**\n\t * Optionally specify a title for the chart\n\t */\n\ttitle?: string;\n\t/**\n\t * boolean to disable animations (enabled by default)\n\t */\n\tanimations?: boolean;\n\t/**\n\t * boolean to prevent the container from resizing\n\t */\n\tresizable?: boolean;\n\t/**\n\t * Optionally specify a width for the chart\n\t */\n\twidth?: string;\n\t/**\n\t * Optionally specify a height for the chart\n\t */\n\theight?: string;\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: TooltipOptions;\n\t/**\n\t * legend configuration\n\t */\n\tlegend?: LegendOptions;\n\t/**\n\t * toolbar configurations\n\t */\n\ttoolbar?: ToolbarOptions;\n\t/**\n\t * Optional function to determine whether is filled based on datasetLabel, label, and/or data\n\t */\n\tgetIsFilled?: (\n\t\tdatasetLabel: any,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultFilled?: boolean\n\t) => boolean;\n\t/**\n\t * Optional function to generate the fill color based on datasetLabel, label, and/or data\n\t */\n\tgetFillColor?: (\n\t\tgroup: string,\n\t\tlabel?: string,\n\t\tdata?: any,\n\t\tdefaultFillColor?: string\n\t) => string;\n\t/**\n\t * Optional function to generate the stroke color based on datasetLabel, label, and/or data\n\t * (note) - not all chart types support the stroke color (e.g. wordcloud)\n\t */\n\tgetStrokeColor?: (\n\t\tgroup: string,\n\t\tlabel?: any,\n\t\tdata?: any,\n\t\tdefaultStrokeColor?: string\n\t) => string;\n\t/**\n\t * stylesheet options\n\t */\n\tstyle?: {\n\t\t/**\n\t\t * optional prefixing string for css classes (defaults to 'cc')\n\t\t */\n\t\tprefix?: string;\n\t};\n\t/**\n\t * options related to charting data\n\t */\n\tdata?: {\n\t\t/**\n\t\t * identifier for data groups\n\t\t */\n\t\tgroupMapsTo?: string;\n\t\t/**\n\t\t * used to simulate data loading in skeleton way\n\t\t */\n\t\tloading?: boolean;\n\t\t/**\n\t\t * options related to pre-selected data groups\n\t\t * Remains empty if every legend item is active or dataset doesn't have the data groups.\n\t\t */\n\t\tselectedGroups?: string[];\n\t};\n\t/**\n\t * options related to color scales\n\t */\n\tcolor?: {\n\t\t/**\n\t\t * e.g. { 'Dataset 1': 'blue' }\n\t\t */\n\t\tscale?: object;\n\t\t/**\n\t\t * use a carbon dataviz preset color palette\n\t\t * put the index (selection of which variant)\n\t\t */\n\t\tpairing?: {\n\t\t\t/**\n\t\t\t * the number of color variants in the palette (defaults to using the number of data groups in the given data)\n\t\t\t */\n\t\t\tnumberOfVariants?: number;\n\t\t\t/**\n\t\t\t * the option number of the color paring\n\t\t\t */\n\t\t\toption?: number;\n\t\t};\n\t\t/*\n\t\t * options related to gradient\n\t\t * e.g. { enabled: true }\n\t\t */\n\t\tgradient?: object;\n\t};\n}\n\n/**\n * Options common to any chart with an axis\n */\nexport interface AxisChartOptions extends BaseChartOptions {\n\taxes?: AxesOptions<AxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * Options common to binned charts with an axis\n */\nexport interface BinnedAxisChartOptions extends AxisChartOptions {\n\taxes?: AxesOptions<BinnedAxisOptions>;\n\tgrid?: GridOptions;\n\ttimeScale?: TimeScaleOptions;\n\t/**\n\t * zoombar configuration\n\t */\n\tzoomBar?: ZoomBarsOptions;\n}\n\n/**\n * options specific to boxplot charts\n */\nexport interface BoxplotChartOptions extends AxisChartOptions {}\n\n/**\n * options specific to bar charts\n */\nexport interface BarChartOptions extends AxisChartOptions {\n\tbars?: BarOptions;\n}\n\n/**\n * options specific to stacked bar charts\n */\nexport interface StackedBarChartOptions extends BarChartOptions {\n\tbars?: StackedBarOptions;\n}\n\n/**\n * options specific to scatter charts\n */\nexport interface ScatterChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the points\n\t */\n\tpoints?: {\n\t\t/**\n\t\t * sets the radius of the point\n\t\t */\n\t\tradius: number;\n\t\tfillOpacity?: number;\n\t\tfilled?: boolean;\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to lollipop charts\n */\nexport interface LollipopChartOptions extends ScatterChartOptions {}\n\n/**\n * options specific to bubble charts\n */\nexport interface BubbleChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bubbles\n\t */\n\tbubble?: {\n\t\t/**\n\t\t * the key to lookup in charting data for the bubble radius value\n\t\t */\n\t\tradiusMapsTo?: string;\n\t\t/**\n\t\t * options for what the bubble radius value maps to\n\t\t */\n\t\tradiusLabel?: string;\n\t\t/**\n\t\t * A function that would determine the range of the bubble radius to use\n\t\t * Returns an array with the 1st value being the min and the 2nd value being the max radius\n\t\t */\n\t\tradiusRange?: Function;\n\t\t/**\n\t\t * Opacity of the fills used within each circle\n\t\t */\n\t\tfillOpacity?: number;\n\t\t/**\n\t\t * enabled scatter dot or not\n\t\t */\n\t\tenabled?: boolean;\n\t};\n}\n\n/**\n * options specific to bullet charts\n */\nexport interface BulletChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the individual bullets\n\t */\n\tbullet?: {\n\t\tperformanceAreaTitles?: string[];\n\t};\n}\n\n/**\n * options specific to histogram charts\n */\nexport interface HistogramChartOptions extends AxisChartOptions {\n\t/**\n\t * options related to bins\n\t */\n\tbins?: {\n\t\trangeLabel?: string;\n\t}\n}\n\n/**\n * options specific to line charts\n */\nexport interface LineChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n}\n\n/**\n * options specific to area charts\n */\nexport interface AreaChartOptions extends AxisChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n\t/**\n\t * options to bound the area of the chart\n\t */\n\tbounds?: {\n\t\tupperBoundMapsTo?: string;\n\t\tlowerBoundMapsTo?: string;\n\t};\n}\n\n/**\n * options specific to area charts\n */\nexport interface StackedAreaChartOptions extends ScatterChartOptions {\n\t/**\n\t * options for the curve of the line\n\t */\n\tcurve?:\n\t\t| string\n\t\t| {\n\t\t\t\tname: string;\n\t\t };\n}\n\n/**\n * options specific to world cloud charts\n */\nexport interface WordCloudChartTooltipOptions extends TooltipOptions {\n\t/** the label that shows up by the highlighted word in the tooltip */\n\twordLabel?: string;\n\t/** the label that shows up by the value of the highlighted word in the tooltip */\n\tvalueLabel?: string;\n}\n\nexport interface WorldCloudChartOptions extends BaseChartOptions {\n\twordCloud?: {\n\t\t/** what key in your charting data will the font sizes map to? */\n\t\tfontSizeMapsTo?: string;\n\t\t/** a function (chartSize, data) => {} that'll decide the range of font sizes, e.g. [10, 80] */\n\t\tfontSizeRange?: Function;\n\t\t/** what key in your charting data will the words map to? */\n\t\twordMapsTo?: string;\n\t};\n\t/**\n\t * tooltip configuration\n\t */\n\ttooltip?: WordCloudChartTooltipOptions;\n}\n\n/**\n * options specific to pie charts\n */\nexport interface PieChartOptions extends BaseChartOptions {\n\tpie?: {\n\t\tlabels?: {\n\t\t\tformatter?: Function;\n\t\t\tenabled?: Boolean;\n\t\t};\n\t\talignment?: Alignments;\n\t\tsortFunction?: (a: any, b: any) => number;\n\t};\n}\n\n/**\n * options specific to gauge charts\n */\nexport interface GaugeChartOptions extends BaseChartOptions {\n\tgauge?: {\n\t\tarcWidth?: number;\n\t\tdeltaArrow?: {\n\t\t\tdirection?: ArrowDirections;\n\t\t\tsize?: Function;\n\t\t\tenabled: Boolean;\n\t\t};\n\t\tshowPercentageSymbol?: Boolean;\n\t\tstatus?: Statuses;\n\t\tdeltaFontSize?: Function;\n\t\tnumberSpacing?: number;\n\t\tnumberFormatter?: Function;\n\t\tvalueFontSize?: Function;\n\t\ttype?: GaugeTypes;\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to donut charts\n */\nexport interface DonutChartOptions extends PieChartOptions {\n\tdonut?: {\n\t\tcenter?: {\n\t\t\tlabel?: string;\n\t\t\tnumber?: number;\n\t\t\tnumberFontSize?: Function;\n\t\t\ttitleFontSize?: Function;\n\t\t\ttitleYPosition?: Function;\n\t\t\tnumberFormatter?: Function;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\nexport interface MeterChartOptions extends BaseChartOptions {\n\tmeter?: {\n\t\tpeak?: number;\n\t\tstatus?: {\n\t\t\tranges: Array<{\n\t\t\t\trange: [number, number];\n\t\t\t\tstatus: Statuses;\n\t\t\t}>;\n\t\t};\n\t\theight?: number;\n\t\ttitle?: {\n\t\t\tpercentageIndicator?: {\n\t\t\t\t/**\n\t\t\t\t * rendering of the percentage value relative to the dataset within title\n\t\t\t\t */\n\t\t\t\tenabled?: boolean;\n\t\t\t};\n\t\t};\n\t};\n}\n\n/**\n * options specific to radar charts\n */\nexport interface RadarChartOptions extends BaseChartOptions {\n\tradar?: {\n\t\taxes: {\n\t\t\tangle: string;\n\t\t\tvalue: string;\n\t\t};\n\t\talignment?: Alignments;\n\t};\n}\n\n/**\n * options specific to combo charts\n */\nexport interface ComboChartOptions extends AxisChartOptions {\n\tcomboChartTypes: Array<{\n\t\ttype: ChartTypes | any;\n\t\toptions?: object;\n\t\tcorrespondingDatasets: Array<string>;\n\t}>;\n}\n\n/*\n * options specific to treemap charts\n */\nexport interface TreemapChartOptions extends BaseChartOptions {}\n\n/*\n * options specific to circle pack charts\n */\nexport interface CirclePackChartOptions extends BaseChartOptions {\n\tcirclePack?: {\n\t\tcircles: {\n\t\t\tfillOpacity: number;\n\t\t};\n\t\t// depth of nodes to display\n\t\thierachyLevel: number;\n\t\tpadding?: {\n\t\t\touter?: number;\n\t\t\tinner?: number;\n\t\t};\n\t};\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { ChartModelCartesian } from './cartesian-charts';
2
+ /**
3
+ * this is intended for binned type of charts
4
+ * */
5
+ export declare class ChartModelBinned extends ChartModelCartesian {
6
+ getTabularDataArray(): any[];
7
+ }
@@ -0,0 +1,52 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
15
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
16
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
17
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
18
+ r[k] = a[j];
19
+ return r;
20
+ };
21
+ // Internal Imports
22
+ import { ChartModelCartesian } from './cartesian-charts';
23
+ import { get } from 'lodash-es';
24
+ /**
25
+ * this is intended for binned type of charts
26
+ * */
27
+ var ChartModelBinned = /** @class */ (function (_super) {
28
+ __extends(ChartModelBinned, _super);
29
+ function ChartModelBinned() {
30
+ return _super !== null && _super.apply(this, arguments) || this;
31
+ }
32
+ ChartModelBinned.prototype.getTabularDataArray = function () {
33
+ var options = this.getOptions();
34
+ var groupMapsTo = options.data.groupMapsTo;
35
+ var binnedStackedData = this.getBinnedStackedData();
36
+ var result = __spreadArrays([
37
+ __spreadArrays([
38
+ get(options, 'bins.rangeLabel') || 'Range'
39
+ ], binnedStackedData.map(function (datum) {
40
+ return get(datum, "0." + groupMapsTo);
41
+ }))
42
+ ], get(binnedStackedData, 0).map(function (d, i) { return __spreadArrays([
43
+ get(d, 'data.x0') + " \u2013 " + get(d, 'data.x1')
44
+ ], binnedStackedData.map(function (datum) {
45
+ return get(datum[i], "data." + get(datum[i], groupMapsTo));
46
+ })); }));
47
+ return result;
48
+ };
49
+ return ChartModelBinned;
50
+ }(ChartModelCartesian));
51
+ export { ChartModelBinned };
52
+ //# sourceMappingURL=../../src/model/binned-charts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binned-charts.js","sourceRoot":"","sources":["binned-charts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC;;KAEK;AACL;IAAsC,oCAAmB;IAAzD;;IAwBA,CAAC;IAvBA,8CAAmB,GAAnB;QACC,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC1B,IAAA,sCAAW,CAAkB;QAErC,IAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAEtD,IAAM,MAAM;;gBAEV,GAAG,CAAC,OAAO,EAAE,iBAAiB,CAAC,IAAI,OAAO;eACvC,iBAAiB,CAAC,GAAG,CAAC,UAAC,KAAK;gBAC9B,OAAA,GAAG,CAAC,KAAK,EAAE,OAAK,WAAa,CAAC;YAA9B,CAA8B,CAC9B;WAEC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK;YACvC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,gBAAM,GAAG,CAAC,CAAC,EAAE,SAAS,CAAG;WAC1C,iBAAiB,CAAC,GAAG,CAAC,UAAC,KAAK;YAC9B,OAAA,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,UAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAG,CAAC;QAAnD,CAAmD,CACnD,GAJyC,CAK1C,CAAC,CACF,CAAC;QAEF,OAAO,MAAM,CAAC;IACf,CAAC;IACF,uBAAC;AAAD,CAAC,AAxBD,CAAsC,mBAAmB,GAwBxD","sourcesContent":["// Internal Imports\nimport { ChartModelCartesian } from './cartesian-charts';\n\nimport { get } from 'lodash-es';\n\n/**\n * this is intended for binned type of charts\n * */\nexport class ChartModelBinned extends ChartModelCartesian {\n\tgetTabularDataArray() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst binnedStackedData = this.getBinnedStackedData();\n\n\t\tconst result = [\n\t\t\t[\n\t\t\t\tget(options, 'bins.rangeLabel') || 'Range',\n\t\t\t\t...binnedStackedData.map((datum) =>\n\t\t\t\t\tget(datum, `0.${groupMapsTo}`)\n\t\t\t\t),\n\t\t\t],\n\t\t\t...get(binnedStackedData, 0).map((d, i) => [\n\t\t\t\t`${get(d, 'data.x0')} – ${get(d, 'data.x1')}`,\n\t\t\t\t...binnedStackedData.map((datum) =>\n\t\t\t\t\tget(datum[i], `data.${get(datum[i], groupMapsTo)}`)\n\t\t\t\t),\n\t\t\t]),\n\t\t];\n\n\t\treturn result;\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { ChartModelCartesian } from './model-cartesian-charts';
1
+ import { ChartModelCartesian } from './cartesian-charts';
2
2
  /** The charting model layer which includes mainly the chart data and options,
3
3
  * as well as some misc. information to be shared among components */
4
4
  export declare class BoxplotChartModel extends ChartModelCartesian {
@@ -12,9 +12,9 @@ var __extends = (this && this.__extends) || (function () {
12
12
  };
13
13
  })();
14
14
  // Internal Imports
15
- import { ChartModelCartesian } from './model-cartesian-charts';
16
- import * as Configuration from './configuration';
17
- import { Tools } from './tools';
15
+ import { ChartModelCartesian } from './cartesian-charts';
16
+ import * as Configuration from '../configuration';
17
+ import { Tools } from '../tools';
18
18
  // D3 Imports
19
19
  import { ascending, min, max, quantile } from 'd3-array';
20
20
  import { scaleOrdinal } from 'd3-scale';
@@ -117,4 +117,4 @@ var BoxplotChartModel = /** @class */ (function (_super) {
117
117
  return BoxplotChartModel;
118
118
  }(ChartModelCartesian));
119
119
  export { BoxplotChartModel };
120
- //# sourceMappingURL=../src/model-boxplot.js.map
120
+ //# sourceMappingURL=../../src/model/boxplot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxplot.js","sourceRoot":"","sources":["boxplot.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;qEACqE;AACrE;I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,OAAO,WAAW,CAAC;IACpB,CAAC;IAES,8CAAkB,GAA5B;QACC,aAAa;QACb,IAAM,cAAc,GAAG,CAAC,CAAC;QAEzB,IAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAC5C,IAAI,CAAC,UAAU,EAAE,EACjB,OAAO,EACP,SAAS,CACT,CAAC;QACF,IAAI,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAM,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC,cAAc,CAAC;QAE9D,qDAAqD;QACrD,aAAa;YACZ,aAAa,IAAI,kBAAkB,CAAI,cAAc,WAAQ,CAAC;gBAC7D,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,CAAC,CAAC;QAEN,yDAAyD;QACzD,IAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAC1C,UAAC,SAAS,EAAE,KAAK,IAAK,OAAG,cAAc,SAAI,aAAa,OAAI,EAAtC,CAAsC,CAC5D,CAAC;QAEF,kCAAkC;QAClC,IAAI,CAAC,eAAe,GAAG,YAAY,EAAE;aACnC,KAAK,CAAC,YAAY,CAAC;aACnB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IACF,wBAAC;AAAD,CAAC,AA5GD,CAAuC,mBAAmB,GA4GzD","sourcesContent":["// Internal Imports\nimport { ChartModelCartesian } from './cartesian-charts';\nimport * as Configuration from '../configuration';\nimport { Tools } from '../tools';\n\n// D3 Imports\nimport { ascending, min, max, quantile } from 'd3-array';\nimport { scaleOrdinal } from 'd3-scale';\n\n/** The charting model layer which includes mainly the chart data and options,\n * as well as some misc. information to be shared among components */\nexport class BoxplotChartModel extends ChartModelCartesian {\n\tconstructor(services: any) {\n\t\tsuper(services);\n\t}\n\n\tgetBoxQuartiles(d) {\n\t\treturn {\n\t\t\tq_25: quantile(d, 0.25),\n\t\t\tq_50: quantile(d, 0.5),\n\t\t\tq_75: quantile(d, 0.75),\n\t\t};\n\t}\n\n\tgetBoxplotData() {\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst groupedData = this.getGroupedData();\n\n\t\t// Prepare the data for the box plots\n\t\tconst boxplotData = [];\n\t\tfor (const { name: group, data } of groupedData) {\n\t\t\tconst rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();\n\t\t\tconst values = data.map((d) => d[rangeIdentifier]).sort(ascending);\n\n\t\t\tconst record = {\n\t\t\t\t[groupMapsTo]: group,\n\t\t\t\tcounts: values,\n\t\t\t\tquartiles: this.getBoxQuartiles(values),\n\t\t\t\toutliers: null,\n\t\t\t\twhiskers: null,\n\t\t\t};\n\n\t\t\tconst q1 = record.quartiles.q_25;\n\t\t\tconst q3 = record.quartiles.q_75;\n\n\t\t\tconst iqr = (q3 - q1) * 1.5;\n\t\t\tconst irq1 = q1 - iqr;\n\t\t\tconst irq3 = q3 + iqr;\n\n\t\t\tconst outliers = [];\n\t\t\tconst normalValues = [];\n\n\t\t\tfor (const value of values) {\n\t\t\t\tif (value < irq1) {\n\t\t\t\t\toutliers.push(value);\n\t\t\t\t} else if (value > irq3) {\n\t\t\t\t\toutliers.push(value);\n\t\t\t\t} else {\n\t\t\t\t\tnormalValues.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trecord.outliers = outliers;\n\n\t\t\tconst minNormalValue = min(normalValues);\n\t\t\tconst maxNormalValue = max(normalValues);\n\t\t\trecord.whiskers = {\n\t\t\t\tmin: minNormalValue\n\t\t\t\t\t? minNormalValue\n\t\t\t\t\t: min([\n\t\t\t\t\t\t\trecord.quartiles.q_25,\n\t\t\t\t\t\t\trecord.quartiles.q_50,\n\t\t\t\t\t\t\trecord.quartiles.q_75,\n\t\t\t\t\t ]),\n\t\t\t\tmax: maxNormalValue\n\t\t\t\t\t? maxNormalValue\n\t\t\t\t\t: max([\n\t\t\t\t\t\t\trecord.quartiles.q_25,\n\t\t\t\t\t\t\trecord.quartiles.q_50,\n\t\t\t\t\t\t\trecord.quartiles.q_75,\n\t\t\t\t\t ]),\n\t\t\t};\n\n\t\t\tboxplotData.push(record);\n\t\t}\n\n\t\treturn boxplotData;\n\t}\n\n\tprotected setColorClassNames() {\n\t\t// monochrome\n\t\tconst numberOfColors = 1;\n\n\t\tconst colorPairingOptions = Tools.getProperty(\n\t\t\tthis.getOptions(),\n\t\t\t'color',\n\t\t\t'pairing'\n\t\t);\n\t\tlet pairingOption = Tools.getProperty(colorPairingOptions, 'option');\n\t\tconst colorPairingCounts = Configuration.color.pairingOptions;\n\n\t\t// Use default palette if user choice is not in range\n\t\tpairingOption =\n\t\t\tpairingOption <= colorPairingCounts[`${numberOfColors}-color`]\n\t\t\t\t? pairingOption\n\t\t\t\t: 1;\n\n\t\t// Create color classes for graph, tooltip and stroke use\n\t\tconst colorPairing = this.allDataGroups.map(\n\t\t\t(dataGroup, index) => `${numberOfColors}-${pairingOption}-1`\n\t\t);\n\n\t\t// Create default color classnames\n\t\tthis.colorClassNames = scaleOrdinal()\n\t\t\t.range(colorPairing)\n\t\t\t.domain(this.allDataGroups);\n\t}\n}\n"]}
@@ -4,6 +4,8 @@ import { ChartModel } from './model';
4
4
  * */
5
5
  export declare class ChartModelCartesian extends ChartModel {
6
6
  constructor(services: any);
7
+ private assignRangeAndDomains;
8
+ getTabularDataArray(): any[];
7
9
  exportToCSV(): void;
8
10
  setData(newData: any): any;
9
11
  /**
@@ -11,10 +11,17 @@ var __extends = (this && this.__extends) || (function () {
11
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
12
  };
13
13
  })();
14
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
15
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
16
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
17
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
18
+ r[k] = a[j];
19
+ return r;
20
+ };
14
21
  // Internal Imports
15
22
  import { ChartModel } from './model';
16
- import { Tools } from './tools';
17
- import { ScaleTypes, AxisPositions } from './interfaces';
23
+ import { Tools } from '../tools';
24
+ import { ScaleTypes, AxisPositions } from '../interfaces';
18
25
  // date formatting
19
26
  import { format } from 'date-fns';
20
27
  /**
@@ -25,33 +32,86 @@ var ChartModelCartesian = /** @class */ (function (_super) {
25
32
  function ChartModelCartesian(services) {
26
33
  return _super.call(this, services) || this;
27
34
  }
28
- ChartModelCartesian.prototype.exportToCSV = function () {
35
+ // get the scales information
36
+ // needed for getTabularArray()
37
+ ChartModelCartesian.prototype.assignRangeAndDomains = function () {
38
+ var cartesianScales = this.services.cartesianScales;
39
+ var options = this.getOptions();
40
+ var isDualAxes = cartesianScales.isDualAxes();
41
+ var scales = {
42
+ primaryDomain: cartesianScales.domainAxisPosition,
43
+ primaryRange: cartesianScales.rangeAxisPosition,
44
+ secondaryDomain: null,
45
+ secondaryRange: null,
46
+ };
47
+ if (isDualAxes) {
48
+ scales.secondaryDomain =
49
+ cartesianScales.secondaryDomainAxisPosition;
50
+ scales.secondaryRange = cartesianScales.secondaryRangeAxisPosition;
51
+ }
52
+ Object.keys(scales).forEach(function (scale) {
53
+ var position = scales[scale];
54
+ if (cartesianScales.scales[position]) {
55
+ scales[scale] = {
56
+ position: position,
57
+ label: cartesianScales.getScaleLabel(position),
58
+ identifier: Tools.getProperty(options, 'axes', position, 'mapsTo'),
59
+ };
60
+ }
61
+ else {
62
+ scales[scale] = null;
63
+ }
64
+ });
65
+ return scales;
66
+ };
67
+ ChartModelCartesian.prototype.getTabularDataArray = function () {
29
68
  var displayData = this.getDisplayData();
30
69
  var options = this.getOptions();
31
70
  var groupMapsTo = options.data.groupMapsTo;
32
71
  var cartesianScales = this.services.cartesianScales;
33
- var domainIdentifier = cartesianScales.getDomainIdentifier();
34
- var rangeIdentifier = cartesianScales.getRangeIdentifier();
72
+ var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
35
73
  var domainScaleType = cartesianScales.getDomainAxisScaleType();
36
74
  var domainValueFormatter;
37
75
  if (domainScaleType === ScaleTypes.TIME) {
38
76
  domainValueFormatter = function (d) { return format(d, 'MMM d, yyyy'); };
39
77
  }
40
- // domain & range labels
41
- var domainLabel = cartesianScales.getDomainLabel();
42
- var rangeLabel = cartesianScales.getRangeLabel();
43
- var data = [['Group', domainLabel, rangeLabel]];
44
- data = data.concat(displayData.map(function (datum) { return [
45
- "\"" + datum[groupMapsTo] + "\"",
46
- "\"" + (datum[domainIdentifier] === null
47
- ? '–'
78
+ var result = __spreadArrays([
79
+ __spreadArrays([
80
+ 'Group',
81
+ primaryDomain.label,
82
+ primaryRange.label
83
+ ], (secondaryDomain ? [secondaryDomain.label] : []), (secondaryRange ? [secondaryRange.label] : []))
84
+ ], displayData.map(function (datum) { return __spreadArrays([
85
+ datum[groupMapsTo],
86
+ datum[primaryDomain.identifier] === null
87
+ ? '&ndash;'
48
88
  : domainValueFormatter
49
- ? domainValueFormatter(datum[domainIdentifier])
50
- : datum[domainIdentifier]) + "\"",
51
- "\"" + (datum[rangeIdentifier] === null
52
- ? '–'
53
- : datum[rangeIdentifier].toLocaleString()) + "\"",
54
- ]; }));
89
+ ? domainValueFormatter(datum[primaryDomain.identifier])
90
+ : datum[primaryDomain.identifier],
91
+ datum[primaryRange.identifier] === null ||
92
+ isNaN(datum[primaryRange.identifier])
93
+ ? '&ndash;'
94
+ : datum[primaryRange.identifier].toLocaleString()
95
+ ], (secondaryDomain
96
+ ? [
97
+ datum[secondaryDomain.identifier] === null
98
+ ? '&ndash;'
99
+ : datum[secondaryDomain.identifier],
100
+ ]
101
+ : []), (secondaryRange
102
+ ? [
103
+ datum[secondaryRange.identifier] === null ||
104
+ isNaN(datum[secondaryRange.identifier])
105
+ ? '&ndash;'
106
+ : datum[secondaryRange.identifier],
107
+ ]
108
+ : [])); }));
109
+ return result;
110
+ };
111
+ ChartModelCartesian.prototype.exportToCSV = function () {
112
+ var data = this.getTabularDataArray().map(function (row) {
113
+ return row.map(function (column) { return "\"" + column + "\""; });
114
+ });
55
115
  var csvString = '', csvData = '';
56
116
  data.forEach(function (d, i) {
57
117
  csvData = d.join(',');
@@ -148,4 +208,4 @@ var ChartModelCartesian = /** @class */ (function (_super) {
148
208
  return ChartModelCartesian;
149
209
  }(ChartModel));
150
210
  export { ChartModelCartesian };
151
- //# sourceMappingURL=../src/model-cartesian-charts.js.map
211
+ //# sourceMappingURL=../../src/model/cartesian-charts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesian-charts.js","sourceRoot":"","sources":["cartesian-charts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,mBAAmB;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE1D,kBAAkB;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;KAEK;AACL;IAAyC,uCAAU;IAClD,6BAAY,QAAa;eACxB,kBAAM,QAAQ,CAAC;IAChB,CAAC;IAED,6BAA6B;IAC7B,+BAA+B;IACvB,mDAAqB,GAA7B;QACS,IAAA,+CAAe,CAAmB;QAC1C,IAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAM,UAAU,GAAG,eAAe,CAAC,UAAU,EAAE,CAAC;QAEhD,IAAM,MAAM,GAAG;YACd,aAAa,EAAE,eAAe,CAAC,kBAAkB;YACjD,YAAY,EAAE,eAAe,CAAC,iBAAiB;YAC/C,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,IAAI;SACpB,CAAC;QACF,IAAI,UAAU,EAAE;YACf,MAAM,CAAC,eAAe;gBACrB,eAAe,CAAC,2BAA2B,CAAC;YAC7C,MAAM,CA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G,iBAAM,QAAQ,YAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACb,CAAC;IACF,0BAAC;AAAD,CAAC,AA7OD,CAAyC,UAAU,GA6OlD","sourcesContent":["// Internal Imports\nimport { ChartModel } from './model';\nimport { Tools } from '../tools';\nimport { ScaleTypes, AxisPositions } from '../interfaces';\n\n// date formatting\nimport { format } from 'date-fns';\n\n/**\n * This supports adding X and Y Cartesian[2D] zoom data to a ChartModel\n * */\nexport class ChartModelCartesian extends ChartModel {\n\tconstructor(services: any) {\n\t\tsuper(services);\n\t}\n\n\t// get the scales information\n\t// needed for getTabularArray()\n\tprivate assignRangeAndDomains() {\n\t\tconst { cartesianScales } = this.services;\n\t\tconst options = this.getOptions();\n\t\tconst isDualAxes = cartesianScales.isDualAxes();\n\n\t\tconst scales = {\n\t\t\tprimaryDomain: cartesianScales.domainAxisPosition,\n\t\t\tprimaryRange: cartesianScales.rangeAxisPosition,\n\t\t\tsecondaryDomain: null,\n\t\t\tsecondaryRange: null,\n\t\t};\n\t\tif (isDualAxes) {\n\t\t\tscales.secondaryDomain =\n\t\t\t\tcartesianScales.secondaryDomainAxisPosition;\n\t\t\tscales.secondaryRange = cartesianScales.secondaryRangeAxisPosition;\n\t\t}\n\n\t\tObject.keys(scales).forEach((scale) => {\n\t\t\tconst position = scales[scale];\n\t\t\tif (cartesianScales.scales[position]) {\n\t\t\t\tscales[scale] = {\n\t\t\t\t\tposition: position,\n\t\t\t\t\tlabel: cartesianScales.getScaleLabel(position),\n\t\t\t\t\tidentifier: Tools.getProperty(\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\t'axes',\n\t\t\t\t\t\tposition,\n\t\t\t\t\t\t'mapsTo'\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tscales[scale] = null;\n\t\t\t}\n\t\t});\n\n\t\treturn scales;\n\t}\n\n\tgetTabularDataArray() {\n\t\tconst displayData = this.getDisplayData();\n\t\tconst options = this.getOptions();\n\t\tconst { groupMapsTo } = options.data;\n\n\t\tconst { cartesianScales } = this.services;\n\t\tconst {\n\t\t\tprimaryDomain,\n\t\t\tprimaryRange,\n\t\t\tsecondaryDomain,\n\t\t\tsecondaryRange,\n\t\t} = this.assignRangeAndDomains();\n\n\t\tconst domainScaleType = cartesianScales.getDomainAxisScaleType();\n\t\tlet domainValueFormatter;\n\t\tif (domainScaleType === ScaleTypes.TIME) {\n\t\t\tdomainValueFormatter = (d) => format(d, 'MMM d, yyyy');\n\t\t}\n\n\t\tconst result = [\n\t\t\t[\n\t\t\t\t'Group',\n\t\t\t\tprimaryDomain.label,\n\t\t\t\tprimaryRange.label,\n\t\t\t\t...(secondaryDomain ? [secondaryDomain.label] : []),\n\t\t\t\t...(secondaryRange ? [secondaryRange.label] : []),\n\t\t\t],\n\t\t\t...displayData.map((datum) => [\n\t\t\t\tdatum[groupMapsTo],\n\t\t\t\tdatum[primaryDomain.identifier] === null\n\t\t\t\t\t? '&ndash;'\n\t\t\t\t\t: domainValueFormatter\n\t\t\t\t\t? domainValueFormatter(datum[primaryDomain.identifier])\n\t\t\t\t\t: datum[primaryDomain.identifier],\n\t\t\t\tdatum[primaryRange.identifier] === null ||\n\t\t\t\tisNaN(datum[primaryRange.identifier])\n\t\t\t\t\t? '&ndash;'\n\t\t\t\t\t: datum[primaryRange.identifier].toLocaleString(),\n\t\t\t\t...(secondaryDomain\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tdatum[secondaryDomain.identifier] === null\n\t\t\t\t\t\t\t\t? '&ndash;'\n\t\t\t\t\t\t\t\t: datum[secondaryDomain.identifier],\n\t\t\t\t\t ]\n\t\t\t\t\t: []),\n\t\t\t\t...(secondaryRange\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tdatum[secondaryRange.identifier] === null ||\n\t\t\t\t\t\t\tisNaN(datum[secondaryRange.identifier])\n\t\t\t\t\t\t\t\t? '&ndash;'\n\t\t\t\t\t\t\t\t: datum[secondaryRange.identifier],\n\t\t\t\t\t ]\n\t\t\t\t\t: []),\n\t\t\t]),\n\t\t];\n\n\t\treturn result;\n\t}\n\n\texportToCSV() {\n\t\tlet data = this.getTabularDataArray().map((row) =>\n\t\t\trow.map((column) => `\\\"${column}\\\"`)\n\t\t);\n\n\t\tlet csvString = '',\n\t\t\tcsvData = '';\n\t\tdata.forEach(function (d, i) {\n\t\t\tcsvData = d.join(',');\n\t\t\tcsvString += i < data.length ? csvData + '\\n' : csvData;\n\t\t});\n\n\t\tthis.services.files.downloadCSV(csvString, 'myChart.csv');\n\t}\n\n\tsetData(newData) {\n\t\tlet data;\n\t\tif (newData) {\n\t\t\tdata = super.setData(newData);\n\t\t\tif (\n\t\t\t\tTools.getProperty(\n\t\t\t\t\tthis.getOptions(),\n\t\t\t\t\t'zoomBar',\n\t\t\t\t\tAxisPositions.TOP,\n\t\t\t\t\t'enabled'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// get pre-defined zoom bar data\n\t\t\t\tconst definedZoomBarData = Tools.getProperty(\n\t\t\t\t\tthis.getOptions(),\n\t\t\t\t\t'zoomBar',\n\t\t\t\t\tAxisPositions.TOP,\n\t\t\t\t\t'data'\n\t\t\t\t);\n\t\t\t\t// if we have zoom bar data we need to update it as well\n\t\t\t\t// with pre-defined zoom bar data\n\t\t\t\tthis.setZoomBarData(definedZoomBarData);\n\t\t\t}\n\t\t}\n\n\t\treturn data;\n\t}\n\n\t/**\n\t * @param zoomBarData any special zoom bar data to use instead of the model data\n\t */\n\tsetZoomBarData(newZoomBarData?) {\n\t\tconst sanitizedData = newZoomBarData\n\t\t\t? this.sanitize(Tools.clone(newZoomBarData))\n\t\t\t: this.getDisplayData(); // if we're not passed explicit zoom data use the model\n\n\t\tlet zoomBarNormalizedValues = sanitizedData;\n\n\t\tconst { cartesianScales } = this.services;\n\t\tif (\n\t\t\tsanitizedData &&\n\t\t\tcartesianScales.domainAxisPosition &&\n\t\t\tcartesianScales.rangeAxisPosition\n\t\t) {\n\t\t\tconst domainIdentifier = cartesianScales.getDomainIdentifier();\n\t\t\tconst rangeIdentifier = cartesianScales.getRangeIdentifier();\n\t\t\t// get all dates (Number) in displayData\n\t\t\tlet allDates = sanitizedData.map((datum) =>\n\t\t\t\tdatum[domainIdentifier].getTime()\n\t\t\t);\n\t\t\tallDates = Tools.removeArrayDuplicates(allDates).sort();\n\n\t\t\t// Go through all date values\n\t\t\t// And get corresponding data from each dataset\n\t\t\tzoomBarNormalizedValues = allDates.map((date) => {\n\t\t\t\tlet sum = 0;\n\t\t\t\tconst datum = {};\n\n\t\t\t\tsanitizedData.forEach((data) => {\n\t\t\t\t\tif (data[domainIdentifier].getTime() === date) {\n\t\t\t\t\t\tsum += data[rangeIdentifier];\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tdatum[domainIdentifier] = new Date(date);\n\t\t\t\tdatum[rangeIdentifier] = sum;\n\n\t\t\t\treturn datum;\n\t\t\t});\n\t\t}\n\n\t\tthis.set({ zoomBarData: zoomBarNormalizedValues });\n\t}\n\n\tgetZoomBarData() {\n\t\treturn this.get('zoomBarData');\n\t}\n\n\tprotected sanitizeDateValues(data) {\n\t\tconst options = this.getOptions();\n\n\t\tif (!options.axes) {\n\t\t\treturn data;\n\t\t}\n\n\t\tconst keysToCheck = [];\n\t\tObject.keys(AxisPositions).forEach((axisPositionKey) => {\n\t\t\tconst axisPosition = AxisPositions[axisPositionKey];\n\t\t\tconst axisOptions = options.axes[axisPosition];\n\n\t\t\tif (axisOptions && axisOptions.scaleType === ScaleTypes.TIME) {\n\t\t\t\tconst axisMapsTo = axisOptions.mapsTo;\n\n\t\t\t\tif (axisMapsTo !== null || axisMapsTo !== undefined) {\n\t\t\t\t\tkeysToCheck.push(axisMapsTo);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (keysToCheck.length > 0) {\n\t\t\t// Check all datapoints and sanitize dates\n\t\t\tdata.forEach((datum) => {\n\t\t\t\tkeysToCheck.forEach((key) => {\n\t\t\t\t\tif (Tools.getProperty(datum, key, 'getTime') === null) {\n\t\t\t\t\t\tdatum[key] = new Date(datum[key]);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tprotected sanitize(data) {\n\t\tdata = super.sanitize(data);\n\t\tdata = this.sanitizeDateValues(data);\n\n\t\treturn data;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { ChartModel } from './model';
2
- import { LegendItemType } from './interfaces/enums';
2
+ import { LegendItemType } from '../interfaces/enums';
3
3
  /** The charting model layer which includes mainly the chart data and options,
4
4
  * as well as some misc. information to be shared among components */
5
5
  export declare class CirclePackChartModel extends ChartModel {
@@ -24,8 +24,8 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  // Internal Imports
26
26
  import { ChartModel } from './model';
27
- import { Tools } from './tools';
28
- import { LegendItemType } from './interfaces/enums';
27
+ import { Tools } from '../tools';
28
+ import { LegendItemType } from '../interfaces/enums';
29
29
  /** The charting model layer which includes mainly the chart data and options,
30
30
  * as well as some misc. information to be shared among components */
31
31
  var CirclePackChartModel = /** @class */ (function (_super) {
@@ -135,4 +135,4 @@ var CirclePackChartModel = /** @class */ (function (_super) {
135
135
  return CirclePackChartModel;
136
136
  }(ChartModel));
137
137
  export { CirclePackChartModel };
138
- //# sourceMappingURL=../src/model-circle-pack.js.map
138
+ //# sourceMappingURL=../../src/model/circle-pack.js.map