oolib 2.54.1 → 2.54.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -55,7 +55,21 @@ var BarChart = function (props) {
|
|
|
55
55
|
right: marginProp.right || config.margin.right,
|
|
56
56
|
}
|
|
57
57
|
: config.margin;
|
|
58
|
-
var data = props.data, id = props.id, className = props.className, numValuePath = props.numValuePath, categoryValuePath = props.categoryValuePath, _a = props.categoryAxis, categoryAxis = _a === void 0 ? 'y' : _a, _b = props.barWidth, barWidth = _b === void 0 ? 20 : _b, numberAxisLabel = props.numberAxisLabel
|
|
58
|
+
var data = props.data, id = props.id, className = props.className, numValuePath = props.numValuePath, numLabelPath = props.numLabelPath, categoryValuePath = props.categoryValuePath, _a = props.categoryAxis, categoryAxis = _a === void 0 ? 'y' : _a, _b = props.barWidth, barWidth = _b === void 0 ? 20 : _b, numberAxisLabel = props.numberAxisLabel, _c = props.highlight
|
|
59
|
+
/**
|
|
60
|
+
* can be 'max' or 'min' or undefined. if undefined,
|
|
61
|
+
* all bars will be painted the same color. if defined,
|
|
62
|
+
* only the max/min will be painted a color.
|
|
63
|
+
* rest of bars will be grey
|
|
64
|
+
*/
|
|
65
|
+
, highlight = _c === void 0 ? 'max' : _c
|
|
66
|
+
/**
|
|
67
|
+
* can be 'max' or 'min' or undefined. if undefined,
|
|
68
|
+
* all bars will be painted the same color. if defined,
|
|
69
|
+
* only the max/min will be painted a color.
|
|
70
|
+
* rest of bars will be grey
|
|
71
|
+
*/
|
|
72
|
+
;
|
|
59
73
|
var wrapperId = "OKE_PiChart".concat(id ? "_" + id : "");
|
|
60
74
|
var wrapperClass = "OKE-PiChart ".concat(className || "");
|
|
61
75
|
(0, react_1.useEffect)(function () { return drawChart(data); }, [data]);
|
|
@@ -141,9 +155,15 @@ var BarChart = function (props) {
|
|
|
141
155
|
.attr('rx', 5)
|
|
142
156
|
.attr("transform", 'translateX(50%)')
|
|
143
157
|
.attr("fill", function (d) {
|
|
144
|
-
return
|
|
158
|
+
return !highlight
|
|
145
159
|
? (0, utilsOolib_1.getPrimaryColor40)(theme === null || theme === void 0 ? void 0 : theme.colors)
|
|
146
|
-
:
|
|
160
|
+
: highlight === 'max'
|
|
161
|
+
? (0, utils_1.getMax)({ data: data, valuePath: numValuePath }) === (0, getVal_1.getVal)(d, numValuePath)
|
|
162
|
+
? (0, utilsOolib_1.getPrimaryColor40)(theme === null || theme === void 0 ? void 0 : theme.colors)
|
|
163
|
+
: themes_1.colors.greyColor15
|
|
164
|
+
: (0, utils_1.getMin)({ data: data, valuePath: numValuePath }) === (0, getVal_1.getVal)(d, numValuePath)
|
|
165
|
+
? (0, utilsOolib_1.getPrimaryColor40)(theme === null || theme === void 0 ? void 0 : theme.colors)
|
|
166
|
+
: themes_1.colors.greyColor15;
|
|
147
167
|
});
|
|
148
168
|
//Bar Number Labels
|
|
149
169
|
svg
|
|
@@ -151,7 +171,7 @@ var BarChart = function (props) {
|
|
|
151
171
|
.data(data)
|
|
152
172
|
.enter()
|
|
153
173
|
.append("text")
|
|
154
|
-
.text(function (d) { return (0, getVal_1.getVal)(d, numValuePath); })
|
|
174
|
+
.text(function (d) { return (0, getVal_1.getVal)(d, numLabelPath || numValuePath); })
|
|
155
175
|
.attr("y", function (d) {
|
|
156
176
|
return categoryAxisGenerator((0, getVal_1.getVal)(d, categoryValuePath)) + (categoryAxisGenerator.bandwidth() / 2) + 4;
|
|
157
177
|
})
|