@hitachivantara/uikit-react-viz 4.0.3 → 4.1.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 (195) hide show
  1. package/dist/Barchart/Barchart.js +45 -72
  2. package/dist/Barchart/Barchart.js.map +1 -1
  3. package/dist/Barchart/barchartPlotlyOverrides.js +1 -13
  4. package/dist/Barchart/barchartPlotlyOverrides.js.map +1 -1
  5. package/dist/Barchart/index.js +0 -2
  6. package/dist/Barchart/index.js.map +1 -1
  7. package/dist/Barchart/styles.js.map +1 -1
  8. package/dist/Chart/Chart.js +30 -76
  9. package/dist/Chart/Chart.js.map +1 -1
  10. package/dist/Chart/Plot/Plot.js +11 -48
  11. package/dist/Chart/Plot/Plot.js.map +1 -1
  12. package/dist/Chart/Plot/index.js +0 -2
  13. package/dist/Chart/Plot/index.js.map +1 -1
  14. package/dist/Chart/Plot/styles.js.map +1 -1
  15. package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js +1 -36
  16. package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -1
  17. package/dist/Chart/Tooltip/MultiTooltip/index.js +0 -2
  18. package/dist/Chart/Tooltip/MultiTooltip/index.js.map +1 -1
  19. package/dist/Chart/Tooltip/MultiTooltip/styles.js +0 -2
  20. package/dist/Chart/Tooltip/MultiTooltip/styles.js.map +1 -1
  21. package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js +2 -26
  22. package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -1
  23. package/dist/Chart/Tooltip/SingleTooltip/index.js +0 -2
  24. package/dist/Chart/Tooltip/SingleTooltip/index.js.map +1 -1
  25. package/dist/Chart/Tooltip/SingleTooltip/styles.js +0 -2
  26. package/dist/Chart/Tooltip/SingleTooltip/styles.js.map +1 -1
  27. package/dist/Chart/Tooltip/Tooltip.js +16 -51
  28. package/dist/Chart/Tooltip/Tooltip.js.map +1 -1
  29. package/dist/Chart/Tooltip/index.js +0 -2
  30. package/dist/Chart/Tooltip/index.js.map +1 -1
  31. package/dist/Chart/Tooltip/styles.js.map +1 -1
  32. package/dist/Chart/chartPlotlyOverrides.js +9 -33
  33. package/dist/Chart/chartPlotlyOverrides.js.map +1 -1
  34. package/dist/Chart/index.js +0 -2
  35. package/dist/Chart/index.js.map +1 -1
  36. package/dist/Chart/styles.js +0 -13
  37. package/dist/Chart/styles.js.map +1 -1
  38. package/dist/ConfusionMatrix/ConfusionMatrix.d.ts +10 -0
  39. package/dist/ConfusionMatrix/ConfusionMatrix.js +102 -0
  40. package/dist/ConfusionMatrix/ConfusionMatrix.js.map +1 -0
  41. package/dist/ConfusionMatrix/CustomTooltip/CustomTooltip.js +47 -0
  42. package/dist/ConfusionMatrix/CustomTooltip/CustomTooltip.js.map +1 -0
  43. package/dist/ConfusionMatrix/CustomTooltip/index.js +14 -0
  44. package/dist/ConfusionMatrix/CustomTooltip/index.js.map +1 -0
  45. package/dist/ConfusionMatrix/CustomTooltip/styles.js +26 -0
  46. package/dist/ConfusionMatrix/CustomTooltip/styles.js.map +1 -0
  47. package/dist/ConfusionMatrix/confusionMatrixPlotlyOverrides.js +189 -0
  48. package/dist/ConfusionMatrix/confusionMatrixPlotlyOverrides.js.map +1 -0
  49. package/dist/ConfusionMatrix/index.d.ts +2 -0
  50. package/dist/ConfusionMatrix/index.js +14 -0
  51. package/dist/ConfusionMatrix/index.js.map +1 -0
  52. package/dist/ConfusionMatrix/styles.js +10 -0
  53. package/dist/ConfusionMatrix/styles.js.map +1 -0
  54. package/dist/Donutchart/Donutchart.js +10 -47
  55. package/dist/Donutchart/Donutchart.js.map +1 -1
  56. package/dist/Donutchart/donutchartPlotlyOverrides.js +1 -13
  57. package/dist/Donutchart/donutchartPlotlyOverrides.js.map +1 -1
  58. package/dist/Donutchart/index.js +0 -2
  59. package/dist/Donutchart/index.js.map +1 -1
  60. package/dist/Donutchart/styles.js.map +1 -1
  61. package/dist/Linechart/Linechart.js +12 -50
  62. package/dist/Linechart/Linechart.js.map +1 -1
  63. package/dist/Linechart/index.js +0 -2
  64. package/dist/Linechart/index.js.map +1 -1
  65. package/dist/Linechart/lineChartPlotlyOverrides.js +1 -17
  66. package/dist/Linechart/lineChartPlotlyOverrides.js.map +1 -1
  67. package/dist/Linechart/styles.js.map +1 -1
  68. package/dist/index.d.ts +3 -0
  69. package/dist/index.js +7 -4
  70. package/dist/index.js.map +1 -1
  71. package/dist/legacy/Barchart/Barchart.js +45 -43
  72. package/dist/legacy/Barchart/Barchart.js.map +1 -1
  73. package/dist/legacy/Barchart/barchartPlotlyOverrides.js +1 -6
  74. package/dist/legacy/Barchart/barchartPlotlyOverrides.js.map +1 -1
  75. package/dist/legacy/Barchart/index.js.map +1 -1
  76. package/dist/legacy/Barchart/styles.js.map +1 -1
  77. package/dist/legacy/Chart/Chart.js +30 -47
  78. package/dist/legacy/Chart/Chart.js.map +1 -1
  79. package/dist/legacy/Chart/Plot/Plot.js +11 -22
  80. package/dist/legacy/Chart/Plot/Plot.js.map +1 -1
  81. package/dist/legacy/Chart/Plot/index.js.map +1 -1
  82. package/dist/legacy/Chart/Plot/styles.js.map +1 -1
  83. package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js +1 -17
  84. package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -1
  85. package/dist/legacy/Chart/Tooltip/MultiTooltip/index.js.map +1 -1
  86. package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js +0 -1
  87. package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js.map +1 -1
  88. package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js +2 -9
  89. package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -1
  90. package/dist/legacy/Chart/Tooltip/SingleTooltip/index.js.map +1 -1
  91. package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js +0 -1
  92. package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js.map +1 -1
  93. package/dist/legacy/Chart/Tooltip/Tooltip.js +16 -30
  94. package/dist/legacy/Chart/Tooltip/Tooltip.js.map +1 -1
  95. package/dist/legacy/Chart/Tooltip/index.js.map +1 -1
  96. package/dist/legacy/Chart/Tooltip/styles.js.map +1 -1
  97. package/dist/legacy/Chart/chartPlotlyOverrides.js +9 -20
  98. package/dist/legacy/Chart/chartPlotlyOverrides.js.map +1 -1
  99. package/dist/legacy/Chart/index.js.map +1 -1
  100. package/dist/legacy/Chart/styles.js +0 -4
  101. package/dist/legacy/Chart/styles.js.map +1 -1
  102. package/dist/legacy/ConfusionMatrix/ConfusionMatrix.d.ts +10 -0
  103. package/dist/legacy/ConfusionMatrix/ConfusionMatrix.js +87 -0
  104. package/dist/legacy/ConfusionMatrix/ConfusionMatrix.js.map +1 -0
  105. package/dist/legacy/ConfusionMatrix/CustomTooltip/CustomTooltip.js +39 -0
  106. package/dist/legacy/ConfusionMatrix/CustomTooltip/CustomTooltip.js.map +1 -0
  107. package/dist/legacy/ConfusionMatrix/CustomTooltip/index.js +2 -0
  108. package/dist/legacy/ConfusionMatrix/CustomTooltip/index.js.map +1 -0
  109. package/dist/legacy/ConfusionMatrix/CustomTooltip/styles.js +19 -0
  110. package/dist/legacy/ConfusionMatrix/CustomTooltip/styles.js.map +1 -0
  111. package/dist/legacy/ConfusionMatrix/confusionMatrixPlotlyOverrides.js +181 -0
  112. package/dist/legacy/ConfusionMatrix/confusionMatrixPlotlyOverrides.js.map +1 -0
  113. package/dist/legacy/ConfusionMatrix/index.d.ts +2 -0
  114. package/dist/legacy/ConfusionMatrix/index.js +2 -0
  115. package/dist/legacy/ConfusionMatrix/index.js.map +1 -0
  116. package/dist/legacy/ConfusionMatrix/styles.js +3 -0
  117. package/dist/legacy/ConfusionMatrix/styles.js.map +1 -0
  118. package/dist/legacy/Donutchart/Donutchart.js +11 -22
  119. package/dist/legacy/Donutchart/Donutchart.js.map +1 -1
  120. package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js +1 -6
  121. package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js.map +1 -1
  122. package/dist/legacy/Donutchart/index.js.map +1 -1
  123. package/dist/legacy/Donutchart/styles.js.map +1 -1
  124. package/dist/legacy/Linechart/Linechart.js +13 -25
  125. package/dist/legacy/Linechart/Linechart.js.map +1 -1
  126. package/dist/legacy/Linechart/index.js.map +1 -1
  127. package/dist/legacy/Linechart/lineChartPlotlyOverrides.js +1 -10
  128. package/dist/legacy/Linechart/lineChartPlotlyOverrides.js.map +1 -1
  129. package/dist/legacy/Linechart/styles.js.map +1 -1
  130. package/dist/legacy/index.d.ts +3 -0
  131. package/dist/legacy/index.js +1 -0
  132. package/dist/legacy/index.js.map +1 -1
  133. package/dist/modern/Barchart/Barchart.js +38 -31
  134. package/dist/modern/Barchart/Barchart.js.map +1 -1
  135. package/dist/modern/Barchart/barchartPlotlyOverrides.js +1 -6
  136. package/dist/modern/Barchart/barchartPlotlyOverrides.js.map +1 -1
  137. package/dist/modern/Barchart/index.js.map +1 -1
  138. package/dist/modern/Barchart/styles.js.map +1 -1
  139. package/dist/modern/Chart/Chart.js +19 -34
  140. package/dist/modern/Chart/Chart.js.map +1 -1
  141. package/dist/modern/Chart/Plot/Plot.js +12 -23
  142. package/dist/modern/Chart/Plot/Plot.js.map +1 -1
  143. package/dist/modern/Chart/Plot/index.js.map +1 -1
  144. package/dist/modern/Chart/Plot/styles.js.map +1 -1
  145. package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js +0 -17
  146. package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -1
  147. package/dist/modern/Chart/Tooltip/MultiTooltip/index.js.map +1 -1
  148. package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js +0 -1
  149. package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js.map +1 -1
  150. package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js +0 -7
  151. package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -1
  152. package/dist/modern/Chart/Tooltip/SingleTooltip/index.js.map +1 -1
  153. package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js +0 -1
  154. package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js.map +1 -1
  155. package/dist/modern/Chart/Tooltip/Tooltip.js +2 -13
  156. package/dist/modern/Chart/Tooltip/Tooltip.js.map +1 -1
  157. package/dist/modern/Chart/Tooltip/index.js.map +1 -1
  158. package/dist/modern/Chart/Tooltip/styles.js.map +1 -1
  159. package/dist/modern/Chart/chartPlotlyOverrides.js +9 -20
  160. package/dist/modern/Chart/chartPlotlyOverrides.js.map +1 -1
  161. package/dist/modern/Chart/index.js.map +1 -1
  162. package/dist/modern/Chart/styles.js +0 -4
  163. package/dist/modern/Chart/styles.js.map +1 -1
  164. package/dist/modern/ConfusionMatrix/ConfusionMatrix.d.ts +10 -0
  165. package/dist/modern/ConfusionMatrix/ConfusionMatrix.js +76 -0
  166. package/dist/modern/ConfusionMatrix/ConfusionMatrix.js.map +1 -0
  167. package/dist/modern/ConfusionMatrix/CustomTooltip/CustomTooltip.js +37 -0
  168. package/dist/modern/ConfusionMatrix/CustomTooltip/CustomTooltip.js.map +1 -0
  169. package/dist/modern/ConfusionMatrix/CustomTooltip/index.js +2 -0
  170. package/dist/modern/ConfusionMatrix/CustomTooltip/index.js.map +1 -0
  171. package/dist/modern/ConfusionMatrix/CustomTooltip/styles.js +17 -0
  172. package/dist/modern/ConfusionMatrix/CustomTooltip/styles.js.map +1 -0
  173. package/dist/modern/ConfusionMatrix/confusionMatrixPlotlyOverrides.js +154 -0
  174. package/dist/modern/ConfusionMatrix/confusionMatrixPlotlyOverrides.js.map +1 -0
  175. package/dist/modern/ConfusionMatrix/index.d.ts +2 -0
  176. package/dist/modern/ConfusionMatrix/index.js +2 -0
  177. package/dist/modern/ConfusionMatrix/index.js.map +1 -0
  178. package/dist/modern/ConfusionMatrix/styles.js +3 -0
  179. package/dist/modern/ConfusionMatrix/styles.js.map +1 -0
  180. package/dist/modern/Donutchart/Donutchart.js +11 -22
  181. package/dist/modern/Donutchart/Donutchart.js.map +1 -1
  182. package/dist/modern/Donutchart/donutchartPlotlyOverrides.js +1 -6
  183. package/dist/modern/Donutchart/donutchartPlotlyOverrides.js.map +1 -1
  184. package/dist/modern/Donutchart/index.js.map +1 -1
  185. package/dist/modern/Donutchart/styles.js.map +1 -1
  186. package/dist/modern/Linechart/Linechart.js +12 -24
  187. package/dist/modern/Linechart/Linechart.js.map +1 -1
  188. package/dist/modern/Linechart/index.js.map +1 -1
  189. package/dist/modern/Linechart/lineChartPlotlyOverrides.js +1 -10
  190. package/dist/modern/Linechart/lineChartPlotlyOverrides.js.map +1 -1
  191. package/dist/modern/Linechart/styles.js.map +1 -1
  192. package/dist/modern/index.d.ts +3 -0
  193. package/dist/modern/index.js +1 -0
  194. package/dist/modern/index.js.map +1 -1
  195. package/package.json +5 -5
