@hitachivantara/uikit-react-viz 4.1.10 → 5.1.1
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.
- package/README.md +1 -1
- package/dist/cjs/components/LineChart/LineChart.cjs +398 -0
- package/dist/cjs/components/LineChart/LineChart.cjs.map +1 -0
- package/dist/cjs/components/LineChart/LineChart.styles.cjs +85 -0
- package/dist/cjs/components/LineChart/LineChart.styles.cjs.map +1 -0
- package/dist/cjs/hooks/useVizTheme.cjs +9 -0
- package/dist/cjs/hooks/useVizTheme.cjs.map +1 -0
- package/dist/cjs/index.cjs +8 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/providers/Provider.cjs +137 -0
- package/dist/cjs/providers/Provider.cjs.map +1 -0
- package/dist/cjs/utils/getAgFunc.cjs +5 -0
- package/dist/cjs/utils/getAgFunc.cjs.map +1 -0
- package/dist/cjs/utils/getAxisType.cjs +16 -0
- package/dist/cjs/utils/getAxisType.cjs.map +1 -0
- package/dist/cjs/utils/getLegendIcon.cjs +10 -0
- package/dist/cjs/utils/getLegendIcon.cjs.map +1 -0
- package/dist/esm/components/LineChart/LineChart.js +377 -0
- package/dist/esm/components/LineChart/LineChart.js.map +1 -0
- package/dist/esm/components/LineChart/LineChart.styles.js +85 -0
- package/dist/esm/components/LineChart/LineChart.styles.js.map +1 -0
- package/dist/esm/hooks/useVizTheme.js +9 -0
- package/dist/esm/hooks/useVizTheme.js.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/providers/Provider.js +118 -0
- package/dist/esm/providers/Provider.js.map +1 -0
- package/dist/esm/utils/getAgFunc.js +5 -0
- package/dist/esm/utils/getAgFunc.js.map +1 -0
- package/dist/esm/utils/getAxisType.js +16 -0
- package/dist/esm/utils/getAxisType.js.map +1 -0
- package/dist/esm/utils/getLegendIcon.js +10 -0
- package/dist/esm/utils/getLegendIcon.js.map +1 -0
- package/dist/types/index.d.ts +234 -0
- package/package.json +36 -48
- package/LICENSE.txt +0 -201
- package/dist/Barchart/Barchart.d.ts +0 -14
- package/dist/Barchart/Barchart.js +0 -214
- package/dist/Barchart/Barchart.js.map +0 -1
- package/dist/Barchart/barchartPlotlyOverrides.js +0 -47
- package/dist/Barchart/barchartPlotlyOverrides.js.map +0 -1
- package/dist/Barchart/index.d.ts +0 -2
- package/dist/Barchart/index.js +0 -14
- package/dist/Barchart/index.js.map +0 -1
- package/dist/Barchart/styles.js +0 -10
- package/dist/Barchart/styles.js.map +0 -1
- package/dist/Chart/Chart.d.ts +0 -44
- package/dist/Chart/Chart.js +0 -194
- package/dist/Chart/Chart.js.map +0 -1
- package/dist/Chart/Plot/Plot.d.ts +0 -43
- package/dist/Chart/Plot/Plot.js +0 -110
- package/dist/Chart/Plot/Plot.js.map +0 -1
- package/dist/Chart/Plot/index.d.ts +0 -2
- package/dist/Chart/Plot/index.js +0 -14
- package/dist/Chart/Plot/index.js.map +0 -1
- package/dist/Chart/Plot/styles.js +0 -10
- package/dist/Chart/Plot/styles.js.map +0 -1
- package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js +0 -143
- package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +0 -1
- package/dist/Chart/Tooltip/MultiTooltip/index.js +0 -14
- package/dist/Chart/Tooltip/MultiTooltip/index.js.map +0 -1
- package/dist/Chart/Tooltip/MultiTooltip/styles.js +0 -49
- package/dist/Chart/Tooltip/MultiTooltip/styles.js.map +0 -1
- package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js +0 -73
- package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +0 -1
- package/dist/Chart/Tooltip/SingleTooltip/index.js +0 -14
- package/dist/Chart/Tooltip/SingleTooltip/index.js.map +0 -1
- package/dist/Chart/Tooltip/SingleTooltip/styles.js +0 -24
- package/dist/Chart/Tooltip/SingleTooltip/styles.js.map +0 -1
- package/dist/Chart/Tooltip/Tooltip.js +0 -146
- package/dist/Chart/Tooltip/Tooltip.js.map +0 -1
- package/dist/Chart/Tooltip/index.js +0 -14
- package/dist/Chart/Tooltip/index.js.map +0 -1
- package/dist/Chart/Tooltip/styles.js +0 -16
- package/dist/Chart/Tooltip/styles.js.map +0 -1
- package/dist/Chart/chartPlotlyOverrides.js +0 -145
- package/dist/Chart/chartPlotlyOverrides.js.map +0 -1
- package/dist/Chart/index.d.ts +0 -5
- package/dist/Chart/index.js +0 -14
- package/dist/Chart/index.js.map +0 -1
- package/dist/Chart/styles.js +0 -36
- package/dist/Chart/styles.js.map +0 -1
- package/dist/ConfusionMatrix/ConfusionMatrix.d.ts +0 -10
- package/dist/ConfusionMatrix/ConfusionMatrix.js +0 -102
- package/dist/ConfusionMatrix/ConfusionMatrix.js.map +0 -1
- package/dist/ConfusionMatrix/CustomTooltip/CustomTooltip.js +0 -47
- package/dist/ConfusionMatrix/CustomTooltip/CustomTooltip.js.map +0 -1
- package/dist/ConfusionMatrix/CustomTooltip/index.js +0 -14
- package/dist/ConfusionMatrix/CustomTooltip/index.js.map +0 -1
- package/dist/ConfusionMatrix/CustomTooltip/styles.js +0 -26
- package/dist/ConfusionMatrix/CustomTooltip/styles.js.map +0 -1
- package/dist/ConfusionMatrix/confusionMatrixPlotlyOverrides.js +0 -189
- package/dist/ConfusionMatrix/confusionMatrixPlotlyOverrides.js.map +0 -1
- package/dist/ConfusionMatrix/index.d.ts +0 -2
- package/dist/ConfusionMatrix/index.js +0 -14
- package/dist/ConfusionMatrix/index.js.map +0 -1
- package/dist/ConfusionMatrix/styles.js +0 -10
- package/dist/ConfusionMatrix/styles.js.map +0 -1
- package/dist/Donutchart/Donutchart.d.ts +0 -10
- package/dist/Donutchart/Donutchart.js +0 -103
- package/dist/Donutchart/Donutchart.js.map +0 -1
- package/dist/Donutchart/donutchartPlotlyOverrides.js +0 -44
- package/dist/Donutchart/donutchartPlotlyOverrides.js.map +0 -1
- package/dist/Donutchart/index.d.ts +0 -2
- package/dist/Donutchart/index.js +0 -14
- package/dist/Donutchart/index.js.map +0 -1
- package/dist/Donutchart/styles.js +0 -10
- package/dist/Donutchart/styles.js.map +0 -1
- package/dist/Linechart/Linechart.d.ts +0 -14
- package/dist/Linechart/Linechart.js +0 -108
- package/dist/Linechart/Linechart.js.map +0 -1
- package/dist/Linechart/index.d.ts +0 -2
- package/dist/Linechart/index.js +0 -14
- package/dist/Linechart/index.js.map +0 -1
- package/dist/Linechart/lineChartPlotlyOverrides.js +0 -63
- package/dist/Linechart/lineChartPlotlyOverrides.js.map +0 -1
- package/dist/Linechart/styles.js +0 -10
- package/dist/Linechart/styles.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -35
- package/dist/index.js.map +0 -1
- package/dist/legacy/Barchart/Barchart.d.ts +0 -14
- package/dist/legacy/Barchart/Barchart.js +0 -199
- package/dist/legacy/Barchart/Barchart.js.map +0 -1
- package/dist/legacy/Barchart/barchartPlotlyOverrides.js +0 -38
- package/dist/legacy/Barchart/barchartPlotlyOverrides.js.map +0 -1
- package/dist/legacy/Barchart/index.d.ts +0 -2
- package/dist/legacy/Barchart/index.js +0 -2
- package/dist/legacy/Barchart/index.js.map +0 -1
- package/dist/legacy/Barchart/styles.js +0 -3
- package/dist/legacy/Barchart/styles.js.map +0 -1
- package/dist/legacy/Chart/Chart.d.ts +0 -44
- package/dist/legacy/Chart/Chart.js +0 -181
- package/dist/legacy/Chart/Chart.js.map +0 -1
- package/dist/legacy/Chart/Plot/Plot.d.ts +0 -43
- package/dist/legacy/Chart/Plot/Plot.js +0 -95
- package/dist/legacy/Chart/Plot/Plot.js.map +0 -1
- package/dist/legacy/Chart/Plot/index.d.ts +0 -2
- package/dist/legacy/Chart/Plot/index.js +0 -2
- package/dist/legacy/Chart/Plot/index.js.map +0 -1
- package/dist/legacy/Chart/Plot/styles.js +0 -3
- package/dist/legacy/Chart/Plot/styles.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js +0 -130
- package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/index.js +0 -2
- package/dist/legacy/Chart/Tooltip/MultiTooltip/index.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js +0 -42
- package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js +0 -57
- package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/index.js +0 -2
- package/dist/legacy/Chart/Tooltip/SingleTooltip/index.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js +0 -17
- package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/Tooltip.js +0 -129
- package/dist/legacy/Chart/Tooltip/Tooltip.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/index.js +0 -2
- package/dist/legacy/Chart/Tooltip/index.js.map +0 -1
- package/dist/legacy/Chart/Tooltip/styles.js +0 -9
- package/dist/legacy/Chart/Tooltip/styles.js.map +0 -1
- package/dist/legacy/Chart/chartPlotlyOverrides.js +0 -136
- package/dist/legacy/Chart/chartPlotlyOverrides.js.map +0 -1
- package/dist/legacy/Chart/index.d.ts +0 -5
- package/dist/legacy/Chart/index.js +0 -2
- package/dist/legacy/Chart/index.js.map +0 -1
- package/dist/legacy/Chart/styles.js +0 -28
- package/dist/legacy/Chart/styles.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/ConfusionMatrix.d.ts +0 -10
- package/dist/legacy/ConfusionMatrix/ConfusionMatrix.js +0 -87
- package/dist/legacy/ConfusionMatrix/ConfusionMatrix.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/CustomTooltip/CustomTooltip.js +0 -39
- package/dist/legacy/ConfusionMatrix/CustomTooltip/CustomTooltip.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/CustomTooltip/index.js +0 -2
- package/dist/legacy/ConfusionMatrix/CustomTooltip/index.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/CustomTooltip/styles.js +0 -19
- package/dist/legacy/ConfusionMatrix/CustomTooltip/styles.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/confusionMatrixPlotlyOverrides.js +0 -181
- package/dist/legacy/ConfusionMatrix/confusionMatrixPlotlyOverrides.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/index.d.ts +0 -2
- package/dist/legacy/ConfusionMatrix/index.js +0 -2
- package/dist/legacy/ConfusionMatrix/index.js.map +0 -1
- package/dist/legacy/ConfusionMatrix/styles.js +0 -3
- package/dist/legacy/ConfusionMatrix/styles.js.map +0 -1
- package/dist/legacy/Donutchart/Donutchart.d.ts +0 -10
- package/dist/legacy/Donutchart/Donutchart.js +0 -89
- package/dist/legacy/Donutchart/Donutchart.js.map +0 -1
- package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js +0 -35
- package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js.map +0 -1
- package/dist/legacy/Donutchart/index.d.ts +0 -2
- package/dist/legacy/Donutchart/index.js +0 -2
- package/dist/legacy/Donutchart/index.js.map +0 -1
- package/dist/legacy/Donutchart/styles.js +0 -3
- package/dist/legacy/Donutchart/styles.js.map +0 -1
- package/dist/legacy/Linechart/Linechart.d.ts +0 -14
- package/dist/legacy/Linechart/Linechart.js +0 -94
- package/dist/legacy/Linechart/Linechart.js.map +0 -1
- package/dist/legacy/Linechart/index.d.ts +0 -2
- package/dist/legacy/Linechart/index.js +0 -2
- package/dist/legacy/Linechart/index.js.map +0 -1
- package/dist/legacy/Linechart/lineChartPlotlyOverrides.js +0 -54
- package/dist/legacy/Linechart/lineChartPlotlyOverrides.js.map +0 -1
- package/dist/legacy/Linechart/styles.js +0 -3
- package/dist/legacy/Linechart/styles.js.map +0 -1
- package/dist/legacy/index.d.ts +0 -11
- package/dist/legacy/index.js +0 -6
- package/dist/legacy/index.js.map +0 -1
- package/dist/modern/Barchart/Barchart.d.ts +0 -14
- package/dist/modern/Barchart/Barchart.js +0 -185
- package/dist/modern/Barchart/Barchart.js.map +0 -1
- package/dist/modern/Barchart/barchartPlotlyOverrides.js +0 -36
- package/dist/modern/Barchart/barchartPlotlyOverrides.js.map +0 -1
- package/dist/modern/Barchart/index.d.ts +0 -2
- package/dist/modern/Barchart/index.js +0 -2
- package/dist/modern/Barchart/index.js.map +0 -1
- package/dist/modern/Barchart/styles.js +0 -3
- package/dist/modern/Barchart/styles.js.map +0 -1
- package/dist/modern/Chart/Chart.d.ts +0 -44
- package/dist/modern/Chart/Chart.js +0 -162
- package/dist/modern/Chart/Chart.js.map +0 -1
- package/dist/modern/Chart/Plot/Plot.d.ts +0 -43
- package/dist/modern/Chart/Plot/Plot.js +0 -89
- package/dist/modern/Chart/Plot/Plot.js.map +0 -1
- package/dist/modern/Chart/Plot/index.d.ts +0 -2
- package/dist/modern/Chart/Plot/index.js +0 -2
- package/dist/modern/Chart/Plot/index.js.map +0 -1
- package/dist/modern/Chart/Plot/styles.js +0 -3
- package/dist/modern/Chart/Plot/styles.js.map +0 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js +0 -122
- package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +0 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/index.js +0 -2
- package/dist/modern/Chart/Tooltip/MultiTooltip/index.js.map +0 -1
- package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js +0 -40
- package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js.map +0 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js +0 -54
- package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +0 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/index.js +0 -2
- package/dist/modern/Chart/Tooltip/SingleTooltip/index.js.map +0 -1
- package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js +0 -15
- package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js.map +0 -1
- package/dist/modern/Chart/Tooltip/Tooltip.js +0 -129
- package/dist/modern/Chart/Tooltip/Tooltip.js.map +0 -1
- package/dist/modern/Chart/Tooltip/index.js +0 -2
- package/dist/modern/Chart/Tooltip/index.js.map +0 -1
- package/dist/modern/Chart/Tooltip/styles.js +0 -9
- package/dist/modern/Chart/Tooltip/styles.js.map +0 -1
- package/dist/modern/Chart/chartPlotlyOverrides.js +0 -126
- package/dist/modern/Chart/chartPlotlyOverrides.js.map +0 -1
- package/dist/modern/Chart/index.d.ts +0 -5
- package/dist/modern/Chart/index.js +0 -2
- package/dist/modern/Chart/index.js.map +0 -1
- package/dist/modern/Chart/styles.js +0 -19
- package/dist/modern/Chart/styles.js.map +0 -1
- package/dist/modern/ConfusionMatrix/ConfusionMatrix.d.ts +0 -10
- package/dist/modern/ConfusionMatrix/ConfusionMatrix.js +0 -76
- package/dist/modern/ConfusionMatrix/ConfusionMatrix.js.map +0 -1
- package/dist/modern/ConfusionMatrix/CustomTooltip/CustomTooltip.js +0 -37
- package/dist/modern/ConfusionMatrix/CustomTooltip/CustomTooltip.js.map +0 -1
- package/dist/modern/ConfusionMatrix/CustomTooltip/index.js +0 -2
- package/dist/modern/ConfusionMatrix/CustomTooltip/index.js.map +0 -1
- package/dist/modern/ConfusionMatrix/CustomTooltip/styles.js +0 -17
- package/dist/modern/ConfusionMatrix/CustomTooltip/styles.js.map +0 -1
- package/dist/modern/ConfusionMatrix/confusionMatrixPlotlyOverrides.js +0 -154
- package/dist/modern/ConfusionMatrix/confusionMatrixPlotlyOverrides.js.map +0 -1
- package/dist/modern/ConfusionMatrix/index.d.ts +0 -2
- package/dist/modern/ConfusionMatrix/index.js +0 -2
- package/dist/modern/ConfusionMatrix/index.js.map +0 -1
- package/dist/modern/ConfusionMatrix/styles.js +0 -3
- package/dist/modern/ConfusionMatrix/styles.js.map +0 -1
- package/dist/modern/Donutchart/Donutchart.d.ts +0 -10
- package/dist/modern/Donutchart/Donutchart.js +0 -78
- package/dist/modern/Donutchart/Donutchart.js.map +0 -1
- package/dist/modern/Donutchart/donutchartPlotlyOverrides.js +0 -33
- package/dist/modern/Donutchart/donutchartPlotlyOverrides.js.map +0 -1
- package/dist/modern/Donutchart/index.d.ts +0 -2
- package/dist/modern/Donutchart/index.js +0 -2
- package/dist/modern/Donutchart/index.js.map +0 -1
- package/dist/modern/Donutchart/styles.js +0 -3
- package/dist/modern/Donutchart/styles.js.map +0 -1
- package/dist/modern/Linechart/Linechart.d.ts +0 -14
- package/dist/modern/Linechart/Linechart.js +0 -82
- package/dist/modern/Linechart/Linechart.js.map +0 -1
- package/dist/modern/Linechart/index.d.ts +0 -2
- package/dist/modern/Linechart/index.js +0 -2
- package/dist/modern/Linechart/index.js.map +0 -1
- package/dist/modern/Linechart/lineChartPlotlyOverrides.js +0 -50
- package/dist/modern/Linechart/lineChartPlotlyOverrides.js.map +0 -1
- package/dist/modern/Linechart/styles.js +0 -3
- package/dist/modern/Linechart/styles.js.map +0 -1
- package/dist/modern/index.d.ts +0 -11
- package/dist/modern/index.js +0 -6
- package/dist/modern/index.js.map +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.applyLayoutDefaults = exports.applyDataDefaults = void 0;
|
|
8
|
-
require("core-js/modules/es.object.to-string.js");
|
|
9
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
10
|
-
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
11
|
-
var setterIfNil = function setterIfNil(object, property, value) {
|
|
12
|
-
var _object$property;
|
|
13
|
-
// eslint-disable-next-line no-param-reassign
|
|
14
|
-
object[property] = (_object$property = object[property]) !== null && _object$property !== void 0 ? _object$property : value;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Auxiliary functions to set the data in order to follow the DS guideline.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
var applyDataDefaults = function applyDataDefaults(inputData, type) {
|
|
22
|
-
var data = inputData;
|
|
23
|
-
data.forEach(function (trace) {
|
|
24
|
-
setterIfNil(trace, "hoverinfo", "none");
|
|
25
|
-
setterIfNil(trace, "textinfo", "none");
|
|
26
|
-
setterIfNil(trace, "type", "pie");
|
|
27
|
-
switch (type) {
|
|
28
|
-
case "thin":
|
|
29
|
-
setterIfNil(trace, "hole", "0.94");
|
|
30
|
-
break;
|
|
31
|
-
case "regular":
|
|
32
|
-
default:
|
|
33
|
-
setterIfNil(trace, "hole", "0.76");
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
exports.applyDataDefaults = applyDataDefaults;
|
|
39
|
-
var applyLayoutDefaults = function applyLayoutDefaults(inputLayout) {
|
|
40
|
-
var defaultLayout = {};
|
|
41
|
-
return !inputLayout ? defaultLayout : (0, _cloneDeep.default)(inputLayout);
|
|
42
|
-
};
|
|
43
|
-
exports.applyLayoutDefaults = applyLayoutDefaults;
|
|
44
|
-
//# sourceMappingURL=donutchartPlotlyOverrides.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"donutchartPlotlyOverrides.js","names":["setterIfNil","object","property","value","applyDataDefaults","inputData","type","data","forEach","trace","applyLayoutDefaults","inputLayout","defaultLayout","clone"],"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;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAW,CAAIC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAK;EAAA;EAC/C;EACAF,MAAM,CAACC,QAAQ,CAAC,uBAAGD,MAAM,CAACC,QAAQ,CAAC,+DAAIC,KAAK;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiB,CAAIC,SAAS,EAAEC,IAAI,EAAK;EACpD,IAAMC,IAAI,GAAGF,SAAS;EAEtBE,IAAI,CAACC,OAAO,CAAC,UAACC,KAAK,EAAK;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;AAAC;AAEK,IAAMG,mBAAmB,GAAG,SAAtBA,mBAAmB,CAAIC,WAAW,EAAK;EAClD,IAAMC,aAAa,GAAG,CAAC,CAAC;EAExB,OAAO,CAACD,WAAW,GAAGC,aAAa,GAAG,IAAAC,kBAAK,EAACF,WAAW,CAAC;AAC1D,CAAC;AAAC"}
|
package/dist/Donutchart/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _Donutchart.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _Donutchart = _interopRequireDefault(require("./Donutchart"));
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/Donutchart/index.js"],"sourcesContent":["export { default } from \"./Donutchart\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles"],"sources":["../../src/Donutchart/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,CAAC;AAAC,eAEHA,MAAM;AAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { HvChartProps } from "../Chart";
|
|
2
|
-
|
|
3
|
-
export interface HvLinechartProps extends HvChartProps {
|
|
4
|
-
/**
|
|
5
|
-
* Sets the type of graph.
|
|
6
|
-
*/
|
|
7
|
-
type?: "line" | "area" | "stack";
|
|
8
|
-
/**
|
|
9
|
-
* Defines it should present a range slider.
|
|
10
|
-
*/
|
|
11
|
-
rangeSlider?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function HvLinechart(props: HvLinechartProps): JSX.Element | null;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.keys.js");
|
|
4
|
-
require("core-js/modules/es.symbol.js");
|
|
5
|
-
require("core-js/modules/es.array.filter.js");
|
|
6
|
-
require("core-js/modules/es.object.to-string.js");
|
|
7
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
8
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
10
|
-
require("core-js/modules/es.array.iterator.js");
|
|
11
|
-
require("core-js/modules/es.string.iterator.js");
|
|
12
|
-
require("core-js/modules/es.weak-map.js");
|
|
13
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
14
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
15
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
16
|
-
Object.defineProperty(exports, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
19
|
-
exports.default = void 0;
|
|
20
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
24
|
-
var _styles = require("@mui/styles");
|
|
25
|
-
var _Chart = _interopRequireDefault(require("../Chart"));
|
|
26
|
-
var _lineChartPlotlyOverrides = require("./lineChartPlotlyOverrides");
|
|
27
|
-
var _styles2 = _interopRequireDefault(require("./styles"));
|
|
28
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
-
var _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "type", "rangeSlider"];
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
-
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; }
|
|
33
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
34
|
-
/**
|
|
35
|
-
* A line chart or line plot or line graph is a type of chart which displays information as a series of data points
|
|
36
|
-
* called 'markers' connected by straight line segments. It is a basic type of chart common in many fields.
|
|
37
|
-
* Our implementation leverages the Plotly charting library. If you have a specific case
|
|
38
|
-
* that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.
|
|
39
|
-
*/
|
|
40
|
-
var Linechart = function Linechart(_ref) {
|
|
41
|
-
var id = _ref.id,
|
|
42
|
-
classes = _ref.classes,
|
|
43
|
-
data = _ref.data,
|
|
44
|
-
layout = _ref.layout,
|
|
45
|
-
config = _ref.config,
|
|
46
|
-
_ref$tooltipType = _ref.tooltipType,
|
|
47
|
-
tooltipType = _ref$tooltipType === void 0 ? "multiple" : _ref$tooltipType,
|
|
48
|
-
_ref$type = _ref.type,
|
|
49
|
-
type = _ref$type === void 0 ? "line" : _ref$type,
|
|
50
|
-
_ref$rangeSlider = _ref.rangeSlider,
|
|
51
|
-
rangeSlider = _ref$rangeSlider === void 0 ? false : _ref$rangeSlider,
|
|
52
|
-
others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
|
-
/* Values derived from props */
|
|
54
|
-
|
|
55
|
-
var chartData = (0, _react.useMemo)(function () {
|
|
56
|
-
return (0, _lineChartPlotlyOverrides.applyDataDefaults)(data, type);
|
|
57
|
-
}, [data, type]);
|
|
58
|
-
var chartLayout = (0, _react.useMemo)(function () {
|
|
59
|
-
return (0, _lineChartPlotlyOverrides.applyLayoutDefaults)(layout, rangeSlider);
|
|
60
|
-
}, [layout, rangeSlider]);
|
|
61
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chart.default, _objectSpread({
|
|
62
|
-
id: id,
|
|
63
|
-
classes: classes,
|
|
64
|
-
data: chartData,
|
|
65
|
-
layout: chartLayout,
|
|
66
|
-
config: config,
|
|
67
|
-
tooltipType: tooltipType
|
|
68
|
-
}, others));
|
|
69
|
-
};
|
|
70
|
-
process.env.NODE_ENV !== "production" ? Linechart.propTypes = {
|
|
71
|
-
/**
|
|
72
|
-
* An Id passed on to the component
|
|
73
|
-
*/
|
|
74
|
-
id: _propTypes.default.string,
|
|
75
|
-
/**
|
|
76
|
-
* A Jss Object used to override or extend the styles applied.
|
|
77
|
-
*/
|
|
78
|
-
classes: _propTypes.default.instanceOf(Object),
|
|
79
|
-
/**
|
|
80
|
-
* Plotly data object (see https://plot.ly/javascript/reference/).
|
|
81
|
-
*/
|
|
82
|
-
data: _propTypes.default.arrayOf(_propTypes.default.instanceOf(Object)).isRequired,
|
|
83
|
-
/**
|
|
84
|
-
* Plotly layout object (see https://plot.ly/javascript/reference/#layout).
|
|
85
|
-
*/
|
|
86
|
-
layout: _propTypes.default.instanceOf(Object),
|
|
87
|
-
/**
|
|
88
|
-
* Plotly config object (see https://plot.ly/javascript/configuration-options/).
|
|
89
|
-
*/
|
|
90
|
-
config: _propTypes.default.instanceOf(Object),
|
|
91
|
-
/**
|
|
92
|
-
* Defines if should use a single or multiline tooltip.
|
|
93
|
-
*/
|
|
94
|
-
tooltipType: _propTypes.default.oneOf(["single", "multiple"]),
|
|
95
|
-
/**
|
|
96
|
-
* Sets the type of graph.
|
|
97
|
-
*/
|
|
98
|
-
type: _propTypes.default.oneOf(["line", "area", "stack"]),
|
|
99
|
-
/**
|
|
100
|
-
* Defines it should present a range slider.
|
|
101
|
-
*/
|
|
102
|
-
rangeSlider: _propTypes.default.bool
|
|
103
|
-
} : void 0;
|
|
104
|
-
var _default = (0, _styles.withStyles)(_styles2.default, {
|
|
105
|
-
name: "HvLinechart"
|
|
106
|
-
})(Linechart);
|
|
107
|
-
exports.default = _default;
|
|
108
|
-
//# sourceMappingURL=Linechart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Linechart.js","names":["Linechart","id","classes","data","layout","config","tooltipType","type","rangeSlider","others","chartData","useMemo","applyDataDefaults","chartLayout","applyLayoutDefaults","propTypes","PropTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","withStyles","styles","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;AACA;AACA;AACA;AACA;AACA;AAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAS,OAUT;EAAA,IATJC,EAAE,QAAFA,EAAE;IACFC,OAAO,Q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,KAAK,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;EACpD;AACF;AACA;EACEf,IAAI,EAAES,kBAAS,CAACM,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;EAChD;AACF;AACA;EACEd,WAAW,EAAEQ,kBAAS,CAACO;AACzB,CAAC;AAAC,eAEa,IAAAC,kBAAU,EAACC,gBAAM,EAAE;EAAEC,IAAI,EAAE;AAAc,CAAC,CAAC,CAAC1B,SAAS,CAAC;AAAA"}
|
package/dist/Linechart/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "default", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _Linechart.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _Linechart = _interopRequireDefault(require("./Linechart"));
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/Linechart/index.js"],"sourcesContent":["export { default } from \"./Linechart\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.applyLayoutDefaults = exports.applyDataDefaults = void 0;
|
|
8
|
-
require("core-js/modules/es.object.to-string.js");
|
|
9
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
10
|
-
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
11
|
-
var setterIfNil = function setterIfNil(object, property, value) {
|
|
12
|
-
var _object$property;
|
|
13
|
-
// eslint-disable-next-line no-param-reassign
|
|
14
|
-
object[property] = (_object$property = object[property]) !== null && _object$property !== void 0 ? _object$property : value;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Auxiliary functions to set the data in order to follow the DS guideline.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
var applyDataDefaults = function applyDataDefaults(inputData, type) {
|
|
22
|
-
var data = inputData;
|
|
23
|
-
data.forEach(function (trace) {
|
|
24
|
-
setterIfNil(trace, "hoverinfo", "none");
|
|
25
|
-
setterIfNil(trace, "mode", "lines");
|
|
26
|
-
switch (type) {
|
|
27
|
-
case "area":
|
|
28
|
-
setterIfNil(trace, "fill", "tonexty");
|
|
29
|
-
setterIfNil(trace, "type", "scatter");
|
|
30
|
-
break;
|
|
31
|
-
case "line":
|
|
32
|
-
setterIfNil(trace, "type", "line");
|
|
33
|
-
break;
|
|
34
|
-
case "stack":
|
|
35
|
-
setterIfNil(trace, "fill", "tonexty");
|
|
36
|
-
setterIfNil(trace, "type", "scatter");
|
|
37
|
-
setterIfNil(trace, "stackgroup", "one");
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
setterIfNil(trace, "type", "line");
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return data;
|
|
44
|
-
};
|
|
45
|
-
exports.applyDataDefaults = applyDataDefaults;
|
|
46
|
-
var applyLayoutDefaults = function applyLayoutDefaults() {
|
|
47
|
-
var inputLayout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
-
var rangeSlider = arguments.length > 1 ? arguments[1] : undefined;
|
|
49
|
-
var layout = (0, _cloneDeep.default)(inputLayout);
|
|
50
|
-
setterIfNil(layout, "xaxis", {});
|
|
51
|
-
setterIfNil(layout.xaxis, "showgrid", true);
|
|
52
|
-
setterIfNil(layout.xaxis, "showline", true);
|
|
53
|
-
setterIfNil(layout, "yaxis", {});
|
|
54
|
-
setterIfNil(layout.yaxis, "showline", false);
|
|
55
|
-
if (rangeSlider) {
|
|
56
|
-
setterIfNil(layout.xaxis, "rangeslider", {
|
|
57
|
-
visible: true
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return layout;
|
|
61
|
-
};
|
|
62
|
-
exports.applyLayoutDefaults = applyLayoutDefaults;
|
|
63
|
-
//# sourceMappingURL=lineChartPlotlyOverrides.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lineChartPlotlyOverrides.js","names":["setterIfNil","object","property","value","applyDataDefaults","inputData","type","data","forEach","trace","applyLayoutDefaults","inputLayout","rangeSlider","layout","clone","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;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAW,CAAIC,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAK;EAAA;EAC/C;EACAF,MAAM,CAACC,QAAQ,CAAC,uBAAGD,MAAM,CAACC,QAAQ,CAAC,+DAAIC,KAAK;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiB,CAAIC,SAAS,EAAEC,IAAI,EAAK;EACpD,IAAMC,IAAI,GAAGF,SAAS;EAEtBE,IAAI,CAACC,OAAO,CAAC,UAACC,KAAK,EAAK;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,MAAM,EAAE,MAAM,CAAC;IAAC;EAEzC,CAAC,CAAC;EAEF,OAAOF,IAAI;AACb,CAAC;AAAC;AAEK,IAAMG,mBAAmB,GAAG,SAAtBA,mBAAmB,GAAsC;EAAA,IAAlCC,WAAW,uEAAG,CAAC,CAAC;EAAA,IAAEC,WAAW;EAC/D,IAAMC,MAAM,GAAG,IAAAC,kBAAK,EAACH,WAAW,CAAC;EAEjCX,WAAW,CAACa,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;EAChCb,WAAW,CAACa,MAAM,CAACE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC;EAC3Cf,WAAW,CAACa,MAAM,CAACE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC;EAE3Cf,WAAW,CAACa,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;EAChCb,WAAW,CAACa,MAAM,CAACG,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC;EAE5C,IAAIJ,WAAW,EAAE;IACfZ,WAAW,CAACa,MAAM,CAACE,KAAK,EAAE,aAAa,EAAE;MACvCE,OAAO,EAAE;IACX,CAAC,CAAC;EACJ;EAEA,OAAOJ,MAAM;AACf,CAAC;AAAC"}
|
package/dist/Linechart/styles.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles"],"sources":["../../src/Linechart/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,CAAC;AAAC,eAEHA,MAAM;AAAA"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as HvBarchart } from "./Barchart";
|
|
2
|
-
export * from "./Barchart";
|
|
3
|
-
|
|
4
|
-
export { default as HvDonutchart } from "./Donutchart";
|
|
5
|
-
export * from "./Donutchart";
|
|
6
|
-
|
|
7
|
-
export { default as HvLinechart } from "./Linechart";
|
|
8
|
-
export * from "./Linechart";
|
|
9
|
-
|
|
10
|
-
export { default as HvConfusionMatrix} from "./ConfusionMatrix";
|
|
11
|
-
export * from "./ConfusionMatrix";
|
package/dist/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "HvBarchart", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _Barchart.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "HvConfusionMatrix", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _ConfusionMatrix.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "HvDonutchart", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _Donutchart.default;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "HvLinechart", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _Linechart.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
var _Barchart = _interopRequireDefault(require("./Barchart"));
|
|
32
|
-
var _Donutchart = _interopRequireDefault(require("./Donutchart"));
|
|
33
|
-
var _Linechart = _interopRequireDefault(require("./Linechart"));
|
|
34
|
-
var _ConfusionMatrix = _interopRequireDefault(require("./ConfusionMatrix"));
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["// components\nexport { default as HvBarchart } from \"./Barchart\";\nexport { default as HvDonutchart } from \"./Donutchart\";\nexport { default as HvLinechart } from \"./Linechart\";\nexport { default as HvConfusionMatrix } from \"./ConfusionMatrix\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;AACA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { HvChartProps } from "../Chart";
|
|
2
|
-
|
|
3
|
-
export interface HvBarchartProps extends HvChartProps {
|
|
4
|
-
/**
|
|
5
|
-
* Sets if the chart is stack.
|
|
6
|
-
*/
|
|
7
|
-
stack?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Sets if the chart is horizontal.
|
|
10
|
-
*/
|
|
11
|
-
horizontal?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function HvBarchart(props: HvBarchartProps): JSX.Element | null;
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "stack", "horizontal"];
|
|
5
|
-
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
|
-
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; }
|
|
7
|
-
import "core-js/modules/es.array.map.js";
|
|
8
|
-
import "core-js/modules/es.object.keys.js";
|
|
9
|
-
import "core-js/modules/es.symbol.js";
|
|
10
|
-
import "core-js/modules/es.array.filter.js";
|
|
11
|
-
import "core-js/modules/es.object.to-string.js";
|
|
12
|
-
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
13
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
14
|
-
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
15
|
-
import React, { useMemo, useEffect, useState, useCallback, useRef } from "react";
|
|
16
|
-
import PropTypes from "prop-types";
|
|
17
|
-
import { withStyles } from "@mui/styles";
|
|
18
|
-
import Chart from "../Chart";
|
|
19
|
-
import { applyLayoutDefaults, applyDataDefaults } from "./barchartPlotlyOverrides";
|
|
20
|
-
import styles from "./styles";
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
var MARGIN = 50;
|
|
23
|
-
var MAX_BAR_WIDTH = 90;
|
|
24
|
-
var MIN_BAR_WIDTH = 3;
|
|
25
|
-
var MIN_WIDTH = 75;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A Bar chart is a chart or graph that presents categorical data with rectangular bars.
|
|
29
|
-
*
|
|
30
|
-
* Our implementation leverages the Plotly charting library. If you have a specific case
|
|
31
|
-
* that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.
|
|
32
|
-
*/
|
|
33
|
-
var Barchart = function Barchart(_ref) {
|
|
34
|
-
var id = _ref.id,
|
|
35
|
-
classes = _ref.classes,
|
|
36
|
-
data = _ref.data,
|
|
37
|
-
layout = _ref.layout,
|
|
38
|
-
config = _ref.config,
|
|
39
|
-
_ref$tooltipType = _ref.tooltipType,
|
|
40
|
-
tooltipType = _ref$tooltipType === void 0 ? "multiple" : _ref$tooltipType,
|
|
41
|
-
_ref$stack = _ref.stack,
|
|
42
|
-
stack = _ref$stack === void 0 ? false : _ref$stack,
|
|
43
|
-
_ref$horizontal = _ref.horizontal,
|
|
44
|
-
horizontal = _ref$horizontal === void 0 ? false : _ref$horizontal,
|
|
45
|
-
others = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
/* Values derived from props */
|
|
47
|
-
|
|
48
|
-
var dataWithDefaults = useMemo(function () {
|
|
49
|
-
return applyDataDefaults(data, horizontal);
|
|
50
|
-
}, [data, horizontal]);
|
|
51
|
-
var chartLayout = useMemo(function () {
|
|
52
|
-
return applyLayoutDefaults(layout, stack, horizontal);
|
|
53
|
-
}, [layout, stack, horizontal]);
|
|
54
|
-
|
|
55
|
-
/* State */
|
|
56
|
-
|
|
57
|
-
var _useState = useState(dataWithDefaults),
|
|
58
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
-
chartData = _useState2[0],
|
|
60
|
-
setChartData = _useState2[1];
|
|
61
|
-
|
|
62
|
-
/* Effects */
|
|
63
|
-
|
|
64
|
-
var firstRender = useRef(true);
|
|
65
|
-
useEffect(function () {
|
|
66
|
-
// only setChartData when prop value changes
|
|
67
|
-
// not needed on first render because the
|
|
68
|
-
// initial state is already properly set
|
|
69
|
-
if (!firstRender.current) {
|
|
70
|
-
setChartData(dataWithDefaults);
|
|
71
|
-
}
|
|
72
|
-
firstRender.current = false;
|
|
73
|
-
}, [dataWithDefaults]);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Used to force the max width of each bar with 90px.
|
|
77
|
-
*
|
|
78
|
-
* (this is effectively more an effect than a callback)
|
|
79
|
-
*/
|
|
80
|
-
var recalculateBarWidth = useCallback(function (ref) {
|
|
81
|
-
// use the data and layout info directly from the plotly ref
|
|
82
|
-
// as it's always the most uptodate version.
|
|
83
|
-
var plotData = ref.current.props.data;
|
|
84
|
-
var plotLayout = ref.current.props.layout;
|
|
85
|
-
if (plotData.length > 0) {
|
|
86
|
-
var barmode = plotLayout.barmode,
|
|
87
|
-
bargap = plotLayout.bargap,
|
|
88
|
-
bargroupgap = plotLayout.bargroupgap;
|
|
89
|
-
var isStack = barmode === "stack";
|
|
90
|
-
var numberOfBarsByGroup = isStack ? 1 : plotData.length;
|
|
91
|
-
var numberOfGroup = plotData[0].x.length;
|
|
92
|
-
var _ref$current$el$getBo = ref.current.el.getBoundingClientRect(),
|
|
93
|
-
boundingRect = _ref$current$el$getBo.width;
|
|
94
|
-
var width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;
|
|
95
|
-
var plotWidth = width - MARGIN;
|
|
96
|
-
var groupWidth = plotWidth / numberOfGroup;
|
|
97
|
-
var colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;
|
|
98
|
-
var calculatedBarWidth = colWidth / numberOfBarsByGroup;
|
|
99
|
-
var greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;
|
|
100
|
-
var lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;
|
|
101
|
-
var isAlreadyGreaterThan90 = plotData[0].width !== undefined;
|
|
102
|
-
if (greaterThan90 && !isAlreadyGreaterThan90) {
|
|
103
|
-
var newWidth = MAX_BAR_WIDTH / plotWidth * numberOfGroup;
|
|
104
|
-
var newData = plotData.map(function (subData) {
|
|
105
|
-
return _objectSpread(_objectSpread({}, subData), {}, {
|
|
106
|
-
width: newWidth
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
setChartData(newData);
|
|
110
|
-
}
|
|
111
|
-
if (lessThan3 && !isAlreadyGreaterThan90) {
|
|
112
|
-
var _newWidth = MIN_BAR_WIDTH / plotWidth * numberOfGroup;
|
|
113
|
-
var _newData = plotData.map(function (subData) {
|
|
114
|
-
return _objectSpread(_objectSpread({}, subData), {}, {
|
|
115
|
-
width: _newWidth
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
setChartData(_newData);
|
|
119
|
-
}
|
|
120
|
-
if (!greaterThan90 && isAlreadyGreaterThan90) {
|
|
121
|
-
var _newData2 = plotData.map(function (subData) {
|
|
122
|
-
return _objectSpread(_objectSpread({}, subData), {}, {
|
|
123
|
-
width: undefined
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
setChartData(_newData2);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}, []);
|
|
130
|
-
return /*#__PURE__*/_jsx(Chart, _objectSpread({
|
|
131
|
-
id: id,
|
|
132
|
-
classes: classes,
|
|
133
|
-
data: chartData,
|
|
134
|
-
layout: chartLayout,
|
|
135
|
-
config: config,
|
|
136
|
-
tooltipType: tooltipType,
|
|
137
|
-
afterPlot: recalculateBarWidth
|
|
138
|
-
}, others));
|
|
139
|
-
};
|
|
140
|
-
process.env.NODE_ENV !== "production" ? Barchart.propTypes = {
|
|
141
|
-
/**
|
|
142
|
-
* An Id passed on to the component
|
|
143
|
-
*/
|
|
144
|
-
id: PropTypes.string,
|
|
145
|
-
/**
|
|
146
|
-
* A Jss Object used to override or extend the styles applied.
|
|
147
|
-
*/
|
|
148
|
-
classes: PropTypes.shape({
|
|
149
|
-
root: PropTypes.string
|
|
150
|
-
}),
|
|
151
|
-
/**
|
|
152
|
-
* Plotly data object (see https://plot.ly/javascript/reference/).
|
|
153
|
-
*/
|
|
154
|
-
data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,
|
|
155
|
-
/**
|
|
156
|
-
* Plotly layout object (see https://plot.ly/javascript/reference/#layout).
|
|
157
|
-
*/
|
|
158
|
-
layout: PropTypes.instanceOf(Object),
|
|
159
|
-
/**
|
|
160
|
-
* Plotly config object (see https://plot.ly/javascript/configuration-options/).
|
|
161
|
-
*/
|
|
162
|
-
config: PropTypes.instanceOf(Object),
|
|
163
|
-
/**
|
|
164
|
-
* Defines if should use a single or multiline tooltip.
|
|
165
|
-
*/
|
|
166
|
-
tooltipType: PropTypes.oneOf(["single", "multiple"]),
|
|
167
|
-
/**
|
|
168
|
-
* Custom tooltip element to be displayed
|
|
169
|
-
*/
|
|
170
|
-
tooltip: PropTypes.func,
|
|
171
|
-
/**
|
|
172
|
-
* Function to be called after plot render.
|
|
173
|
-
*/
|
|
174
|
-
afterPlot: PropTypes.func,
|
|
175
|
-
/**
|
|
176
|
-
* Defines the X axis title.
|
|
177
|
-
*/
|
|
178
|
-
xAxisTitle: PropTypes.string,
|
|
179
|
-
/**
|
|
180
|
-
* Defines the Y axis title.
|
|
181
|
-
*/
|
|
182
|
-
yAxisTitle: PropTypes.string,
|
|
183
|
-
/**
|
|
184
|
-
* Defines the chart subtitle.
|
|
185
|
-
*/
|
|
186
|
-
subtitle: PropTypes.string,
|
|
187
|
-
/**
|
|
188
|
-
* Sets is the chart is stack.
|
|
189
|
-
*/
|
|
190
|
-
stack: PropTypes.bool,
|
|
191
|
-
/**
|
|
192
|
-
* Sets is the chart is horizontal.
|
|
193
|
-
*/
|
|
194
|
-
horizontal: PropTypes.bool
|
|
195
|
-
} : void 0;
|
|
196
|
-
export default withStyles(styles, {
|
|
197
|
-
name: "HvBarchart"
|
|
198
|
-
})(Barchart);
|
|
199
|
-
//# sourceMappingURL=Barchart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Barchart.js","names":["React","useMemo","useEffect","useState","useCallback","useRef","PropTypes","withStyles","Chart","applyLayoutDefaults","applyDataDefaults","styles","MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","MIN_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","el","getBoundingClientRect","boundingRect","width","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","string","shape","root","arrayOf","instanceOf","Object","isRequired","oneOf","tooltip","func","afterPlot","xAxisTitle","yAxisTitle","subtitle","bool","name"],"sources":["../../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@mui/styles\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\nconst MIN_WIDTH = 75;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\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 Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width: boundingRect } = ref.current.el.getBoundingClientRect();\n const width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\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 afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.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.shape({\n root: PropTypes.string,\n }),\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 * Custom tooltip element to be displayed\n */\n tooltip: PropTypes.func,\n /**\n * Function to be called after plot render.\n */\n afterPlot: PropTypes.func,\n /**\n * Defines the X axis title.\n */\n xAxisTitle: PropTypes.string,\n /**\n * Defines the Y axis title.\n */\n yAxisTitle: PropTypes.string,\n /**\n * Defines the chart subtitle.\n */\n subtitle: PropTypes.string,\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAChF,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,KAAK,MAAM,UAAU;AAC5B,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,2BAA2B;AAClF,OAAOC,MAAM,MAAM,UAAU;AAAC;AAE9B,IAAMC,MAAM,GAAG,EAAE;AACjB,IAAMC,aAAa,GAAG,EAAE;AACxB,IAAMC,aAAa,GAAG,CAAC;AACvB,IAAMC,SAAS,GAAG,EAAE;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAQ,OAUR;EAAA,IATJC,EAAE,QAAFA,EAAE;IACFC,OAAO,QAAPA,OAAO;IACPC,IAAI,QAAJA,IAAI;IACJC,MAAM,QAANA,MAAM;IACNC,MAAM,QAANA,MAAM;IAAA,wBACNC,WAAW;IAAXA,WAAW,iCAAG,UAAU;IAAA,kBACxBC,KAAK;IAALA,KAAK,2BAAG,KAAK;IAAA,uBACbC,UAAU;IAAVA,UAAU,gCAAG,KAAK;IACfC,MAAM;EAET;;EAEA,IAAMC,gBAAgB,GAAGzB,OAAO,CAAC;IAAA,OAAMS,iBAAiB,CAACS,IAAI,EAAEK,UAAU,CAAC;EAAA,GAAE,CAACL,IAAI,EAAEK,UAAU,CAAC,CAAC;EAC/F,IAAMG,WAAW,GAAG1B,OAAO,CACzB;IAAA,OAAMQ,mBAAmB,CAACW,MAAM,EAAEG,KAAK,EAAEC,UAAU,CAAC;EAAA,GACpD,CAACJ,MAAM,EAAEG,KAAK,EAAEC,UAAU,CAAC,CAC5B;;EAED;;EAEA,gBA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