@carbon/charts 1.6.13 → 1.7.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 (190) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/axis-chart.js +1 -1
  3. package/axis-chart.js.map +1 -1
  4. package/build/src/interfaces/charts.d.ts +6 -0
  5. package/build/src/tools.d.ts +2420 -151
  6. package/bundle.js +1 -1
  7. package/chart.js +1 -1
  8. package/chart.js.map +1 -1
  9. package/charts/alluvial.js +1 -1
  10. package/charts/alluvial.js.map +1 -1
  11. package/charts/area-stacked.js +1 -1
  12. package/charts/area-stacked.js.map +1 -1
  13. package/charts/area.js +1 -1
  14. package/charts/area.js.map +1 -1
  15. package/charts/bar-grouped.js +1 -1
  16. package/charts/bar-grouped.js.map +1 -1
  17. package/charts/bar-simple.js +1 -1
  18. package/charts/bar-simple.js.map +1 -1
  19. package/charts/bar-stacked.js +1 -1
  20. package/charts/bar-stacked.js.map +1 -1
  21. package/charts/boxplot.js +1 -1
  22. package/charts/boxplot.js.map +1 -1
  23. package/charts/bubble.js +1 -1
  24. package/charts/bubble.js.map +1 -1
  25. package/charts/bullet.js +1 -1
  26. package/charts/bullet.js.map +1 -1
  27. package/charts/circle-pack.js +1 -1
  28. package/charts/circle-pack.js.map +1 -1
  29. package/charts/combo.js +1 -1
  30. package/charts/combo.js.map +1 -1
  31. package/charts/donut.js +1 -1
  32. package/charts/donut.js.map +1 -1
  33. package/charts/gauge.js +1 -1
  34. package/charts/gauge.js.map +1 -1
  35. package/charts/heatmap.js +1 -1
  36. package/charts/heatmap.js.map +1 -1
  37. package/charts/histogram.js +1 -1
  38. package/charts/histogram.js.map +1 -1
  39. package/charts/line.js +1 -1
  40. package/charts/line.js.map +1 -1
  41. package/charts/lollipop.js +1 -1
  42. package/charts/lollipop.js.map +1 -1
  43. package/charts/meter.js +1 -1
  44. package/charts/meter.js.map +1 -1
  45. package/charts/pie.js +1 -1
  46. package/charts/pie.js.map +1 -1
  47. package/charts/radar.js +1 -1
  48. package/charts/radar.js.map +1 -1
  49. package/charts/scatter.js +1 -1
  50. package/charts/scatter.js.map +1 -1
  51. package/charts/tree.js +1 -1
  52. package/charts/tree.js.map +1 -1
  53. package/charts/treemap.js +1 -1
  54. package/charts/treemap.js.map +1 -1
  55. package/charts/wordcloud.js +1 -1
  56. package/charts/wordcloud.js.map +1 -1
  57. package/components/axes/axis.js +1 -1
  58. package/components/axes/axis.js.map +1 -1
  59. package/components/axes/grid.js +1 -1
  60. package/components/axes/grid.js.map +1 -1
  61. package/components/axes/hover-axis.js +1 -1
  62. package/components/axes/hover-axis.js.map +1 -1
  63. package/components/axes/ruler-binned.js +1 -1
  64. package/components/axes/ruler-binned.js.map +1 -1
  65. package/components/axes/ruler.js +1 -1
  66. package/components/axes/ruler.js.map +1 -1
  67. package/components/axes/toolbar.js +1 -1
  68. package/components/axes/toolbar.js.map +1 -1
  69. package/components/axes/two-dimensional-axes.js +1 -1
  70. package/components/axes/two-dimensional-axes.js.map +1 -1
  71. package/components/axes/zero-line.js +1 -1
  72. package/components/axes/zero-line.js.map +1 -1
  73. package/components/axes/zoom-bar.js +1 -1
  74. package/components/axes/zoom-bar.js.map +1 -1
  75. package/components/component.js +1 -1
  76. package/components/component.js.map +1 -1
  77. package/components/essentials/color-scale-legend.js +1 -1
  78. package/components/essentials/color-scale-legend.js.map +1 -1
  79. package/components/essentials/highlights.js +1 -1
  80. package/components/essentials/highlights.js.map +1 -1
  81. package/components/essentials/legend.js +1 -1
  82. package/components/essentials/legend.js.map +1 -1
  83. package/components/essentials/modal.js +1 -1
  84. package/components/essentials/modal.js.map +1 -1
  85. package/components/essentials/threshold.js +1 -1
  86. package/components/essentials/threshold.js.map +1 -1
  87. package/components/essentials/title-meter.js +1 -1
  88. package/components/essentials/title-meter.js.map +1 -1
  89. package/components/essentials/title.js +1 -1
  90. package/components/essentials/title.js.map +1 -1
  91. package/components/essentials/tooltip-axis.js +1 -1
  92. package/components/essentials/tooltip-axis.js.map +1 -1
  93. package/components/essentials/tooltip.js +1 -1
  94. package/components/essentials/tooltip.js.map +1 -1
  95. package/components/graphs/alluvial.js +1 -1
  96. package/components/graphs/alluvial.js.map +1 -1
  97. package/components/graphs/area-stacked.js +1 -1
  98. package/components/graphs/area-stacked.js.map +1 -1
  99. package/components/graphs/area.js +1 -1
  100. package/components/graphs/area.js.map +1 -1
  101. package/components/graphs/bar-grouped.js +1 -1
  102. package/components/graphs/bar-grouped.js.map +1 -1
  103. package/components/graphs/bar-simple.js +1 -1
  104. package/components/graphs/bar-simple.js.map +1 -1
  105. package/components/graphs/bar-stacked.js +1 -1
  106. package/components/graphs/bar-stacked.js.map +1 -1
  107. package/components/graphs/bar.js +1 -1
  108. package/components/graphs/bar.js.map +1 -1
  109. package/components/graphs/boxplot.js +1 -1
  110. package/components/graphs/boxplot.js.map +1 -1
  111. package/components/graphs/bubble.js +1 -1
  112. package/components/graphs/bubble.js.map +1 -1
  113. package/components/graphs/bullet.js +1 -1
  114. package/components/graphs/bullet.js.map +1 -1
  115. package/components/graphs/circle-pack.js +1 -1
  116. package/components/graphs/circle-pack.js.map +1 -1
  117. package/components/graphs/donut.js +1 -1
  118. package/components/graphs/donut.js.map +1 -1
  119. package/components/graphs/gauge.js +1 -1
  120. package/components/graphs/gauge.js.map +1 -1
  121. package/components/graphs/heatmap.js +1 -1
  122. package/components/graphs/heatmap.js.map +1 -1
  123. package/components/graphs/histogram.js +1 -1
  124. package/components/graphs/histogram.js.map +1 -1
  125. package/components/graphs/line.js +1 -1
  126. package/components/graphs/line.js.map +1 -1
  127. package/components/graphs/lollipop.js +1 -1
  128. package/components/graphs/lollipop.js.map +1 -1
  129. package/components/graphs/meter.js +1 -1
  130. package/components/graphs/meter.js.map +1 -1
  131. package/components/graphs/pie.js +1 -1
  132. package/components/graphs/pie.js.map +1 -1
  133. package/components/graphs/radar.js +1 -1
  134. package/components/graphs/radar.js.map +1 -1
  135. package/components/graphs/scatter-stacked.js +1 -1
  136. package/components/graphs/scatter-stacked.js.map +1 -1
  137. package/components/graphs/scatter.js +1 -1
  138. package/components/graphs/scatter.js.map +1 -1
  139. package/components/graphs/skeleton-lines.js +1 -1
  140. package/components/graphs/skeleton-lines.js.map +1 -1
  141. package/components/graphs/skeleton.js +1 -1
  142. package/components/graphs/skeleton.js.map +1 -1
  143. package/components/graphs/tree.js +1 -1
  144. package/components/graphs/tree.js.map +1 -1
  145. package/components/graphs/treemap.js +1 -1
  146. package/components/graphs/treemap.js.map +1 -1
  147. package/components/graphs/wordcloud.js +1 -1
  148. package/components/graphs/wordcloud.js.map +1 -1
  149. package/components/layout/layout.js +1 -1
  150. package/components/layout/layout.js.map +1 -1
  151. package/configuration.js +1 -1
  152. package/configuration.js.map +1 -1
  153. package/demo/data/bar.js +60 -12
  154. package/demo/data/bar.js.map +1 -1
  155. package/demo/tsconfig.tsbuildinfo +1 -1
  156. package/interfaces/charts.d.ts +6 -0
  157. package/interfaces/charts.js.map +1 -1
  158. package/model/boxplot.js +1 -1
  159. package/model/boxplot.js.map +1 -1
  160. package/model/bullet.js +1 -1
  161. package/model/bullet.js.map +1 -1
  162. package/model/cartesian-charts.js +1 -1
  163. package/model/cartesian-charts.js.map +1 -1
  164. package/model/circle-pack.js +1 -1
  165. package/model/circle-pack.js.map +1 -1
  166. package/model/heatmap.js +1 -1
  167. package/model/heatmap.js.map +1 -1
  168. package/model/meter.js +1 -1
  169. package/model/meter.js.map +1 -1
  170. package/model/model.js +8 -2
  171. package/model/model.js.map +1 -1
  172. package/model/radar.js +1 -1
  173. package/model/radar.js.map +1 -1
  174. package/model/treemap.js +1 -1
  175. package/model/treemap.js.map +1 -1
  176. package/package.json +1 -1
  177. package/services/essentials/dom-utils.js +15 -3
  178. package/services/essentials/dom-utils.js.map +1 -1
  179. package/services/essentials/transitions.js +1 -1
  180. package/services/essentials/transitions.js.map +1 -1
  181. package/services/scales-cartesian.js +1 -1
  182. package/services/scales-cartesian.js.map +1 -1
  183. package/services/time-series.js +1 -1
  184. package/services/time-series.js.map +1 -1
  185. package/services/zoom.js +1 -1
  186. package/services/zoom.js.map +1 -1
  187. package/tools.d.ts +141 -155
  188. package/tools.js +315 -344
  189. package/tools.js.map +1 -1
  190. package/tsconfig.tsbuildinfo +92 -92