@@ -0,0 +1,17 @@
1
+ import { makeStyles } from "@mui/styles";
2
+ const useStyles = makeStyles(theme => ({
3
+ root: {
4
+ backgroundColor: theme.hv.palette.atmosphere.atmo1,
5
+ width: "fit-content",
6
+ minWidth: 150,
7
+ boxShadow: theme.hv.shadows[1],
8
+ zIndex: 1000
9
+ },
10
+ container: {
11
+ padding: theme.hvSpacing("15px", "sm"),
12
+ display: "flex",
13
+ flexDirection: "column"
14
+ }
15
+ }));
16
+ export default useStyles;
17
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","names":["makeStyles","useStyles","theme","root","backgroundColor","hv","palette","atmosphere","atmo1","width","minWidth","boxShadow","shadows","zIndex","container","padding","hvSpacing","display","flexDirection"],"sources":["../../../../src/ConfusionMatrix/CustomTooltip/styles.js"],"sourcesContent":["import { makeStyles } from \"@mui/styles\";\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n width: \"fit-content\",\n minWidth: 150,\n boxShadow: theme.hv.shadows[1],\n zIndex: 1000,\n },\n container: {\n padding: theme.hvSpacing(\"15px\", \"sm\"),\n display: \"flex\",\n flexDirection: \"column\",\n },\n}));\n\nexport default useStyles;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,MAAMC,SAAS,GAAGD,UAAU,CAAEE,KAAK,KAAM;EACvCC,IAAI,EAAE;IACJC,eAAe,EAAEF,KAAK,CAACG,EAAE,CAACC,OAAO,CAACC,UAAU,CAACC,KAAK;IAClDC,KAAK,EAAE,aAAa;IACpBC,QAAQ,EAAE,GAAG;IACbC,SAAS,EAAET,KAAK,CAACG,EAAE,CAACO,OAAO,CAAC,CAAC,CAAC;IAC9BC,MAAM,EAAE;EACV,CAAC;EACDC,SAAS,EAAE;IACTC,OAAO,EAAEb,KAAK,CAACc,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC;IACtCC,OAAO,EAAE,MAAM;IACfC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC,CAAC;AAEH,eAAejB,SAAS"}
@@ -0,0 +1,154 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ /* eslint-disable no-param-reassign */
5
+ import clone from "lodash/cloneDeep";
6
+ const HEX_ALPHA_50 = "80";
7
+ const HEIGHT_PER_CATEGORY = 45;
8
+ const WIDTH_PER_CATEGORY = 55;
9
+ const setterIfNil = (object, property, value) => {
10
+ var _object$property;
11
+ object[property] = (_object$property = object[property]) !== null && _object$property !== void 0 ? _object$property : value;
12
+ };
13
+ const buildAnnotations = (trace, customAnnotations, deltaMatrix = false) => {
14
+ const {
15
+ x = [],
16
+ y = [],
17
+ z = []
18
+ } = trace;
19
+ const annotations = [];
20
+ for (let i = 0; i < y.length; i += 1) {
21
+ for (let j = 0; j < x.length; j += 1) {
22
+ var _customAnnotations$te, _customAnnotations$te2, _customAnnotations$si;
23
+ const currentValue = z[i][j];
24
+ let textValue;
25
+ let size = 12;
26
+ if (currentValue > 999) {
27
+ textValue = currentValue.toExponential(1);
28
+ } else {
29
+ textValue = currentValue;
30
+ }
31
+ if (deltaMatrix) {
32
+ if (i !== j) {
33
+ textValue = 0 - textValue;
34
+ } else {
35
+ textValue = `<span style="font-weight: 600;">${textValue}</span>`;
36
+ size = 14;
37
+ }
38
+ }
39
+ const result = {
40
+ xref: "x1",
41
+ yref: "y1",
42
+ x: x[j],
43
+ y: y[i],
44
+ text: (_customAnnotations$te = customAnnotations === null || customAnnotations === void 0 ? void 0 : (_customAnnotations$te2 = customAnnotations.text) === null || _customAnnotations$te2 === void 0 ? void 0 : _customAnnotations$te2.call(customAnnotations, currentValue)) !== null && _customAnnotations$te !== void 0 ? _customAnnotations$te : textValue,
45
+ font: {
46
+ family: "Open Sans",
47
+ size: (_customAnnotations$si = customAnnotations === null || customAnnotations === void 0 ? void 0 : customAnnotations.size) !== null && _customAnnotations$si !== void 0 ? _customAnnotations$si : size,
48
+ color: customAnnotations === null || customAnnotations === void 0 ? void 0 : customAnnotations.textColor
49
+ },
50
+ showarrow: false
51
+ };
52
+ annotations.push(result);
53
+ }
54
+ }
55
+ return annotations;
56
+ };
57
+
58
+ /**
59
+ * Auxiliary functions to set the layout in order to follow the DS guideline.
60
+ */
61
+ export const applyLayoutDefaults = (inputLayout = {}, theme, data = [{}], deltaMatrix) => {
62
+ var _theme$hv, _theme$hv$palette, _theme$hv$palette$acc, _theme$hv2, _theme$hv2$palette, _theme$hv2$palette$at;
63
+ const layout = clone(inputLayout);
64
+ setterIfNil(layout, "hovermode", "closest");
65
+ const [trace] = data;
66
+ const categories = (trace === null || trace === void 0 ? void 0 : trace.x) || [];
67
+ const squareWidth = categories.length * WIDTH_PER_CATEGORY;
68
+ const squareHeight = categories.length * HEIGHT_PER_CATEGORY;
69
+ const chartWidth = Math.max(squareWidth, WIDTH_PER_CATEGORY * 10);
70
+ const chartHeight = Math.max(squareHeight, WIDTH_PER_CATEGORY * 10);
71
+ setterIfNil(layout, "width", chartWidth);
72
+ setterIfNil(layout, "height", chartHeight);
73
+ setterIfNil(layout, "margin", {
74
+ t: 130,
75
+ b: 40,
76
+ pad: 10
77
+ });
78
+ const textColor = (theme === null || theme === void 0 ? void 0 : (_theme$hv = theme.hv) === null || _theme$hv === void 0 ? void 0 : (_theme$hv$palette = _theme$hv.palette) === null || _theme$hv$palette === void 0 ? void 0 : (_theme$hv$palette$acc = _theme$hv$palette.accent) === null || _theme$hv$palette$acc === void 0 ? void 0 : _theme$hv$palette$acc.acce1) || "black";
79
+ const getAxisLayout = (text, standoff) => ({
80
+ color: textColor,
81
+ showline: false,
82
+ showgrid: false,
83
+ tickfont: {
84
+ family: "Open Sans",
85
+ size: 12
86
+ },
87
+ ticks: "",
88
+ title: {
89
+ text,
90
+ standoff,
91
+ font: {
92
+ family: "Open Sans",
93
+ size: 12
94
+ }
95
+ }
96
+ });
97
+ setterIfNil(layout, "yaxis", _objectSpread(_objectSpread({}, getAxisLayout("True Label", 50)), {}, {
98
+ autorange: "reversed"
99
+ }));
100
+ setterIfNil(layout, "xaxis", _objectSpread(_objectSpread({}, getAxisLayout("Predicted Label", 15)), {}, {
101
+ side: "top",
102
+ tickangle: "-45"
103
+ }));
104
+ const backgroundColor = (theme === null || theme === void 0 ? void 0 : (_theme$hv2 = theme.hv) === null || _theme$hv2 === void 0 ? void 0 : (_theme$hv2$palette = _theme$hv2.palette) === null || _theme$hv2$palette === void 0 ? void 0 : (_theme$hv2$palette$at = _theme$hv2$palette.atmosphere) === null || _theme$hv2$palette$at === void 0 ? void 0 : _theme$hv2$palette$at.atmo1) || "white";
105
+ setterIfNil(layout, "paper_bgcolor", backgroundColor);
106
+ setterIfNil(layout, "plot_bgcolor", backgroundColor);
107
+ setterIfNil(layout, "annotations", buildAnnotations(trace, _objectSpread({
108
+ textColor
109
+ }, layout.customAnnotations || {}), deltaMatrix));
110
+ return layout;
111
+ };
112
+ const calculateDeltaMatrix = (matrix1, matrix2) => {
113
+ let deltaMin = 0;
114
+ const matrixData = matrix1.reduce((lineAcc, classLine, lineIndex) => {
115
+ const lineValues = classLine.reduce((columnAcc, columnValue, columnIndex) => {
116
+ let value = columnValue - matrix2[lineIndex][columnIndex];
117
+ deltaMin = Math.min(deltaMin, value);
118
+ if (lineIndex !== columnIndex) {
119
+ value = 0 - value;
120
+ }
121
+ return [...columnAcc, value];
122
+ }, []);
123
+ return [...lineAcc, lineValues];
124
+ }, []);
125
+ return [matrixData, deltaMin];
126
+ };
127
+ export const applyDataDefaults = (inputData = [{}], theme, deltaMatrix) => {
128
+ var _theme$hv3, _theme$hv3$palette, _theme$hv3$palette$at, _theme$hv4, _theme$hv4$viz, _theme$hv4$viz$palett, _theme$hv4$viz$palett2, _theme$hv5, _theme$hv5$viz, _theme$hv5$viz$palett, _theme$hv5$viz$palett2;
129
+ const data = clone(inputData);
130
+ const backgroundColor = (theme === null || theme === void 0 ? void 0 : (_theme$hv3 = theme.hv) === null || _theme$hv3 === void 0 ? void 0 : (_theme$hv3$palette = _theme$hv3.palette) === null || _theme$hv3$palette === void 0 ? void 0 : (_theme$hv3$palette$at = _theme$hv3$palette.atmosphere) === null || _theme$hv3$palette$at === void 0 ? void 0 : _theme$hv3$palette$at.atmo1) || "white";
131
+ const greenColor = (theme === null || theme === void 0 ? void 0 : (_theme$hv4 = theme.hv) === null || _theme$hv4 === void 0 ? void 0 : (_theme$hv4$viz = _theme$hv4.viz) === null || _theme$hv4$viz === void 0 ? void 0 : (_theme$hv4$viz$palett = _theme$hv4$viz.palette) === null || _theme$hv4$viz$palett === void 0 ? void 0 : (_theme$hv4$viz$palett2 = _theme$hv4$viz$palett.polarized) === null || _theme$hv4$viz$palett2 === void 0 ? void 0 : _theme$hv4$viz$palett2.cviz21) || "#008000";
132
+ const redColor = (theme === null || theme === void 0 ? void 0 : (_theme$hv5 = theme.hv) === null || _theme$hv5 === void 0 ? void 0 : (_theme$hv5$viz = _theme$hv5.viz) === null || _theme$hv5$viz === void 0 ? void 0 : (_theme$hv5$viz$palett = _theme$hv5$viz.palette) === null || _theme$hv5$viz$palett === void 0 ? void 0 : (_theme$hv5$viz$palett2 = _theme$hv5$viz$palett.polarized) === null || _theme$hv5$viz$palett2 === void 0 ? void 0 : _theme$hv5$viz$palett2.cviz26) || "#FF0000";
133
+ data.forEach(trace => {
134
+ setterIfNil(trace, "type", "heatmap");
135
+ setterIfNil(trace, "hoverinfo", "none");
136
+ const colorscale = [[0, backgroundColor], [1, `${greenColor}${HEX_ALPHA_50}`]];
137
+ const deltaColorscale = [[0, `${redColor}${HEX_ALPHA_50}`], [0.5, backgroundColor], [1, `${greenColor}${HEX_ALPHA_50}`]];
138
+ setterIfNil(trace, "colorscale", deltaMatrix ? deltaColorscale : colorscale);
139
+ setterIfNil(trace, "showscale", false);
140
+ const [matrixData, deltaMin] = deltaMatrix ? calculateDeltaMatrix(trace.z, deltaMatrix) : [trace.z];
141
+ trace.z = matrixData;
142
+ if (deltaMatrix) {
143
+ const getMax = matrix => {
144
+ const max = Math.max(...matrix.flat());
145
+ return max < 0 ? Math.abs(deltaMin) : max;
146
+ };
147
+ setterIfNil(trace, "zmin", deltaMin);
148
+ setterIfNil(trace, "zmid", 0);
149
+ setterIfNil(trace, "zmax", getMax(matrixData));
150
+ }
151
+ });
152
+ return data;
153
+ };
154
+ //# sourceMappingURL=confusionMatrixPlotlyOverrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confusionMatrixPlotlyOverrides.js","names":["clone","HEX_ALPHA_50","HEIGHT_PER_CATEGORY","WIDTH_PER_CATEGORY","setterIfNil","object","property","value","buildAnnotations","trace","customAnnotations","deltaMatrix","x","y","z","annotations","i","length","j","currentValue","textValue","size","toExponential","result","xref","yref","text","font","family","color","textColor","showarrow","push","applyLayoutDefaults","inputLayout","theme","data","layout","categories","squareWidth","squareHeight","chartWidth","Math","max","chartHeight","t","b","pad","hv","palette","accent","acce1","getAxisLayout","standoff","showline","showgrid","tickfont","ticks","title","autorange","side","tickangle","backgroundColor","atmosphere","atmo1","calculateDeltaMatrix","matrix1","matrix2","deltaMin","matrixData","reduce","lineAcc","classLine","lineIndex","lineValues","columnAcc","columnValue","columnIndex","min","applyDataDefaults","inputData","greenColor","viz","polarized","cviz21","redColor","cviz26","forEach","colorscale","deltaColorscale","getMax","matrix","flat","abs"],"sources":["../../../src/ConfusionMatrix/confusionMatrixPlotlyOverrides.js"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport clone from \"lodash/cloneDeep\";\n\nconst HEX_ALPHA_50 = \"80\";\nconst HEIGHT_PER_CATEGORY = 45;\nconst WIDTH_PER_CATEGORY = 55;\n\nconst setterIfNil = (object, property, value) => {\n object[property] = object[property] ?? value;\n};\n\nconst buildAnnotations = (trace, customAnnotations, deltaMatrix = false) => {\n const { x = [], y = [], z = [] } = trace;\n const annotations = [];\n for (let i = 0; i < y.length; i += 1) {\n for (let j = 0; j < x.length; j += 1) {\n const currentValue = z[i][j];\n let textValue;\n let size = 12;\n if (currentValue > 999) {\n textValue = currentValue.toExponential(1);\n } else {\n textValue = currentValue;\n }\n\n if (deltaMatrix) {\n if (i !== j) {\n textValue = 0 - textValue;\n } else {\n textValue = `<span style=\"font-weight: 600;\">${textValue}</span>`;\n size = 14;\n }\n }\n\n const result = {\n xref: \"x1\",\n yref: \"y1\",\n x: x[j],\n y: y[i],\n text: customAnnotations?.text?.(currentValue) ?? textValue,\n font: {\n family: \"Open Sans\",\n size: customAnnotations?.size ?? size,\n color: customAnnotations?.textColor,\n },\n showarrow: false,\n };\n annotations.push(result);\n }\n }\n\n return annotations;\n};\n\n/**\n * Auxiliary functions to set the layout in order to follow the DS guideline.\n */\nexport const applyLayoutDefaults = (inputLayout = {}, theme, data = [{}], deltaMatrix) => {\n const layout = clone(inputLayout);\n setterIfNil(layout, \"hovermode\", \"closest\");\n const [trace] = data;\n\n const categories = trace?.x || [];\n const squareWidth = categories.length * WIDTH_PER_CATEGORY;\n const squareHeight = categories.length * HEIGHT_PER_CATEGORY;\n const chartWidth = Math.max(squareWidth, WIDTH_PER_CATEGORY * 10);\n const chartHeight = Math.max(squareHeight, WIDTH_PER_CATEGORY * 10);\n setterIfNil(layout, \"width\", chartWidth);\n setterIfNil(layout, \"height\", chartHeight);\n setterIfNil(layout, \"margin\", {\n t: 130,\n b: 40,\n pad: 10,\n });\n\n const textColor = theme?.hv?.palette?.accent?.acce1 || \"black\";\n\n const getAxisLayout = (text, standoff) => ({\n color: textColor,\n showline: false,\n showgrid: false,\n tickfont: {\n family: \"Open Sans\",\n size: 12,\n },\n ticks: \"\",\n title: {\n text,\n standoff,\n font: {\n family: \"Open Sans\",\n size: 12,\n },\n },\n });\n setterIfNil(layout, \"yaxis\", {\n ...getAxisLayout(\"True Label\", 50),\n autorange: \"reversed\",\n });\n setterIfNil(layout, \"xaxis\", {\n ...getAxisLayout(\"Predicted Label\", 15),\n side: \"top\",\n tickangle: \"-45\",\n });\n\n const backgroundColor = theme?.hv?.palette?.atmosphere?.atmo1 || \"white\";\n setterIfNil(layout, \"paper_bgcolor\", backgroundColor);\n setterIfNil(layout, \"plot_bgcolor\", backgroundColor);\n\n setterIfNil(\n layout,\n \"annotations\",\n buildAnnotations(trace, { textColor, ...(layout.customAnnotations || {}) }, deltaMatrix)\n );\n\n return layout;\n};\n\nconst calculateDeltaMatrix = (matrix1, matrix2) => {\n let deltaMin = 0;\n const matrixData = matrix1.reduce((lineAcc, classLine, lineIndex) => {\n const lineValues = classLine.reduce((columnAcc, columnValue, columnIndex) => {\n let value = columnValue - matrix2[lineIndex][columnIndex];\n deltaMin = Math.min(deltaMin, value);\n if (lineIndex !== columnIndex) {\n value = 0 - value;\n }\n return [...columnAcc, value];\n }, []);\n return [...lineAcc, lineValues];\n }, []);\n\n return [matrixData, deltaMin];\n};\n\nexport const applyDataDefaults = (inputData = [{}], theme, deltaMatrix) => {\n const data = clone(inputData);\n const backgroundColor = theme?.hv?.palette?.atmosphere?.atmo1 || \"white\";\n const greenColor = theme?.hv?.viz?.palette?.polarized?.cviz21 || \"#008000\";\n const redColor = theme?.hv?.viz?.palette?.polarized?.cviz26 || \"#FF0000\";\n\n data.forEach((trace) => {\n setterIfNil(trace, \"type\", \"heatmap\");\n setterIfNil(trace, \"hoverinfo\", \"none\");\n\n const colorscale = [\n [0, backgroundColor],\n [1, `${greenColor}${HEX_ALPHA_50}`],\n ];\n const deltaColorscale = [\n [0, `${redColor}${HEX_ALPHA_50}`],\n [0.5, backgroundColor],\n [1, `${greenColor}${HEX_ALPHA_50}`],\n ];\n\n setterIfNil(trace, \"colorscale\", deltaMatrix ? deltaColorscale : colorscale);\n setterIfNil(trace, \"showscale\", false);\n\n const [matrixData, deltaMin] = deltaMatrix\n ? calculateDeltaMatrix(trace.z, deltaMatrix)\n : [trace.z];\n trace.z = matrixData;\n\n if (deltaMatrix) {\n const getMax = (matrix) => {\n const max = Math.max(...matrix.flat());\n return max < 0 ? Math.abs(deltaMin) : max;\n };\n\n setterIfNil(trace, \"zmin\", deltaMin);\n setterIfNil(trace, \"zmid\", 0);\n setterIfNil(trace, \"zmax\", getMax(matrixData));\n }\n });\n\n return data;\n};\n"],"mappings":";;;AAAA;AACA,OAAOA,KAAK,MAAM,kBAAkB;AAEpC,MAAMC,YAAY,GAAG,IAAI;AACzB,MAAMC,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,kBAAkB,GAAG,EAA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C,GAC1C,CAACF,KAAK,CAACK,CAAC,CAAC;IACbL,KAAK,CAACK,CAAC,GAAGuD,UAAU;IAEpB,IAAI1D,WAAW,EAAE;MACf,MAAM+E,MAAM,GAAIC,MAAM,IAAK;QACzB,MAAMhD,GAAG,GAAGD,IAAI,CAACC,GAAG,CAAC,GAAGgD,MAAM,CAACC,IAAI,EAAE,CAAC;QACtC,OAAOjD,GAAG,GAAG,CAAC,GAAGD,IAAI,CAACmD,GAAG,CAACzB,QAAQ,CAAC,GAAGzB,GAAG;MAC3C,CAAC;MAEDvC,WAAW,CAACK,KAAK,EAAE,MAAM,EAAE2D,QAAQ,CAAC;MACpChE,WAAW,CAACK,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;MAC7BL,WAAW,CAACK,KAAK,EAAE,MAAM,EAAEiF,MAAM,CAACrB,UAAU,CAAC,CAAC;IAChD;EACF,CAAC,CAAC;EAEF,OAAOjC,IAAI;AACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./ConfusionMatrix";
2
+ export * from "./ConfusionMatrix";
@@ -0,0 +1,2 @@
1
+ export { default } from "./ConfusionMatrix";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/ConfusionMatrix/index.js"],"sourcesContent":["export { default } from \"./ConfusionMatrix\";\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,mBAAmB"}
@@ -0,0 +1,3 @@
1
+ const styles = {};
2
+ export default styles;
3
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","names":["styles"],"sources":["../../../src/ConfusionMatrix/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG,CAAC,CAAC;AAEjB,eAAeA,MAAM"}
@@ -1,39 +1,35 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  const _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "type"];
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import React, { useMemo } from "react";
10
7
  import PropTypes from "prop-types";
