@deephaven/chart 0.22.3-beta.18 → 0.22.3-beta.21

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/dist/Chart.js CHANGED
@@ -1,9 +1,6 @@
1
1
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
-
3
2
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
-
5
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
4
  import React, { Component } from 'react';
8
5
  import deepEqual from 'deep-equal';
9
6
  import memoize from 'memoize-one';
@@ -22,9 +19,9 @@ export class Chart extends Component {
22
19
  * @param faIcon The icon to convert
23
20
  */
24
21
  static convertIcon(faIcon) {
25
- var [width,,,, path] = faIcon.icon; // By default the icons are flipped upside down, so we need to add our own transform
22
+ var [width,,,, path] = faIcon.icon;
23
+ // By default the icons are flipped upside down, so we need to add our own transform
26
24
  // https://github.com/plotly/plotly.js/issues/1335
27
-
28
25
  var stringPath = "".concat(path);
29
26
  return {
30
27
  width,
@@ -34,52 +31,34 @@ export class Chart extends Component {
34
31
  transform: "matrix(1, 0, 0, 1, 0, 0)"
35
32
  };
36
33
  }
37
-
38
34
  static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {
39
35
  if (isDownsampleInProgress) {
40
36
  return 'Downsampling in progress...';
41
37
  }
42
-
43
38
  return isDownsamplingDisabled ? 'Downsampling disabled, click to enable' : 'Downsampling enabled, click to disable';
44
39
  }
45
-
46
40
  static downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled) {
47
41
  if (isDownsampleInProgress) {
48
42
  return 'animation-spin';
49
43
  }
50
-
51
44
  return isDownsamplingDisabled ? undefined : 'fill-active';
52
45
  }
53
-
54
46
  constructor(props) {
55
47
  super(props);
56
-
57
48
  _defineProperty(this, "currentSeries", void 0);
58
-
59
49
  _defineProperty(this, "plot", void 0);
60
-
61
50
  _defineProperty(this, "plotWrapper", void 0);
62
-
63
51
  _defineProperty(this, "columnFormats", void 0);
64
-
65
52
  _defineProperty(this, "dateTimeFormatterOptions", void 0);
66
-
67
53
  _defineProperty(this, "decimalFormatOptions", void 0);
68
-
69
54
  _defineProperty(this, "integerFormatOptions", void 0);
70
-
71
55
  _defineProperty(this, "rect", void 0);
72
-
73
56
  _defineProperty(this, "ranges", void 0);
74
-
75
57
  _defineProperty(this, "isSubscribed", void 0);
76
-
77
58
  _defineProperty(this, "isLoadedFired", void 0);
78
-
79
59
  _defineProperty(this, "getCachedConfig", memoize((downsamplingError, isDownsampleFinished, isDownsampleInProgress, isDownsamplingDisabled) => {
80
60
  var customButtons = [];
81
61
  var hasDownsampleError = Boolean(downsamplingError);
82
-
83
62
  if (hasDownsampleError) {
84
63
  customButtons.push({
85
64
  name: "Downsampling failed: ".concat(downsamplingError),
@@ -88,7 +67,6 @@ export class Chart extends Component {
88
67
  attr: 'fill-warning'
89
68
  });
90
69
  }
91
-
92
70
  if (isDownsampleFinished || isDownsampleInProgress || isDownsamplingDisabled || hasDownsampleError) {
93
71
  var name = Chart.downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled);
94
72
  var attr = Chart.downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled);
@@ -100,18 +78,17 @@ export class Chart extends Component {
100
78
  attr
101
79
  });
102
80
  }
103
-
104
81
  return {
105
82
  displaylogo: false,
106
83
  // Display the mode bar if there's an error or downsampling so user can see progress
107
84
  // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249
108
- displayModeBar: // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
85
+ displayModeBar:
86
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
109
87
  isDownsampleInProgress || hasDownsampleError ? true : 'hover',
110
88
  // Each array gets grouped together in the mode bar
111
89
  modeBarButtons: [customButtons, ['toImage'], ['zoom2d', 'pan2d'], ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d']]
112
90
  };
113
91
  }));
114
-
115
92
  this.handleAfterPlot = this.handleAfterPlot.bind(this);
116
93
  this.handleDownsampleClick = this.handleDownsampleClick.bind(this);
117
94
  this.handleModelEvent = this.handleModelEvent.bind(this);
@@ -139,7 +116,6 @@ export class Chart extends Component {
139
116
  revision: 0
140
117
  };
141
118
  }
