@flexem/fc-gui 3.0.0-alpha.90 → 3.0.0-alpha.92

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.
@@ -32,6 +32,8 @@ export declare class HistoricalCurveElement extends ConditionalDisplayElement {
32
32
  private elementStatus;
33
33
  private chartElement;
34
34
  private isMobileMode;
35
+ private data;
36
+ private timer;
35
37
  constructor(element: HTMLElement, injector: Injector, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, historyDataStore: HistoryDataStore, signalRAppId: string);
36
38
  dispose(): void;
37
39
  private getValidTimePeriods;
@@ -40,6 +42,7 @@ export declare class HistoricalCurveElement extends ConditionalDisplayElement {
40
42
  private reRenderElement;
41
43
  private renderElement;
42
44
  private renderChart;
45
+ initPoint(): void;
43
46
  private getLineChart;
44
47
  private getMultiBarWithFocusChart;
45
48
  private renderCommonProperty;
@@ -29,6 +29,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
29
29
  operationButtonMargin: 4
30
30
  };
31
31
  this.elementStatus = HistoricalCurveElementStatus.Loading;
32
+ this.data = [];
32
33
  this.logger = injector.get(LOGGER_SERVICE_TOKEN);
33
34
  this.localization = injector.get(LOCALIZATION);
34
35
  this.timePeriods = this.getValidTimePeriods();
@@ -140,6 +141,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
140
141
  each(result, v => values.push({ x: moment(v.time).local().toDate().valueOf(), y: v.values[key] }));
141
142
  data.push({ key: channel.name, area: channel.projectEnabled, values: values });
142
143
  });
144
+ this.data = data;
143
145
  nv.addGraph(() => {
144
146
  if (this.model.displaySetting.curveType === CurveType.BarGroup || this.model.displaySetting.curveType === CurveType.BarStack) {
145
147
  return this.getMultiBarWithFocusChart(chartWidth, chartHeight, data);
@@ -149,6 +151,44 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
149
151
  }
150
152
  });
151
153
  }
154
+ initPoint() {
155
+ try {
156
+ this.rootElement
157
+ .selectAll('.nv-scatterWrap')
158
+ .selectAll('.nv-point')
159
+ .style('stroke-opacity', 0)
160
+ .style('stroke-width', 0);
161
+ const legendList = this.rootElement
162
+ .selectAll('.nv-legend')
163
+ .selectAll('.nv-series');
164
+ let hiddenCount = 0;
165
+ for (let i = 0; i < this.data.length; i++) {
166
+ const channel = this.model.dataSetting.channels[i];
167
+ const pointStyle = `stroke-opacity: 1;stroke-width: 8px;stroke :${channel.pointColor}`;
168
+ if (legendList._groups[0][i].firstChild.style.fillOpacity === '1') {
169
+ const pointList = this.rootElement
170
+ .selectAll('.nv-scatterWrap')
171
+ .selectAll('.nv-series-' + (i - hiddenCount)).selectAll('.nv-point')._groups[0];
172
+ if (pointList && pointList.length) {
173
+ for (let j = 0; j < pointList.length; j++) {
174
+ if (j && $(pointList[j]).attr('transform').split(',')[1] !== $(pointList[j - 1]).attr('transform').split(',')[1]) {
175
+ if (channel.enablePoint && channel.pointColor) {
176
+ pointList[j].setAttribute('style', pointStyle);
177
+ pointList[j - 1].setAttribute('style', pointStyle);
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ else {
184
+ hiddenCount++;
185
+ }
186
+ }
187
+ }
188
+ catch (e) {
189
+ console.log(e);
190
+ }
191
+ }
152
192
  getLineChart(chartWidth, chartHeight, data) {
153
193
  const chart = nv.models.lineChart().showLegend(true)
154
194
  .margin({ top: 0, bottom: 0, left: this.displayOption.marginLeft, right: this.displayOption.marginRight })
@@ -164,6 +204,12 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
164
204
  }
165
205
  this.renderCommonProperty(chart, chartWidth, chartHeight, data);
166
206
  this.renderOperationArea(chartWidth, chartHeight);
207
+ this.initPoint();
208
+ chart.legend.dispatch.on('legendClick', () => {
209
+ setTimeout(() => {
210
+ this.initPoint();
211
+ }, 1);
212
+ });
167
213
  return chart;
168
214
  }
169
215
  getMultiBarWithFocusChart(chartWidth, chartHeight, data) {
@@ -207,6 +253,11 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
207
253
  chart.tooltip.headerFormatter(d => this.timeFormat(d, '%x %X'));
208
254
  if (this.model.displaySetting.showAxis) {
209
255
  chart.xAxis.showMaxMin(true).tickFormat(d => {
256
+ clearTimeout(this.timer);
257
+ this.timer = undefined;
258
+ this.timer = setTimeout(() => {
259
+ this.initPoint();
260
+ }, 1);
210
261
  if (this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
211
262
  return this.timeFormat(d, '%y-%m-%d');
212
263
  }
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":63,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":64,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":65,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":66,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":67,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":68,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"loadFirstPage":[{"__symbolic":"method"}],"loadNextPage":[{"__symbolic":"method"}],"loadPreviousPage":[{"__symbolic":"method"}],"loadLastPage":[{"__symbolic":"method"}],"initElementStatus":[{"__symbolic":"method"}],"updateElementStatus":[{"__symbolic":"method"}],"setStatusAsUnbound":[{"__symbolic":"method"}],"setStatusAsLoading":[{"__symbolic":"method"}],"setStatusAsLoadFailed":[{"__symbolic":"method"}],"renderStatus":[{"__symbolic":"method"}],"clearStatus":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":65,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":66,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":67,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":68,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":69,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":70,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"loadFirstPage":[{"__symbolic":"method"}],"loadNextPage":[{"__symbolic":"method"}],"loadPreviousPage":[{"__symbolic":"method"}],"loadLastPage":[{"__symbolic":"method"}],"initElementStatus":[{"__symbolic":"method"}],"updateElementStatus":[{"__symbolic":"method"}],"setStatusAsUnbound":[{"__symbolic":"method"}],"setStatusAsLoading":[{"__symbolic":"method"}],"setStatusAsLoadFailed":[{"__symbolic":"method"}],"renderStatus":[{"__symbolic":"method"}],"clearStatus":[{"__symbolic":"method"}]}}}}]
@@ -7,6 +7,14 @@ export interface HistroicalCurveChannelModel {
7
7
  * 连接线颜色
8
8
  */
9
9
  readonly connectorColor: string;
10
+ /**
11
+ * 启用标记点
12
+ */
13
+ readonly enablePoint: boolean;
14
+ /**
15
+ * 标记点颜色
16
+ */
17
+ readonly pointColor: string;
10
18
  /**
11
19
  * 是否投影颜色
12
20
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.90",
3
+ "version": "3.0.0-alpha.92",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",