11
8
  import { withStyles } from "@mui/styles";
12
9
  import Chart from "../Chart";
13
10
  import { applyDataDefaults, applyLayoutDefaults } from "./donutchartPlotlyOverrides";
14
11
  import styles from "./styles";
12
+
15
13
  /**
16
14
  * Donut charts nicely convey the part-whole relationship and they have become
17
15
  * the most recognizable chart types for representing proportions in business and data statistics.
18
16
  * Our implementation leverages the Plotly charting library. If you have a specific case
19
17
  * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.
20
18
  */
21
-
22
19
  import { jsx as _jsx } from "react/jsx-runtime";
23
-
24
20
  const Donutchart = _ref => {
25
21
  let {
26
- id,
27
- classes,
28
- data,
29
- layout,
30
- config,
31
- tooltipType = "multiple",
32
- type = "regular"
33
- } = _ref,
34
- others = _objectWithoutProperties(_ref, _excluded);
35
-
22
+ id,
23
+ classes,
24
+ data,
25
+ layout,
26
+ config,
27
+ tooltipType = "multiple",
28
+ type = "regular"
29
+ } = _ref,
30
+ others = _objectWithoutProperties(_ref, _excluded);
36
31
  /* Values derived from props */
32
+
37
33
  const chartData = useMemo(() => applyDataDefaults(data, type), [data, type]);
