@dhis2/analytics 23.12.4 → 23.13.2
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/CHANGELOG.md +29 -0
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +9 -9
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +1 -1
- package/build/cjs/locales/nl/translations.json +3 -3
- package/build/cjs/modules/legends.js +20 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +11 -6
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/legend.js +4 -97
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/index.js +42 -4
- package/build/cjs/visualizations/config/generators/highcharts/index.js +33 -0
- package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +9 -9
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +1 -1
- package/build/es/locales/nl/translations.json +3 -3
- package/build/es/modules/legends.js +15 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +11 -6
- package/build/es/visualizations/config/adapters/dhis_highcharts/legend.js +5 -93
- package/build/es/visualizations/config/adapters/dhis_highcharts/series/index.js +41 -4
- package/build/es/visualizations/config/generators/highcharts/index.js +33 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [23.13.2](https://github.com/dhis2/analytics/compare/v23.13.1...v23.13.2) (2022-08-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* highcharts legend when exporting (DHIS2-12719) ([#1279](https://github.com/dhis2/analytics/issues/1279)) ([5f62e20](https://github.com/dhis2/analytics/commit/5f62e2050a1ff7411308a32f87f3e427cdbb4bb4))
|
|
7
|
+
|
|
8
|
+
## [23.13.1](https://github.com/dhis2/analytics/compare/v23.13.0...v23.13.1) (2022-07-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **translations:** sync translations from transifex (master) ([d3a1f4e](https://github.com/dhis2/analytics/commit/d3a1f4e861cf29e95f9615f3585e814d52aa837f))
|
|
14
|
+
|
|
15
|
+
# [23.13.0](https://github.com/dhis2/analytics/compare/v23.12.5...v23.13.0) (2022-07-25)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* search by tokens across identifiable properties (DHIS2-13475) ([c94c427](https://github.com/dhis2/analytics/commit/c94c4271492d390cd76cfb8c8d8104cbfab83e1d))
|
|
21
|
+
* search by tokens across identifiable properties [DHIS2-13475] ([87db2f9](https://github.com/dhis2/analytics/commit/87db2f91f7aa5b2665038324d5b779e2f8267812))
|
|
22
|
+
|
|
23
|
+
## [23.12.5](https://github.com/dhis2/analytics/compare/v23.12.4...v23.12.5) (2022-06-24)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* force the modal content flex item to shrink past its content's width ([#1282](https://github.com/dhis2/analytics/issues/1282)) ([88d6934](https://github.com/dhis2/analytics/commit/88d69342677732206fdc17684ba3f5bd119d85dd))
|
|
29
|
+
|
|
1
30
|
## [23.12.4](https://github.com/dhis2/analytics/compare/v23.12.3...v23.12.4) (2022-06-20)
|
|
2
31
|
|
|
3
32
|
|
|
@@ -129,32 +129,32 @@ const InterpretationModal = _ref2 => {
|
|
|
129
129
|
hidden: shouldCssHideModal
|
|
130
130
|
})
|
|
131
131
|
}, /*#__PURE__*/_react.default.createElement("h1", {
|
|
132
|
-
className: _style.default.dynamic([["
|
|
132
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "title"
|
|
133
133
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
134
|
-
className: _style.default.dynamic([["
|
|
134
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "ellipsis"
|
|
135
135
|
}, _d2I18n.default.t('Viewing interpretation: {{visualisationName}}', {
|
|
136
136
|
visualisationName: visualization.displayName,
|
|
137
137
|
nsSeparator: '^^'
|
|
138
138
|
}))), /*#__PURE__*/_react.default.createElement(_ui.ModalContent, {
|
|
139
139
|
className: modalContentCSS.className
|
|
140
140
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
-
className: _style.default.dynamic([["
|
|
141
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "container"
|
|
142
142
|
}, error && /*#__PURE__*/_react.default.createElement(_ui.NoticeBox, {
|
|
143
143
|
error: true,
|
|
144
144
|
title: _d2I18n.default.t('Could not load interpretation')
|
|
145
145
|
}, error.message || _d2I18n.default.t('The interpretation couldn’t be displayed. Try again or contact your system administrator.')), shouldRenderModalContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
146
|
-
className: _style.default.dynamic([["
|
|
146
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "row"
|
|
147
147
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
148
|
-
className: _style.default.dynamic([["
|
|
148
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "visualisation-wrap"
|
|
149
149
|
}, /*#__PURE__*/_react.default.createElement(VisualizationPlugin, {
|
|
150
150
|
filters: {
|
|
151
151
|
relativePeriodDate: interpretation.created
|
|
152
152
|
},
|
|
153
153
|
visualization: visualization,
|
|
154
154
|
onResponsesReceived: onResponsesReceived,
|
|
155
|
-
className: _style.default.dynamic([["
|
|
155
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]])
|
|
156
156
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
157
|
-
className: _style.default.dynamic([["
|
|
157
|
+
className: _style.default.dynamic([["3175860552", [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]]]) + " " + "thread-wrap"
|
|
158
158
|
}, /*#__PURE__*/_react.default.createElement(_InterpretationThread.InterpretationThread, {
|
|
159
159
|
currentUser: currentUser,
|
|
160
160
|
fetching: fetching,
|
|
@@ -167,9 +167,9 @@ const InterpretationModal = _ref2 => {
|
|
|
167
167
|
disabled: fetching,
|
|
168
168
|
onClick: handleClose
|
|
169
169
|
}, _d2I18n.default.t('Hide interpretation'))), modalCSS.styles, modalContentCSS.styles, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
170
|
-
id: "
|
|
170
|
+
id: "3175860552",
|
|
171
171
|
dynamic: [_ui.colors.grey900, _ui.spacers.dp24, _ui.spacers.dp4, _ui.spacers.dp4]
|
|
172
|
-
}, [".title.__jsx-style-dynamic-selector{color:".concat(_ui.colors.grey900, ";margin:0px;padding:").concat(_ui.spacers.dp24, " 0 ").concat(_ui.spacers.dp4, ";}"), ".ellipsis.__jsx-style-dynamic-selector{display:inline-block;font-size:20px;font-weight:500;line-height:24px;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis;}", ".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".row.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:16px;}", ".visualisation-wrap.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".thread-wrap.__jsx-style-dynamic-selector{padding-right:".concat(_ui.spacers.dp4, ";-webkit-flex-basis:300px;-ms-flex-preferred-size:300px;flex-basis:300px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;overflow-y:auto;}")])));
|
|
172
|
+
}, [".title.__jsx-style-dynamic-selector{color:".concat(_ui.colors.grey900, ";margin:0px;padding:").concat(_ui.spacers.dp24, " 0 ").concat(_ui.spacers.dp4, ";}"), ".ellipsis.__jsx-style-dynamic-selector{display:inline-block;font-size:20px;font-weight:500;line-height:24px;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis;}", ".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".row.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:16px;}", ".visualisation-wrap.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;min-width:0;}", ".thread-wrap.__jsx-style-dynamic-selector{padding-right:".concat(_ui.spacers.dp4, ";-webkit-flex-basis:300px;-ms-flex-preferred-size:300px;flex-basis:300px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;overflow-y:auto;}")])));
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
exports.InterpretationModal = InterpretationModal;
|
|
@@ -130,7 +130,7 @@ const OpenFileDialog = _ref2 => {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
if (filters.searchTerm) {
|
|
133
|
-
queryFilters.push("
|
|
133
|
+
queryFilters.push("identifiable:token:".concat(filters.searchTerm));
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
return queryFilters;
|
|
@@ -200,9 +200,9 @@
|
|
|
200
200
|
"Bi-weekly": "Tweewekelijks",
|
|
201
201
|
"Monthly": "Maandelijks",
|
|
202
202
|
"Bi-monthly": "Tweemaandelijks",
|
|
203
|
-
"Quarterly": "",
|
|
204
|
-
"Six-monthly": "",
|
|
205
|
-
"Six-monthly April": "",
|
|
203
|
+
"Quarterly": "Driemaandelijks",
|
|
204
|
+
"Six-monthly": "Zesmaandelijks",
|
|
205
|
+
"Six-monthly April": "Zesmaandelijks april",
|
|
206
206
|
"Yearly": "Jaarlijks",
|
|
207
207
|
"Financial year (Start November)": "Financieel jaar (Start november)",
|
|
208
208
|
"Financial year (Start October)": "Financieel jaar (Start oktober)",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getLegendByValueFromLegendSet = exports.getColorByValueFromLegendSet = exports.LEGEND_DISPLAY_STYLE_TEXT = exports.LEGEND_DISPLAY_STYLE_FILL = exports.LEGEND_DISPLAY_STRATEGY_FIXED = exports.LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM = void 0;
|
|
6
|
+
exports.getLegendSetByDisplayStrategy = exports.getLegendByValueFromLegendSet = exports.getColorByValueFromLegendSet = exports.LEGEND_DISPLAY_STYLE_TEXT = exports.LEGEND_DISPLAY_STYLE_FILL = exports.LEGEND_DISPLAY_STRATEGY_FIXED = exports.LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM = void 0;
|
|
7
7
|
const LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM = 'BY_DATA_ITEM';
|
|
8
8
|
exports.LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM = LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM;
|
|
9
9
|
const LEGEND_DISPLAY_STRATEGY_FIXED = 'FIXED';
|
|
@@ -27,4 +27,22 @@ const getColorByValueFromLegendSet = (legendSet, value) => {
|
|
|
27
27
|
return legend && legend.color;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
exports.getColorByValueFromLegendSet = getColorByValueFromLegendSet;
|
|
30
|
+
exports.getColorByValueFromLegendSet = getColorByValueFromLegendSet;
|
|
31
|
+
|
|
32
|
+
const getLegendSetByDisplayStrategy = _ref => {
|
|
33
|
+
let {
|
|
34
|
+
displayStrategy,
|
|
35
|
+
legendSets,
|
|
36
|
+
legendSetId
|
|
37
|
+
} = _ref;
|
|
38
|
+
|
|
39
|
+
if (displayStrategy === LEGEND_DISPLAY_STRATEGY_FIXED && legendSets.length) {
|
|
40
|
+
return legendSets[0];
|
|
41
|
+
} else if (displayStrategy === LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM) {
|
|
42
|
+
return legendSets.find(legendSet => legendSet.id === legendSetId);
|
|
43
|
+
} else {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.getLegendSetByDisplayStrategy = getLegendSetByDisplayStrategy;
|
|
@@ -64,7 +64,7 @@ const getTransformedExtraOptions = extraOptions => ({ ...extraOptions,
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
function _default(_ref) {
|
|
67
|
-
var _layout$seriesKey, _layout$seriesKey2, _layout$seriesKey2$la,
|
|
67
|
+
var _layout$legend, _layout$seriesKey, _layout$seriesKey2, _layout$seriesKey2$la, _config$xAxis;
|
|
68
68
|
|
|
69
69
|
let {
|
|
70
70
|
store,
|
|
@@ -110,16 +110,21 @@ function _default(_ref) {
|
|
|
110
110
|
// y-axis
|
|
111
111
|
yAxis: (0, _index7.default)(_layout, series, _extraOptions),
|
|
112
112
|
// series
|
|
113
|
-
series: (0, _index3.default)(
|
|
113
|
+
series: (0, _index3.default)({
|
|
114
|
+
series: series.slice(),
|
|
115
|
+
metaData: store.data[0].metaData.items,
|
|
116
|
+
layout: _layout,
|
|
117
|
+
isStacked: stacked,
|
|
118
|
+
extraOptions: _extraOptions,
|
|
119
|
+
legendSets,
|
|
120
|
+
displayStrategy: (_layout$legend = _layout.legend) === null || _layout$legend === void 0 ? void 0 : _layout$legend.strategy
|
|
121
|
+
}),
|
|
114
122
|
// legend
|
|
115
123
|
legend: (0, _legend.default)({
|
|
116
124
|
isHidden: (_layout$seriesKey = _layout.seriesKey) === null || _layout$seriesKey === void 0 ? void 0 : _layout$seriesKey.hidden,
|
|
117
125
|
fontStyle: (_layout$seriesKey2 = _layout.seriesKey) === null || _layout$seriesKey2 === void 0 ? void 0 : (_layout$seriesKey2$la = _layout$seriesKey2.label) === null || _layout$seriesKey2$la === void 0 ? void 0 : _layout$seriesKey2$la.fontStyle,
|
|
118
126
|
visType: _layout.type,
|
|
119
|
-
dashboard: _extraOptions.dashboard
|
|
120
|
-
legendSets,
|
|
121
|
-
metaData: store.data[0].metaData.items,
|
|
122
|
-
displayStrategy: (_layout$legend = _layout.legend) === null || _layout$legend === void 0 ? void 0 : _layout$legend.strategy
|
|
127
|
+
dashboard: _extraOptions.dashboard
|
|
123
128
|
}),
|
|
124
129
|
// pane
|
|
125
130
|
pane: (0, _index2.default)(_layout.type),
|
|
@@ -7,18 +7,10 @@ exports.default = _default;
|
|
|
7
7
|
|
|
8
8
|
var _fontStyle = require("../../../../modules/fontStyle.js");
|
|
9
9
|
|
|
10
|
-
var _legends = require("../../../../modules/legends.js");
|
|
11
|
-
|
|
12
10
|
var _visTypes = require("../../../../modules/visTypes.js");
|
|
13
11
|
|
|
14
|
-
var _colorSets = require("../../../util/colors/colorSets.js");
|
|
15
|
-
|
|
16
12
|
var _getTextAlignOption = require("./getTextAlignOption.js");
|
|
17
13
|
|
|
18
|
-
var _type = _interopRequireDefault(require("./type.js"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
const DASHBOARD_ITEM_STYLE = {
|
|
23
15
|
fontSize: '11px',
|
|
24
16
|
fontWeight: 500
|
|
@@ -48,100 +40,15 @@ function getLegend(fontStyle, dashboard, visType) {
|
|
|
48
40
|
});
|
|
49
41
|
}
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
let {
|
|
53
|
-
displayStrategy,
|
|
54
|
-
legendSets,
|
|
55
|
-
legendSetId
|
|
56
|
-
} = _ref;
|
|
57
|
-
|
|
58
|
-
if (displayStrategy === _legends.LEGEND_DISPLAY_STRATEGY_FIXED && legendSets.length) {
|
|
59
|
-
return legendSets[0];
|
|
60
|
-
} else if (displayStrategy === _legends.LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM) {
|
|
61
|
-
return legendSets.find(legendSet => legendSet.id === legendSetId);
|
|
62
|
-
} else {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const formatLabel = _ref2 => {
|
|
68
|
-
var _metaData$seriesId, _legendSet$legends;
|
|
69
|
-
|
|
70
|
-
let {
|
|
71
|
-
seriesId,
|
|
72
|
-
seriesColor,
|
|
73
|
-
seriesName,
|
|
74
|
-
seriesType,
|
|
75
|
-
metaData,
|
|
76
|
-
displayStrategy,
|
|
77
|
-
legendSets,
|
|
78
|
-
fontStyle,
|
|
79
|
-
visType
|
|
80
|
-
} = _ref2;
|
|
81
|
-
const legendSet = getLegendSetByDisplayStrategy({
|
|
82
|
-
displayStrategy,
|
|
83
|
-
legendSets,
|
|
84
|
-
legendSetId: (_metaData$seriesId = metaData[seriesId]) === null || _metaData$seriesId === void 0 ? void 0 : _metaData$seriesId.legendSet
|
|
85
|
-
});
|
|
86
|
-
const result = []; // Note: Highcharts strips out 'data-test' and similar attributes, hence 'class="data-test-..." was used instead
|
|
87
|
-
|
|
88
|
-
result.push('<div style="display: flex; align-items: center; margin-bottom: 4px;" class="data-test-series-key-item">');
|
|
89
|
-
|
|
90
|
-
if ((!seriesId || seriesId.startsWith('trendline')) && seriesType === (0, _type.default)(_visTypes.VIS_TYPE_LINE).type) {
|
|
91
|
-
// trendline
|
|
92
|
-
result.push("<span style=\"height: ".concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 6.5, "px; width: ").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "px; background-color: ").concat(seriesColor, "; display: inline-block;\"></span>"));
|
|
93
|
-
result.push("<span style=\"margin-left: 8px\" class=\"data-test-series-key-item-name\">".concat(seriesName, "</span>"));
|
|
94
|
-
} else if (legendSet !== null && legendSet !== void 0 && (_legendSet$legends = legendSet.legends) !== null && _legendSet$legends !== void 0 && _legendSet$legends.length && (0, _visTypes.isLegendSetType)(visType) && seriesType !== (0, _type.default)(_visTypes.VIS_TYPE_LINE).type) {
|
|
95
|
-
// item with legend set
|
|
96
|
-
legendSet.legends.sort((a, b) => a.startValue - b.startValue).forEach((legend, index) => result.push("<svg width=\"".concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "\" height=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "\" style=\"margin-right:-5px; z-index: ").concat(legendSet.legends.length - index, "\" class=\"data-test-series-key-item-bullet\">\n <circle cx=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" cy=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" r=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" fill=\"").concat(legend.color, "\"></circle>\n </svg>")));
|
|
97
|
-
result.push("<span style=\"margin-left: 8px\" class=\"data-test-series-key-item-name\">".concat(seriesName, "</span>"));
|
|
98
|
-
} else {
|
|
99
|
-
// regular item (not a trendline, no applied legend set)
|
|
100
|
-
if ((seriesColor === null || seriesColor === void 0 ? void 0 : seriesColor.patternIndex) !== undefined) {
|
|
101
|
-
const pattern = _colorSets.colorSets[_colorSets.COLOR_SET_PATTERNS].patterns[seriesColor.patternIndex];
|
|
102
|
-
result.push("<svg style=\"height: ".concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "px; width: ").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "px; display: inline-block; margin-right:5px\" class=\"data-test-series-key-item-bullet\">\n <defs>\n <pattern id=\"pattern").concat(seriesColor.patternIndex, "\" patternUnits=\"userSpaceOnUse\" width=\"").concat(pattern.width, "\" height=\"").concat(pattern.height, "\">\n <path stroke=\"").concat(pattern.color, "\" d=\"").concat(pattern.path, "\"/>\n </pattern>\n </defs>\n <circle cx=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" cy=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" r=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" fill=\"url(#pattern").concat(seriesColor.patternIndex, ")\"/>\n </svg>"));
|
|
103
|
-
} else {
|
|
104
|
-
result.push("<svg width=\"".concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "\" height=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], "\" style=\"margin-right:5px\" class=\"data-test-series-key-item-bullet\">\n <circle cx=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" cy=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" r=\"").concat(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" fill=\"").concat(seriesColor, "\"></circle>\n </svg>"));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
result.push("<span class=\"data-test-series-key-item-name\">".concat(seriesName, "</span>"));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
result.push('</div>');
|
|
111
|
-
return result.join('');
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
function _default(_ref3) {
|
|
43
|
+
function _default(_ref) {
|
|
115
44
|
let {
|
|
116
45
|
isHidden,
|
|
117
46
|
fontStyle,
|
|
118
47
|
visType,
|
|
119
|
-
dashboard
|
|
120
|
-
|
|
121
|
-
metaData,
|
|
122
|
-
displayStrategy
|
|
123
|
-
} = _ref3;
|
|
48
|
+
dashboard
|
|
49
|
+
} = _ref;
|
|
124
50
|
const mergedFontStyle = (0, _fontStyle.mergeFontStyleWithDefault)(fontStyle, _fontStyle.FONT_STYLE_LEGEND);
|
|
125
51
|
return isHidden || visType === _visTypes.VIS_TYPE_SCATTER ? {
|
|
126
52
|
enabled: false
|
|
127
|
-
} : Object.assign({}, getLegend(mergedFontStyle, dashboard, visType), getItemStyle(mergedFontStyle, dashboard)
|
|
128
|
-
useHTML: true,
|
|
129
|
-
symbolWidth: 0.001,
|
|
130
|
-
symbolHeight: 0.001,
|
|
131
|
-
labelFormatter: function () {
|
|
132
|
-
var _this$userOptions, _this$userOptions2;
|
|
133
|
-
|
|
134
|
-
return formatLabel({
|
|
135
|
-
seriesId: (_this$userOptions = this.userOptions) === null || _this$userOptions === void 0 ? void 0 : _this$userOptions.id,
|
|
136
|
-
seriesColor: this.color,
|
|
137
|
-
seriesName: this.name,
|
|
138
|
-
seriesType: (_this$userOptions2 = this.userOptions) === null || _this$userOptions2 === void 0 ? void 0 : _this$userOptions2.type,
|
|
139
|
-
metaData,
|
|
140
|
-
displayStrategy,
|
|
141
|
-
legendSets,
|
|
142
|
-
fontStyle: mergedFontStyle,
|
|
143
|
-
visType
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
});
|
|
53
|
+
} : Object.assign({}, getLegend(mergedFontStyle, dashboard, visType), getItemStyle(mergedFontStyle, dashboard));
|
|
147
54
|
}
|
|
@@ -11,6 +11,8 @@ var _axis = require("../../../../../modules/axis.js");
|
|
|
11
11
|
|
|
12
12
|
var _axisHasRelativeItems = require("../../../../../modules/layout/axisHasRelativeItems.js");
|
|
13
13
|
|
|
14
|
+
var _legends = require("../../../../../modules/legends.js");
|
|
15
|
+
|
|
14
16
|
var _visTypes = require("../../../../../modules/visTypes.js");
|
|
15
17
|
|
|
16
18
|
var _axisId = require("../../../../util/axisId.js");
|
|
@@ -95,12 +97,21 @@ function getIdColorMap(series, layout, extraOptions) {
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
function getDefault(
|
|
100
|
+
function getDefault(_ref) {
|
|
101
|
+
let {
|
|
102
|
+
series,
|
|
103
|
+
metaData,
|
|
104
|
+
layout,
|
|
105
|
+
isStacked,
|
|
106
|
+
extraOptions,
|
|
107
|
+
legendSets,
|
|
108
|
+
displayStrategy
|
|
109
|
+
} = _ref;
|
|
99
110
|
const fullIdAxisMap = (0, _customAxes.getFullIdAxisMap)(layout.series, series);
|
|
100
111
|
const idColorMap = getIdColorMap(series, layout, extraOptions);
|
|
101
112
|
const indexColorPatternMap = getIndexColorPatternMap(series, layout, extraOptions);
|
|
102
113
|
series.forEach((seriesObj, index) => {
|
|
103
|
-
var _seriesObj$custom, _layout$series2;
|
|
114
|
+
var _seriesObj$custom, _layout$series2, _metaData$seriesObj$i;
|
|
104
115
|
|
|
105
116
|
// show values
|
|
106
117
|
if (!seriesObj.dataLabels && (layout.showValues || layout.showData)) {
|
|
@@ -160,6 +171,15 @@ function getDefault(series, metaData, layout, isStacked, extraOptions) {
|
|
|
160
171
|
if (extraOptions.yearlySeries) {
|
|
161
172
|
seriesObj.name = extraOptions.yearlySeries[index];
|
|
162
173
|
}
|
|
174
|
+
|
|
175
|
+
seriesObj.legendSet = (0, _legends.getLegendSetByDisplayStrategy)({
|
|
176
|
+
displayStrategy,
|
|
177
|
+
legendSets,
|
|
178
|
+
legendSetId: (_metaData$seriesObj$i = metaData[seriesObj.id]) === null || _metaData$seriesObj$i === void 0 ? void 0 : _metaData$seriesObj$i.legendSet
|
|
179
|
+
});
|
|
180
|
+
seriesObj.marker = {
|
|
181
|
+
enabled: false
|
|
182
|
+
};
|
|
163
183
|
}); // DHIS2-701: use cumulative values
|
|
164
184
|
|
|
165
185
|
if (layout.cumulativeValues === true) {
|
|
@@ -169,7 +189,17 @@ function getDefault(series, metaData, layout, isStacked, extraOptions) {
|
|
|
169
189
|
return series;
|
|
170
190
|
}
|
|
171
191
|
|
|
172
|
-
function _default(
|
|
192
|
+
function _default(_ref2) {
|
|
193
|
+
let {
|
|
194
|
+
series,
|
|
195
|
+
metaData,
|
|
196
|
+
layout,
|
|
197
|
+
isStacked,
|
|
198
|
+
extraOptions,
|
|
199
|
+
legendSets,
|
|
200
|
+
displayStrategy
|
|
201
|
+
} = _ref2;
|
|
202
|
+
|
|
173
203
|
switch (layout.type) {
|
|
174
204
|
case _visTypes.VIS_TYPE_PIE:
|
|
175
205
|
series = (0, _pie.default)(series, Object.values(getIdColorMap(series, layout, extraOptions)));
|
|
@@ -184,7 +214,15 @@ function _default(series, metaData, layout, isStacked, extraOptions) {
|
|
|
184
214
|
break;
|
|
185
215
|
|
|
186
216
|
default:
|
|
187
|
-
series = getDefault(
|
|
217
|
+
series = getDefault({
|
|
218
|
+
series,
|
|
219
|
+
metaData,
|
|
220
|
+
layout,
|
|
221
|
+
isStacked,
|
|
222
|
+
extraOptions,
|
|
223
|
+
legendSets,
|
|
224
|
+
displayStrategy
|
|
225
|
+
});
|
|
188
226
|
}
|
|
189
227
|
|
|
190
228
|
series.forEach(seriesObj => {
|
|
@@ -29,6 +29,38 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
29
29
|
(0, _patternFill.default)(_highcharts.default);
|
|
30
30
|
(0, _boost.default)(_highcharts.default);
|
|
31
31
|
|
|
32
|
+
function drawLegendSymbolWrap() {
|
|
33
|
+
const pick = _highcharts.default.pick;
|
|
34
|
+
|
|
35
|
+
_highcharts.default.wrap(_highcharts.default.seriesTypes.column.prototype, 'drawLegendSymbol', function (proceed, legend, item) {
|
|
36
|
+
var _this$options$legendS, _this$options$legendS2;
|
|
37
|
+
|
|
38
|
+
if ((_this$options$legendS = this.options.legendSet) !== null && _this$options$legendS !== void 0 && (_this$options$legendS2 = _this$options$legendS.legends) !== null && _this$options$legendS2 !== void 0 && _this$options$legendS2.length) {
|
|
39
|
+
const ys = legend.baseline - legend.symbolHeight + 1,
|
|
40
|
+
// y start
|
|
41
|
+
x = legend.symbolWidth / 2 > 8 ? legend.symbolWidth / 2 : 8,
|
|
42
|
+
// x start
|
|
43
|
+
ye = legend.symbolHeight + ys; // y end
|
|
44
|
+
|
|
45
|
+
const legends = this.options.legendSet.legends.sort((a, b) => a.startValue - b.startValue);
|
|
46
|
+
this.chart.renderer.path(['M', x, ys, 'A', 1, 1, 0, 0, 0, x, ye, 'V', ys]).attr({
|
|
47
|
+
fill: legends.at(legends.length >= 5 ? 1 : 0).color
|
|
48
|
+
}).add(this.legendGroup);
|
|
49
|
+
this.chart.renderer.path(['M', x, ye, 'A', 1, 1, 0, 0, 0, x, ys, 'V', ye]).attr({
|
|
50
|
+
fill: legends.at(legends.length >= 5 ? -2 : -1).color
|
|
51
|
+
}).add(this.legendGroup);
|
|
52
|
+
} else {
|
|
53
|
+
var options = legend.options,
|
|
54
|
+
symbolHeight = legend.symbolHeight,
|
|
55
|
+
square = options.squareSymbol,
|
|
56
|
+
symbolWidth = square ? symbolHeight : legend.symbolWidth;
|
|
57
|
+
item.legendSymbol = this.chart.renderer.rect(square ? (legend.symbolWidth - symbolHeight) / 2 : 0, legend.baseline - symbolHeight + 1, symbolWidth, symbolHeight, pick(legend.options.symbolRadius, symbolHeight / 2)).addClass('highcharts-point').attr({
|
|
58
|
+
zIndex: 3
|
|
59
|
+
}).add(item.legendGroup);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
32
64
|
function _default(config, el) {
|
|
33
65
|
if (config) {
|
|
34
66
|
config.chart.renderTo = el || config.chart.renderTo; // silence warning about accessibility
|
|
@@ -43,6 +75,7 @@ function _default(config, el) {
|
|
|
43
75
|
});
|
|
44
76
|
}
|
|
45
77
|
|
|
78
|
+
drawLegendSymbolWrap();
|
|
46
79
|
return new _highcharts.default.Chart(config);
|
|
47
80
|
}
|
|
48
81
|
}
|
|
@@ -107,32 +107,32 @@ const InterpretationModal = _ref2 => {
|
|
|
107
107
|
hidden: shouldCssHideModal
|
|
108
108
|
})
|
|
109
109
|
}, /*#__PURE__*/React.createElement("h1", {
|
|
110
|
-
className: _JSXStyle.dynamic([["
|
|
110
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "title"
|
|
111
111
|
}, /*#__PURE__*/React.createElement("span", {
|
|
112
|
-
className: _JSXStyle.dynamic([["
|
|
112
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "ellipsis"
|
|
113
113
|
}, i18n.t('Viewing interpretation: {{visualisationName}}', {
|
|
114
114
|
visualisationName: visualization.displayName,
|
|
115
115
|
nsSeparator: '^^'
|
|
116
116
|
}))), /*#__PURE__*/React.createElement(ModalContent, {
|
|
117
117
|
className: modalContentCSS.className
|
|
118
118
|
}, /*#__PURE__*/React.createElement("div", {
|
|
119
|
-
className: _JSXStyle.dynamic([["
|
|
119
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "container"
|
|
120
120
|
}, error && /*#__PURE__*/React.createElement(NoticeBox, {
|
|
121
121
|
error: true,
|
|
122
122
|
title: i18n.t('Could not load interpretation')
|
|
123
123
|
}, error.message || i18n.t('The interpretation couldn’t be displayed. Try again or contact your system administrator.')), shouldRenderModalContent && /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
className: _JSXStyle.dynamic([["
|
|
124
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "row"
|
|
125
125
|
}, /*#__PURE__*/React.createElement("div", {
|
|
126
|
-
className: _JSXStyle.dynamic([["
|
|
126
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "visualisation-wrap"
|
|
127
127
|
}, /*#__PURE__*/React.createElement(VisualizationPlugin, {
|
|
128
128
|
filters: {
|
|
129
129
|
relativePeriodDate: interpretation.created
|
|
130
130
|
},
|
|
131
131
|
visualization: visualization,
|
|
132
132
|
onResponsesReceived: onResponsesReceived,
|
|
133
|
-
className: _JSXStyle.dynamic([["
|
|
133
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]])
|
|
134
134
|
})), /*#__PURE__*/React.createElement("div", {
|
|
135
|
-
className: _JSXStyle.dynamic([["
|
|
135
|
+
className: _JSXStyle.dynamic([["3175860552", [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]]]) + " " + "thread-wrap"
|
|
136
136
|
}, /*#__PURE__*/React.createElement(InterpretationThread, {
|
|
137
137
|
currentUser: currentUser,
|
|
138
138
|
fetching: fetching,
|
|
@@ -145,9 +145,9 @@ const InterpretationModal = _ref2 => {
|
|
|
145
145
|
disabled: fetching,
|
|
146
146
|
onClick: handleClose
|
|
147
147
|
}, i18n.t('Hide interpretation'))), modalCSS.styles, modalContentCSS.styles, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
148
|
-
id: "
|
|
148
|
+
id: "3175860552",
|
|
149
149
|
dynamic: [colors.grey900, spacers.dp24, spacers.dp4, spacers.dp4]
|
|
150
|
-
}, [".title.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";margin:0px;padding:").concat(spacers.dp24, " 0 ").concat(spacers.dp4, ";}"), ".ellipsis.__jsx-style-dynamic-selector{display:inline-block;font-size:20px;font-weight:500;line-height:24px;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis;}", ".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".row.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:16px;}", ".visualisation-wrap.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".thread-wrap.__jsx-style-dynamic-selector{padding-right:".concat(spacers.dp4, ";-webkit-flex-basis:300px;-ms-flex-preferred-size:300px;flex-basis:300px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;overflow-y:auto;}")])));
|
|
150
|
+
}, [".title.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";margin:0px;padding:").concat(spacers.dp24, " 0 ").concat(spacers.dp4, ";}"), ".ellipsis.__jsx-style-dynamic-selector{display:inline-block;font-size:20px;font-weight:500;line-height:24px;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis;}", ".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".row.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;gap:16px;}", ".visualisation-wrap.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;min-width:0;}", ".thread-wrap.__jsx-style-dynamic-selector{padding-right:".concat(spacers.dp4, ";-webkit-flex-basis:300px;-ms-flex-preferred-size:300px;flex-basis:300px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;overflow-y:auto;}")])));
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
InterpretationModal.propTypes = {
|
|
@@ -103,7 +103,7 @@ export const OpenFileDialog = _ref2 => {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
if (filters.searchTerm) {
|
|
106
|
-
queryFilters.push("
|
|
106
|
+
queryFilters.push("identifiable:token:".concat(filters.searchTerm));
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
return queryFilters;
|
|
@@ -200,9 +200,9 @@
|
|
|
200
200
|
"Bi-weekly": "Tweewekelijks",
|
|
201
201
|
"Monthly": "Maandelijks",
|
|
202
202
|
"Bi-monthly": "Tweemaandelijks",
|
|
203
|
-
"Quarterly": "",
|
|
204
|
-
"Six-monthly": "",
|
|
205
|
-
"Six-monthly April": "",
|
|
203
|
+
"Quarterly": "Driemaandelijks",
|
|
204
|
+
"Six-monthly": "Zesmaandelijks",
|
|
205
|
+
"Six-monthly April": "Zesmaandelijks april",
|
|
206
206
|
"Yearly": "Jaarlijks",
|
|
207
207
|
"Financial year (Start November)": "Financieel jaar (Start november)",
|
|
208
208
|
"Financial year (Start October)": "Financieel jaar (Start oktober)",
|
|
@@ -11,4 +11,19 @@ export const getLegendByValueFromLegendSet = (legendSet, value) => {
|
|
|
11
11
|
export const getColorByValueFromLegendSet = (legendSet, value) => {
|
|
12
12
|
const legend = getLegendByValueFromLegendSet(legendSet, value);
|
|
13
13
|
return legend && legend.color;
|
|
14
|
+
};
|
|
15
|
+
export const getLegendSetByDisplayStrategy = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
displayStrategy,
|
|
18
|
+
legendSets,
|
|
19
|
+
legendSetId
|
|
20
|
+
} = _ref;
|
|
21
|
+
|
|
22
|
+
if (displayStrategy === LEGEND_DISPLAY_STRATEGY_FIXED && legendSets.length) {
|
|
23
|
+
return legendSets[0];
|
|
24
|
+
} else if (displayStrategy === LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM) {
|
|
25
|
+
return legendSets.find(legendSet => legendSet.id === legendSetId);
|
|
26
|
+
} else {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
14
29
|
};
|
|
@@ -31,7 +31,7 @@ const getTransformedExtraOptions = extraOptions => ({ ...extraOptions,
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export default function (_ref) {
|
|
34
|
-
var _layout$seriesKey, _layout$seriesKey2, _layout$seriesKey2$la,
|
|
34
|
+
var _layout$legend, _layout$seriesKey, _layout$seriesKey2, _layout$seriesKey2$la, _config$xAxis;
|
|
35
35
|
|
|
36
36
|
let {
|
|
37
37
|
store,
|
|
@@ -77,16 +77,21 @@ export default function (_ref) {
|
|
|
77
77
|
// y-axis
|
|
78
78
|
yAxis: getYAxis(_layout, series, _extraOptions),
|
|
79
79
|
// series
|
|
80
|
-
series: getSeries(
|
|
80
|
+
series: getSeries({
|
|
81
|
+
series: series.slice(),
|
|
82
|
+
metaData: store.data[0].metaData.items,
|
|
83
|
+
layout: _layout,
|
|
84
|
+
isStacked: stacked,
|
|
85
|
+
extraOptions: _extraOptions,
|
|
86
|
+
legendSets,
|
|
87
|
+
displayStrategy: (_layout$legend = _layout.legend) === null || _layout$legend === void 0 ? void 0 : _layout$legend.strategy
|
|
88
|
+
}),
|
|
81
89
|
// legend
|
|
82
90
|
legend: getLegend({
|
|
83
91
|
isHidden: (_layout$seriesKey = _layout.seriesKey) === null || _layout$seriesKey === void 0 ? void 0 : _layout$seriesKey.hidden,
|
|
84
92
|
fontStyle: (_layout$seriesKey2 = _layout.seriesKey) === null || _layout$seriesKey2 === void 0 ? void 0 : (_layout$seriesKey2$la = _layout$seriesKey2.label) === null || _layout$seriesKey2$la === void 0 ? void 0 : _layout$seriesKey2$la.fontStyle,
|
|
85
93
|
visType: _layout.type,
|
|
86
|
-
dashboard: _extraOptions.dashboard
|
|
87
|
-
legendSets,
|
|
88
|
-
metaData: store.data[0].metaData.items,
|
|
89
|
-
displayStrategy: (_layout$legend = _layout.legend) === null || _layout$legend === void 0 ? void 0 : _layout$legend.strategy
|
|
94
|
+
dashboard: _extraOptions.dashboard
|
|
90
95
|
}),
|
|
91
96
|
// pane
|
|
92
97
|
pane: getPane(_layout.type),
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { FONT_STYLE_OPTION_FONT_SIZE, FONT_STYLE_OPTION_TEXT_COLOR, FONT_STYLE_OPTION_BOLD, FONT_STYLE_OPTION_ITALIC, FONT_STYLE_OPTION_TEXT_ALIGN, FONT_STYLE_LEGEND, mergeFontStyleWithDefault } from '../../../../modules/fontStyle.js';
|
|
2
|
-
import {
|
|
3
|
-
import { isLegendSetType, isVerticalType, VIS_TYPE_LINE, VIS_TYPE_SCATTER } from '../../../../modules/visTypes.js';
|
|
4
|
-
import { colorSets, COLOR_SET_PATTERNS } from '../../../util/colors/colorSets.js';
|
|
2
|
+
import { isVerticalType, VIS_TYPE_SCATTER } from '../../../../modules/visTypes.js';
|
|
5
3
|
import { getTextAlignOption } from './getTextAlignOption.js';
|
|
6
|
-
import getType from './type.js';
|
|
7
4
|
const DASHBOARD_ITEM_STYLE = {
|
|
8
5
|
fontSize: '11px',
|
|
9
6
|
fontWeight: 500
|
|
@@ -33,100 +30,15 @@ function getLegend(fontStyle, dashboard, visType) {
|
|
|
33
30
|
});
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
let {
|
|
38
|
-
displayStrategy,
|
|
39
|
-
legendSets,
|
|
40
|
-
legendSetId
|
|
41
|
-
} = _ref;
|
|
42
|
-
|
|
43
|
-
if (displayStrategy === LEGEND_DISPLAY_STRATEGY_FIXED && legendSets.length) {
|
|
44
|
-
return legendSets[0];
|
|
45
|
-
} else if (displayStrategy === LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM) {
|
|
46
|
-
return legendSets.find(legendSet => legendSet.id === legendSetId);
|
|
47
|
-
} else {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const formatLabel = _ref2 => {
|
|
53
|
-
var _metaData$seriesId, _legendSet$legends;
|
|
54
|
-
|
|
55
|
-
let {
|
|
56
|
-
seriesId,
|
|
57
|
-
seriesColor,
|
|
58
|
-
seriesName,
|
|
59
|
-
seriesType,
|
|
60
|
-
metaData,
|
|
61
|
-
displayStrategy,
|
|
62
|
-
legendSets,
|
|
63
|
-
fontStyle,
|
|
64
|
-
visType
|
|
65
|
-
} = _ref2;
|
|
66
|
-
const legendSet = getLegendSetByDisplayStrategy({
|
|
67
|
-
displayStrategy,
|
|
68
|
-
legendSets,
|
|
69
|
-
legendSetId: (_metaData$seriesId = metaData[seriesId]) === null || _metaData$seriesId === void 0 ? void 0 : _metaData$seriesId.legendSet
|
|
70
|
-
});
|
|
71
|
-
const result = []; // Note: Highcharts strips out 'data-test' and similar attributes, hence 'class="data-test-..." was used instead
|
|
72
|
-
|
|
73
|
-
result.push('<div style="display: flex; align-items: center; margin-bottom: 4px;" class="data-test-series-key-item">');
|
|
74
|
-
|
|
75
|
-
if ((!seriesId || seriesId.startsWith('trendline')) && seriesType === getType(VIS_TYPE_LINE).type) {
|
|
76
|
-
// trendline
|
|
77
|
-
result.push("<span style=\"height: ".concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 6.5, "px; width: ").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "px; background-color: ").concat(seriesColor, "; display: inline-block;\"></span>"));
|
|
78
|
-
result.push("<span style=\"margin-left: 8px\" class=\"data-test-series-key-item-name\">".concat(seriesName, "</span>"));
|
|
79
|
-
} else if (legendSet !== null && legendSet !== void 0 && (_legendSet$legends = legendSet.legends) !== null && _legendSet$legends !== void 0 && _legendSet$legends.length && isLegendSetType(visType) && seriesType !== getType(VIS_TYPE_LINE).type) {
|
|
80
|
-
// item with legend set
|
|
81
|
-
legendSet.legends.sort((a, b) => a.startValue - b.startValue).forEach((legend, index) => result.push("<svg width=\"".concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "\" height=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "\" style=\"margin-right:-5px; z-index: ").concat(legendSet.legends.length - index, "\" class=\"data-test-series-key-item-bullet\">\n <circle cx=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" cy=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" r=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" fill=\"").concat(legend.color, "\"></circle>\n </svg>")));
|
|
82
|
-
result.push("<span style=\"margin-left: 8px\" class=\"data-test-series-key-item-name\">".concat(seriesName, "</span>"));
|
|
83
|
-
} else {
|
|
84
|
-
// regular item (not a trendline, no applied legend set)
|
|
85
|
-
if ((seriesColor === null || seriesColor === void 0 ? void 0 : seriesColor.patternIndex) !== undefined) {
|
|
86
|
-
const pattern = colorSets[COLOR_SET_PATTERNS].patterns[seriesColor.patternIndex];
|
|
87
|
-
result.push("<svg style=\"height: ".concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "px; width: ").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "px; display: inline-block; margin-right:5px\" class=\"data-test-series-key-item-bullet\">\n <defs>\n <pattern id=\"pattern").concat(seriesColor.patternIndex, "\" patternUnits=\"userSpaceOnUse\" width=\"").concat(pattern.width, "\" height=\"").concat(pattern.height, "\">\n <path stroke=\"").concat(pattern.color, "\" d=\"").concat(pattern.path, "\"/>\n </pattern>\n </defs>\n <circle cx=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" cy=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" r=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" fill=\"url(#pattern").concat(seriesColor.patternIndex, ")\"/>\n </svg>"));
|
|
88
|
-
} else {
|
|
89
|
-
result.push("<svg width=\"".concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "\" height=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE], "\" style=\"margin-right:5px\" class=\"data-test-series-key-item-bullet\">\n <circle cx=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" cy=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" r=\"").concat(fontStyle[FONT_STYLE_OPTION_FONT_SIZE] / 2, "\" fill=\"").concat(seriesColor, "\"></circle>\n </svg>"));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
result.push("<span class=\"data-test-series-key-item-name\">".concat(seriesName, "</span>"));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
result.push('</div>');
|
|
96
|
-
return result.join('');
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export default function (_ref3) {
|
|
33
|
+
export default function (_ref) {
|
|
100
34
|
let {
|
|
101
35
|
isHidden,
|
|
102
36
|
fontStyle,
|
|
103
37
|
visType,
|
|
104
|
-
dashboard
|
|
105
|
-
|
|
106
|
-
metaData,
|
|
107
|
-
displayStrategy
|
|
108
|
-
} = _ref3;
|
|
38
|
+
dashboard
|
|
39
|
+
} = _ref;
|
|
109
40
|
const mergedFontStyle = mergeFontStyleWithDefault(fontStyle, FONT_STYLE_LEGEND);
|
|
110
41
|
return isHidden || visType === VIS_TYPE_SCATTER ? {
|
|
111
42
|
enabled: false
|
|
112
|
-
} : Object.assign({}, getLegend(mergedFontStyle, dashboard, visType), getItemStyle(mergedFontStyle, dashboard)
|
|
113
|
-
useHTML: true,
|
|
114
|
-
symbolWidth: 0.001,
|
|
115
|
-
symbolHeight: 0.001,
|
|
116
|
-
labelFormatter: function () {
|
|
117
|
-
var _this$userOptions, _this$userOptions2;
|
|
118
|
-
|
|
119
|
-
return formatLabel({
|
|
120
|
-
seriesId: (_this$userOptions = this.userOptions) === null || _this$userOptions === void 0 ? void 0 : _this$userOptions.id,
|
|
121
|
-
seriesColor: this.color,
|
|
122
|
-
seriesName: this.name,
|
|
123
|
-
seriesType: (_this$userOptions2 = this.userOptions) === null || _this$userOptions2 === void 0 ? void 0 : _this$userOptions2.type,
|
|
124
|
-
metaData,
|
|
125
|
-
displayStrategy,
|
|
126
|
-
legendSets,
|
|
127
|
-
fontStyle: mergedFontStyle,
|
|
128
|
-
visType
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
});
|
|
43
|
+
} : Object.assign({}, getLegend(mergedFontStyle, dashboard, visType), getItemStyle(mergedFontStyle, dashboard));
|
|
132
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { colors } from '@dhis2/ui';
|
|
2
2
|
import { hasCustomAxes } from '../../../../../modules/axis.js';
|
|
3
3
|
import { axisHasRelativeItems } from '../../../../../modules/layout/axisHasRelativeItems.js';
|
|
4
|
+
import { getLegendSetByDisplayStrategy } from '../../../../../modules/legends.js';
|
|
4
5
|
import { VIS_TYPE_PIE, VIS_TYPE_GAUGE, isDualAxisType, isYearOverYear, VIS_TYPE_LINE, VIS_TYPE_SCATTER } from '../../../../../modules/visTypes.js';
|
|
5
6
|
import { getAxisStringFromId } from '../../../../util/axisId.js';
|
|
6
7
|
import { colorSets, COLOR_SET_PATTERNS } from '../../../../util/colors/colorSets.js';
|
|
@@ -73,12 +74,21 @@ function getIdColorMap(series, layout, extraOptions) {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
function getDefault(
|
|
77
|
+
function getDefault(_ref) {
|
|
78
|
+
let {
|
|
79
|
+
series,
|
|
80
|
+
metaData,
|
|
81
|
+
layout,
|
|
82
|
+
isStacked,
|
|
83
|
+
extraOptions,
|
|
84
|
+
legendSets,
|
|
85
|
+
displayStrategy
|
|
86
|
+
} = _ref;
|
|
77
87
|
const fullIdAxisMap = getFullIdAxisMap(layout.series, series);
|
|
78
88
|
const idColorMap = getIdColorMap(series, layout, extraOptions);
|
|
79
89
|
const indexColorPatternMap = getIndexColorPatternMap(series, layout, extraOptions);
|
|
80
90
|
series.forEach((seriesObj, index) => {
|
|
81
|
-
var _seriesObj$custom, _layout$series2;
|
|
91
|
+
var _seriesObj$custom, _layout$series2, _metaData$seriesObj$i;
|
|
82
92
|
|
|
83
93
|
// show values
|
|
84
94
|
if (!seriesObj.dataLabels && (layout.showValues || layout.showData)) {
|
|
@@ -138,6 +148,15 @@ function getDefault(series, metaData, layout, isStacked, extraOptions) {
|
|
|
138
148
|
if (extraOptions.yearlySeries) {
|
|
139
149
|
seriesObj.name = extraOptions.yearlySeries[index];
|
|
140
150
|
}
|
|
151
|
+
|
|
152
|
+
seriesObj.legendSet = getLegendSetByDisplayStrategy({
|
|
153
|
+
displayStrategy,
|
|
154
|
+
legendSets,
|
|
155
|
+
legendSetId: (_metaData$seriesObj$i = metaData[seriesObj.id]) === null || _metaData$seriesObj$i === void 0 ? void 0 : _metaData$seriesObj$i.legendSet
|
|
156
|
+
});
|
|
157
|
+
seriesObj.marker = {
|
|
158
|
+
enabled: false
|
|
159
|
+
};
|
|
141
160
|
}); // DHIS2-701: use cumulative values
|
|
142
161
|
|
|
143
162
|
if (layout.cumulativeValues === true) {
|
|
@@ -147,7 +166,17 @@ function getDefault(series, metaData, layout, isStacked, extraOptions) {
|
|
|
147
166
|
return series;
|
|
148
167
|
}
|
|
149
168
|
|
|
150
|
-
export default function (
|
|
169
|
+
export default function (_ref2) {
|
|
170
|
+
let {
|
|
171
|
+
series,
|
|
172
|
+
metaData,
|
|
173
|
+
layout,
|
|
174
|
+
isStacked,
|
|
175
|
+
extraOptions,
|
|
176
|
+
legendSets,
|
|
177
|
+
displayStrategy
|
|
178
|
+
} = _ref2;
|
|
179
|
+
|
|
151
180
|
switch (layout.type) {
|
|
152
181
|
case VIS_TYPE_PIE:
|
|
153
182
|
series = getPie(series, Object.values(getIdColorMap(series, layout, extraOptions)));
|
|
@@ -162,7 +191,15 @@ export default function (series, metaData, layout, isStacked, extraOptions) {
|
|
|
162
191
|
break;
|
|
163
192
|
|
|
164
193
|
default:
|
|
165
|
-
series = getDefault(
|
|
194
|
+
series = getDefault({
|
|
195
|
+
series,
|
|
196
|
+
metaData,
|
|
197
|
+
layout,
|
|
198
|
+
isStacked,
|
|
199
|
+
extraOptions,
|
|
200
|
+
legendSets,
|
|
201
|
+
displayStrategy
|
|
202
|
+
});
|
|
166
203
|
}
|
|
167
204
|
|
|
168
205
|
series.forEach(seriesObj => {
|
|
@@ -12,6 +12,38 @@ HNDTD(H);
|
|
|
12
12
|
HE(H);
|
|
13
13
|
HPF(H);
|
|
14
14
|
HB(H);
|
|
15
|
+
|
|
16
|
+
function drawLegendSymbolWrap() {
|
|
17
|
+
const pick = H.pick;
|
|
18
|
+
H.wrap(H.seriesTypes.column.prototype, 'drawLegendSymbol', function (proceed, legend, item) {
|
|
19
|
+
var _this$options$legendS, _this$options$legendS2;
|
|
20
|
+
|
|
21
|
+
if ((_this$options$legendS = this.options.legendSet) !== null && _this$options$legendS !== void 0 && (_this$options$legendS2 = _this$options$legendS.legends) !== null && _this$options$legendS2 !== void 0 && _this$options$legendS2.length) {
|
|
22
|
+
const ys = legend.baseline - legend.symbolHeight + 1,
|
|
23
|
+
// y start
|
|
24
|
+
x = legend.symbolWidth / 2 > 8 ? legend.symbolWidth / 2 : 8,
|
|
25
|
+
// x start
|
|
26
|
+
ye = legend.symbolHeight + ys; // y end
|
|
27
|
+
|
|
28
|
+
const legends = this.options.legendSet.legends.sort((a, b) => a.startValue - b.startValue);
|
|
29
|
+
this.chart.renderer.path(['M', x, ys, 'A', 1, 1, 0, 0, 0, x, ye, 'V', ys]).attr({
|
|
30
|
+
fill: legends.at(legends.length >= 5 ? 1 : 0).color
|
|
31
|
+
}).add(this.legendGroup);
|
|
32
|
+
this.chart.renderer.path(['M', x, ye, 'A', 1, 1, 0, 0, 0, x, ys, 'V', ye]).attr({
|
|
33
|
+
fill: legends.at(legends.length >= 5 ? -2 : -1).color
|
|
34
|
+
}).add(this.legendGroup);
|
|
35
|
+
} else {
|
|
36
|
+
var options = legend.options,
|
|
37
|
+
symbolHeight = legend.symbolHeight,
|
|
38
|
+
square = options.squareSymbol,
|
|
39
|
+
symbolWidth = square ? symbolHeight : legend.symbolWidth;
|
|
40
|
+
item.legendSymbol = this.chart.renderer.rect(square ? (legend.symbolWidth - symbolHeight) / 2 : 0, legend.baseline - symbolHeight + 1, symbolWidth, symbolHeight, pick(legend.options.symbolRadius, symbolHeight / 2)).addClass('highcharts-point').attr({
|
|
41
|
+
zIndex: 3
|
|
42
|
+
}).add(item.legendGroup);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
15
47
|
export default function (config, el) {
|
|
16
48
|
if (config) {
|
|
17
49
|
config.chart.renderTo = el || config.chart.renderTo; // silence warning about accessibility
|
|
@@ -26,6 +58,7 @@ export default function (config, el) {
|
|
|
26
58
|
});
|
|
27
59
|
}
|
|
28
60
|
|
|
61
|
+
drawLegendSymbolWrap();
|
|
29
62
|
return new H.Chart(config);
|
|
30
63
|
}
|
|
31
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.13.2",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"validate-push": "yarn test"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@dhis2/app-runtime": "^3.4.
|
|
35
|
-
"@dhis2/cli-app-scripts": "^9.0.
|
|
34
|
+
"@dhis2/app-runtime": "^3.4.4",
|
|
35
|
+
"@dhis2/cli-app-scripts": "^9.0.1",
|
|
36
36
|
"@dhis2/cli-style": "^10.4.1",
|
|
37
37
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
38
|
-
"@dhis2/ui": "^8.
|
|
38
|
+
"@dhis2/ui": "^8.4.2",
|
|
39
39
|
"@sambego/storybook-state": "^2.0.1",
|
|
40
|
-
"@storybook/addons": "^6.
|
|
40
|
+
"@storybook/addons": "^6.5.9",
|
|
41
41
|
"@storybook/preset-create-react-app": "^3.1.7",
|
|
42
42
|
"@storybook/react": "^6.1.14",
|
|
43
43
|
"enzyme": "^3.9.0",
|