package/tools.d.ts CHANGED
@@ -1,158 +1,144 @@
1
1
  import { CartesianOrientations } from './interfaces';
2
+ import { debounce, merge, unionBy, clamp, flatten, groupBy, camelCase, isEmpty, isEqual, flatMapDeep, kebabCase, fromPairs, some } from 'lodash-es';
2
3
  import { Numeric } from 'd3-array';
3
- export declare namespace Tools {
4
- export const debounce: any;
5
- export const clone: any;
6
- export const merge: any;
7
- export const unionBy: any;
8
- export const removeArrayDuplicates: any;
9
- export const clamp: any;
10
- export const flatten: any;
11
- export const groupBy: any;
12
- export const camelCase: any;
13
- export const isEmpty: any;
14
- export const isEqual: any;
15
- export const flatMapDeep: any;
16
- export const kebabCase: any;
17
- export const fromPairs: any;
18
- export const some: any;
19
- export function debounceWithD3MousePosition(fn: any, delay: any, holder: any): () => void;
20
- /**
21
- * Returns default chart options merged with provided options,
22
- * with special cases for axes.
23
- * Axes object will not merge the not provided axes.
24
- *
25
- * @export
26
- * @param {AxisChartOptions} defaultOptions Configuration.options[chartType]
27
- * @param {AxisChartOptions} providedOptions user provided options
28
- * @returns merged options
29
- */
30
- export function mergeDefaultChartOptions(defaultOptions: any, providedOptions: any): any;
31
- /**************************************
32
- * DOM-related operations *
33
- *************************************/
34
- /**
35
- * Get width & height of an element
36
- *
37
- * @export
38
- * @param {any} el element to get dimensions from
39
- * @returns an object containing the width and height of el
40
- */
41
- export function getDimensions(el: any): {
42
- width: number;
43
- height: number;
44
- };
45
- /**
46
- * Gets elements's x and y translations from transform attribute or returns null
47
- *
48
- * @param {HTMLElement} element
49
- * @returns an object containing the translated x and y values or null
50
- */
51
- export function getTranslationValues(elementRef: HTMLElement): {
52
- tx: string;
53
- ty: string;
54
- };
55
- /**************************************
56
- * Formatting & calculations *
57
- *************************************/
58
- /**
59
- * Gets x and y coordinates from HTML transform attribute
60
- *
61
- * @export
62
- * @param {any} string the transform attribute string ie. transform(x,y)
63
- * @returns Returns an object with x and y offsets of the transform
64
- */
65
- export function getTranformOffsets(string: any): {
66
- x: number;
67
- y: number;
68
- };
69
- /**
70
- * Returns string value for height/width using pixels if there isn't a specified unit of measure
71
- *
72
- * @param value string or number value to be checked for unit of measure
73
- */
74
- export function formatWidthHeightValues(value: any): any;
75
- /**
76
- * Capitalizes first letter of a string
77
- *
78
- * @export
79
- * @param {any} string the input string to perform first letter capitalization with
80
- * @returns The transformed string after first letter is capitalized
81
- */
82
- export function capitalizeFirstLetter(string: any): any;
83
- /**
84
- * Get the percentage of a datapoint compared to the entire dataset.
85
- * @export
86
- * @param {any} item
87
- * @param {any} fullData
88
- * @param {string} key
89
- * @returns The percentage in the form of a number (1 significant digit if necessary)
90
- */
91
- export function convertValueToPercentage(item: any, fullData: any, key?: string): number;
92
- /**
93
- * Truncate the labels
94
- * @export
95
- * @param {any} fullText
96
- * @param {any} truncationType
97
- * @param {any} numCharacter
98
- * @returns Truncated text
99
- */
100
- export function truncateLabel(fullText: any, truncationType: any, numCharacter: any): any;
101
- /**
102
- * Update legend additional items
103
- * @param {any} defaultOptions
104
- * @param {any} providedOptions
105
- */
106
- export function updateLegendAdditionalItems(defaultOptions: any, providedOptions: any): void;
107
- /**************************************
108
- * Object/array related checks *
109
- *************************************/
110
- /**
111
- * Compares two arrays to return the difference between two arrays' items.
112
- *
113
- * @export
114
- * @param {any[]} oldArray the array to check for missing items
115
- * @param {any[]} newArray the array to check for newly added items
116
- * @returns An object containing items missing (existing in oldArray but not newArray)
117
- * and items added (existing in newArray but not in oldArray). Object is of the form { missing: [], added: [] }
118
- */
119
- export function arrayDifferences(oldArray: any[], newArray: any[]): {
120
- missing: any[];
121
- added: any[];
122
- };
123
- /**
124
- * Gets the duplicated keys from an array of data
125
- *
126
- * @export
127
- * @param {*} data - array of data
128
- * @returns A list of the duplicated keys in data
129
- */
130
- export function getDuplicateValues(arr: any): any[];
131
- /**
132
- * In D3, moves an element to the front of the canvas
133
- *
134
- * @export
135
- * @param {any} element input element to moved in front
136
- * @returns The function to be used by D3 to push element to the top of the canvas
137
- */
138
- export function moveToFront(element: any): any;
139
- /**
140
- * Gets a speicified property from within an object.
141
- *
142
- * @param object the object containing the property to retrieve
143
- * @param propPath nested properties used to extract the final property from within the object
144
- * (i.e "style", "color" would retrieve the color property from within an object that has "color" nested within "style")
145
- */
146
- export const getProperty: (object: any, ...propPath: any[]) => any;
147
- interface SVGPathCoordinates {
148
- x0: number;
149
- x1: number;
150
- y0: number;
151
- y1: number;
152
- }
153
- export const flipSVGCoordinatesBasedOnOrientation: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => SVGPathCoordinates;
154
- export const generateSVGPathString: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => string;
155
- export function flipDomainAndRangeBasedOnOrientation<D, R>(domain: D, range: R, orientation?: CartesianOrientations): [D, R] | [R, D];
156
- export const compareNumeric: (a: Numeric, b: Numeric) => boolean;
157
- export {};
4
+ export { debounce, merge, unionBy, clamp, flatten, groupBy, camelCase, isEmpty, isEqual, flatMapDeep, kebabCase, fromPairs, some, };
5
+ export declare const clone: any;
6
+ export declare const removeArrayDuplicates: any;
7
+ export declare function debounceWithD3MousePosition(fn: any, delay: any, holder: any): () => void;
8
+ /**
9
+ * Returns default chart options merged with provided options,
10
+ * with special cases for axes.
11
+ * Axes object will not merge the not provided axes.
12
+ *
13
+ * @export
14
+ * @param {AxisChartOptions} defaultOptions Configuration.options[chartType]
15
+ * @param {AxisChartOptions} providedOptions user provided options
16
+ * @returns merged options
17
+ */
18
+ export declare function mergeDefaultChartOptions(defaultOptions: any, providedOptions: any): any;
19
+ /**************************************
20
+ * DOM-related operations *
21
+ *************************************/
22
+ /**
23
+ * Get width & height of an element
24
+ *
25
+ * @export
26
+ * @param {any} el element to get dimensions from
27
+ * @returns an object containing the width and height of el
28
+ */
29
+ export declare function getDimensions(el: any): {
30
+ width: number;
31
+ height: number;
32
+ };
33
+ /**
34
+ * Gets elements's x and y translations from transform attribute or returns null
35
+ *
36
+ * @param {HTMLElement} element
37
+ * @returns an object containing the translated x and y values or null
38
+ */
39
+ export declare function getTranslationValues(elementRef: HTMLElement): {
40
+ tx: string;
41
+ ty: string;
42
+ };
43
+ /**************************************
44
+ * Formatting & calculations *
45
+ *************************************/
46
+ /**
47
+ * Gets x and y coordinates from HTML transform attribute
48
+ *
49
+ * @export
50
+ * @param {any} string the transform attribute string ie. transform(x,y)
51
+ * @returns Returns an object with x and y offsets of the transform
52
+ */
53
+ export declare function getTranformOffsets(string: any): {
54
+ x: number;
55
+ y: number;
56
+ };
57
+ /**
58
+ * Returns string value for height/width using pixels if there isn't a specified unit of measure
59
+ *
60
+ * @param value string or number value to be checked for unit of measure
61
+ */
62
+ export declare function formatWidthHeightValues(value: any): any;
63
+ /**
64
+ * Capitalizes first letter of a string
65
+ *
66
+ * @export
67
+ * @param {any} string the input string to perform first letter capitalization with
68
+ * @returns The transformed string after first letter is capitalized
69
+ */
70
+ export declare function capitalizeFirstLetter(string: any): any;
71
+ /**
72
+ * Get the percentage of a datapoint compared to the entire dataset.
73
+ * @export
74
+ * @param {any} item
75
+ * @param {any} fullData
76
+ * @param {string} key
77
+ * @returns The percentage in the form of a number (1 significant digit if necessary)
78
+ */
79
+ export declare function convertValueToPercentage(item: any, fullData: any, key?: string): number;
80
+ /**
81
+ * Truncate the labels
82
+ * @export
83
+ * @param {any} fullText
84
+ * @param {any} truncationType
85
+ * @param {any} numCharacter
86
+ * @returns Truncated text
87
+ */
88
+ export declare function truncateLabel(fullText: any, truncationType: any, numCharacter: any): any;
89
+ /**
90
+ * Update legend additional items
91
+ * @param {any} defaultOptions
92
+ * @param {any} providedOptions
93
+ */
94
+ export declare function updateLegendAdditionalItems(defaultOptions: any, providedOptions: any): void;
95
+ /**************************************
96
+ * Object/array related checks *
97
+ *************************************/
98
+ /**
99
+ * Compares two arrays to return the difference between two arrays' items.
100
+ *
101
+ * @export
102
+ * @param {any[]} oldArray the array to check for missing items
103
+ * @param {any[]} newArray the array to check for newly added items
104
+ * @returns An object containing items missing (existing in oldArray but not newArray)
105
+ * and items added (existing in newArray but not in oldArray). Object is of the form { missing: [], added: [] }
106
+ */
107
+ export declare function arrayDifferences(oldArray: any[], newArray: any[]): {
108
+ missing: any[];
109
+ added: any[];
110
+ };
111
+ /**
112
+ * Gets the duplicated keys from an array of data
113
+ *
114
+ * @export
115
+ * @param {*} data - array of data
116
+ * @returns A list of the duplicated keys in data
117
+ */
118
+ export declare function getDuplicateValues(arr: any): any[];
119
+ /**
120
+ * In D3, moves an element to the front of the canvas
121
+ *
122
+ * @export
123
+ * @param {any} element input element to moved in front
124
+ * @returns The function to be used by D3 to push element to the top of the canvas
125
+ */
126
+ export declare function moveToFront(element: any): any;
127
+ /**
128
+ * Gets a speicified property from within an object.
129
+ *
130
+ * @param object the object containing the property to retrieve
131
+ * @param propPath nested properties used to extract the final property from within the object
132
+ * (i.e "style", "color" would retrieve the color property from within an object that has "color" nested within "style")
133
+ */
134
+ export declare const getProperty: (object: any, ...propPath: any[]) => any;
135
+ interface SVGPathCoordinates {
136
+ x0: number;
137
+ x1: number;
138
+ y0: number;
139
+ y1: number;
158
140
  }
141
+ export declare const flipSVGCoordinatesBasedOnOrientation: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => SVGPathCoordinates;
142
+ export declare const generateSVGPathString: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => string;
143
+ export declare function flipDomainAndRangeBasedOnOrientation<D, R>(domain: D, range: R, orientation?: CartesianOrientations): [D, R] | [R, D];
144
+ export declare const compareNumeric: (a: Numeric, b: Numeric) => boolean;