142
-
143
119
  componentDidMount() {
144
120
  // Need to make sure the model dimensions are up to date before initializing the data
145
121
  this.updateDimensions();
@@ -149,19 +125,16 @@ export class Chart extends Component {
149
125
  var {
150
126
  isActive
151
127
  } = this.props;
152
-
153
128
  if (isActive) {
154
129
  this.subscribe();
155
130
  }
156
131
  }
157
-
158
132
  componentDidUpdate(prevProps) {
159
133
  var {
160
134
  isActive,
161
135
  settings
162
136
  } = this.props;
163
137
  this.updateFormatterSettings(settings);
164
-
165
138
  if (isActive !== prevProps.isActive) {
166
139
  if (isActive) {
167
140
  this.subscribe();
@@ -170,17 +143,13 @@ export class Chart extends Component {
170
143
  }
171
144
  }
172
145
  }
173
-
174
146
  componentWillUnmount() {
175
147
  this.unsubscribe();
176
148
  }
177
-
178
149
  getPlotRect() {
179
150
  var _this$plotWrapper$cur, _this$plotWrapper$cur2;
180
-
181
151
  return (_this$plotWrapper$cur = (_this$plotWrapper$cur2 = this.plotWrapper.current) === null || _this$plotWrapper$cur2 === void 0 ? void 0 : _this$plotWrapper$cur2.getBoundingClientRect()) !== null && _this$plotWrapper$cur !== void 0 ? _this$plotWrapper$cur : null;
182
152
  }
183
-
184
153
  initData() {
185
154
  var {
186
155
  model
@@ -193,42 +162,35 @@ export class Chart extends Component {
193
162
  layout: _objectSpread(_objectSpread({}, layout), model.getLayout())
194
163
  });
195
164
  }
196
-
197
165
  subscribe() {
198
166
  if (this.isSubscribed) {
199
167
  return;
200
168
  }
201
-
202
169
  var {
203
170
  model
204
171
  } = this.props;
205
-
206
172
  if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {
207
173
  log.debug2('Delaying subscription until model dimensions are set');
208
174
  return;
209
175
  }
210
-
211
176
  model.subscribe(this.handleModelEvent);
212
177
  this.isSubscribed = true;
213
178
  }
214
-
215
179
  unsubscribe() {
216
180
  if (!this.isSubscribed) {
217
181
  return;
218
182
  }
219
-
220
183
  var {
221
184
  model
222
185
  } = this.props;
223
186
  model.unsubscribe(this.handleModelEvent);
224
187
  this.isSubscribed = false;
225
188
  }
226
-
227
189
  handleAfterPlot() {
228
- if (this.plot.current != null) {// TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly
190
+ if (this.plot.current != null) {
191
+ // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly
229
192
  }
230
193
  }
231
-
232
194
  handleDownsampleClick() {
233
195
  this.setState(_ref => {
234
196
  var {
@@ -250,14 +212,12 @@ export class Chart extends Component {
250
212
  model.setDownsamplingDisabled(isDownsamplingDisabled);
251
213
  });
252
214
  }
253
-
254
215
  handleModelEvent(event) {
255
216
  var {
256
217
  type,
257
218
  detail
258
219
  } = event;
259
220
  log.debug2('Received data update', type, detail);
260
-
261
221
  switch (type) {
262
222
  case ChartModel.EVENT_UPDATED:
263
223
  {
@@ -267,11 +227,9 @@ export class Chart extends Component {
267
227
  layout,
268
228
  revision
269
229
  } = state;
270
-
271
230
  if (typeof layout.datarevision === 'number') {
272
231
  layout.datarevision += 1;
273
232
  }
274
-
275
233
  return {
276
234
  data: detail,
277
235
  layout,
@@ -286,21 +244,17 @@ export class Chart extends Component {
286
244
  });
287
245
  break;
288
246
  }
289
-
290
247
  case ChartModel.EVENT_LOADFINISHED:
291
248
  {
292
249
  var {
293
250
  onUpdate: _onUpdate
294
251
  } = this.props;
295
252
  this.isLoadedFired = true;
296
-
297
253
  _onUpdate({
298
254
  isLoading: false
299
255
  });
300
-
301
256
  break;
302
257
  }
303
-
304
258
  case ChartModel.EVENT_DISCONNECT:
305
259
  {
306
260
  var {
@@ -309,7 +263,6 @@ export class Chart extends Component {
309
263
  onDisconnect();
310
264
  break;
311
265
  }
312
-
313
266
  case ChartModel.EVENT_RECONNECT:
314
267
  {
315
268
  var {
@@ -318,7 +271,6 @@ export class Chart extends Component {
318
271
  onReconnect();
319
272
  break;
320
273
  }
321
-
322
274
  case ChartModel.EVENT_DOWNSAMPLESTARTED:
323
275
  {
324
276
  this.setState({
@@ -328,7 +280,6 @@ export class Chart extends Component {
328
280
  });
329
281
  break;
330
282
  }
331
-
332
283
  case ChartModel.EVENT_DOWNSAMPLEFINISHED:
333
284
  {
334
285
  this.setState({
@@ -338,12 +289,10 @@ export class Chart extends Component {
338
289
  });
339
290
  break;
340
291
  }
341
-
342
292
  case ChartModel.EVENT_DOWNSAMPLENEEDED:
343
293
  case ChartModel.EVENT_DOWNSAMPLEFAILED:
344
294
  {
345
295
  var _detail$message;
346
-
347
296
  var downsamplingError = (_detail$message = detail.message) !== null && _detail$message !== void 0 ? _detail$message : detail;
348
297
  this.setState({
349
298
  isDownsampleFinished: false,
@@ -357,12 +306,10 @@ export class Chart extends Component {
357
306
  onError(new Error(downsamplingError));
358
307
  break;
359
308
  }
360
-
361
309
  default:
362
310
  log.debug('Unknown event type', type, event);
363
311
  }
364
312
  }
365
-
366
313
  handlePlotUpdate(figure) {
367
314
  // User could have modified zoom/pan here, update the model dimensions
368
315
  // We don't need to update the datarevision, as we don't have any data changes
@@ -372,35 +319,29 @@ export class Chart extends Component {
372
319
  } = figure;
373
320
  var ranges = ChartUtils.getLayoutRanges(layout);
374
321
  var isRangesChanged = !deepEqual(ranges, this.ranges);
375
-
376
322
  if (isRangesChanged) {
377
323
  this.ranges = ranges;
378
324
  this.updateModelDimensions(true);
379
325
  }
380
326
  }
381
-
382
327
  handleRelayout(changes) {
383
328
  log.debug('handleRelayout', changes);
384
-
385
329
  if (changes.hiddenlabels != null) {
386
330
  var {
387
331
  onSettingsChanged
388
- } = this.props; // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes
332
+ } = this.props;
333
+ // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes
389
334
  // Series visibility for other types of charts is handled in handleRestyle
390
-
391
335
  var hiddenSeries = [...changes.hiddenlabels];
392
336
  onSettingsChanged({
393
337
  hiddenSeries
394
338
  });
395
339
  }
396
-
397
340
  this.updateModelDimensions();
398
341
  }
399
-
400
342
  handleRestyle(_ref2) {
401
343
  var [changes, seriesIndexes] = _ref2;
402
344
  log.debug('handleRestyle', changes, seriesIndexes);
403
-
404
345
  if (Object.keys(changes).includes('visible')) {
405
346
  var {
406
347
  data
@@ -408,7 +349,6 @@ export class Chart extends Component {
408
349
  var {
409
350
  onSettingsChanged
410
351
  } = this.props;
411
-
412
352
  if (data != null) {
413
353
  var hiddenSeries = data.reduce((acc, _ref3) => {
414
354
  var {
@@ -423,6 +363,7 @@ export class Chart extends Component {
423
363
  }
424
364
  }
425
365
  }
366
+
426
367
  /**
427
368
  * Update the models dimensions and ranges.
428
369
  * Note that this will update it all whether the plot size changes OR the range
@@ -431,40 +372,33 @@ export class Chart extends Component {
431
372
  * ChartModel API a bit cleaner.
432
373
  * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)
433
374
  */
434
-
435
-
436
375
  updateModelDimensions() {
437
376
  var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
438
377
  var rect = this.getPlotRect();
439
-
440
378
  if (!rect) {
441
379
  log.warn('Unable to get plotting rect');
442
380
  return;
443
381
  }
444
-
445
382
  var isRectChanged = !this.rect || this.rect.width !== rect.width || this.rect.height !== rect.height;
446
-
447
383
  if (isRectChanged || force) {
448
384
  this.rect = rect;
449
385
  var {
450
386
  isActive,
451
387
  model
452
388
  } = this.props;
453
- model.setDimensions(rect); // We may need to resubscribe if dimensions were too small before
454
-
389
+ model.setDimensions(rect);
390
+ // We may need to resubscribe if dimensions were too small before
455
391
  if (isActive) {
456
392
  this.subscribe();
457
393
  }
458
394
  }
459
395
  }
460
-
461
396
  initFormatter() {
462
397
  var {
463
398
  settings
464
399
  } = this.props;
465
400
  this.updateFormatterSettings(settings);
466
401
  }
467
-
468
402
  updateFormatterSettings(settings) {
469
403
  var columnFormats = FormatterUtils.getColumnFormats(settings);
470
404
  var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);
@@ -472,7 +406,6 @@ export class Chart extends Component {
472
406
  decimalFormatOptions = {},
473
407
  integerFormatOptions = {}
474
408
  } = settings;
475
-
476
409
  if (!deepEqual(this.columnFormats, columnFormats) || !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) || !deepEqual(this.decimalFormatOptions, decimalFormatOptions) || !deepEqual(this.integerFormatOptions, integerFormatOptions)) {
477
410
  this.columnFormats = FormatterUtils.getColumnFormats(settings);
478
411
  this.dateTimeFormatterOptions = dateTimeFormatterOptions;
@@ -481,7 +414,6 @@ export class Chart extends Component {
481
414
  this.updateFormatter();
482
415
  }
483
416
  }
484
-
485
417
  updateFormatter() {
486
418
  var formatter = new Formatter(this.columnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);
487
419
  var {
@@ -489,10 +421,8 @@ export class Chart extends Component {
489
421
  } = this.props;
490
422
  model.setFormatter(formatter);
491
423
  }
492
-
493
424
  updateDimensions() {
494
425
  var rect = this.getPlotRect();
495
-
496
426
  if (this.plot.current != null && rect != null && rect.width > 0 && rect.height > 0) {
497
427
  // Call relayout to resize avoiding the debouncing plotly does
498
428
  // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552
@@ -503,7 +433,6 @@ export class Chart extends Component {
503
433
  });
504
434
  }
505
435
  }
506
-
507
436
  render() {
508
437
  var {
509
438
  data,
@@ -537,9 +466,7 @@ export class Chart extends Component {
537
466
  }
538
467
  }));
539
468
  }
540
-
541
469
  }
542
-
543
470
  _defineProperty(Chart, "defaultProps", {
544
471
  isActive: true,
545
472
  settings: {
@@ -555,6 +482,5 @@ _defineProperty(Chart, "defaultProps", {
555
482
  onError: () => undefined,
556
483
  onSettingsChanged: () => undefined
557
484
  });
558
-
559
485
  export default Chart;
560
486
  //# sourceMappingURL=Chart.js.map
package/dist/Chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["React","Component","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","log","module","Chart","convertIcon","faIcon","width","path","icon","stringPath","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","downsamplingError","isDownsampleFinished","customButtons","hasDownsampleError","Boolean","push","name","click","attr","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","isSubscribed","isLoadedFired","currentSeries","state","data","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","subscribe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","getPlotRect","current","getBoundingClientRect","model","setState","getData","getLayout","rect","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","ranges","getLayoutRanges","isRangesChanged","changes","hiddenlabels","onSettingsChanged","hiddenSeries","seriesIndexes","Object","keys","includes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","error","timeZone","defaultDateTimeFormat","FULL_DATE_FORMAT","showTimeZone","showTSeparator"],"sources":["../src/Chart.tsx"],"sourcesContent":["import React, { Component, ReactElement, RefObject } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport {\n vsLoading,\n dhGraphLineDown,\n dhWarningFilled,\n IconDefinition,\n} from '@deephaven/icons';\nimport {\n Formatter,\n FormatterUtils,\n DateUtils,\n DateTimeColumnFormatterOptions,\n DecimalColumnFormatterOptions,\n IntegerColumnFormatterOptions,\n FormattingRule,\n ColumnFormatSettings,\n DateTimeFormatSettings,\n} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { Layout, Icon, PlotData } from 'plotly.js';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\nimport ChartModel from './ChartModel';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\ntype FormatterSettings = ColumnFormatSettings &\n DateTimeFormatSettings & {\n decimalFormatOptions?: DecimalColumnFormatterOptions;\n integerFormatOptions?: IntegerColumnFormatterOptions;\n };\n\ninterface ChartProps {\n model: ChartModel;\n settings: FormatterSettings;\n isActive: boolean;\n onDisconnect: () => void;\n onReconnect: () => void;\n onUpdate: (obj: { isLoading: boolean }) => void;\n onError: (error: Error) => void;\n onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;\n}\n\ninterface ChartState {\n data: Partial<PlotData>[] | null;\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n layout: Partial<Layout>;\n revision: number;\n}\n\nexport class Chart extends Component<ChartProps, ChartState> {\n static defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n onDisconnect: (): void => undefined,\n onReconnect: (): void => undefined,\n onUpdate: (): void => undefined,\n onError: (): void => undefined,\n onSettingsChanged: (): void => undefined,\n };\n\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon: IconDefinition): Icon {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n const stringPath = `${path}`;\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n\n return isDownsamplingDisabled\n ? 'Downsampling disabled, click to enable'\n : 'Downsampling enabled, click to disable';\n }\n\n static downsampleButtonAttr(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string | undefined {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props: ChartProps) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount(): void {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount(): void {\n this.unsubscribe();\n }\n\n currentSeries: number;\n\n plot: RefObject<typeof Plot>;\n\n plotWrapper: RefObject<HTMLDivElement>;\n\n columnFormats?: FormattingRule[];\n\n dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;\n\n decimalFormatOptions: DecimalColumnFormatterOptions;\n\n integerFormatOptions: IntegerColumnFormatterOptions;\n\n rect?: DOMRect;\n\n ranges?: unknown;\n\n isSubscribed: boolean;\n\n isLoadedFired: boolean;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ) => {\n const customButtons = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n hasDownsampleError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const attr = Chart.downsampleButtonAttr(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'],\n ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect(): DOMRect | null {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData(): void {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe(): void {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe(): void {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot(): void {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick(): void {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event: CustomEvent): void {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ?? detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: { layout: Layout }): void {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes: { hiddenlabels?: string[] }): void {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: [\n Record<string, unknown>,\n number[]\n ]): void {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n if (data != null) {\n const hiddenSeries = data.reduce(\n (acc: string[], { name, visible }) =>\n name != null && visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false): void {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter(): void {\n const { settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n }\n\n updateFormatterSettings(settings: FormatterSettings): void {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter(): void {\n const formatter = new Formatter(\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(\n (e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n }\n );\n }\n }\n\n render(): ReactElement {\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <Plot\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onError={log.error}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nexport default Chart;\n"],"mappings":";;;;;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;AAbX,C;;AAsgBxB,eAAed,KAAf"}
1
+ {"version":3,"file":"Chart.js","names":["React","Component","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","log","module","Chart","convertIcon","faIcon","width","path","icon","stringPath","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","downsamplingError","isDownsampleFinished","customButtons","hasDownsampleError","Boolean","push","name","click","attr","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","isSubscribed","isLoadedFired","currentSeries","state","data","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","subscribe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","getPlotRect","current","getBoundingClientRect","model","setState","getData","getLayout","rect","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","ranges","getLayoutRanges","isRangesChanged","changes","hiddenlabels","onSettingsChanged","hiddenSeries","seriesIndexes","Object","keys","includes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","error","timeZone","defaultDateTimeFormat","FULL_DATE_FORMAT","showTimeZone","showTSeparator"],"sources":["../src/Chart.tsx"],"sourcesContent":["import React, { Component, ReactElement, RefObject } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport {\n vsLoading,\n dhGraphLineDown,\n dhWarningFilled,\n IconDefinition,\n} from '@deephaven/icons';\nimport {\n Formatter,\n FormatterUtils,\n DateUtils,\n DateTimeColumnFormatterOptions,\n DecimalColumnFormatterOptions,\n IntegerColumnFormatterOptions,\n FormattingRule,\n ColumnFormatSettings,\n DateTimeFormatSettings,\n} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { Layout, Icon, PlotData } from 'plotly.js';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\nimport ChartModel from './ChartModel';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\ntype FormatterSettings = ColumnFormatSettings &\n DateTimeFormatSettings & {\n decimalFormatOptions?: DecimalColumnFormatterOptions;\n integerFormatOptions?: IntegerColumnFormatterOptions;\n };\n\ninterface ChartProps {\n model: ChartModel;\n settings: FormatterSettings;\n isActive: boolean;\n onDisconnect: () => void;\n onReconnect: () => void;\n onUpdate: (obj: { isLoading: boolean }) => void;\n onError: (error: Error) => void;\n onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;\n}\n\ninterface ChartState {\n data: Partial<PlotData>[] | null;\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n layout: Partial<Layout>;\n revision: number;\n}\n\nexport class Chart extends Component<ChartProps, ChartState> {\n static defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n onDisconnect: (): void => undefined,\n onReconnect: (): void => undefined,\n onUpdate: (): void => undefined,\n onError: (): void => undefined,\n onSettingsChanged: (): void => undefined,\n };\n\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon: IconDefinition): Icon {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n const stringPath = `${path}`;\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n\n return isDownsamplingDisabled\n ? 'Downsampling disabled, click to enable'\n : 'Downsampling enabled, click to disable';\n }\n\n static downsampleButtonAttr(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string | undefined {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props: ChartProps) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount(): void {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount(): void {\n this.unsubscribe();\n }\n\n currentSeries: number;\n\n plot: RefObject<typeof Plot>;\n\n plotWrapper: RefObject<HTMLDivElement>;\n\n columnFormats?: FormattingRule[];\n\n dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;\n\n decimalFormatOptions: DecimalColumnFormatterOptions;\n\n integerFormatOptions: IntegerColumnFormatterOptions;\n\n rect?: DOMRect;\n\n ranges?: unknown;\n\n isSubscribed: boolean;\n\n isLoadedFired: boolean;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ) => {\n const customButtons = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n hasDownsampleError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const attr = Chart.downsampleButtonAttr(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'],\n ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect(): DOMRect | null {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData(): void {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe(): void {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe(): void {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot(): void {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick(): void {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event: CustomEvent): void {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ?? detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: { layout: Layout }): void {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes: { hiddenlabels?: string[] }): void {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: [\n Record<string, unknown>,\n number[]\n ]): void {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n if (data != null) {\n const hiddenSeries = data.reduce(\n (acc: string[], { name, visible }) =>\n name != null && visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false): void {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter(): void {\n const { settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n }\n\n updateFormatterSettings(settings: FormatterSettings): void {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter(): void {\n const formatter = new Formatter(\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(\n (e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n }\n );\n }\n }\n\n render(): ReactElement {\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <Plot\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onError={log.error}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nexport default Chart;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAiC,OAAO;AACjE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,aAAa;AACjC,SACEC,SAAS,EACTC,eAAe,EACfC,eAAe,QAEV,kBAAkB;AACzB,SACEC,SAAS,EACTC,cAAc,EACdC,SAAS,QAOJ,wBAAwB;AAC/B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAE1BC,MAAM;AAAA,OACNC,IAAI;AAAA,OACJC,UAAU;AAAA,OACVC,UAAU;AAAA;AAGjB,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,OAAO,CAAC;AA6B/B,OAAO,MAAMC,KAAK,SAAShB,SA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