@dhis2/analytics 26.8.6 → 26.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/__demo__/SingleValue.stories.js +706 -0
- package/build/cjs/components/PivotTable/PivotTableValueCell.js +6 -2
- package/build/cjs/components/PivotTable/styles/PivotTable.style.js +2 -2
- package/build/cjs/locales/en/translations.json +2 -0
- package/build/cjs/locales/lo/translations.json +16 -12
- package/build/cjs/modules/pivotTable/PivotTableEngine.js +59 -24
- package/build/cjs/modules/pivotTable/pivotTableConstants.js +6 -2
- package/build/cjs/modules/valueTypes.js +4 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart/default.js +26 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart/index.js +18 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart/singleValue.js +19 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +36 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +12 -0
- package/build/cjs/visualizations/config/adapters/{dhis_dhis/value/index.js → dhis_highcharts/customSVGOptions/singleValue/getSingleValueFormattedValue.js} +8 -6
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueLegendColor.js +11 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueSubtext.js +11 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueTextColor.js +20 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueTitleColor.js +26 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/index.js +31 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/index.js +24 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/index.js +18 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/addIconElement.js +34 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/checkIfFitsWithinContainer.js +19 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/computeLayoutRect.js +39 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/computeSpacingTop.js +21 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/constants.js +11 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/getAvailableSpace.js +14 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +48 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/positionElements.js +46 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js +109 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/exporting.js +30 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +33 -23
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/lang.js +17 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/plotOptions.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/index.js +5 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/__tests__/singleValue.spec.js +62 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +56 -22
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/singleValue.js +27 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/__tests__/singleValue.spec.js +44 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/index.js +50 -22
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/singleValue.js +31 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/type.js +2 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/index.js +1 -0
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/index.js +4 -5
- package/build/cjs/visualizations/config/adapters/index.js +2 -4
- package/build/cjs/visualizations/config/generators/highcharts/index.js +8 -0
- package/build/cjs/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/index.js +13 -0
- package/build/cjs/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/nonASCIIFont.js +17 -0
- package/build/cjs/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/textShadow.js +289 -0
- package/build/cjs/visualizations/config/generators/index.js +2 -4
- package/build/cjs/visualizations/store/adapters/dhis_highcharts/index.js +3 -0
- package/build/cjs/visualizations/store/adapters/dhis_highcharts/singleValue.js +10 -0
- package/build/cjs/visualizations/store/adapters/index.js +2 -4
- package/build/cjs/visualizations/util/shouldUseContrastColor.js +24 -0
- package/build/es/__demo__/SingleValue.stories.js +702 -0
- package/build/es/components/PivotTable/PivotTableValueCell.js +6 -2
- package/build/es/components/PivotTable/styles/PivotTable.style.js +2 -2
- package/build/es/locales/en/translations.json +2 -0
- package/build/es/locales/lo/translations.json +16 -12
- package/build/es/modules/pivotTable/PivotTableEngine.js +61 -26
- package/build/es/modules/pivotTable/pivotTableConstants.js +4 -1
- package/build/es/modules/valueTypes.js +2 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/chart/default.js +19 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/chart/index.js +11 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/chart/singleValue.js +12 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +29 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +6 -0
- package/build/es/visualizations/config/adapters/{dhis_dhis/value/index.js → dhis_highcharts/customSVGOptions/singleValue/getSingleValueFormattedValue.js} +4 -4
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueLegendColor.js +5 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueSubtext.js +5 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueTextColor.js +14 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueTitleColor.js +20 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/index.js +25 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/index.js +16 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/index.js +11 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/addIconElement.js +28 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/checkIfFitsWithinContainer.js +13 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/computeLayoutRect.js +33 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/computeSpacingTop.js +15 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/constants.js +4 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/getAvailableSpace.js +8 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +42 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/positionElements.js +40 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js +101 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/exporting.js +23 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +23 -13
- package/build/es/visualizations/config/adapters/dhis_highcharts/lang.js +11 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/plotOptions.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/series/index.js +6 -2
- package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/__tests__/singleValue.spec.js +59 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +56 -24
- package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/singleValue.js +14 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/title/__tests__/singleValue.spec.js +42 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/title/index.js +52 -24
- package/build/es/visualizations/config/adapters/dhis_highcharts/title/singleValue.js +18 -0
- package/build/es/visualizations/config/adapters/dhis_highcharts/type.js +3 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/xAxis/index.js +2 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/yAxis/index.js +5 -6
- package/build/es/visualizations/config/adapters/index.js +1 -3
- package/build/es/visualizations/config/generators/highcharts/index.js +8 -0
- package/build/es/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/index.js +6 -0
- package/build/es/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/nonASCIIFont.js +11 -0
- package/build/es/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/textShadow.js +283 -0
- package/build/es/visualizations/config/generators/index.js +1 -3
- package/build/es/visualizations/store/adapters/dhis_highcharts/index.js +4 -1
- package/build/es/visualizations/store/adapters/dhis_highcharts/singleValue.js +4 -0
- package/build/es/visualizations/store/adapters/index.js +1 -3
- package/build/es/visualizations/util/shouldUseContrastColor.js +17 -0
- package/package.json +1 -2
- package/build/cjs/visualizations/config/adapters/dhis_dhis/index.js +0 -39
- package/build/cjs/visualizations/config/adapters/dhis_dhis/subtitle/__tests__/index.spec.js +0 -49
- package/build/cjs/visualizations/config/adapters/dhis_dhis/subtitle/__tests__/singleValue.spec.js +0 -15
- package/build/cjs/visualizations/config/adapters/dhis_dhis/subtitle/index.js +0 -34
- package/build/cjs/visualizations/config/adapters/dhis_dhis/subtitle/singleValue.js +0 -11
- package/build/cjs/visualizations/config/adapters/dhis_dhis/title/__tests__/index.spec.js +0 -39
- package/build/cjs/visualizations/config/adapters/dhis_dhis/title/__tests__/singleValue.spec.js +0 -17
- package/build/cjs/visualizations/config/adapters/dhis_dhis/title/index.js +0 -31
- package/build/cjs/visualizations/config/adapters/dhis_dhis/title/singleValue.js +0 -18
- package/build/cjs/visualizations/config/adapters/dhis_dhis/type.js +0 -19
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart.js +0 -39
- package/build/cjs/visualizations/config/generators/dhis/index.js +0 -28
- package/build/cjs/visualizations/config/generators/dhis/singleValue.js +0 -359
- package/build/cjs/visualizations/store/adapters/dhis_dhis/index.js +0 -83
- package/build/cjs/visualizations/store/adapters/dhis_dhis/singleValue.js +0 -10
- package/build/es/visualizations/config/adapters/dhis_dhis/index.js +0 -30
- package/build/es/visualizations/config/adapters/dhis_dhis/subtitle/__tests__/index.spec.js +0 -46
- package/build/es/visualizations/config/adapters/dhis_dhis/subtitle/__tests__/singleValue.spec.js +0 -12
- package/build/es/visualizations/config/adapters/dhis_dhis/subtitle/index.js +0 -27
- package/build/es/visualizations/config/adapters/dhis_dhis/subtitle/singleValue.js +0 -4
- package/build/es/visualizations/config/adapters/dhis_dhis/title/__tests__/index.spec.js +0 -36
- package/build/es/visualizations/config/adapters/dhis_dhis/title/__tests__/singleValue.spec.js +0 -14
- package/build/es/visualizations/config/adapters/dhis_dhis/title/index.js +0 -24
- package/build/es/visualizations/config/adapters/dhis_dhis/title/singleValue.js +0 -11
- package/build/es/visualizations/config/adapters/dhis_dhis/type.js +0 -13
- package/build/es/visualizations/config/adapters/dhis_highcharts/chart.js +0 -32
- package/build/es/visualizations/config/generators/dhis/index.js +0 -21
- package/build/es/visualizations/config/generators/dhis/singleValue.js +0 -353
- package/build/es/visualizations/store/adapters/dhis_dhis/index.js +0 -76
- package/build/es/visualizations/store/adapters/dhis_dhis/singleValue.js +0 -4
package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = loadCustomSVG;
|
|
7
|
+
var _visTypes = require("../../../../../../modules/visTypes.js");
|
|
8
|
+
var _index = _interopRequireDefault(require("./singleValue/index.js"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function loadCustomSVG(visType) {
|
|
11
|
+
switch (visType) {
|
|
12
|
+
case _visTypes.VIS_TYPE_SINGLE_VALUE:
|
|
13
|
+
_index.default.call(this);
|
|
14
|
+
break;
|
|
15
|
+
default:
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.addIconElement = addIconElement;
|
|
7
|
+
const parser = new DOMParser();
|
|
8
|
+
function addIconElement(svgString, color) {
|
|
9
|
+
const svgIconDocument = parser.parseFromString(svgString, 'image/svg+xml');
|
|
10
|
+
const iconElHeight = svgIconDocument.documentElement.getAttribute('height');
|
|
11
|
+
const iconElWidth = svgIconDocument.documentElement.getAttribute('width');
|
|
12
|
+
const iconGroup = this.renderer.g('icon').attr({
|
|
13
|
+
color,
|
|
14
|
+
'data-test': 'visualization-icon'
|
|
15
|
+
}).css({
|
|
16
|
+
visibility: 'hidden'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/* Force the group element to have the same dimensions as the original
|
|
20
|
+
* SVG image by adding this rect. This ensures the icon has the intended
|
|
21
|
+
* whitespace around it and makes scaling and translating easier. */
|
|
22
|
+
this.renderer.rect(0, 0, iconElWidth, iconElHeight).add(iconGroup);
|
|
23
|
+
Array.from(svgIconDocument.documentElement.children).forEach(pathNode => {
|
|
24
|
+
/* It is also possible to use the SVGRenderer to draw the icon but that
|
|
25
|
+
* approach is more error prone, so during review it was decided to just
|
|
26
|
+
* append the SVG children to the iconGroup using native the native DOM
|
|
27
|
+
* API. For reference see this commit, for an implementation using the
|
|
28
|
+
* SVVGRenderer:
|
|
29
|
+
* https://github.com/dhis2/analytics/pull/1698/commits/f95bee838e07f4cdfc3cab6e92f28f49a386a0ad */
|
|
30
|
+
iconGroup.element.appendChild(pathNode);
|
|
31
|
+
});
|
|
32
|
+
iconGroup.add();
|
|
33
|
+
return iconGroup;
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkIfFitsWithinContainer = checkIfFitsWithinContainer;
|
|
7
|
+
var _constants = require("./constants.js");
|
|
8
|
+
function checkIfFitsWithinContainer(availableSpace, valueElement, subTextElement, icon, subText, spacing) {
|
|
9
|
+
const valueRect = valueElement.getBBox(true);
|
|
10
|
+
const subTextRect = subText ? subTextElement.getBBox(true) : {
|
|
11
|
+
width: 0,
|
|
12
|
+
height: 0
|
|
13
|
+
};
|
|
14
|
+
const requiredValueWidth = icon ? valueRect.width + spacing.iconGap + spacing.iconSize : valueRect.width;
|
|
15
|
+
const requiredHeight = subText ? valueRect.height * _constants.ACTUAL_NUMBER_HEIGHT_FACTOR + spacing.subTextTop + subTextRect.height : valueRect.height * _constants.ACTUAL_NUMBER_HEIGHT_FACTOR;
|
|
16
|
+
const fitsHorizontally = availableSpace.width > requiredValueWidth && availableSpace.width > subTextRect.width;
|
|
17
|
+
const fitsVertically = availableSpace.height > requiredHeight;
|
|
18
|
+
return fitsHorizontally && fitsVertically;
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.computeLayoutRect = computeLayoutRect;
|
|
7
|
+
var _computeSpacingTop = require("./computeSpacingTop.js");
|
|
8
|
+
var _constants = require("./constants.js");
|
|
9
|
+
function computeLayoutRect(valueElement, subTextElement, iconElement, spacing) {
|
|
10
|
+
const valueRect = valueElement.getBBox();
|
|
11
|
+
const containerCenterY = this.chartHeight / 2;
|
|
12
|
+
const containerCenterX = this.chartWidth / 2;
|
|
13
|
+
const minY = _computeSpacingTop.computeSpacingTop.call(this, spacing.valueTop);
|
|
14
|
+
let width = valueRect.width;
|
|
15
|
+
let height = valueRect.height * _constants.ACTUAL_NUMBER_HEIGHT_FACTOR;
|
|
16
|
+
let sideMarginTop = 0;
|
|
17
|
+
let sideMarginBottom = 0;
|
|
18
|
+
if (iconElement) {
|
|
19
|
+
width += spacing.iconGap + spacing.iconSize;
|
|
20
|
+
}
|
|
21
|
+
if (subTextElement) {
|
|
22
|
+
const subTextRect = subTextElement.getBBox();
|
|
23
|
+
if (subTextRect.width > width) {
|
|
24
|
+
sideMarginTop = (subTextRect.width - width) / 2;
|
|
25
|
+
width = subTextRect.width;
|
|
26
|
+
} else {
|
|
27
|
+
sideMarginBottom = (width - subTextRect.width) / 2;
|
|
28
|
+
}
|
|
29
|
+
height += spacing.subTextTop + subTextRect.height;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
x: containerCenterX - width / 2,
|
|
33
|
+
y: Math.max(containerCenterY - height / 2, minY),
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
sideMarginTop,
|
|
37
|
+
sideMarginBottom
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.computeSpacingTop = computeSpacingTop;
|
|
7
|
+
function computeSpacingTop(valueSpacingTop) {
|
|
8
|
+
if (this.subtitle.textStr) {
|
|
9
|
+
/* If a subtitle is present this will be below the title so base
|
|
10
|
+
* the value X position on this */
|
|
11
|
+
const subTitleRect = this.subtitle.element.getBBox();
|
|
12
|
+
return subTitleRect.y + subTitleRect.height + valueSpacingTop;
|
|
13
|
+
} else if (this.title.textStr) {
|
|
14
|
+
// Otherwise base on title
|
|
15
|
+
const titleRect = this.title.element.getBBox();
|
|
16
|
+
return titleRect.y + titleRect.height + valueSpacingTop;
|
|
17
|
+
} else {
|
|
18
|
+
// If neither are present only adjust for valueSpacingTop
|
|
19
|
+
return valueSpacingTop;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ACTUAL_NUMBER_HEIGHT_FACTOR = void 0;
|
|
7
|
+
// multiply value text size with this factor
|
|
8
|
+
// to get very close to the actual number height
|
|
9
|
+
// as numbers don't go below the baseline like e.g. "j" and "g"
|
|
10
|
+
const ACTUAL_NUMBER_HEIGHT_FACTOR = 2 / 3;
|
|
11
|
+
exports.ACTUAL_NUMBER_HEIGHT_FACTOR = ACTUAL_NUMBER_HEIGHT_FACTOR;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAvailableSpace = getAvailableSpace;
|
|
7
|
+
var _computeSpacingTop = require("./computeSpacingTop.js");
|
|
8
|
+
var _styles = require("./styles.js");
|
|
9
|
+
function getAvailableSpace(valueSpacingTop) {
|
|
10
|
+
return {
|
|
11
|
+
height: this.chartHeight - _computeSpacingTop.computeSpacingTop.call(this, valueSpacingTop),
|
|
12
|
+
width: this.chartWidth - _styles.MIN_SIDE_WHITESPACE * 2
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = loadSingleValueSVG;
|
|
7
|
+
var _addIconElement = require("./addIconElement.js");
|
|
8
|
+
var _checkIfFitsWithinContainer = require("./checkIfFitsWithinContainer.js");
|
|
9
|
+
var _getAvailableSpace = require("./getAvailableSpace.js");
|
|
10
|
+
var _positionElements = require("./positionElements.js");
|
|
11
|
+
var _styles = require("./styles.js");
|
|
12
|
+
function loadSingleValueSVG() {
|
|
13
|
+
var _this$userOptions;
|
|
14
|
+
const {
|
|
15
|
+
formattedValue,
|
|
16
|
+
icon,
|
|
17
|
+
subText,
|
|
18
|
+
fontColor
|
|
19
|
+
} = this.userOptions.customSVGOptions;
|
|
20
|
+
const dynamicStyles = new _styles.DynamicStyles((_this$userOptions = this.userOptions) === null || _this$userOptions === void 0 ? void 0 : _this$userOptions.isPdfExport);
|
|
21
|
+
const valueElement = this.renderer.text(formattedValue).attr('data-test', 'visualization-primary-value').css({
|
|
22
|
+
color: fontColor,
|
|
23
|
+
visibility: 'hidden'
|
|
24
|
+
}).add();
|
|
25
|
+
const subTextElement = subText ? this.renderer.text(subText).attr('data-test', 'visualization-subtext').css({
|
|
26
|
+
color: fontColor,
|
|
27
|
+
visibility: 'hidden'
|
|
28
|
+
}).add() : null;
|
|
29
|
+
const iconElement = icon ? _addIconElement.addIconElement.call(this, icon, fontColor) : null;
|
|
30
|
+
let fitsWithinContainer = false;
|
|
31
|
+
let styles = {};
|
|
32
|
+
while (!fitsWithinContainer && dynamicStyles.hasNext()) {
|
|
33
|
+
styles = dynamicStyles.next();
|
|
34
|
+
valueElement.css(styles.value);
|
|
35
|
+
subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.css(styles.subText);
|
|
36
|
+
fitsWithinContainer = (0, _checkIfFitsWithinContainer.checkIfFitsWithinContainer)(_getAvailableSpace.getAvailableSpace.call(this, styles.spacing.valueTop), valueElement, subTextElement, icon, subText, styles.spacing);
|
|
37
|
+
}
|
|
38
|
+
_positionElements.positionElements.call(this, valueElement, subTextElement, iconElement, styles.spacing);
|
|
39
|
+
valueElement.css({
|
|
40
|
+
visibility: 'visible'
|
|
41
|
+
});
|
|
42
|
+
iconElement === null || iconElement === void 0 ? void 0 : iconElement.css({
|
|
43
|
+
visibility: 'visible'
|
|
44
|
+
});
|
|
45
|
+
subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.css({
|
|
46
|
+
visibility: 'visible'
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.positionElements = positionElements;
|
|
7
|
+
var _computeLayoutRect = require("./computeLayoutRect.js");
|
|
8
|
+
var _constants = require("./constants.js");
|
|
9
|
+
function positionElements(valueElement, subTextElement, iconElement, spacing) {
|
|
10
|
+
const valueElementBox = valueElement.getBBox();
|
|
11
|
+
/* Layout here refers to a virtual rect that wraps
|
|
12
|
+
* all indiviual parts of the single value visualization
|
|
13
|
+
* (value, subtext and icon) */
|
|
14
|
+
const layoutRect = _computeLayoutRect.computeLayoutRect.call(this, valueElement, subTextElement, iconElement, spacing);
|
|
15
|
+
valueElement.align({
|
|
16
|
+
align: 'right',
|
|
17
|
+
verticalAlign: 'top',
|
|
18
|
+
alignByTranslate: false,
|
|
19
|
+
x: (valueElementBox.width + layoutRect.sideMarginTop) * -1,
|
|
20
|
+
y: valueElementBox.height * _constants.ACTUAL_NUMBER_HEIGHT_FACTOR
|
|
21
|
+
}, false, layoutRect);
|
|
22
|
+
if (iconElement) {
|
|
23
|
+
const {
|
|
24
|
+
height
|
|
25
|
+
} = iconElement.getBBox();
|
|
26
|
+
const scale = spacing.iconSize / height;
|
|
27
|
+
const translateX = layoutRect.x + layoutRect.sideMarginTop;
|
|
28
|
+
const iconHeight = height * scale;
|
|
29
|
+
const valueElementHeight = valueElementBox.height * _constants.ACTUAL_NUMBER_HEIGHT_FACTOR;
|
|
30
|
+
const translateY = layoutRect.y + (valueElementHeight - iconHeight) / 2;
|
|
31
|
+
|
|
32
|
+
/* The icon is a <g> with <path> elements that contain coordinates.
|
|
33
|
+
* These path-coordinates only scale correctly when using CSS translate */
|
|
34
|
+
iconElement.css({
|
|
35
|
+
transform: `translate(${translateX}px, ${translateY}px) scale(${scale})`
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (subTextElement) {
|
|
39
|
+
subTextElement.align({
|
|
40
|
+
align: 'left',
|
|
41
|
+
verticalAlign: 'bottom',
|
|
42
|
+
alignByTranslate: false,
|
|
43
|
+
x: layoutRect.sideMarginBottom
|
|
44
|
+
}, false, layoutRect);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MIN_SIDE_WHITESPACE = exports.DynamicStyles = void 0;
|
|
7
|
+
const valueStyles = [{
|
|
8
|
+
'font-size': '164px',
|
|
9
|
+
'letter-spacing': '-5px'
|
|
10
|
+
}, {
|
|
11
|
+
'font-size': '128px',
|
|
12
|
+
'letter-spacing': '-4px'
|
|
13
|
+
}, {
|
|
14
|
+
'font-size': '96px',
|
|
15
|
+
'letter-spacing': '-3px'
|
|
16
|
+
}, {
|
|
17
|
+
'font-size': '64px',
|
|
18
|
+
'letter-spacing': '-2.5px'
|
|
19
|
+
}, {
|
|
20
|
+
'font-size': '40px',
|
|
21
|
+
'letter-spacing': '-1.5px'
|
|
22
|
+
}, {
|
|
23
|
+
'font-size': '20px',
|
|
24
|
+
'letter-spacing': '-1px'
|
|
25
|
+
}];
|
|
26
|
+
const subTextStyles = [{
|
|
27
|
+
'font-size': '36px',
|
|
28
|
+
'letter-spacing': '-1.4px'
|
|
29
|
+
}, {
|
|
30
|
+
'font-size': '32px',
|
|
31
|
+
'letter-spacing': '-1.2px'
|
|
32
|
+
}, {
|
|
33
|
+
'font-size': '26px',
|
|
34
|
+
'letter-spacing': '-0.8px'
|
|
35
|
+
}, {
|
|
36
|
+
'font-size': '20px',
|
|
37
|
+
'letter-spacing': '-0.6px'
|
|
38
|
+
}, {
|
|
39
|
+
'font-size': '14px',
|
|
40
|
+
'letter-spacing': '0.2px'
|
|
41
|
+
}, {
|
|
42
|
+
'font-size': '9px',
|
|
43
|
+
'letter-spacing': '0px'
|
|
44
|
+
}];
|
|
45
|
+
const spacings = [{
|
|
46
|
+
valueTop: 8,
|
|
47
|
+
subTextTop: 12,
|
|
48
|
+
iconGap: 8,
|
|
49
|
+
iconSize: 164
|
|
50
|
+
}, {
|
|
51
|
+
valueTop: 8,
|
|
52
|
+
subTextTop: 12,
|
|
53
|
+
iconGap: 6,
|
|
54
|
+
iconSize: 128
|
|
55
|
+
}, {
|
|
56
|
+
valueTop: 8,
|
|
57
|
+
subTextTop: 8,
|
|
58
|
+
iconGap: 4,
|
|
59
|
+
iconSize: 96
|
|
60
|
+
}, {
|
|
61
|
+
valueTop: 8,
|
|
62
|
+
subTextTop: 8,
|
|
63
|
+
iconGap: 4,
|
|
64
|
+
iconSize: 64
|
|
65
|
+
}, {
|
|
66
|
+
valueTop: 8,
|
|
67
|
+
subTextTop: 8,
|
|
68
|
+
iconGap: 4,
|
|
69
|
+
iconSize: 40
|
|
70
|
+
}, {
|
|
71
|
+
valueTop: 8,
|
|
72
|
+
subTextTop: 4,
|
|
73
|
+
iconGap: 2,
|
|
74
|
+
iconSize: 20
|
|
75
|
+
}];
|
|
76
|
+
const MIN_SIDE_WHITESPACE = 4;
|
|
77
|
+
exports.MIN_SIDE_WHITESPACE = MIN_SIDE_WHITESPACE;
|
|
78
|
+
class DynamicStyles {
|
|
79
|
+
constructor(isPdfExport) {
|
|
80
|
+
this.currentIndex = 0;
|
|
81
|
+
this.isPdfExport = isPdfExport;
|
|
82
|
+
}
|
|
83
|
+
getStyle() {
|
|
84
|
+
return {
|
|
85
|
+
value: {
|
|
86
|
+
...valueStyles[this.currentIndex],
|
|
87
|
+
'font-weight': this.isPdfExport ? 'normal' : '300'
|
|
88
|
+
},
|
|
89
|
+
subText: subTextStyles[this.currentIndex],
|
|
90
|
+
spacing: spacings[this.currentIndex]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
next() {
|
|
94
|
+
if (this.currentIndex === valueStyles.length - 1) {
|
|
95
|
+
throw new Error('No next available, already on the smallest style');
|
|
96
|
+
} else {
|
|
97
|
+
++this.currentIndex;
|
|
98
|
+
}
|
|
99
|
+
return this.getStyle();
|
|
100
|
+
}
|
|
101
|
+
first() {
|
|
102
|
+
this.currentIndex = 0;
|
|
103
|
+
return this.getStyle();
|
|
104
|
+
}
|
|
105
|
+
hasNext() {
|
|
106
|
+
return this.currentIndex < valueStyles.length - 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.DynamicStyles = DynamicStyles;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getExporting;
|
|
7
|
+
var _visTypes = require("../../../../modules/visTypes.js");
|
|
8
|
+
var _index = _interopRequireDefault(require("./events/loadCustomSVG/singleValue/index.js"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function getExporting(visType) {
|
|
11
|
+
const exporting = {
|
|
12
|
+
// disable exporting context menu
|
|
13
|
+
enabled: false
|
|
14
|
+
};
|
|
15
|
+
switch (visType) {
|
|
16
|
+
case _visTypes.VIS_TYPE_SINGLE_VALUE:
|
|
17
|
+
return {
|
|
18
|
+
...exporting,
|
|
19
|
+
chartOptions: {
|
|
20
|
+
chart: {
|
|
21
|
+
events: {
|
|
22
|
+
load: _index.default
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
default:
|
|
28
|
+
return exporting;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -11,20 +11,23 @@ var _index = require("../../../../modules/outliers/index.js");
|
|
|
11
11
|
var _visTypes = require("../../../../modules/visTypes.js");
|
|
12
12
|
var _themes = require("../../../util/colors/themes.js");
|
|
13
13
|
var _addTrendLines = _interopRequireWildcard(require("./addTrendLines.js"));
|
|
14
|
-
var
|
|
14
|
+
var _index2 = _interopRequireDefault(require("./chart/index.js"));
|
|
15
|
+
var _index3 = _interopRequireDefault(require("./customSVGOptions/index.js"));
|
|
16
|
+
var _exporting = _interopRequireDefault(require("./exporting.js"));
|
|
15
17
|
var _getScatterData = _interopRequireDefault(require("./getScatterData.js"));
|
|
16
18
|
var _getSortedConfig = _interopRequireDefault(require("./getSortedConfig.js"));
|
|
17
19
|
var _getTrimmedConfig = _interopRequireDefault(require("./getTrimmedConfig.js"));
|
|
20
|
+
var _lang = _interopRequireDefault(require("./lang.js"));
|
|
18
21
|
var _legend = _interopRequireDefault(require("./legend.js"));
|
|
19
22
|
var _legendSet = require("./legendSet.js");
|
|
20
23
|
var _noData = _interopRequireDefault(require("./noData.js"));
|
|
21
|
-
var
|
|
24
|
+
var _index4 = _interopRequireDefault(require("./pane/index.js"));
|
|
22
25
|
var _plotOptions = _interopRequireDefault(require("./plotOptions.js"));
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
26
|
+
var _index5 = _interopRequireDefault(require("./series/index.js"));
|
|
27
|
+
var _index6 = _interopRequireDefault(require("./subtitle/index.js"));
|
|
28
|
+
var _index7 = _interopRequireDefault(require("./title/index.js"));
|
|
29
|
+
var _index8 = _interopRequireDefault(require("./xAxis/index.js"));
|
|
30
|
+
var _index9 = _interopRequireDefault(require("./yAxis/index.js"));
|
|
28
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
32
|
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; }
|
|
30
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -67,17 +70,17 @@ function _default(_ref) {
|
|
|
67
70
|
}
|
|
68
71
|
let config = {
|
|
69
72
|
// type etc
|
|
70
|
-
chart: (0,
|
|
73
|
+
chart: (0, _index2.default)(_layout, el, _extraOptions, series),
|
|
71
74
|
// title
|
|
72
|
-
title: (0,
|
|
75
|
+
title: (0, _index7.default)(_layout, store.data[0].metaData, _extraOptions, series),
|
|
73
76
|
// subtitle
|
|
74
|
-
subtitle: (0,
|
|
77
|
+
subtitle: (0, _index6.default)(series, _layout, store.data[0].metaData, _extraOptions),
|
|
75
78
|
// x-axis
|
|
76
|
-
xAxis: (0,
|
|
79
|
+
xAxis: (0, _index8.default)(store, _layout, _extraOptions, series),
|
|
77
80
|
// y-axis
|
|
78
|
-
yAxis: (0,
|
|
81
|
+
yAxis: (0, _index9.default)(_layout, series, _extraOptions),
|
|
79
82
|
// series
|
|
80
|
-
series: (0,
|
|
83
|
+
series: (0, _index5.default)({
|
|
81
84
|
series: series.slice(),
|
|
82
85
|
metaData: store.data[0].metaData.items,
|
|
83
86
|
layout: _layout,
|
|
@@ -94,22 +97,28 @@ function _default(_ref) {
|
|
|
94
97
|
dashboard: _extraOptions.dashboard
|
|
95
98
|
}),
|
|
96
99
|
// pane
|
|
97
|
-
pane: (0,
|
|
100
|
+
pane: (0, _index4.default)(_layout.type),
|
|
98
101
|
// no data + zoom
|
|
99
|
-
lang:
|
|
100
|
-
|
|
101
|
-
resetZoom: _extraOptions.resetZoom.text
|
|
102
|
-
},
|
|
103
|
-
noData: (0, _noData.default)(),
|
|
102
|
+
lang: (0, _lang.default)(_layout.type, _extraOptions),
|
|
103
|
+
noData: (0, _noData.default)(_layout.type),
|
|
104
104
|
// credits
|
|
105
105
|
credits: {
|
|
106
106
|
enabled: false
|
|
107
107
|
},
|
|
108
108
|
// exporting
|
|
109
|
-
exporting:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
exporting: (0, _exporting.default)(_layout.type),
|
|
110
|
+
/* The config object passed to the Highcharts Chart constructor
|
|
111
|
+
* can contain arbitrary properties, which are made accessible
|
|
112
|
+
* under the Chart instance's `userOptions` member. This means
|
|
113
|
+
* that in event callback functions the custom SVG options are
|
|
114
|
+
* accessible as `this.userOptions.customSVGOptions` */
|
|
115
|
+
customSVGOptions: (0, _index3.default)({
|
|
116
|
+
extraConfig,
|
|
117
|
+
layout: _layout,
|
|
118
|
+
extraOptions: _extraOptions,
|
|
119
|
+
metaData: store.data[0].metaData,
|
|
120
|
+
series
|
|
121
|
+
})
|
|
113
122
|
};
|
|
114
123
|
|
|
115
124
|
// get plot options for scatter
|
|
@@ -185,5 +194,6 @@ function _default(_ref) {
|
|
|
185
194
|
|
|
186
195
|
// force apply extra config
|
|
187
196
|
Object.assign(config, extraConfig);
|
|
197
|
+
console.log((0, _objectClean.default)(config));
|
|
188
198
|
return (0, _objectClean.default)(config);
|
|
189
199
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getLang;
|
|
7
|
+
var _visTypes = require("../../../../modules/visTypes.js");
|
|
8
|
+
function getLang(visType, extraOptions) {
|
|
9
|
+
return {
|
|
10
|
+
/* The SingleValue visualization consists of some custom SVG elements
|
|
11
|
+
* rendered on an empty chart. Since the chart is empty, there is never
|
|
12
|
+
* any data and Highcharts will show the noData text. To avoid this we
|
|
13
|
+
* clear the text here. */
|
|
14
|
+
noData: visType === _visTypes.VIS_TYPE_SINGLE_VALUE ? undefined : extraOptions.noData.text,
|
|
15
|
+
resetZoom: extraOptions.resetZoom.text
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -160,6 +160,7 @@ function getDefault(_ref) {
|
|
|
160
160
|
return series;
|
|
161
161
|
}
|
|
162
162
|
function _default(_ref2) {
|
|
163
|
+
var _series;
|
|
163
164
|
let {
|
|
164
165
|
series,
|
|
165
166
|
metaData,
|
|
@@ -170,6 +171,9 @@ function _default(_ref2) {
|
|
|
170
171
|
displayStrategy
|
|
171
172
|
} = _ref2;
|
|
172
173
|
switch (layout.type) {
|
|
174
|
+
case _visTypes.VIS_TYPE_SINGLE_VALUE:
|
|
175
|
+
series = [];
|
|
176
|
+
break;
|
|
173
177
|
case _visTypes.VIS_TYPE_PIE:
|
|
174
178
|
series = (0, _pie.default)(series, Object.values(getIdColorMap(series, layout, extraOptions)));
|
|
175
179
|
break;
|
|
@@ -190,7 +194,7 @@ function _default(_ref2) {
|
|
|
190
194
|
displayStrategy
|
|
191
195
|
});
|
|
192
196
|
}
|
|
193
|
-
series.forEach(seriesObj => {
|
|
197
|
+
(_series = series) === null || _series === void 0 ? void 0 : _series.forEach(seriesObj => {
|
|
194
198
|
// animation
|
|
195
199
|
seriesObj.animation = {
|
|
196
200
|
duration: getAnimation(extraOptions.animation, DEFAULT_ANIMATION_DURATION)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _singleValue = _interopRequireDefault(require("../singleValue.js"));
|
|
4
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5
|
+
jest.mock('../../../../../util/getFilterText', () => () => 'The default filter text');
|
|
6
|
+
describe('getSingleValueSubtitle', () => {
|
|
7
|
+
it('returns empty subtitle when flag hideSubtitle exists', () => {
|
|
8
|
+
expect((0, _singleValue.default)({
|
|
9
|
+
hideSubtitle: true
|
|
10
|
+
})).toEqual('');
|
|
11
|
+
});
|
|
12
|
+
it('returns the subtitle provided in the layout', () => {
|
|
13
|
+
const subtitle = 'The subtitle was already set';
|
|
14
|
+
expect((0, _singleValue.default)({
|
|
15
|
+
subtitle
|
|
16
|
+
})).toEqual(subtitle);
|
|
17
|
+
});
|
|
18
|
+
it('returns an empty string when layout does not have filters', () => {
|
|
19
|
+
expect((0, _singleValue.default)({})).toEqual('');
|
|
20
|
+
});
|
|
21
|
+
it('returns the filter text', () => {
|
|
22
|
+
expect((0, _singleValue.default)({
|
|
23
|
+
filters: []
|
|
24
|
+
})).toEqual('The default filter text');
|
|
25
|
+
});
|
|
26
|
+
describe('not dashboard', () => {
|
|
27
|
+
describe('layout does not include title', () => {
|
|
28
|
+
it('returns empty subtitle', () => {
|
|
29
|
+
expect((0, _singleValue.default)({
|
|
30
|
+
filters: undefined
|
|
31
|
+
}, {}, false)).toEqual('');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/* All these tests have been moved and adjusted from here:
|
|
36
|
+
* src/visualizations/config/adapters/dhis_dhis/title/__tests__`
|
|
37
|
+
* The test below asserted the default subtitle behaviour, for
|
|
38
|
+
* visualization types other than SingleValue. It expected that
|
|
39
|
+
* the title was being used as subtitle. It fails now, and I
|
|
40
|
+
* believe that this behaviour does not make sense. So instead
|
|
41
|
+
* of fixing it, I disabled it. */
|
|
42
|
+
// describe('layout includes title', () => {
|
|
43
|
+
// it('returns filter title as subtitle', () => {
|
|
44
|
+
// expect(
|
|
45
|
+
// getSingleValueSubtitle(
|
|
46
|
+
// { filters: undefined, title: 'Chart title' },
|
|
47
|
+
// {},
|
|
48
|
+
// false
|
|
49
|
+
// )
|
|
50
|
+
// ).toEqual('The default filter text')
|
|
51
|
+
// })
|
|
52
|
+
// })
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('dashboard', () => {
|
|
56
|
+
it('returns filter title as subtitle', () => {
|
|
57
|
+
expect((0, _singleValue.default)({
|
|
58
|
+
filters: {}
|
|
59
|
+
}, {}, true)).toEqual('The default filter text');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|