@flexem/fc-gui 3.0.0-alpha.32 → 3.0.0-alpha.36
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 +10 -0
- package/bundles/@flexem/fc-gui.umd.js +83 -7
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +4 -4
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/air-quality/air-quality-element.js +3 -3
- package/elements/historical-curve/historical-curve.element.js +80 -4
- package/package.json +1 -1
|
@@ -40,9 +40,9 @@ export class AirQualityElement extends ConditionalDisplayElement {
|
|
|
40
40
|
this.buildBackgroudRect(airQualitySvg, backgroundColor);
|
|
41
41
|
this.buildLocGroup(airQualitySvg, airQuality.city, fontColor);
|
|
42
42
|
this.buildAirQualityText(airQualitySvg, 130, 55, airQuality.aqi, fontColor, 53);
|
|
43
|
-
this.buildAirQualityText(airQualitySvg,
|
|
43
|
+
this.buildAirQualityText(airQualitySvg, 220, 28, '空气质量', fontColor);
|
|
44
44
|
this.buildRectBackgroundForAqi(airQualitySvg, airQuality.level);
|
|
45
|
-
this.buildAirQualityText(airQualitySvg,
|
|
45
|
+
this.buildAirQualityText(airQualitySvg, 220, 49, airQuality.category, fontColor);
|
|
46
46
|
this.buildAirQualityText(airQualitySvg, 30, 75, 'PM2.5', fontColor, 12, 0.8);
|
|
47
47
|
this.buildAirQualityText(airQualitySvg, 30, 95, airQuality.pm25, fontColor, 15);
|
|
48
48
|
this.buildAirQualityText(airQualitySvg, 80, 75, 'PM10', fontColor, 12, 0.8);
|
|
@@ -105,7 +105,7 @@ export class AirQualityElement extends ConditionalDisplayElement {
|
|
|
105
105
|
backgroundColor = '#A10E0E';
|
|
106
106
|
}
|
|
107
107
|
airQualitySvg.append('rect')
|
|
108
|
-
.attr('x', '
|
|
108
|
+
.attr('x', '195')
|
|
109
109
|
.attr('y', '35')
|
|
110
110
|
.attr('rx', '5')
|
|
111
111
|
.attr('width', '50')
|
|
@@ -22,7 +22,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
22
22
|
marginRight: 20,
|
|
23
23
|
mobileMinWidth: 450,
|
|
24
24
|
operationAreaHeight: 32,
|
|
25
|
-
operationAreaMarginTop:
|
|
25
|
+
operationAreaMarginTop: 25,
|
|
26
26
|
operationSelectFontSize: '16px',
|
|
27
27
|
operationButtonWidth: 24,
|
|
28
28
|
operationButtonHeight: 24,
|
|
@@ -39,7 +39,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
39
39
|
}, this.model.displaySetting.refreshInterval * 1000);
|
|
40
40
|
this.isMobileMode = DisplayMode.Mobile === injector.get(GlobalSettings).displayMode;
|
|
41
41
|
if (this.isMobileMode) {
|
|
42
|
-
this.displayOption.operationAreaMarginTop =
|
|
42
|
+
this.displayOption.operationAreaMarginTop = 35;
|
|
43
43
|
if (this.model.displaySetting.size.width >= this.displayOption.mobileMinWidth) {
|
|
44
44
|
this.displayOption.operationAreaHeight = 68;
|
|
45
45
|
this.displayOption.operationSelectFontSize = '24px';
|
|
@@ -205,7 +205,12 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
205
205
|
renderCommonProperty(chart, chartWidth, chartHeight, data) {
|
|
206
206
|
chart.tooltip.headerFormatter(d => this.timeFormat(d, '%x %X'));
|
|
207
207
|
if (this.model.displaySetting.showAxis) {
|
|
208
|
-
chart.xAxis.showMaxMin(true).tickFormat(d =>
|
|
208
|
+
chart.xAxis.showMaxMin(true).tickFormat(d => {
|
|
209
|
+
if (this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
|
|
210
|
+
return this.timeFormat(d, '%y-%m-%d');
|
|
211
|
+
}
|
|
212
|
+
return this.timeFormat(Number(d), '%X');
|
|
213
|
+
});
|
|
209
214
|
if (this.model.displaySetting.axisSetting) {
|
|
210
215
|
if (this.model.displaySetting.axisSetting.showAxisLabel && this.model.displaySetting.axisSetting.axisLabelFont) {
|
|
211
216
|
chart.xAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize);
|
|
@@ -230,15 +235,86 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
230
235
|
chart.update();
|
|
231
236
|
this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
|
|
232
237
|
});
|
|
238
|
+
const fontSize = this.model.displaySetting.axisSetting.axisLabelFont.fontSize;
|
|
233
239
|
this.rootElement.selectAll('.domain').style('stroke-opacity', 1);
|
|
234
240
|
if (this.model.displaySetting.showAxis && this.model.displaySetting.axisSetting) {
|
|
235
241
|
const axisColor = this.model.displaySetting.axisSetting.axisColor;
|
|
236
242
|
this.rootElement.selectAll('.domain').style('stroke', axisColor);
|
|
237
243
|
if (this.model.displaySetting.axisSetting.showAxisLabel) {
|
|
238
|
-
const fontSize = this.model.displaySetting.axisSetting.axisLabelFont.fontSize;
|
|
239
244
|
this.rootElement.selectAll('.nv-axisMaxMin').select('text').style('font-size', fontSize);
|
|
240
245
|
}
|
|
241
246
|
}
|
|
247
|
+
const self = this;
|
|
248
|
+
if (self.currentTimePeriod === 3 || self.currentTimePeriod === 4 || self.currentTimePeriod === 5) {
|
|
249
|
+
this.rootElement
|
|
250
|
+
.selectAll('.nv-x')
|
|
251
|
+
.selectAll('.tick')
|
|
252
|
+
.selectAll('text')
|
|
253
|
+
.data(function (d) {
|
|
254
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
255
|
+
})
|
|
256
|
+
.enter()
|
|
257
|
+
.append('text')
|
|
258
|
+
.attr('class', 'full-date')
|
|
259
|
+
.attr('x', 0)
|
|
260
|
+
.attr('y', 0)
|
|
261
|
+
.attr('dy', '2.3em')
|
|
262
|
+
.style('text-anchor', 'middle')
|
|
263
|
+
.style('font-size', fontSize)
|
|
264
|
+
.text((d) => d);
|
|
265
|
+
this.rootElement
|
|
266
|
+
.selectAll('.nv-axisMaxMin-x')
|
|
267
|
+
.selectAll('text')
|
|
268
|
+
.data(function (d) {
|
|
269
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
270
|
+
})
|
|
271
|
+
.enter()
|
|
272
|
+
.append('text')
|
|
273
|
+
.attr('class', 'full-date')
|
|
274
|
+
.attr('x', 0)
|
|
275
|
+
.attr('y', 0)
|
|
276
|
+
.attr('dy', '2.3em')
|
|
277
|
+
.style('text-anchor', 'middle')
|
|
278
|
+
.style('font-size', fontSize)
|
|
279
|
+
.text((d) => d);
|
|
280
|
+
const h = this.rootElement
|
|
281
|
+
.selectAll('.nv-focusWrap')
|
|
282
|
+
.attr('transform')
|
|
283
|
+
.slice(0, -1)
|
|
284
|
+
.split(',')[1];
|
|
285
|
+
this.rootElement
|
|
286
|
+
.selectAll('.nv-focusWrap')
|
|
287
|
+
.attr('transform', `translate(0,${Number(h) + 15})`);
|
|
288
|
+
const resizeObserver = new window.MutationObserver(() => {
|
|
289
|
+
this.rootElement
|
|
290
|
+
.selectAll('.nv-x')
|
|
291
|
+
.selectAll('.tick')
|
|
292
|
+
.selectAll('.full-date')
|
|
293
|
+
.remove();
|
|
294
|
+
this.rootElement
|
|
295
|
+
.selectAll('.nv-x')
|
|
296
|
+
.selectAll('.tick')
|
|
297
|
+
.selectAll('text')
|
|
298
|
+
.data(function (d) {
|
|
299
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
300
|
+
})
|
|
301
|
+
.enter()
|
|
302
|
+
.append('text')
|
|
303
|
+
.attr('class', 'full-date')
|
|
304
|
+
.attr('x', 0)
|
|
305
|
+
.attr('y', 0)
|
|
306
|
+
.attr('dy', '2.3em')
|
|
307
|
+
.style('text-anchor', 'middle')
|
|
308
|
+
.style('font-size', fontSize)
|
|
309
|
+
.text((d) => d);
|
|
310
|
+
});
|
|
311
|
+
resizeObserver.observe(document.getElementsByClassName('extent')[0], { attributes: true });
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
this.rootElement
|
|
315
|
+
.selectAll('.full-date')
|
|
316
|
+
.remove();
|
|
317
|
+
}
|
|
242
318
|
}
|
|
243
319
|
renderOperationArea(chartWidth, chartHeight) {
|
|
244
320
|
const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop})`)
|