@deephaven/chart 0.15.5-vite.12 → 0.15.5

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.d.ts CHANGED
@@ -1,32 +1,76 @@
1
- export class Chart extends React.Component<any, any, any> {
1
+ import { Component, ReactElement, RefObject } from 'react';
2
+ import { IconDefinition } from '@deephaven/icons';
3
+ import { DateTimeColumnFormatterOptions, DecimalColumnFormatterOptions, IntegerColumnFormatterOptions, FormattingRule } from '@deephaven/jsapi-utils';
4
+ import { WorkspaceSettings } from '@deephaven/redux';
5
+ import { Layout, Icon } from 'plotly.js';
6
+ import Plot from './plotly/Plot';
7
+ import ChartModel from './ChartModel';
8
+ import './Chart.scss';
9
+ interface ChartProps {
10
+ model: ChartModel;
11
+ settings: Partial<WorkspaceSettings>;
12
+ isActive: boolean;
13
+ onDisconnect: () => void;
14
+ onReconnect: () => void;
15
+ onUpdate: (obj: {
16
+ isLoading: boolean;
17
+ }) => void;
18
+ onError: (error: Error) => void;
19
+ onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;
20
+ }
21
+ interface ChartModelSettings {
22
+ hiddenSeries: string[];
23
+ }
24
+ interface ChartState {
25
+ data: {
26
+ name: string;
27
+ visible: string;
28
+ }[] | null;
29
+ downsamplingError: unknown;
30
+ isDownsampleFinished: boolean;
31
+ isDownsampleInProgress: boolean;
32
+ isDownsamplingDisabled: boolean;
33
+ layout: {
34
+ datarevision: number;
35
+ };
36
+ revision: number;
37
+ }
38
+ export declare class Chart extends Component<ChartProps, ChartState> {
39
+ static defaultProps: {
40
+ isActive: boolean;
41
+ settings: {
42
+ timeZone: string;
43
+ defaultDateTimeFormat: string;
44
+ showTimeZone: boolean;
45
+ showTSeparator: boolean;
46
+ formatter: never[];
47
+ };
48
+ onDisconnect: () => void;
49
+ onReconnect: () => void;
50
+ onUpdate: () => void;
51
+ onError: () => void;
52
+ onSettingsChanged: () => void;
53
+ };
2
54
  /**
3
55
  * Convert a font awesome icon definition to a plotly icon definition
4
- * @param {FontAwesome.IconDefinition} faIcon The icon to convert
56
+ * @param faIcon The icon to convert
5
57
  */
6
- static convertIcon(faIcon: FontAwesome.IconDefinition): {
7
- width: any;
8
- path: any;
9
- ascent: any;
10
- descent: number;
11
- transform: string;
12
- };
13
- static downsampleButtonTitle(isDownsampleInProgress: any, isDownsamplingDisabled: any): "Downsampling in progress..." | "Downsampling disabled, click to enable" | "Downsampling enabled, click to disable";
14
- static downsampleButtonAttr(isDownsampleInProgress: any, isDownsamplingDisabled: any): "animation-spin" | "fill-active" | undefined;
15
- constructor(props: any);
16
- handleAfterPlot(): void;
17
- handleDownsampleClick(): void;
18
- handleModelEvent(event: any): void;
19
- handlePlotUpdate(figure: any): void;
20
- handleRelayout(changes: any): void;
21
- handleRestyle([changes, seriesIndexes]: [any, any]): void;
22
- plot: React.RefObject<any>;
23
- plotWrapper: React.RefObject<any>;
24
- columnFormats: any[];
25
- dateTimeFormatterOptions: {};
26
- decimalFormatOptions: {};
27
- integerFormatOptions: {};
28
- rect: any;
29
- ranges: object | null;
58
+ static convertIcon(faIcon: IconDefinition): Icon;
59
+ static downsampleButtonTitle(isDownsampleInProgress: boolean, isDownsamplingDisabled: boolean): string;
60
+ static downsampleButtonAttr(isDownsampleInProgress: boolean, isDownsamplingDisabled: boolean): string | undefined;
61
+ constructor(props: ChartProps);
62
+ componentDidMount(): void;
63
+ componentDidUpdate(prevProps: ChartProps): void;
64
+ componentWillUnmount(): void;
65
+ currentSeries: number;
66
+ plot: RefObject<typeof Plot>;
67
+ plotWrapper: RefObject<HTMLDivElement>;
68
+ columnFormats?: FormattingRule[];
69
+ dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;
70
+ decimalFormatOptions: DecimalColumnFormatterOptions;
71
+ integerFormatOptions: IntegerColumnFormatterOptions;
72
+ rect?: DOMRect;
73
+ ranges?: unknown;
30
74
  isSubscribed: boolean;
31
75
  isLoadedFired: boolean;
32
76
  getCachedConfig: (this: any, downsamplingError: any, isDownsampleFinished: any, isDownsampleInProgress: any, isDownsamplingDisabled: any) => {
@@ -34,21 +78,28 @@ export class Chart extends React.Component<any, any, any> {
34
78
  displayModeBar: string | boolean;
35
79
  modeBarButtons: (string[] | {
36
80
  name: string;
37
- icon: {
38
- width: any;
39
- path: any;
40
- ascent: any;
41
- descent: number;
42
- transform: string;
43
- };
81
+ icon: Icon;
44
82
  click: () => void;
45
83
  attr: string | undefined;
46
84
  }[])[];
47
85
  };
48
- getPlotRect(): any;
86
+ getPlotRect(): DOMRect | null;
49
87
  initData(): void;
50
88
  subscribe(): void;
51
89
  unsubscribe(): void;
90
+ handleAfterPlot(): void;
91
+ handleDownsampleClick(): void;
92
+ handleModelEvent(event: CustomEvent): void;
93
+ handlePlotUpdate(figure: {
94
+ layout: Layout;
95
+ }): void;
96
+ handleRelayout(changes: {
97
+ hiddenlabels?: string[];
98
+ }): void;
99
+ handleRestyle([changes, seriesIndexes]: [
100
+ Record<string, unknown>,
101
+ number[]
102
+ ]): void;
52
103
  /**
53
104
  * Update the models dimensions and ranges.
54
105
  * Note that this will update it all whether the plot size changes OR the range
@@ -59,58 +110,13 @@ export class Chart extends React.Component<any, any, any> {
59
110
  */
60
111
  updateModelDimensions(force?: boolean): void;
61
112
  initFormatter(): void;
62
- updateFormatterSettings(settings: any): void;
113
+ updateFormatterSettings(settings: Partial<WorkspaceSettings> & {
114
+ decimalFormatOptions: DecimalColumnFormatterOptions;
115
+ integerFormatOptions: IntegerColumnFormatterOptions;
116
+ }): void;
63
117
  updateFormatter(): void;
64
118
  updateDimensions(): void;
65
- }
66
- export namespace Chart {
67
- namespace propTypes {
68
- const model: PropTypes.Validator<ChartModel>;
69
- const settings: PropTypes.Requireable<PropTypes.InferProps<{
70
- timeZone: PropTypes.Validator<string>;
71
- defaultDateTimeFormat: PropTypes.Validator<string>;
72
- showTimeZone: PropTypes.Validator<boolean>;
73
- showTSeparator: PropTypes.Validator<boolean>;
74
- formatter: PropTypes.Validator<(PropTypes.InferProps<{}> | null | undefined)[]>;
75
- decimalFormatOptions: PropTypes.Requireable<PropTypes.InferProps<{
76
- defaultFormatString: PropTypes.Requireable<string>;
77
- }>>;
78
- integerFormatOptions: PropTypes.Requireable<PropTypes.InferProps<{
79
- defaultFormatString: PropTypes.Requireable<string>;
80
- }>>;
81
- }>>;
82
- const isActive: PropTypes.Requireable<boolean>;
83
- const onDisconnect: PropTypes.Requireable<(...args: any[]) => any>;
84
- const onReconnect: PropTypes.Requireable<(...args: any[]) => any>;
85
- const onUpdate: PropTypes.Requireable<(...args: any[]) => any>;
86
- const onError: PropTypes.Requireable<(...args: any[]) => any>;
87
- const onSettingsChanged: PropTypes.Requireable<(...args: any[]) => any>;
88
- }
89
- namespace defaultProps {
90
- const isActive_1: boolean;
91
- export { isActive_1 as isActive };
92
- export namespace settings_1 {
93
- const timeZone: string;
94
- const defaultDateTimeFormat: string;
95
- const showTimeZone: boolean;
96
- const showTSeparator: boolean;
97
- const formatter: never[];
98
- }
99
- export { settings_1 as settings };
100
- export function onDisconnect_1(): void;
101
- export { onDisconnect_1 as onDisconnect };
102
- export function onReconnect_1(): void;
103
- export { onReconnect_1 as onReconnect };
104
- export function onUpdate_1(): void;
105
- export { onUpdate_1 as onUpdate };
106
- export function onError_1(): void;
107
- export { onError_1 as onError };
108
- export function onSettingsChanged_1(): void;
109
- export { onSettingsChanged_1 as onSettingsChanged };
110
- }
119
+ render(): ReactElement;
111
120
  }
112
121
  export default Chart;
113
- import React from "react";
114
- import ChartModel from "./ChartModel";
115
- import PropTypes from "prop-types";
116
122
  //# sourceMappingURL=Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.jsx"],"names":[],"mappings":"AAgBA;IACE;;;OAGG;IACH;;;;;;MAWC;IAED,4MAQC;IAED,oIAMC;IAED,wBAgCC;IAqID,wBAIC;IAED,8BAcC;IAED,mCAsEC;IAED,oCAcC;IAED,mCAWC;IAED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kBxB,MAAM,IAAI,YAAY;CAsCvB;AAED,eAAe,KAAK,CAAC"}
package/dist/Chart.js CHANGED
@@ -5,7 +5,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  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
6
 
7
7
  import React, { Component } from 'react';
8
- import PropTypes from 'prop-types';
9
8
  import deepEqual from 'deep-equal';
10
9
  import memoize from 'memoize-one';
11
10
  import { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';
@@ -20,15 +19,16 @@ var log = Log.module('Chart');
20
19
  export class Chart extends Component {
21
20
  /**
22
21
  * Convert a font awesome icon definition to a plotly icon definition
23
- * @param {FontAwesome.IconDefinition} faIcon The icon to convert
22
+ * @param faIcon The icon to convert
24
23
  */
25
24
  static convertIcon(faIcon) {
26
25
  var [width,,,, path] = faIcon.icon; // By default the icons are flipped upside down, so we need to add our own transform
27
26
  // https://github.com/plotly/plotly.js/issues/1335
28
27
 
28
+ var stringPath = "".concat(path);
29
29
  return {
30
30
  width,
31
- path,
31
+ path: stringPath,
32
32
  ascent: width,
33
33
  descent: 0,
34
34
  transform: "matrix(1, 0, 0, 1, 0, 0)"
@@ -54,13 +54,35 @@ export class Chart extends Component {
54
54
  constructor(props) {
55
55
  super(props);
56
56
 
57
+ _defineProperty(this, "currentSeries", void 0);
58
+
59
+ _defineProperty(this, "plot", void 0);
60
+
61
+ _defineProperty(this, "plotWrapper", void 0);
62
+
63
+ _defineProperty(this, "columnFormats", void 0);
64
+
65
+ _defineProperty(this, "dateTimeFormatterOptions", void 0);
66
+
67
+ _defineProperty(this, "decimalFormatOptions", void 0);
68
+
69
+ _defineProperty(this, "integerFormatOptions", void 0);
70
+
71
+ _defineProperty(this, "rect", void 0);
72
+
73
+ _defineProperty(this, "ranges", void 0);
74
+
75
+ _defineProperty(this, "isSubscribed", void 0);
76
+
77
+ _defineProperty(this, "isLoadedFired", void 0);
78
+
57
79
  _defineProperty(this, "getCachedConfig", memoize((downsamplingError, isDownsampleFinished, isDownsampleInProgress, isDownsamplingDisabled) => {
58
80
  var customButtons = [];
59
81
 
60
82
  if (downsamplingError) {
61
83
  customButtons.push({
62
84
  name: "Downsampling failed: ".concat(downsamplingError),
63
- click: () => {},
85
+ click: () => undefined,
64
86
  icon: Chart.convertIcon(dhWarningFilled),
65
87
  attr: 'fill-warning'
66
88
  });
@@ -100,10 +122,9 @@ export class Chart extends Component {
100
122
  this.dateTimeFormatterOptions = {};
101
123
  this.decimalFormatOptions = {};
102
124
  this.integerFormatOptions = {};
103
- this.rect = null;
104
- this.ranges = null;
105
125
  this.isSubscribed = false;
106
126
  this.isLoadedFired = false;
127
+ this.currentSeries = 0;
107
128
  this.state = {
108
129
  data: null,
109
130
  downsamplingError: null,
@@ -353,7 +374,7 @@ export class Chart extends Component {
353
374
  handleRelayout(changes) {
354
375
  log.debug('handleRelayout', changes);
355
376
 
356
- if (Object.keys(changes).includes('hiddenlabels')) {
377
+ if (changes.hiddenlabels != null) {
357
378
  var {
358
379
  onSettingsChanged
359
380
  } = this.props; // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes
@@ -379,16 +400,19 @@ export class Chart extends Component {
379
400
  var {
380
401
  onSettingsChanged
381
402
  } = this.props;
382
- var hiddenSeries = data.reduce((acc, _ref3) => {
383
- var {
384
- name,
385
- visible
386
- } = _ref3;
387
- return visible === 'legendonly' ? [...acc, name] : acc;
388
- }, []);
389
- onSettingsChanged({
390
- hiddenSeries
391
- });
403
+
404
+ if (data != null) {
405
+ var hiddenSeries = data.reduce((acc, _ref3) => {
406
+ var {
407
+ name,
408
+ visible
409
+ } = _ref3;
410
+ return visible === 'legendonly' ? [...acc, name] : acc;
411
+ }, []);
412
+ onSettingsChanged({
413
+ hiddenSeries
414
+ });
415
+ }
392
416
  }
393
417
  }
394
418
  /**
@@ -507,30 +531,8 @@ export class Chart extends Component {
507
531
  }
508
532
 
509
533
  }
510
- Chart.propTypes = {
511
- model: PropTypes.instanceOf(ChartModel).isRequired,
512
- // These settings come from the redux store
513
- settings: PropTypes.shape({
514
- timeZone: PropTypes.string.isRequired,
515
- defaultDateTimeFormat: PropTypes.string.isRequired,
516
- showTimeZone: PropTypes.bool.isRequired,
517
- showTSeparator: PropTypes.bool.isRequired,
518
- formatter: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
519
- decimalFormatOptions: PropTypes.shape({
520
- defaultFormatString: PropTypes.string
521
- }),
522
- integerFormatOptions: PropTypes.shape({
523
- defaultFormatString: PropTypes.string
524
- })
525
- }),
526
- isActive: PropTypes.bool,
527
- onDisconnect: PropTypes.func,
528
- onReconnect: PropTypes.func,
529
- onUpdate: PropTypes.func,
530
- onError: PropTypes.func,
531
- onSettingsChanged: PropTypes.func
532
- };
533
- Chart.defaultProps = {
534
+
535
+ _defineProperty(Chart, "defaultProps", {
534
536
  isActive: true,
535
537
  settings: {
536
538
  timeZone: 'America/New_York',
@@ -539,11 +541,12 @@ Chart.defaultProps = {
539
541
  showTSeparator: true,
540
542
  formatter: []
541
543
  },
542
- onDisconnect: () => {},
543
- onReconnect: () => {},
544
- onUpdate: () => {},
545
- onError: () => {},
546
- onSettingsChanged: () => {}
547
- };
544
+ onDisconnect: () => undefined,
545
+ onReconnect: () => undefined,
546
+ onUpdate: () => undefined,
547
+ onError: () => undefined,
548
+ onSettingsChanged: () => undefined
549
+ });
550
+
548
551
  export default Chart;
549
552
  //# sourceMappingURL=Chart.js.map
package/dist/Chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["React","Component","PropTypes","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","log","module","Chart","convertIcon","faIcon","width","path","icon","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","downsamplingError","isDownsampleFinished","customButtons","push","name","click","attr","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","rect","ranges","isSubscribed","isLoadedFired","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","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","currentSeries","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","getLayoutRanges","isRangesChanged","changes","Object","keys","includes","onSettingsChanged","hiddenSeries","hiddenlabels","seriesIndexes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","error","propTypes","instanceOf","isRequired","shape","timeZone","string","defaultDateTimeFormat","showTimeZone","bool","showTSeparator","arrayOf","defaultFormatString","func","defaultProps","FULL_DATE_FORMAT"],"sources":["../src/Chart.jsx"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';\nimport { Formatter, FormatterUtils, DateUtils } from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\n\nimport ChartModel from './ChartModel';\nimport ChartUtils from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\nexport class Chart extends Component {\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param {FontAwesome.IconDefinition} faIcon The icon to convert\n */\n static convertIcon(faIcon) {\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 return {\n width,\n path,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {\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(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props) {\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.rect = null;\n this.ranges = null;\n this.isSubscribed = false;\n this.isLoadedFired = false;\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() {\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) {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount() {\n this.unsubscribe();\n }\n\n getCachedConfig = memoize(\n (\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n ) => {\n const customButtons = [];\n if (downsamplingError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => {},\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n downsamplingError\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 isDownsampleInProgress || downsamplingError ? 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() {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData() {\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() {\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() {\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() {\n if (this.plot.current) {\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() {\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) {\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 layout.datarevision += 1;\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.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) {\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) {\n log.debug('handleRelayout', changes);\n if (Object.keys(changes).includes('hiddenlabels')) {\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 log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n const hiddenSeries = data.reduce(\n (acc, { name, visible }) =>\n visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\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 {boolean} force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false) {\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() {\n const { settings } = this.props;\n this.updateFormatterSettings(settings);\n }\n\n updateFormatterSettings(settings) {\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() {\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() {\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(e => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n\n render() {\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\nChart.propTypes = {\n model: PropTypes.instanceOf(ChartModel).isRequired,\n // These settings come from the redux store\n settings: PropTypes.shape({\n timeZone: PropTypes.string.isRequired,\n defaultDateTimeFormat: PropTypes.string.isRequired,\n showTimeZone: PropTypes.bool.isRequired,\n showTSeparator: PropTypes.bool.isRequired,\n formatter: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n decimalFormatOptions: PropTypes.shape({\n defaultFormatString: PropTypes.string,\n }),\n integerFormatOptions: PropTypes.shape({\n defaultFormatString: PropTypes.string,\n }),\n }),\n isActive: PropTypes.bool,\n onDisconnect: PropTypes.func,\n onReconnect: PropTypes.func,\n onUpdate: PropTypes.func,\n onError: PropTypes.func,\n onSettingsChanged: PropTypes.func,\n};\n\nChart.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: () => {},\n onReconnect: () => {},\n onUpdate: () => {},\n onError: () => {},\n onSettingsChanged: () => {},\n};\n\nexport default Chart;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,SAASC,SAAT,EAAoBC,eAApB,EAAqCC,eAArC,QAA4D,kBAA5D;AACA,SAASC,SAAT,EAAoBC,cAApB,EAAoCC,SA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;EAmBhB5D,QAAQ,EAAE7F,SAAS,CAACyJ,IAnBJ;EAoBhBhD,OAAO,EAAEzG,SAAS,CAACyJ,IApBH;EAqBhBtC,iBAAiB,EAAEnH,SAAS,CAACyJ;AArBb,CAAlB;AAwBAzI,KAAK,CAAC0I,YAAN,GAAqB;EACnBpF,QAAQ,EAAE,IADS;EAEnBI,QAAQ,EAAE;IACRuE,QAAQ,EAAE,kBADF;IAERE,qBAAqB,EAAE3I,SAAS,CAACmJ,gBAFzB;IAGRP,YAAY,EAAE,KAHN;IAIRE,cAAc,EAAE,IAJR;IAKRrB,SAAS,EAAE;EALH,CAFS;EASnBhC,YAAY,EAAE,MAAM,CAAE,CATH;EAUnBE,WAAW,EAAE,MAAM,CAAE,CAVF;EAWnBN,QAAQ,EAAE,MAAM,CAAE,CAXC;EAYnBY,OAAO,EAAE,MAAM,CAAE,CAZE;EAanBU,iBAAiB,EAAE,MAAM,CAAE;AAbR,CAArB;AAgBA,eAAenG,KAAf"}
1
+ {"version":3,"sources":["../src/Chart.tsx"],"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","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"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAA0D,OAA1D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,SACEC,SADF,EAEEC,eAFF,EAGEC,eAHF,QAKO,kBALP;AAMA,SACEC,SADF,EAEEC,cAFF,EAGEC,SAHF,QAQO,wBARP;AASA,OAAOC,GAAP,MAAgB,gBAAhB;OAGOC,M;OACAC,I;OAEAC,U;OACAC,U;;AAGP,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,OAAX,CAAZ;AAmCA,OAAO,MAAMC,KAAN,SAAoBhB,SAApB,CAAsD;AAiB3D;AACF;AACA;AACA;AACoB,SAAXiB,WAAW,CAACC,MAAD,EAA+B;AAC/C,QAAM,CAACC,KAAD,KAAcC,IAAd,IAAsBF,MAAM,CAACG,IAAnC,CAD+C,CAE/C;AACA;;AACA,QAAMC,UAAU,aAAMF,IAAN,CAAhB;AACA,WAAO;AACLD,MAAAA,KADK;AAELC,MAAAA,IAAI,EAAEE,UAFD;AAGLC,MAAAA,MAAM,EAAEJ,KAHH;AAILK,MAAAA,OAAO,EAA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AAAA,SAAS,EAAE;AALH,GAFU;AASpBjC,EAAAA,YAAY,EAAE,MAAYnE,SATN;AAUpBqE,EAAAA,WAAW,EAAE,MAAYrE,SAVL;AAWpB+D,EAAAA,QAAQ,EAAE,MAAY/D,SAXF;AAYpB2E,EAAAA,OAAO,EAAE,MAAY3E,SAZD;AAapBoF,EAAAA,iBAAiB,EAAE,MAAYpF;AAbX,C;;AAugBxB,eAAed,KAAf","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} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { WorkspaceSettings } from '@deephaven/redux';\nimport { Layout, Icon } from 'plotly.js';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\n\nimport ChartModel from './ChartModel';\nimport ChartUtils from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\ntype FormatterSettings = Partial<WorkspaceSettings> & {\n decimalFormatOptions: DecimalColumnFormatterOptions;\n integerFormatOptions: IntegerColumnFormatterOptions;\n};\n\ninterface ChartProps {\n model: ChartModel;\n // These settings come from the redux store\n settings: Partial<WorkspaceSettings>;\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 ChartModelSettings {\n hiddenSeries: string[];\n}\n\ninterface ChartState {\n data: { name: string; visible: string }[] | null;\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n layout: {\n datarevision: number;\n };\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,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n ) => {\n const customButtons = [];\n if (downsamplingError) {\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 downsamplingError\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 isDownsampleInProgress || downsamplingError ? 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) {\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 layout.datarevision += 1;\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.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 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 {boolean} 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(\n settings: Partial<WorkspaceSettings> & {\n decimalFormatOptions: DecimalColumnFormatterOptions;\n integerFormatOptions: IntegerColumnFormatterOptions;\n }\n ): 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"],"file":"Chart.js"}
@@ -1,4 +1,6 @@
1
- export default ChartModel;
1
+ import { Column } from '@deephaven/jsapi-shim';
2
+ import { Formatter } from '@deephaven/jsapi-utils';
3
+ declare type ChartEvent = CustomEvent;
2
4
  /**
3
5
  * Model for a Chart
4
6
  * All of these methods should return very quickly.
@@ -13,24 +15,28 @@ declare class ChartModel {
13
15
  static EVENT_DOWNSAMPLEFAILED: string;
14
16
  static EVENT_DOWNSAMPLENEEDED: string;
15
17
  static EVENT_LOADFINISHED: string;
16
- listeners: any[];
17
- formatter: any;
18
- rect: DOMRect | null;
18
+ constructor();
19
+ listeners: ((event: ChartEvent) => void)[];
20
+ formatter?: Formatter;
21
+ rect?: DOMRect;
19
22
  isDownsamplingDisabled: boolean;
20
- title: any;
21
- getData(): never[];
23
+ title?: string;
24
+ getData(): {
25
+ name: string;
26
+ visible: string;
27
+ }[];
22
28
  getDefaultTitle(): string;
23
- getLayout(): {};
24
- getFilterColumnMap(): Map<any, any>;
29
+ getLayout(): Record<string, unknown>;
30
+ getFilterColumnMap(): Map<string, Column>;
25
31
  isFilterRequired(): boolean;
26
- setFilter(): void;
32
+ setFilter(filter: Map<string, string>): void;
27
33
  /**
28
34
  * Close this model, clean up any underlying subscriptions
29
35
  */
30
36
  close(): void;
31
37
  /**
32
38
  * Set the formatter to use when charting the data.
33
- * @param {Formatter} formatter The formatter to use to format the charting data
39
+ * @param formatter The formatter to use to format the charting data
34
40
  */
35
41
  setFormatter(formatter: Formatter): void;
36
42
  /**
@@ -43,21 +49,22 @@ declare class ChartModel {
43
49
  * @param {DOMRect} rect The bounding rectangle of the plot
44
50
  */
45
51
  setDimensions(rect: DOMRect): void;
46
- setTitle(title: any): void;
52
+ setTitle(title: string): void;
47
53
  /**
48
54
  * Subscribe to this ChartModel and start listening for all events.
49
55
  * @param {Function<Event>} callback Callback when an event occurs
50
56
  */
51
- subscribe(callback: Function): void;
52
- unsubscribe(callback: any): void;
53
- fireEvent(event: any): void;
54
- fireUpdate(data: any): void;
57
+ subscribe(callback: (event: ChartEvent) => void): void;
58
+ unsubscribe(callback: (event: ChartEvent) => void): void;
59
+ fireEvent(event: ChartEvent): void;
60
+ fireUpdate(data: unknown): void;
55
61
  fireDisconnect(): void;
56
62
  fireReconnect(): void;
57
- fireDownsampleStart(detail: any): void;
58
- fireDownsampleFinish(detail: any): void;
59
- fireDownsampleFail(detail: any): void;
60
- fireDownsampleNeeded(detail: any): void;
63
+ fireDownsampleStart(detail: unknown): void;
64
+ fireDownsampleFinish(detail: unknown): void;
65
+ fireDownsampleFail(detail: unknown): void;
66
+ fireDownsampleNeeded(detail: unknown): void;
61
67
  fireLoadFinished(): void;
62
68
  }
69
+ export default ChartModel;
63
70
  //# sourceMappingURL=ChartModel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartModel.d.ts","sourceRoot":"","sources":["../src/ChartModel.js"],"names":[],"mappings":";AAEA;;;;GAIG;AACH;IACE,6BAAkD;IAElD,gCAAwD;IAExD,+BAAsD;IAEtD,uCAAsE;IAEtE,wCAAwE;IAExE,sCAAoE;IAEpE,sCAAoE;IAEpE,kCAA4D;IAG1D,iBAAmB;IACnB,eAAqB;IACrB,qBAAgB;IAChB,gCAAmC;IACnC,WAAiB;IAGnB,mBAEC;IAED,0BAEC;IAED,gBAEC;IAED,oCAEC;IAED,4BAEC;IAED,kBAAc;IAEd;;OAEG;IACH,cAAU;IAEV;;;OAGG;IACH,yCAEC;IAED;;;OAGG;IACH,gDAFW,OAAO,QAIjB;IAED;;;OAGG;IACH,oBAFW,OAAO,QAIjB;IAED,2BAEC;IAED;;;OAGG;IACH,oCAEC;IAED,iCAEC;IAED,4BAIC;IAED,4BAEC;IAED,uBAEC;IAED,sBAEC;IAED,uCAIC;IAED,wCAIC;IAED,sCAIC;IAED,wCAIC;IAED,yBAEC;CACF"}
1
+ {"version":3,"file":"ChartModel.d.ts","sourceRoot":"","sources":["../src/ChartModel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,aAAK,UAAU,GAAG,WAAW,CAAC;AAC9B;;;;GAIG;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