@dhis2/analytics 27.0.1 → 28.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/__demo__/ScatterPlotPdfExport.stories.js +46 -0
- package/build/cjs/__demo__/SingleValue.stories.js +34 -2
- package/build/cjs/__fixtures__/scatterPlotData.js +863 -0
- package/build/cjs/components/FileMenu/__tests__/utils.spec.js +18 -91
- package/build/cjs/components/FileMenu/utils.js +5 -29
- package/build/cjs/locales/ar/translations.json +3 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +2 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/addIconElement.js +2 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +13 -16
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/positionElements.js +2 -5
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js +13 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/exporting.js +33 -17
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/index.js +2 -1
- package/build/cjs/visualizations/config/generators/highcharts/index.js +30 -16
- package/build/cjs/visualizations/util/colors/colorSets.js +1 -2
- package/build/es/__demo__/ScatterPlotPdfExport.stories.js +37 -0
- package/build/es/__demo__/SingleValue.stories.js +35 -3
- package/build/es/__fixtures__/scatterPlotData.js +857 -0
- package/build/es/components/FileMenu/__tests__/utils.spec.js +18 -91
- package/build/es/components/FileMenu/utils.js +6 -30
- package/build/es/locales/ar/translations.json +3 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueBackgroundColor.js +2 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/addIconElement.js +2 -2
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +13 -16
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/positionElements.js +2 -5
- package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js +13 -2
- package/build/es/visualizations/config/adapters/dhis_highcharts/exporting.js +33 -17
- package/build/es/visualizations/config/adapters/dhis_highcharts/index.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/title/index.js +2 -1
- package/build/es/visualizations/config/generators/highcharts/index.js +30 -16
- package/build/es/visualizations/util/colors/colorSets.js +1 -2
- package/package.json +4 -3
|
@@ -87,92 +87,37 @@ describe('utils', () => {
|
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
describe('preparePayloadForSave', () => {
|
|
90
|
-
|
|
91
|
-
query: jest.fn()
|
|
92
|
-
};
|
|
93
|
-
beforeEach(() => {
|
|
94
|
-
jest.clearAllMocks();
|
|
95
|
-
});
|
|
96
|
-
it('fetches subscribers and adds them to the visualization', async () => {
|
|
97
|
-
const visualization = {
|
|
98
|
-
id: '123',
|
|
99
|
-
type: 'BAR',
|
|
100
|
-
name: 'Existing Name',
|
|
101
|
-
description: 'Existing Description'
|
|
102
|
-
};
|
|
103
|
-
mockEngine.query.mockResolvedValue({
|
|
104
|
-
ao: {
|
|
105
|
-
subscribers: ['user1', 'user2']
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const result = await preparePayloadForSave({
|
|
109
|
-
visualization,
|
|
110
|
-
engine: mockEngine
|
|
111
|
-
});
|
|
112
|
-
expect(mockEngine.query).toHaveBeenCalledWith({
|
|
113
|
-
ao: {
|
|
114
|
-
resource: 'visualizations',
|
|
115
|
-
id: expect.any(Function),
|
|
116
|
-
params: {
|
|
117
|
-
fields: 'subscribers'
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
variables: {
|
|
122
|
-
id: '123'
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
expect(result.subscribers).toEqual(['user1', 'user2']);
|
|
126
|
-
});
|
|
127
|
-
it('sets the name to the provided name', async () => {
|
|
90
|
+
it('sets the name to the provided name', () => {
|
|
128
91
|
const visualization = {
|
|
129
92
|
id: '123',
|
|
130
93
|
type: 'MAP',
|
|
131
94
|
name: 'Existing name'
|
|
132
95
|
};
|
|
133
96
|
const name = 'New Name';
|
|
134
|
-
|
|
135
|
-
ao: {
|
|
136
|
-
subscribers: []
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
const result = await preparePayloadForSave({
|
|
97
|
+
const result = preparePayloadForSave({
|
|
140
98
|
visualization,
|
|
141
|
-
name
|
|
142
|
-
engine: mockEngine
|
|
99
|
+
name
|
|
143
100
|
});
|
|
144
101
|
expect(result.name).toBe(name);
|
|
145
102
|
});
|
|
146
|
-
it('sets the name to the existing name if no new name is provided',
|
|
103
|
+
it('sets the name to the existing name if no new name is provided', () => {
|
|
147
104
|
const visualization = {
|
|
148
105
|
id: '123',
|
|
149
106
|
type: 'LINE_LIST',
|
|
150
107
|
name: 'Existing Name'
|
|
151
108
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
subscribers: []
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
const result = await preparePayloadForSave({
|
|
158
|
-
visualization,
|
|
159
|
-
engine: mockEngine
|
|
109
|
+
const result = preparePayloadForSave({
|
|
110
|
+
visualization
|
|
160
111
|
});
|
|
161
112
|
expect(result.name).toBe('Existing Name');
|
|
162
113
|
});
|
|
163
|
-
it('sets the name to a default value if no name is provided',
|
|
114
|
+
it('sets the name to a default value if no name is provided', () => {
|
|
164
115
|
const visualization = {
|
|
165
116
|
id: '123',
|
|
166
117
|
type: 'BAR'
|
|
167
118
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
subscribers: []
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
const result = await preparePayloadForSave({
|
|
174
|
-
visualization,
|
|
175
|
-
engine: mockEngine
|
|
119
|
+
const result = preparePayloadForSave({
|
|
120
|
+
visualization
|
|
176
121
|
});
|
|
177
122
|
const expectedName = `Untitled Bar, ${new Date().toLocaleDateString(undefined, {
|
|
178
123
|
year: 'numeric',
|
|
@@ -181,55 +126,37 @@ describe('utils', () => {
|
|
|
181
126
|
})}`;
|
|
182
127
|
expect(result.name).toBe(expectedName);
|
|
183
128
|
});
|
|
184
|
-
it('sets the description to the provided description',
|
|
129
|
+
it('sets the description to the provided description', () => {
|
|
185
130
|
const visualization = {
|
|
186
131
|
id: '123',
|
|
187
132
|
type: 'YEAR_OVER_YEAR_LINE',
|
|
188
133
|
description: 'Existing Description'
|
|
189
134
|
};
|
|
190
135
|
const description = 'New Description';
|
|
191
|
-
|
|
192
|
-
ao: {
|
|
193
|
-
subscribers: []
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
const result = await preparePayloadForSave({
|
|
136
|
+
const result = preparePayloadForSave({
|
|
197
137
|
visualization,
|
|
198
|
-
description
|
|
199
|
-
engine: mockEngine
|
|
138
|
+
description
|
|
200
139
|
});
|
|
201
140
|
expect(result.description).toBe(description);
|
|
202
141
|
});
|
|
203
|
-
it('keeps the existing description if no new description is provided',
|
|
142
|
+
it('keeps the existing description if no new description is provided', () => {
|
|
204
143
|
const visualization = {
|
|
205
144
|
id: '123',
|
|
206
145
|
type: 'COLUMN',
|
|
207
146
|
description: 'Existing Description'
|
|
208
147
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
subscribers: []
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
const result = await preparePayloadForSave({
|
|
215
|
-
visualization,
|
|
216
|
-
engine: mockEngine
|
|
148
|
+
const result = preparePayloadForSave({
|
|
149
|
+
visualization
|
|
217
150
|
});
|
|
218
151
|
expect(result.description).toBe('Existing Description');
|
|
219
152
|
});
|
|
220
|
-
it('sets the description to undefined if no description is provided and none exists',
|
|
153
|
+
it('sets the description to undefined if no description is provided and none exists', () => {
|
|
221
154
|
const visualization = {
|
|
222
155
|
id: '123',
|
|
223
156
|
type: 'BAR'
|
|
224
157
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
subscribers: []
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
const result = await preparePayloadForSave({
|
|
231
|
-
visualization,
|
|
232
|
-
engine: mockEngine
|
|
158
|
+
const result = preparePayloadForSave({
|
|
159
|
+
visualization
|
|
233
160
|
});
|
|
234
161
|
expect(result.description).toBeUndefined();
|
|
235
162
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import i18n from '@dhis2/d2-i18n';
|
|
2
|
-
import { getDisplayNameByVisType
|
|
2
|
+
import { getDisplayNameByVisType } from '../../modules/visTypes.js';
|
|
3
3
|
export const FILE_TYPE_EVENT_REPORT = 'eventReport';
|
|
4
4
|
export const FILE_TYPE_VISUALIZATION = 'visualization';
|
|
5
5
|
export const FILE_TYPE_MAP = 'map';
|
|
@@ -54,38 +54,12 @@ export const preparePayloadForSaveAs = _ref => {
|
|
|
54
54
|
visualization.description = description !== undefined ? description : visualization.description;
|
|
55
55
|
return visualization;
|
|
56
56
|
};
|
|
57
|
-
const
|
|
58
|
-
ao: {
|
|
59
|
-
resource: getApiEndpointByVisType(type),
|
|
60
|
-
id: _ref2 => {
|
|
61
|
-
let {
|
|
62
|
-
id
|
|
63
|
-
} = _ref2;
|
|
64
|
-
return id;
|
|
65
|
-
},
|
|
66
|
-
params: {
|
|
67
|
-
fields: 'subscribers'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const apiFetchAOSubscribers = (dataEngine, id, type) => {
|
|
72
|
-
return dataEngine.query(getSubscriberQuery(type), {
|
|
73
|
-
variables: {
|
|
74
|
-
id
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
export const preparePayloadForSave = async _ref3 => {
|
|
57
|
+
export const preparePayloadForSave = _ref2 => {
|
|
79
58
|
let {
|
|
80
59
|
visualization,
|
|
81
60
|
name,
|
|
82
|
-
description
|
|
83
|
-
|
|
84
|
-
} = _ref3;
|
|
85
|
-
const {
|
|
86
|
-
ao
|
|
87
|
-
} = await apiFetchAOSubscribers(engine, visualization.id, visualization.type);
|
|
88
|
-
visualization.subscribers = ao.subscribers;
|
|
61
|
+
description
|
|
62
|
+
} = _ref2;
|
|
89
63
|
visualization.name = name || visualization.name || i18n.t('Untitled {{visualizationType}}, {{date}}', {
|
|
90
64
|
visualizationType: getDisplayNameByVisType(visualization.type),
|
|
91
65
|
date: new Date().toLocaleDateString(undefined, {
|
|
@@ -95,5 +69,7 @@ export const preparePayloadForSave = async _ref3 => {
|
|
|
95
69
|
})
|
|
96
70
|
});
|
|
97
71
|
visualization.description = description !== undefined ? description : visualization.description;
|
|
72
|
+
delete visualization.displayName;
|
|
73
|
+
delete visualization.displayDescription;
|
|
98
74
|
return visualization;
|
|
99
75
|
};
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"About this event chart": "",
|
|
27
27
|
"About this event report": "",
|
|
28
28
|
"This app could not retrieve required data.": "",
|
|
29
|
-
"Network error": "",
|
|
29
|
+
"Network error": "خطأ في الشبكة",
|
|
30
30
|
"Data / Edit calculation": "",
|
|
31
31
|
"Data / New calculation": "",
|
|
32
32
|
"Remove item": "",
|
|
@@ -166,6 +166,7 @@
|
|
|
166
166
|
"line list": "",
|
|
167
167
|
"map": "خريطة",
|
|
168
168
|
"visualization": "",
|
|
169
|
+
"Untitled {{visualizationType}}, {{date}}": "",
|
|
169
170
|
"Edit": "تعديل",
|
|
170
171
|
"Write a reply": "كتابة رد",
|
|
171
172
|
"Post reply": "",
|
|
@@ -471,6 +472,7 @@
|
|
|
471
472
|
"Single value": "قيمة مفردة",
|
|
472
473
|
"Outlier table": "",
|
|
473
474
|
"All charts": "",
|
|
475
|
+
"Map": "الخريطة",
|
|
474
476
|
"{{seriesName}} (trend)": "",
|
|
475
477
|
"Trend": "الاتجاه",
|
|
476
478
|
"No legend for this series": "لا معلومات مفاتيح إيضاحية لهذه السلسلة",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LEGEND_DISPLAY_STYLE_FILL } from '../../../../../../modules/legends.js';
|
|
2
2
|
import { getSingleValueLegendColor } from './getSingleValueLegendColor.js';
|
|
3
3
|
export function getSingleValueBackgroundColor(legendOptions, legendSets, value) {
|
|
4
|
+
let defaultColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'transparent';
|
|
4
5
|
const legendColor = getSingleValueLegendColor(legendOptions, legendSets, value);
|
|
5
|
-
return legendColor && legendOptions.style === LEGEND_DISPLAY_STYLE_FILL ? legendColor :
|
|
6
|
+
return legendColor && legendOptions.style === LEGEND_DISPLAY_STYLE_FILL ? legendColor : defaultColor;
|
|
6
7
|
}
|
|
@@ -5,8 +5,8 @@ export function addIconElement(svgString, color) {
|
|
|
5
5
|
const iconElWidth = svgIconDocument.documentElement.getAttribute('width');
|
|
6
6
|
const iconGroup = this.renderer.g('icon').attr({
|
|
7
7
|
color,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
fill: color,
|
|
9
|
+
'data-test': 'visualization-icon',
|
|
10
10
|
visibility: 'hidden'
|
|
11
11
|
});
|
|
12
12
|
|
|
@@ -4,19 +4,22 @@ import { getAvailableSpace } from './getAvailableSpace.js';
|
|
|
4
4
|
import { positionElements } from './positionElements.js';
|
|
5
5
|
import { DynamicStyles } from './styles.js';
|
|
6
6
|
export default function loadSingleValueSVG() {
|
|
7
|
+
var _this$userOptions;
|
|
7
8
|
const {
|
|
8
9
|
formattedValue,
|
|
9
10
|
icon,
|
|
10
11
|
subText,
|
|
11
12
|
fontColor
|
|
12
13
|
} = this.userOptions.customSVGOptions;
|
|
13
|
-
const dynamicStyles = new DynamicStyles();
|
|
14
|
-
const valueElement = this.renderer.text(formattedValue).attr(
|
|
15
|
-
|
|
14
|
+
const dynamicStyles = new DynamicStyles((_this$userOptions = this.userOptions) === null || _this$userOptions === void 0 ? void 0 : _this$userOptions.isPdfExport);
|
|
15
|
+
const valueElement = this.renderer.text(formattedValue).attr({
|
|
16
|
+
'data-test': 'visualization-primary-value',
|
|
17
|
+
fill: fontColor,
|
|
16
18
|
visibility: 'hidden'
|
|
17
19
|
}).add();
|
|
18
|
-
const subTextElement = subText ? this.renderer.text(subText).attr(
|
|
19
|
-
|
|
20
|
+
const subTextElement = subText ? this.renderer.text(subText).attr({
|
|
21
|
+
'data-test': 'visualization-subtext',
|
|
22
|
+
fill: fontColor,
|
|
20
23
|
visibility: 'hidden'
|
|
21
24
|
}).add() : null;
|
|
22
25
|
const iconElement = icon ? addIconElement.call(this, icon, fontColor) : null;
|
|
@@ -24,18 +27,12 @@ export default function loadSingleValueSVG() {
|
|
|
24
27
|
let styles = {};
|
|
25
28
|
while (!fitsWithinContainer && dynamicStyles.hasNext()) {
|
|
26
29
|
styles = dynamicStyles.next();
|
|
27
|
-
valueElement.
|
|
28
|
-
subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.
|
|
30
|
+
valueElement.attr(styles.value);
|
|
31
|
+
subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.attr(styles.subText);
|
|
29
32
|
fitsWithinContainer = checkIfFitsWithinContainer(getAvailableSpace.call(this, styles.spacing.valueTop), valueElement, subTextElement, icon, subText, styles.spacing);
|
|
30
33
|
}
|
|
31
34
|
positionElements.call(this, valueElement, subTextElement, iconElement, styles.spacing);
|
|
32
|
-
valueElement.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
iconElement === null || iconElement === void 0 ? void 0 : iconElement.css({
|
|
36
|
-
visibility: 'visible'
|
|
37
|
-
});
|
|
38
|
-
subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.css({
|
|
39
|
-
visibility: 'visible'
|
|
40
|
-
});
|
|
35
|
+
valueElement.attr('visibility', 'visible');
|
|
36
|
+
iconElement === null || iconElement === void 0 ? void 0 : iconElement.attr('visibility', 'visible');
|
|
37
|
+
subTextElement === null || subTextElement === void 0 ? void 0 : subTextElement.attr('visibility', 'visible');
|
|
41
38
|
}
|
|
@@ -22,11 +22,8 @@ export function positionElements(valueElement, subTextElement, iconElement, spac
|
|
|
22
22
|
const iconHeight = height * scale;
|
|
23
23
|
const valueElementHeight = valueElementBox.height * ACTUAL_NUMBER_HEIGHT_FACTOR;
|
|
24
24
|
const translateY = layoutRect.y + (valueElementHeight - iconHeight) / 2;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* These path-coordinates only scale correctly when using CSS translate */
|
|
28
|
-
iconElement.css({
|
|
29
|
-
transform: `translate(${translateX}px, ${translateY}px) scale(${scale})`
|
|
25
|
+
iconElement.attr({
|
|
26
|
+
transform: `translate(${translateX} ${translateY}) scale(${scale})`
|
|
30
27
|
});
|
|
31
28
|
}
|
|
32
29
|
if (subTextElement) {
|
|
@@ -69,11 +69,12 @@ const spacings = [{
|
|
|
69
69
|
}];
|
|
70
70
|
export const MIN_SIDE_WHITESPACE = 4;
|
|
71
71
|
export class DynamicStyles {
|
|
72
|
-
constructor() {
|
|
72
|
+
constructor(isPdfExport) {
|
|
73
73
|
this.currentIndex = 0;
|
|
74
|
+
this.isPdfExport = isPdfExport;
|
|
74
75
|
}
|
|
75
76
|
getStyle() {
|
|
76
|
-
|
|
77
|
+
const style = {
|
|
77
78
|
value: {
|
|
78
79
|
...valueStyles[this.currentIndex],
|
|
79
80
|
'font-weight': '300'
|
|
@@ -81,6 +82,16 @@ export class DynamicStyles {
|
|
|
81
82
|
subText: subTextStyles[this.currentIndex],
|
|
82
83
|
spacing: spacings[this.currentIndex]
|
|
83
84
|
};
|
|
85
|
+
if (this.isPdfExport) {
|
|
86
|
+
/* font-weight is not supported for offline PDF export and providing
|
|
87
|
+
* a specific value will cause the PDF to show a serif font instead */
|
|
88
|
+
style.value['font-weight'] = 'normal';
|
|
89
|
+
/* letter-spacing is also not supported and providing a specific
|
|
90
|
+
* value will cause misalignment issues in the PDF */
|
|
91
|
+
style.value['letter-spacing'] = 'normal';
|
|
92
|
+
style.subText['letter-spacing'] = 'normal';
|
|
93
|
+
}
|
|
94
|
+
return style;
|
|
84
95
|
}
|
|
85
96
|
next() {
|
|
86
97
|
if (this.currentIndex === valueStyles.length - 1) {
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { VIS_TYPE_SINGLE_VALUE } from '../../../../modules/visTypes.js';
|
|
2
|
+
import { getSingleValueBackgroundColor } from './customSVGOptions/singleValue/getSingleValueBackgroundColor.js';
|
|
2
3
|
import loadSingleValueSVG from './events/loadCustomSVG/singleValue/index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const DEFAULT_EXPORT_BACKGROUND_COLOR = '#ffffff';
|
|
5
|
+
const BASE_EXPORTING_CONFIG = {
|
|
6
|
+
// disable exporting context menu
|
|
7
|
+
enabled: false,
|
|
8
|
+
// use offline exporting only
|
|
9
|
+
fallbackToExportServer: false,
|
|
10
|
+
allowHTML: true,
|
|
11
|
+
showExportInProgress: true,
|
|
12
|
+
applyStyleSheets: true,
|
|
13
|
+
sourceHeight: 768,
|
|
14
|
+
sourceWidth: 1024,
|
|
15
|
+
scale: 1,
|
|
16
|
+
chartOptions: {
|
|
17
|
+
chart: {
|
|
18
|
+
backgroundColor: DEFAULT_EXPORT_BACKGROUND_COLOR
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export default function getExporting(layout, legendSets, series) {
|
|
23
|
+
if (layout.type === VIS_TYPE_SINGLE_VALUE) {
|
|
24
|
+
return {
|
|
25
|
+
...BASE_EXPORTING_CONFIG,
|
|
26
|
+
chartOptions: {
|
|
27
|
+
...BASE_EXPORTING_CONFIG.chartOptions,
|
|
28
|
+
chart: {
|
|
29
|
+
...BASE_EXPORTING_CONFIG.chartOptions.chart,
|
|
30
|
+
backgroundColor: getSingleValueBackgroundColor(layout.legend, legendSets, series[0], DEFAULT_EXPORT_BACKGROUND_COLOR),
|
|
31
|
+
events: {
|
|
32
|
+
load: loadSingleValueSVG
|
|
17
33
|
}
|
|
18
34
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return exporting;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
22
37
|
}
|
|
38
|
+
return BASE_EXPORTING_CONFIG;
|
|
23
39
|
}
|
|
@@ -97,7 +97,7 @@ export default function (_ref) {
|
|
|
97
97
|
enabled: false
|
|
98
98
|
},
|
|
99
99
|
// exporting
|
|
100
|
-
exporting: getExporting(_layout.
|
|
100
|
+
exporting: getExporting(_layout, _extraOptions.legendSets, series),
|
|
101
101
|
/* The config object passed to the Highcharts Chart constructor
|
|
102
102
|
* can contain arbitrary properties, which are made accessible
|
|
103
103
|
* under the Chart instance's `userOptions` member. This means
|
|
@@ -37,7 +37,8 @@ export default function (layout, metaData, extraOptions, series) {
|
|
|
37
37
|
const legendOptions = layout.legend;
|
|
38
38
|
const fontStyle = mergeFontStyleWithDefault(layout.fontStyle && layout.fontStyle[FONT_STYLE_VISUALIZATION_TITLE], FONT_STYLE_VISUALIZATION_TITLE);
|
|
39
39
|
const title = Object.assign({
|
|
40
|
-
text: undefined
|
|
40
|
+
text: undefined,
|
|
41
|
+
minScale: 1
|
|
41
42
|
}, dashboard ? DASHBOARD_TITLE_STYLE : {
|
|
42
43
|
margin: 30,
|
|
43
44
|
align: getTextAlignOption(fontStyle[FONT_STYLE_OPTION_TEXT_ALIGN], FONT_STYLE_VISUALIZATION_TITLE, isVerticalType(layout.type)),
|
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import H from 'highcharts';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import 'highcharts/highcharts-more';
|
|
3
|
+
import 'highcharts/modules/boost';
|
|
4
|
+
import 'highcharts/modules/exporting';
|
|
5
|
+
import 'highcharts/modules/no-data-to-display';
|
|
6
|
+
import 'highcharts/modules/offline-exporting';
|
|
7
|
+
import 'highcharts/modules/pattern-fill';
|
|
8
|
+
import 'highcharts/modules/solid-gauge';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
HB(H);
|
|
10
|
+
/* Whitelist some additional SVG attributes and tags here. Without this,
|
|
11
|
+
* the PDF export for the SingleValue visualization and charts in boost-mode
|
|
12
|
+
* breaks. For more info about the boost mode issue, see:
|
|
13
|
+
* https://github.com/highcharts/highcharts/issues/8333 */
|
|
14
|
+
H.AST.allowedTags.push('fedropshadow', 'image');
|
|
15
|
+
H.AST.allowedAttributes.push('transform-origin', 'preserveAspectRatio', 'fill-rule', 'clip-rule');
|
|
16
16
|
|
|
17
|
-
/*
|
|
18
|
-
*
|
|
19
|
-
|
|
17
|
+
/* This is a workaround for https://github.com/highcharts/highcharts/issues/22008
|
|
18
|
+
* We add some transparent text in a non-ASCII script to the chart to prevent
|
|
19
|
+
* the chart from being exported in a serif font */
|
|
20
|
+
H.addEvent(H.Chart, 'load', function () {
|
|
21
|
+
this.renderer.text('모', 20, 20).attr({
|
|
22
|
+
opacity: 0
|
|
23
|
+
}).add();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/* Workaround for https://github.com/highcharts/highcharts/issues/23049
|
|
27
|
+
* (there happen to be 10 colors and 10 patterns)*/
|
|
28
|
+
const {
|
|
29
|
+
colors
|
|
30
|
+
} = H.getOptions();
|
|
31
|
+
H.patterns.forEach((pattern, i) => {
|
|
32
|
+
pattern.color = colors[i];
|
|
33
|
+
});
|
|
20
34
|
function drawLegendSymbolWrap() {
|
|
21
35
|
const pick = H.pick;
|
|
22
36
|
H.wrap(H.seriesTypes.column.prototype, 'drawLegendSymbol', function (proceed, legend, item) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import H from 'highcharts';
|
|
2
|
-
import
|
|
3
|
-
HPF(H);
|
|
2
|
+
import 'highcharts/modules/pattern-fill';
|
|
4
3
|
export const COLOR_SET_DEFAULT = 'DEFAULT';
|
|
5
4
|
export const COLOR_SET_BASIC = 'BASIC';
|
|
6
5
|
export const COLOR_SET_EXTENDED = 'EXTENDED';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.0.1",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"crypto-js": "^4.2.0",
|
|
69
69
|
"d2-utilizr": "^0.2.16",
|
|
70
70
|
"d3-color": "^1.2.3",
|
|
71
|
-
"highcharts": "^
|
|
71
|
+
"highcharts": "^12.1.2",
|
|
72
72
|
"lodash": "^4.17.21",
|
|
73
73
|
"markdown-it": "^13.0.1",
|
|
74
74
|
"mathjs": "^9.4.2",
|
|
@@ -81,5 +81,6 @@
|
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
"build"
|
|
84
|
-
]
|
|
84
|
+
],
|
|
85
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
85
86
|
}
|