38
34
  const chartLayout = useMemo(() => applyLayoutDefaults(layout), [layout]);
39
35
  return /*#__PURE__*/_jsx(Chart, _objectSpread({
@@ -46,38 +42,31 @@ const Donutchart = _ref => {
46
42
  type: type
47
43
  }, others));
48
44
  };
49
-
50
45
  process.env.NODE_ENV !== "production" ? Donutchart.propTypes = {
51
46
  /**
52
47
  * An Id passed on to the component
53
48
  */
54
49
  id: PropTypes.string,
55
-
56
50
  /**
57
51
  * A Jss Object used to override or extend the styles applied.
58
52
  */
59
53
  classes: PropTypes.instanceOf(Object),
60
-
61
54
  /**
62
55
  * Plotly data object (see https://plot.ly/javascript/reference/).
63
56
  */
64
57
  data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,
65
-
66
58
  /**
67
59
  * Plotly layout object (see https://plot.ly/javascript/reference/#layout).
68
60
  */
69
61
  layout: PropTypes.instanceOf(Object),
70
-
71
62
  /**
72
63
  * Plotly config object (see https://plot.ly/javascript/configuration-options/).
73
64
  */
74
65
  config: PropTypes.instanceOf(Object),
75
-
76
66
  /**
77
67
  * Defines if should use a single or multiline tooltip.
78
68
  */
79
69
  tooltipType: PropTypes.oneOf(["single", "multiple"]),
80
-
81
70
  /**
82
71
  * Sets the type of graph.
83
72
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Donutchart.js","names":["React","useMemo","PropTypes","withStyles","Chart","applyDataDefaults","applyLayoutDefaults","styles","Donutchart","id","classes","data","layout","config","tooltipType","type","others","chartData","chartLayout","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","name"],"sources":["../../../src/Donutchart/Donutchart.js"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport Chart from \"../Chart\";\nimport { applyDataDefaults, applyLayoutDefaults } from \"./donutchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\n/**\n * Donut charts nicely convey the part-whole relationship and they have become\n * the most recognizable chart types for representing proportions in business and data statistics.\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Donutchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n type = \"regular\",\n ...others\n}) => {\n /* Values derived from props */\n\n const chartData = useMemo(() => applyDataDefaults(data, type), [data, type]);\n const chartLayout = useMemo(() => applyLayoutDefaults(layout), [layout]);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n type={type}\n {...others}\n />\n );\n};\n\nDonutchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets the type of graph.\n */\n type: PropTypes.oneOf([\"regular\", \"thin\"]),\n};\n\nexport default withStyles(styles, { name: \"HvDonutchart\" })(Donutchart);\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,iBAAT,EAA4BC,mBAA5B,QAAuD,6BAAvD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;;;;AACA,MAAMC,UAAU,GAAG,QASb;EAAA,IATc;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AgB,CAAC,SAAD,EAAY,MAAZ,CAAhB;AA5Be,CAAvB;AA+BA,eAAetB,UAAU,CAACI,MAAD,EAAS;EAAEmB,IAAI,EAAE;AAAR,CAAT,CAAV,CAA6ClB,UAA7C,CAAf"}
1
+ {"version":3,"file":"Donutchart.js","names":["React","useMemo","PropTypes","withStyles","Chart","applyDataDefaults","applyLayoutDefaults","styles","Donutchart","id","classes","data","layout","config","tooltipType","type","others","chartData","chartLayout","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","name"],"sources":["../../../src/Donutchart/Donutchart.js"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport Chart from \"../Chart\";\nimport { applyDataDefaults, applyLayoutDefaults } from \"./donutchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\n/**\n * Donut charts nicely convey the part-whole relationship and they have become\n * the most recognizable chart types for representing proportions in business and data statistics.\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Donutchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n type = \"regular\",\n ...others\n}) => {\n /* Values derived from props */\n\n const chartData = useMemo(() => applyDataDefaults(data, type), [data, type]);\n const chartLayout = useMemo(() => applyLayoutDefaults(layout), [layout]);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n type={type}\n {...others}\n />\n );\n};\n\nDonutchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets the type of graph.\n */\n type: PropTypes.oneOf([\"regular\", \"thin\"]),\n};\n\nexport default withStyles(styles, { name: \"HvDonutchart\" })(Donutchart);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,KAAK,MAAM,UAAU;AAC5B,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,6BAA6B;AACpF,OAAOC,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AALA;AAMA,MAAMC,UAAU,GAAG,QASb;EAAA,IATc;MAClBC,EAAE;MACFC,OAAO;MACPC,IAAI;MACJC,MAAM;MACNC,MAAM;MACNC,WAAW,GAAG,UAAU;MACxBC,IAAI,GAAG;IAET,CAAC;IADIC,MAAM;EAET;;EAEA,MAAMC,SAAS,GAAGhB,OAAO,CAAC,MAAMI,iBAAiB,CAACM,IAAI,EAAEI,IAAI,CAAC,EAAE,CAACJ,IAAI,EAAEI,IAAI,CAAC,CAAC;EAC5E,MAAMG,WAAW,GAAGjB,OAAO,CAAC,MAAMK,mBAAmB,CAACM,MAAM,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAExE,oBACE,KAAC,KAAK;IACJ,EAAE,EAAEH,EAAG;IACP,OAAO,EAAEC,OAAQ;IACjB,IAAI,EAAEO,SAAU;IAChB,MAAM,EAAEC,WAAY;IACpB,MAAM,EAAEL,MAAO;IACf,WAAW,EAAEC,WAAY;IACzB,IAAI,EAAEC;EAAK,GACPC,MAAM,EACV;AAEN,CAAC;AAED,wCAAAR,UAAU,CAACW,SAAS,GAAG;EACrB;AACF;AACA;EACEV,EAAE,EAAEP,SAAS,CAACkB,MAAM;EACpB;AACF;AACA;EACEV,OAAO,EAAER,SAAS,CAACmB,UAAU,CAACC,MAAM,CAAC;EACrC;AACF;AACA;EACEX,IAAI,EAAET,SAAS,CAACqB,OAAO,CAACrB,SAAS,CAACmB,UAAU,CAACC,MAAM,CAAC,CAAC,CAACE,UAAU;EAChE;AACF;AACA;EACEZ,MAAM,EAAEV,SAAS,CAACmB,UAAU,CAACC,MAAM,CAAC;EACpC;AACF;AACA;EACET,MAAM,EAAEX,SAAS,CAACmB,UAAU,CAACC,MAAM,CAAC;EACpC;AACF;AACA;EACER,WAAW,EAAEZ,SAAS,CAACuB,KAAK,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;EACpD;AACF;AACA;EACEV,IAAI,EAAEb,SAAS,CAACuB,KAAK,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC;AAC3C,CAAC;AAED,eAAetB,UAAU,CAACI,MAAM,EAAE;EAAEmB,IAAI,EAAE;AAAe,CAAC,CAAC,CAAClB,UAAU,CAAC"}
@@ -1,29 +1,24 @@
1
1
  import clone from "lodash/cloneDeep";
2
-
3
2
  const setterIfNil = (object, property, value) => {
4
3
  var _object$property;
5
-
6
4
  // eslint-disable-next-line no-param-reassign
7
5
  object[property] = (_object$property = object[property]) !== null && _object$property !== void 0 ? _object$property : value;
8
6
  };
7
+
9
8
  /**
10
9
  * Auxiliary functions to set the data in order to follow the DS guideline.
11
10
  *
12
11
  */
13
-
14
-
15
12
  export const applyDataDefaults = (inputData, type) => {
16
13
  const data = inputData;
17
14
  data.forEach(trace => {
18
15
  setterIfNil(trace, "hoverinfo", "none");
19
16
  setterIfNil(trace, "textinfo", "none");
20
17
  setterIfNil(trace, "type", "pie");
21
-
22
18
  switch (type) {
23
19
  case "thin":
24
20
  setterIfNil(trace, "hole", "0.94");
25
21
  break;
26
-
27
22
  case "regular":
28
23
  default:
29
24
  setterIfNil(trace, "hole", "0.76");
@@ -1 +1 @@
1
- {"version":3,"file":"donutchartPlotlyOverrides.js","names":["clone","setterIfNil","object","property","value","applyDataDefaults","inputData","type","data","forEach","trace","applyLayoutDefaults","inputLayout","defaultLayout"],"sources":["../../../src/Donutchart/donutchartPlotlyOverrides.js"],"sourcesContent":["import clone from \"lodash/cloneDeep\";\n\nconst setterIfNil = (object, property, value) => {\n // eslint-disable-next-line no-param-reassign\n object[property] = object[property] ?? value;\n};\n\n/**\n * Auxiliary functions to set the data in order to follow the DS guideline.\n *\n */\nexport const applyDataDefaults = (inputData, type) => {\n const data = inputData;\n\n data.forEach((trace) => {\n setterIfNil(trace, \"hoverinfo\", \"none\");\n setterIfNil(trace, \"textinfo\", \"none\");\n setterIfNil(trace, \"type\", \"pie\");\n\n switch (type) {\n case \"thin\":\n setterIfNil(trace, \"hole\", \"0.94\");\n break;\n case \"regular\":\n default:\n setterIfNil(trace, \"hole\", \"0.76\");\n }\n });\n\n return data;\n};\n\nexport const applyLayoutDefaults = (inputLayout) => {\n const defaultLayout = {};\n\n return !inputLayout ? defaultLayout : clone(inputLayout);\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,kBAAlB;;AAEA,MAAMC,WAAW,GAAG,CAACC,MAAD,EAASC,QAAT,EAAmBC,KAAnB,KAA6B;EAAA;;EAC/C;EACAF,MAAM,CAACC,QAAD,CAAN,uBAAmBD,MAAM,CAACC,QAAD,CAAzB,+DAAuCC,KAAvC;AACD,CAHD;AAKA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAACC,SAAD,EAAYC,IAAZ,KAAqB;EACpD,MAAMC,IAAI,GAAGF,SAAb;EAEAE,IAAI,CAACC,OAAL,CAAcC,KAAD,IAAW;IACtBT,WAAW,CAACS,KAAD,EAAQ,WAAR,EAAqB,MAArB,CAAX;IACAT,WAAW,CAACS,KAAD,EAAQ,UAAR,EAAoB,MAApB,CAAX;IACAT,WAAW,CAACS,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAX;;IAEA,QAAQH,IAAR;MACE,KAAK,MAAL;QACEN,WAAW,CAACS,KAAD,EAAQ,MAAR,EAAgB,MAAhB,CAAX;QACA;;MACF,KAAK,SAAL;MACA;QACET,WAAW,CAACS,KAAD,EAAQ,MAAR,EAAgB,MAAhB,CAAX;IANJ;EAQD,CAbD;EAeA,OAAOF,IAAP;AACD,CAnBM;AAqBP,OAAO,MAAMG,mBAAmB,GAAIC,WAAD,IAAiB;EAClD,MAAMC,aAAa,GAAG,EAAtB;EAEA,OAAO,CAACD,WAAD,GAAeC,aAAf,GAA+Bb,KAAK,CAACY,WAAD,CAA3C;AACD,CAJM"}
1
+ {"version":3,"file":"donutchartPlotlyOverrides.js","names":["clone","setterIfNil","object","property","value","applyDataDefaults","inputData","type","data","forEach","trace","applyLayoutDefaults","inputLayout","defaultLayout"],"sources":["../../../src/Donutchart/donutchartPlotlyOverrides.js"],"sourcesContent":["import clone from \"lodash/cloneDeep\";\n\nconst setterIfNil = (object, property, value) => {\n // eslint-disable-next-line no-param-reassign\n object[property] = object[property] ?? value;\n};\n\n/**\n * Auxiliary functions to set the data in order to follow the DS guideline.\n *\n */\nexport const applyDataDefaults = (inputData, type) => {\n const data = inputData;\n\n data.forEach((trace) => {\n setterIfNil(trace, \"hoverinfo\", \"none\");\n setterIfNil(trace, \"textinfo\", \"none\");\n setterIfNil(trace, \"type\", \"pie\");\n\n switch (type) {\n case \"thin\":\n setterIfNil(trace, \"hole\", \"0.94\");\n break;\n case \"regular\":\n default:\n setterIfNil(trace, \"hole\", \"0.76\");\n }\n });\n\n return data;\n};\n\nexport const applyLayoutDefaults = (inputLayout) => {\n const defaultLayout = {};\n\n return !inputLayout ? defaultLayout : clone(inputLayout);\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,kBAAkB;AAEpC,MAAMC,WAAW,GAAG,CAACC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,KAAK;EAAA;EAC/C;EACAF,MAAM,CAACC,QAAQ,CAAC,uBAAGD,MAAM,CAACC,QAAQ,CAAC,+DAAIC,KAAK;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAACC,SAAS,EAAEC,IAAI,KAAK;EACpD,MAAMC,IAAI,GAAGF,SAAS;EAEtBE,IAAI,CAACC,OAAO,CAAEC,KAAK,IAAK;IACtBT,WAAW,CAACS,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC;IACvCT,WAAW,CAACS,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC;IACtCT,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;IAEjC,QAAQH,IAAI;MACV,KAAK,MAAM;QACTN,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;QAClC;MACF,KAAK,SAAS;MACd;QACET,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IAAC;EAEzC,CAAC,CAAC;EAEF,OAAOF,IAAI;AACb,CAAC;AAED,OAAO,MAAMG,mBAAmB,GAAIC,WAAW,IAAK;EAClD,MAAMC,aAAa,GAAG,CAAC,CAAC;EAExB,OAAO,CAACD,WAAW,GAAGC,aAAa,GAAGb,KAAK,CAACY,WAAW,CAAC;AAC1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/Donutchart/index.js"],"sourcesContent":["export { default } from \"./Donutchart\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,cAAxB"}
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/Donutchart/index.js"],"sourcesContent":["export { default } from \"./Donutchart\";\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","names":["styles"],"sources":["../../../src/Donutchart/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG,EAAf;AAEA,eAAeA,MAAf"}
1
+ {"version":3,"file":"styles.js","names":["styles"],"sources":["../../../src/Donutchart/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG,CAAC,CAAC;AAEjB,eAAeA,MAAM"}
@@ -1,40 +1,36 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  const _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "type", "rangeSlider"];
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import React, { useMemo } from "react";
10
7
  import PropTypes from "prop-types";
11
8
  import { withStyles } from "@mui/styles";
12
9
  import Chart from "../Chart";
13
10
  import { applyDataDefaults, applyLayoutDefaults } from "./lineChartPlotlyOverrides";
14
11
  import styles from "./styles";
12
+
15
13
  /**
16
14
  * A line chart or line plot or line graph is a type of chart which displays information as a series of data points
17
15
  * called 'markers' connected by straight line segments. It is a basic type of chart common in many fields.
18
16
  * Our implementation leverages the Plotly charting library. If you have a specific case
19
17
  * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.
20
18
  */
21
-
22
19
  import { jsx as _jsx } from "react/jsx-runtime";
23
-
24
20
  const Linechart = _ref => {
25
21
  let {
26
- id,
27
- classes,
28
- data,
29
- layout,
30
- config,
31
- tooltipType = "multiple",
32
- type = "line",
33
- rangeSlider = false
34
- } = _ref,
35
- others = _objectWithoutProperties(_ref, _excluded);
36
-
22
+ id,
23
+ classes,
24
+ data,
25
+ layout,
26
+ config,
27
+ tooltipType = "multiple",
28
+ type = "line",
29
+ rangeSlider = false
30
+ } = _ref,
31
+ others = _objectWithoutProperties(_ref, _excluded);
37
32
  /* Values derived from props */
33
+
38
34
  const chartData = useMemo(() => applyDataDefaults(data, type), [data, type]);
39
35
  const chartLayout = useMemo(() => applyLayoutDefaults(layout, rangeSlider), [layout, rangeSlider]);
40
36
  return /*#__PURE__*/_jsx(Chart, _objectSpread({
@@ -46,43 +42,35 @@ const Linechart = _ref => {
46
42
  tooltipType: tooltipType
47
43
  }, others));
48
44
  };
49
-
50
45
  process.env.NODE_ENV !== "production" ? Linechart.propTypes = {
51
46
  /**
52
47
  * An Id passed on to the component
53
48
  */
54
49
  id: PropTypes.string,
55
-
56
50
  /**
57
51
  * A Jss Object used to override or extend the styles applied.
58
52
  */
59
53
  classes: PropTypes.instanceOf(Object),
60
-
61
54
  /**
62
55
  * Plotly data object (see https://plot.ly/javascript/reference/).
63
56
  */
64
57
  data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,
65
-
66
58
  /**
67
59
  * Plotly layout object (see https://plot.ly/javascript/reference/#layout).
68
60
  */
69
61
  layout: PropTypes.instanceOf(Object),
70
-
71
62
  /**
72
63
  * Plotly config object (see https://plot.ly/javascript/configuration-options/).
73
64
  */
74
65
  config: PropTypes.instanceOf(Object),
75
-
76
66
  /**
77
67
  * Defines if should use a single or multiline tooltip.
78
68
  */
79
69
  tooltipType: PropTypes.oneOf(["single", "multiple"]),
80
-
81
70
  /**
82
71
  * Sets the type of graph.
83
72
  */
84
73
  type: PropTypes.oneOf(["line", "area", "stack"]),
85
-
86
74
  /**
87
75
  * Defines it should present a range slider.
88
76
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Linechart.js","names":["React","useMemo","PropTypes","withStyles","Chart","applyDataDefaults","applyLayoutDefaults","styles","Linechart","id","classes","data","layout","config","tooltipType","type","rangeSlider","others","chartData","chartLayout","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","name"],"sources":["../../../src/Linechart/Linechart.js"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport Chart from \"../Chart\";\nimport { applyDataDefaults, applyLayoutDefaults } from \"./lineChartPlotlyOverrides\";\nimport styles from \"./styles\";\n\n/**\n * A line chart or line plot or line graph is a type of chart which displays information as a series of data points\n * called 'markers' connected by straight line segments. It is a basic type of chart common in many fields.\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Linechart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n type = \"line\",\n rangeSlider = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const chartData = useMemo(() => applyDataDefaults(data, type), [data, type]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, rangeSlider),\n [layout, rangeSlider]\n );\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n {...others}\n />\n );\n};\n\nLinechart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets the type of graph.\n */\n type: PropTypes.oneOf([\"line\", \"area\", \"stack\"]),\n /**\n * Defines it should present a range slider.\n */\n rangeSlider: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvLinechart\" })(Linechart);\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,iBAAT,EAA4BC,mBAA5B,QAAuD,4BAAvD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;;;;AACA,MAAMC,SAAS,GAAG,QAUZ;EAAA,IAVa;IACjBC,EADiB;IAEjBC,OAFiB;IAGjBC,IAHiB;IAIjBC,MAJiB;IAKjBC,MALiB;IAMjBC,WAAW,GAAG,UANG;IAOjBC,IAAI,GAAG,MAPU;IAQjBC,WAAW,GAAG;EARG,CAUb;EAAA,IADDC,MACC;;EACJ;EAEA,MAAMC,SAAS,GAAGjB,OAAO,CAAC,MAAMI,iBAAiB,CAACM,IAAD,EAAOI,IAAP,CAAxB,EAAsC,CAACJ,IAAD,EAAOI,IAAP,CAAtC,CAAzB;EACA,MAAMI,WAAW,GAAGlB,OAAO,CACzB,MAAMK,mBAAmB,CAACM,MAAD,EAASI,WAAT,CADA,EAEzB,CAACJ,MAAD,EAASI,WAAT,CAFyB,CAA3B;EAKA,oBACE,KAAC,KAAD;IACE,EAAE,EAAEP,EADN;IAEE,OAAO,EAAEC,OAFX;IAGE,IAAI,EAAEQ,SAHR;IAIE,MAAM,EAAEC,WAJV;IAKE,MAAM,EAAEN,MALV;IAME,WAAW,EAAEC;EANf,GAOMG,MAPN,EADF;AAWD,CA9BD;;AAgCA,wCAAAT,SAAS,CAACY,SAAV,GAAsB;EACpB;AACF;AACA;EACEX,EAAE,EAAEP,SAAS,CAACmB,MAJM;;EAKpB;AACF;AACA;EACEX,OAAO,EAAER,SAAS,CAACoB,UAAV,CAAqBC,MAArB,CARW;;EASpB;AACF;AACA;EACEZ,IAAI,EAAET,SAAS,CAACsB,OAAV,CAAkBtB,SAAS,CAACoB,UAAV,CAAqBC,MAArB,CAAlB,EAAgDE,UAZlC;;EAapB;AACF;AACA;EACEb,MAAM,EAAEV,SAAS,CAACoB,UAAV,CAAqBC,MAArB,CAhBY;;EAiBpB;AACF;AACA;EACEV,MAAM,EAAEX,SAAS,CAACoB,UAAV,CAAqBC,MAArB,CApBY;;EAqBpB;AACF;AACA;EACET,WAAW,EAAEZ,SAAS,CAACwB,KAAV,CAAgB,CAAC,QAAD,EAAW,UAAX,CAAhB,CAxBO;;EAyBpB;AACF;AACA;EACEX,IAAI,EAAEb,SAAS,CAACwB,KAAV,CAAgB,CAAC,MAAD,EAAS,MAAT,EAAiB,OAAjB,CAAhB,CA5Bc;;EA6BpB;AACF;AACA;EACEV,WAAW,EAAEd,SAAS,CAACyB;AAhCH,CAAtB;AAmCA,eAAexB,UAAU,CAACI,MAAD,EAAS;EAAEqB,IAAI,EAAE;AAAR,CAAT,CAAV,CAA4CpB,SAA5C,CAAf"}
1
+ {"version":3,"file":"Linechart.js","names":["React","useMemo","PropTypes","withStyles","Chart","applyDataDefaults","applyLayoutDefaults","styles","Linechart","id","classes","data","layout","config","tooltipType","type","rangeSlider","others","chartData","chartLayout","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","name"],"sources":["../../../src/Linechart/Linechart.js"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport Chart from \"../Chart\";\nimport { applyDataDefaults, applyLayoutDefaults } from \"./lineChartPlotlyOverrides\";\nimport styles from \"./styles\";\n\n/**\n * A line chart or line plot or line graph is a type of chart which displays information as a series of data points\n * called 'markers' connected by straight line segments. It is a basic type of chart common in many fields.\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Linechart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n type = \"line\",\n rangeSlider = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const chartData = useMemo(() => applyDataDefaults(data, type), [data, type]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, rangeSlider),\n [layout, rangeSlider]\n );\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n {...others}\n />\n );\n};\n\nLinechart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets the type of graph.\n */\n type: PropTypes.oneOf([\"line\", \"area\", \"stack\"]),\n /**\n * Defines it should present a range slider.\n */\n rangeSlider: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvLinechart\" })(Linechart);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,KAAK,MAAM,UAAU;AAC5B,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,4BAA4B;AACnF,OAAOC,MAAM,MAAM,UAAU;;AAE7B;AACA;AACA;AACA;AACA;AACA;AALA;AAMA,MAAMC,SAAS,GAAG,QAUZ;EAAA,IA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MAAM,EAAE,OAAO,CAAC,CAAC;EAChD;AACF;AACA;EACEV,WAAW,EAAEd,SAAS,CAACyB;AACzB,CAAC;AAED,eAAexB,UAAU,CAACI,MAAM,EAAE;EAAEqB,IAAI,EAAE;AAAc,CAAC,CAAC,CAACpB,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/Linechart/index.js"],"sourcesContent":["export { default } from \"./Linechart\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,aAAxB"}
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../../src/Linechart/index.js"],"sourcesContent":["export { default } from \"./Linechart\";\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,aAAa"}
@@ -1,39 +1,32 @@
1
1
  import clone from "lodash/cloneDeep";
2
-
3
2
  const setterIfNil = (object, property, value) => {
4
3
  var _object$property;
5
-
6
4
  // eslint-disable-next-line no-param-reassign
7
5
  object[property] = (_object$property = object[property]) !== null && _object$property !== void 0 ? _object$property : value;
8
6
  };
7
+
9
8
  /**
10
9
  * Auxiliary functions to set the data in order to follow the DS guideline.
11
10
  *
12
11
  */
13
-
14
-
15
12
  export const applyDataDefaults = (inputData, type) => {
16
13
  const data = inputData;
17
14
  data.forEach(trace => {
18
15
  setterIfNil(trace, "hoverinfo", "none");
19
16
  setterIfNil(trace, "mode", "lines");
20
-
21
17
  switch (type) {
22
18
  case "area":
23
19
  setterIfNil(trace, "fill", "tonexty");
24
20
  setterIfNil(trace, "type", "scatter");
25
21
  break;
26
-
27
22
  case "line":
28
23
  setterIfNil(trace, "type", "line");
29
24
  break;
30
-
31
25
  case "stack":
32
26
  setterIfNil(trace, "fill", "tonexty");
33
27
  setterIfNil(trace, "type", "scatter");
34
28
  setterIfNil(trace, "stackgroup", "one");
35
29
  break;
36
-
37
30
  default:
38
31
  setterIfNil(trace, "type", "line");
39
32
  }
@@ -47,13 +40,11 @@ export const applyLayoutDefaults = (inputLayout = {}, rangeSlider) => {
47
40
  setterIfNil(layout.xaxis, "showline", true);
48
41
  setterIfNil(layout, "yaxis", {});
49
42
  setterIfNil(layout.yaxis, "showline", false);
50
-
51
43
  if (rangeSlider) {
52
44
  setterIfNil(layout.xaxis, "rangeslider", {
53
45
  visible: true
54
46
  });
55
47
  }
56
-
57
48
  return layout;
58
49
  };
59
50
  //# sourceMappingURL=lineChartPlotlyOverrides.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lineChartPlotlyOverrides.js","names":["clone","setterIfNil","object","property","value","applyDataDefaults","inputData","type","data","forEach","trace","applyLayoutDefaults","inputLayout","rangeSlider","layout","xaxis","yaxis","visible"],"sources":["../../../src/Linechart/lineChartPlotlyOverrides.js"],"sourcesContent":["import clone from \"lodash/cloneDeep\";\n\nconst setterIfNil = (object, property, value) => {\n // eslint-disable-next-line no-param-reassign\n object[property] = object[property] ?? value;\n};\n\n/**\n * Auxiliary functions to set the data in order to follow the DS guideline.\n *\n */\nexport const applyDataDefaults = (inputData, type) => {\n const data = inputData;\n\n data.forEach((trace) => {\n setterIfNil(trace, \"hoverinfo\", \"none\");\n setterIfNil(trace, \"mode\", \"lines\");\n\n switch (type) {\n case \"area\":\n setterIfNil(trace, \"fill\", \"tonexty\");\n setterIfNil(trace, \"type\", \"scatter\");\n break;\n case \"line\":\n setterIfNil(trace, \"type\", \"line\");\n break;\n case \"stack\":\n setterIfNil(trace, \"fill\", \"tonexty\");\n setterIfNil(trace, \"type\", \"scatter\");\n setterIfNil(trace, \"stackgroup\", \"one\");\n break;\n default:\n setterIfNil(trace, \"type\", \"line\");\n }\n });\n\n return data;\n};\n\nexport const applyLayoutDefaults = (inputLayout = {}, rangeSlider) => {\n const layout = clone(inputLayout);\n\n setterIfNil(layout, \"xaxis\", {});\n setterIfNil(layout.xaxis, \"showgrid\", true);\n setterIfNil(layout.xaxis, \"showline\", true);\n\n setterIfNil(layout, \"yaxis\", {});\n setterIfNil(layout.yaxis, \"showline\", false);\n\n if (rangeSlider) {\n setterIfNil(lay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CAApB;EAEAX,WAAW,CAACa,MAAD,EAAS,OAAT,EAAkB,EAAlB,CAAX;EACAb,WAAW,CAACa,MAAM,CAACC,KAAR,EAAe,UAAf,EAA2B,IAA3B,CAAX;EACAd,WAAW,CAACa,MAAM,CAACC,KAAR,EAAe,UAAf,EAA2B,IAA3B,CAAX;EAEAd,WAAW,CAACa,MAAD,EAAS,OAAT,EAAkB,EAAlB,CAAX;EACAb,WAAW,CAACa,MAAM,CAACE,KAAR,EAAe,UAAf,EAA2B,KAA3B,CAAX;;EAEA,IAAIH,WAAJ,EAAiB;IACfZ,WAAW,CAACa,MAAM,CAACC,KAAR,EAAe,aAAf,EAA8B;MACvCE,OAAO,EAAE;IAD8B,CAA9B,CAAX;EAGD;;EAED,OAAOH,MAAP;AACD,CAjBM"}
1
+ {"version":3,"file":"lineChartPlotlyOverrides.js","names":["clone","setterIfNil","object","property","value","applyDataDefaults","inputData","type","data","forEach","trace","applyLayoutDefaults","inputLayout","rangeSlider","layout","xaxis","yaxis","visible"],"sources":["../../../src/Linechart/lineChartPlotlyOverrides.js"],"sourcesContent":["import clone from \"lodash/cloneDeep\";\n\nconst setterIfNil = (object, property, value) => {\n // eslint-disable-next-line no-param-reassign\n object[property] = object[property] ?? value;\n};\n\n/**\n * Auxiliary functions to set the data in order to follow the DS guideline.\n *\n */\nexport const applyDataDefaults = (inputData, type) => {\n const data = inputData;\n\n data.forEach((trace) => {\n setterIfNil(trace, \"hoverinfo\", \"none\");\n setterIfNil(trace, \"mode\", \"lines\");\n\n switch (type) {\n case \"area\":\n setterIfNil(trace, \"fill\", \"tonexty\");\n setterIfNil(trace, \"type\", \"scatter\");\n break;\n case \"line\":\n setterIfNil(trace, \"type\", \"line\");\n break;\n case \"stack\":\n setterIfNil(trace, \"fill\", \"tonexty\");\n setterIfNil(trace, \"type\", \"scatter\");\n setterIfNil(trace, \"stackgroup\", \"one\");\n break;\n default:\n setterIfNil(trace, \"type\", \"line\");\n }\n });\n\n return data;\n};\n\nexport const applyLayoutDefaults = (inputLayout = {}, rangeSlider) => {\n const layout = clone(inputLayout);\n\n setterIfNil(layout, \"xaxis\", {});\n setterIfNil(layout.xaxis, \"showgrid\", true);\n setterIfNil(layout.xaxis, \"showline\", true);\n\n setterIfNil(layout, \"yaxis\", {});\n setterIfNil(layout.yaxis, \"showline\", false);\n\n if (rangeSlider) {\n setterIfNil(layout.xaxis, \"rangeslider\", {\n visible: true,\n });\n }\n\n return layout;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,kBAAkB;AAEpC,MAAMC,WAAW,GAAG,CAACC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,KAAK;EAAA;EAC/C;EACAF,MAAM,CAACC,QAAQ,CAAC,uBAAGD,MAAM,CAACC,QAAQ,CAAC,+DAAIC,KAAK;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAACC,SAAS,EAAEC,IAAI,KAAK;EACpD,MAAMC,IAAI,GAAGF,SAAS;EAEtBE,IAAI,CAACC,OAAO,CAAEC,KAAK,IAAK;IACtBT,WAAW,CAACS,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC;IACvCT,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;IAEnC,QAAQH,IAAI;MACV,KAAK,MAAM;QACTN,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;QACrCT,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;QACrC;MACF,KAAK,MAAM;QACTT,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;QAClC;MACF,KAAK,OAAO;QACVT,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;QACrCT,WAAW,CAACS,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC;QACrCT,WAAW,CAACS,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC;QACvC;MACF;QACET,WAAW,CAACS,KAAK,EAAE,M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