@deephaven/chart 0.63.1-express-memory-fix.2 → 0.64.1-beta.0
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 +8 -98
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +56 -25
- package/dist/Chart.js.map +1 -1
- package/dist/ChartModelFactory.d.ts +2 -5
- package/dist/ChartModelFactory.d.ts.map +1 -1
- package/dist/ChartModelFactory.js +4 -6
- package/dist/ChartModelFactory.js.map +1 -1
- package/dist/ChartTestUtils.d.ts +6 -6
- package/dist/ChartTestUtils.d.ts.map +1 -1
- package/dist/ChartTestUtils.js.map +1 -1
- package/dist/ChartUtils.d.ts +20 -16
- package/dist/ChartUtils.d.ts.map +1 -1
- package/dist/ChartUtils.js +99 -70
- package/dist/ChartUtils.js.map +1 -1
- package/dist/FigureChartModel.d.ts +1 -4
- package/dist/FigureChartModel.d.ts.map +1 -1
- package/dist/FigureChartModel.js +7 -15
- package/dist/FigureChartModel.js.map +1 -1
- package/dist/MockChartModel.d.ts.map +1 -1
- package/dist/MockChartModel.js +9 -7
- package/dist/MockChartModel.js.map +1 -1
- package/dist/plotly/plotly-extends.d.js +6 -0
- package/dist/plotly/plotly-extends.d.js.map +1 -0
- package/package.json +11 -11
package/dist/Chart.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import { DateTimeColumnFormatterOptions, DecimalColumnFormatterOptions, IntegerColumnFormatterOptions, FormattingRule, ColumnFormatSettings, DateTimeFormatSettings } from '@deephaven/jsapi-utils';
|
|
4
|
-
import { Config as PlotlyConfig, Layout, Icon, Data } from 'plotly.js';
|
|
5
|
-
import type { PlotParams } from 'react-plotly.js';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DecimalColumnFormatterOptions, IntegerColumnFormatterOptions, ColumnFormatSettings, DateTimeFormatSettings } from '@deephaven/jsapi-utils';
|
|
6
3
|
import Plotly from './plotly/Plotly';
|
|
7
4
|
import ChartModel from './ChartModel';
|
|
5
|
+
import { ChartTheme } from './ChartTheme';
|
|
8
6
|
import { ChartModelSettings } from './ChartUtils';
|
|
9
7
|
import './Chart.scss';
|
|
10
8
|
type FormatterSettings = ColumnFormatSettings & DateTimeFormatSettings & {
|
|
@@ -13,6 +11,7 @@ type FormatterSettings = ColumnFormatSettings & DateTimeFormatSettings & {
|
|
|
13
11
|
};
|
|
14
12
|
interface ChartProps {
|
|
15
13
|
model: ChartModel;
|
|
14
|
+
theme: ChartTheme;
|
|
16
15
|
settings: FormatterSettings;
|
|
17
16
|
isActive: boolean;
|
|
18
17
|
Plotly: typeof Plotly;
|
|
@@ -25,98 +24,9 @@ interface ChartProps {
|
|
|
25
24
|
onError: (error: Error) => void;
|
|
26
25
|
onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;
|
|
27
26
|
}
|
|
28
|
-
interface
|
|
29
|
-
|
|
30
|
-
/** An error specific to downsampling */
|
|
31
|
-
downsamplingError: unknown;
|
|
32
|
-
isDownsampleFinished: boolean;
|
|
33
|
-
isDownsampleInProgress: boolean;
|
|
34
|
-
isDownsamplingDisabled: boolean;
|
|
35
|
-
/** Any other kind of error */
|
|
36
|
-
error: unknown;
|
|
37
|
-
shownError: string | null;
|
|
38
|
-
layout: Partial<Layout>;
|
|
39
|
-
revision: number;
|
|
40
|
-
}
|
|
41
|
-
export declare class Chart extends Component<ChartProps, ChartState> {
|
|
42
|
-
static defaultProps: {
|
|
43
|
-
isActive: boolean;
|
|
44
|
-
settings: {
|
|
45
|
-
timeZone: string;
|
|
46
|
-
defaultDateTimeFormat: string;
|
|
47
|
-
showTimeZone: boolean;
|
|
48
|
-
showTSeparator: boolean;
|
|
49
|
-
formatter: never[];
|
|
50
|
-
};
|
|
51
|
-
Plotly: typeof Plotly;
|
|
52
|
-
onDisconnect: () => void;
|
|
53
|
-
onReconnect: () => void;
|
|
54
|
-
onUpdate: () => void;
|
|
55
|
-
onError: () => void;
|
|
56
|
-
onSettingsChanged: () => void;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Convert a font awesome icon definition to a plotly icon definition
|
|
60
|
-
* @param faIcon The icon to convert
|
|
61
|
-
*/
|
|
62
|
-
static convertIcon(faIcon: IconDefinition): Icon;
|
|
63
|
-
static downsampleButtonTitle(isDownsampleInProgress: boolean, isDownsamplingDisabled: boolean): string;
|
|
64
|
-
static downsampleButtonAttr(isDownsampleInProgress: boolean, isDownsamplingDisabled: boolean): string | undefined;
|
|
65
|
-
constructor(props: ChartProps);
|
|
66
|
-
componentDidMount(): void;
|
|
67
|
-
componentDidUpdate(prevProps: ChartProps): void;
|
|
68
|
-
componentWillUnmount(): void;
|
|
69
|
-
currentSeries: number;
|
|
70
|
-
PlotComponent: React.ComponentType<PlotParams>;
|
|
71
|
-
plot: RefObject<typeof this.PlotComponent>;
|
|
72
|
-
plotWrapper: RefObject<HTMLDivElement>;
|
|
73
|
-
columnFormats?: FormattingRule[];
|
|
74
|
-
dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;
|
|
75
|
-
decimalFormatOptions: DecimalColumnFormatterOptions;
|
|
76
|
-
integerFormatOptions: IntegerColumnFormatterOptions;
|
|
77
|
-
rect?: DOMRect;
|
|
78
|
-
ranges?: unknown;
|
|
79
|
-
isSubscribed: boolean;
|
|
80
|
-
isLoadedFired: boolean;
|
|
81
|
-
resizeObserver: ResizeObserver;
|
|
82
|
-
getCachedConfig: (downsamplingError: unknown, isDownsampleFinished: boolean, isDownsampleInProgress: boolean, isDownsamplingDisabled: boolean, data: Partial<Data>[], error: unknown) => Partial<PlotlyConfig>;
|
|
83
|
-
getPlotRect(): DOMRect | null;
|
|
84
|
-
initData(): void;
|
|
85
|
-
subscribe(model: ChartModel): void;
|
|
86
|
-
unsubscribe(model: ChartModel): void;
|
|
87
|
-
handleAfterPlot(): void;
|
|
88
|
-
handleDownsampleClick(): void;
|
|
89
|
-
handleErrorClose(): void;
|
|
90
|
-
handleModelEvent(event: CustomEvent): void;
|
|
91
|
-
handlePlotUpdate(figure: Readonly<{
|
|
92
|
-
layout: Partial<Layout>;
|
|
93
|
-
}>): void;
|
|
94
|
-
handleRelayout(changes: {
|
|
95
|
-
hiddenlabels?: string[];
|
|
96
|
-
}): void;
|
|
97
|
-
handleResize(): void;
|
|
98
|
-
handleRestyle([changes, seriesIndexes]: readonly [
|
|
99
|
-
Record<string, unknown>,
|
|
100
|
-
number[]
|
|
101
|
-
]): void;
|
|
102
|
-
/**
|
|
103
|
-
* Toggle the error message. If it is already being displayed, then hide it.
|
|
104
|
-
*/
|
|
105
|
-
toggleErrorMessage(error: string): void;
|
|
106
|
-
/**
|
|
107
|
-
* Update the models dimensions and ranges.
|
|
108
|
-
* Note that this will update it all whether the plot size changes OR the range
|
|
109
|
-
* the user is looking at has changed (eg. panning/zooming).
|
|
110
|
-
* Could update each independently, but doing them at the same time keeps the
|
|
111
|
-
* ChartModel API a bit cleaner.
|
|
112
|
-
* @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)
|
|
113
|
-
*/
|
|
114
|
-
updateModelDimensions(force?: boolean): void;
|
|
115
|
-
initFormatter(): void;
|
|
116
|
-
updateFormatterSettings(settings: FormatterSettings): void;
|
|
117
|
-
updateFormatter(): void;
|
|
118
|
-
updateDimensions(): void;
|
|
119
|
-
render(): ReactElement;
|
|
27
|
+
interface ChartContainerProps extends Partial<Omit<ChartProps, 'theme'>> {
|
|
28
|
+
model: ChartModel;
|
|
120
29
|
}
|
|
121
|
-
export default
|
|
30
|
+
export default function ChartContainer(props: ChartContainerProps): JSX.Element;
|
|
31
|
+
export {};
|
|
122
32
|
//# sourceMappingURL=Chart.d.ts.map
|
package/dist/Chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"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AAM,CAAC,OAAO,UAAU,cAAc,CACpC,KAAK,EAAE,mBAAmB,GACzB,GAAG,CAAC,OAAO,CAIb"}
|
package/dist/Chart.js
CHANGED
|
@@ -10,17 +10,22 @@ import { CopyButton, Popper } from '@deephaven/components';
|
|
|
10
10
|
import { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';
|
|
11
11
|
import { Formatter, FormatterUtils, DateUtils } from '@deephaven/jsapi-utils';
|
|
12
12
|
import Log from '@deephaven/log';
|
|
13
|
+
import { bindAllMethods } from '@deephaven/utils';
|
|
13
14
|
import createPlotlyComponent from "./plotly/createPlotlyComponent.js";
|
|
14
15
|
import Plotly from "./plotly/Plotly.js";
|
|
15
16
|
import ChartModel from "./ChartModel.js";
|
|
16
17
|
import ChartUtils from "./ChartUtils.js";
|
|
17
18
|
import "./Chart.css";
|
|
18
19
|
import DownsamplingError from "./DownsamplingError.js";
|
|
20
|
+
import useChartTheme from "./useChartTheme.js";
|
|
19
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
22
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
24
|
var log = Log.module('Chart');
|
|
23
|
-
|
|
25
|
+
|
|
26
|
+
// All of the ChartProps have default values except for model in the Chart
|
|
27
|
+
// component, hence the Partial here.
|
|
28
|
+
class Chart extends Component {
|
|
24
29
|
/**
|
|
25
30
|
* Convert a font awesome icon definition to a plotly icon definition
|
|
26
31
|
* @param faIcon The icon to convert
|
|
@@ -131,14 +136,7 @@ export class Chart extends Component {
|
|
|
131
136
|
[...(has2D ? buttons2D : []), ...(has3D ? buttons3D : [])]]
|
|
132
137
|
};
|
|
133
138
|
}));
|
|
134
|
-
|
|
135
|
-
this.handleDownsampleClick = this.handleDownsampleClick.bind(this);
|
|
136
|
-
this.handleErrorClose = this.handleErrorClose.bind(this);
|
|
137
|
-
this.handleModelEvent = this.handleModelEvent.bind(this);
|
|
138
|
-
this.handlePlotUpdate = this.handlePlotUpdate.bind(this);
|
|
139
|
-
this.handleRelayout = this.handleRelayout.bind(this);
|
|
140
|
-
this.handleResize = this.handleResize.bind(this);
|
|
141
|
-
this.handleRestyle = this.handleRestyle.bind(this);
|
|
139
|
+
bindAllMethods(this);
|
|
142
140
|
this.PlotComponent = createPlotlyComponent(props.Plotly);
|
|
143
141
|
this.plot = /*#__PURE__*/React.createRef();
|
|
144
142
|
this.plotWrapper = (_props$containerRef = props.containerRef) !== null && _props$containerRef !== void 0 ? _props$containerRef : /*#__PURE__*/React.createRef();
|
|
@@ -180,12 +178,14 @@ export class Chart extends Component {
|
|
|
180
178
|
if (this.plotWrapper.current != null) {
|
|
181
179
|
this.resizeObserver.observe(this.plotWrapper.current);
|
|
182
180
|
}
|
|
181
|
+
this.handleThemeChange();
|
|
183
182
|
}
|
|
184
183
|
componentDidUpdate(prevProps) {
|
|
185
184
|
var {
|
|
186
185
|
isActive,
|
|
187
186
|
model,
|
|
188
|
-
settings
|
|
187
|
+
settings,
|
|
188
|
+
theme
|
|
189
189
|
} = this.props;
|
|
190
190
|
this.updateFormatterSettings(settings);
|
|
191
191
|
if (model !== prevProps.model) {
|
|
@@ -200,6 +200,9 @@ export class Chart extends Component {
|
|
|
200
200
|
this.unsubscribe(model);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
if (theme !== prevProps.theme) {
|
|
204
|
+
this.handleThemeChange();
|
|
205
|
+
}
|
|
203
206
|
}
|
|
204
207
|
componentWillUnmount() {
|
|
205
208
|
var {
|
|
@@ -219,12 +222,14 @@ export class Chart extends Component {
|
|
|
219
222
|
var {
|
|
220
223
|
model
|
|
221
224
|
} = this.props;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
this.setState(_ref3 => {
|
|
226
|
+
var {
|
|
227
|
+
layout
|
|
228
|
+
} = _ref3;
|
|
229
|
+
return {
|
|
230
|
+
data: model.getData(),
|
|
231
|
+
layout: _objectSpread(_objectSpread({}, layout), model.getLayout())
|
|
232
|
+
};
|
|
228
233
|
});
|
|
229
234
|
}
|
|
230
235
|
subscribe(model) {
|
|
@@ -251,10 +256,10 @@ export class Chart extends Component {
|
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
258
|
handleDownsampleClick() {
|
|
254
|
-
this.setState(
|
|
259
|
+
this.setState(_ref4 => {
|
|
255
260
|
var {
|
|
256
261
|
isDownsamplingDisabled
|
|
257
|
-
} =
|
|
262
|
+
} = _ref4;
|
|
258
263
|
return {
|
|
259
264
|
downsamplingError: null,
|
|
260
265
|
isDownsampleInProgress: false,
|
|
@@ -418,8 +423,8 @@ export class Chart extends Component {
|
|
|
418
423
|
handleResize() {
|
|
419
424
|
this.updateDimensions();
|
|
420
425
|
}
|
|
421
|
-
handleRestyle(
|
|
422
|
-
var [changes, seriesIndexes] =
|
|
426
|
+
handleRestyle(_ref5) {
|
|
427
|
+
var [changes, seriesIndexes] = _ref5;
|
|
423
428
|
log.debug('handleRestyle', changes, seriesIndexes);
|
|
424
429
|
if (Object.keys(changes).includes('visible')) {
|
|
425
430
|
var {
|
|
@@ -429,11 +434,11 @@ export class Chart extends Component {
|
|
|
429
434
|
onSettingsChanged
|
|
430
435
|
} = this.props;
|
|
431
436
|
if (data != null) {
|
|
432
|
-
var hiddenSeries = data.reduce((acc,
|
|
437
|
+
var hiddenSeries = data.reduce((acc, _ref6) => {
|
|
433
438
|
var {
|
|
434
439
|
name,
|
|
435
440
|
visible
|
|
436
|
-
} =
|
|
441
|
+
} = _ref6;
|
|
437
442
|
return name != null && visible === 'legendonly' ? [...acc, name] : acc;
|
|
438
443
|
}, []);
|
|
439
444
|
onSettingsChanged({
|
|
@@ -442,15 +447,35 @@ export class Chart extends Component {
|
|
|
442
447
|
}
|
|
443
448
|
}
|
|
444
449
|
}
|
|
450
|
+
handleThemeChange() {
|
|
451
|
+
var {
|
|
452
|
+
theme,
|
|
453
|
+
model
|
|
454
|
+
} = this.props;
|
|
455
|
+
var {
|
|
456
|
+
dh
|
|
457
|
+
} = model;
|
|
458
|
+
var chartUtils = new ChartUtils(dh);
|
|
459
|
+
this.setState(_ref7 => {
|
|
460
|
+
var {
|
|
461
|
+
layout
|
|
462
|
+
} = _ref7;
|
|
463
|
+
return {
|
|
464
|
+
layout: _objectSpread(_objectSpread({}, layout), {}, {
|
|
465
|
+
template: chartUtils.makeDefaultTemplate(theme)
|
|
466
|
+
})
|
|
467
|
+
};
|
|
468
|
+
});
|
|
469
|
+
}
|
|
445
470
|
|
|
446
471
|
/**
|
|
447
472
|
* Toggle the error message. If it is already being displayed, then hide it.
|
|
448
473
|
*/
|
|
449
474
|
toggleErrorMessage(error) {
|
|
450
|
-
this.setState(
|
|
475
|
+
this.setState(_ref8 => {
|
|
451
476
|
var {
|
|
452
477
|
shownError
|
|
453
|
-
} =
|
|
478
|
+
} = _ref8;
|
|
454
479
|
return {
|
|
455
480
|
shownError: shownError === error ? null : error
|
|
456
481
|
};
|
|
@@ -607,5 +632,11 @@ _defineProperty(Chart, "defaultProps", {
|
|
|
607
632
|
onError: () => undefined,
|
|
608
633
|
onSettingsChanged: () => undefined
|
|
609
634
|
});
|
|
610
|
-
export default
|
|
635
|
+
export default function ChartContainer(props) {
|
|
636
|
+
var chartTheme = useChartTheme();
|
|
637
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
638
|
+
return /*#__PURE__*/_jsx(Chart, _objectSpread(_objectSpread({}, props), {}, {
|
|
639
|
+
theme: chartTheme
|
|
640
|
+
}));
|
|
641
|
+
}
|
|
611
642
|
//# sourceMappingURL=Chart.js.map
|
package/dist/Chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["React","Component","deepEqual","memoize","CopyButton","Popper","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","createPlotlyComponent","Plotly","ChartModel","ChartUtils","DownsamplingError","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","Chart","convertIcon","faIcon","width","path","icon","stringPath","concat","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","_props$containerRef","_defineProperty","downsamplingError","isDownsampleFinished","data","error","customButtons","hasDownsampleError","Boolean","push","name","title","click","toggleErrorMessage","attr","hasError","handleDownsampleClick","has2D","some","_ref","type","includes","has3D","_ref2","buttons2D","buttons3D","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleErrorClose","handleModelEvent","handlePlotUpdate","handleRelayout","handleResize","handleRestyle","PlotComponent","plot","createRef","plotWrapper","containerRef","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","isSubscribed","isLoadedFired","currentSeries","resizeObserver","window","ResizeObserver","state","shownError","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","model","subscribe","current","observe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","disconnect","getPlotRect","_this$plotWrapper$cur","_this$plotWrapper$cur2","getBoundingClientRect","setState","getData","_objectSpread","getLayout","rect","height","debug2","_ref3","setDownsamplingDisabled","event","detail","EVENT_UPDATED","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","_detail$message","message","onError","EVENT_ERROR","Error","debug","figure","ranges","getLayoutRanges","isRangesChanged","changes","hiddenlabels","onSettingsChanged","hiddenSeries","_ref4","seriesIndexes","Object","keys","reduce","acc","_ref5","visible","_ref6","force","arguments","length","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","dh","setFormatter","PlotlyProp","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","className","ref","children","onAfterPlot","onRelayout","onRestyle","useResizeHandler","style","options","placement","isShown","onExited","closeOnBlur","interactive","tooltip","copy","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 { CopyButton, Popper } from '@deephaven/components';\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 {\n Config as PlotlyConfig,\n Layout,\n Icon,\n Data,\n PlotData,\n ModeBarButtonAny,\n} from 'plotly.js';\nimport type { PlotParams } from 'react-plotly.js';\nimport createPlotlyComponent from './plotly/createPlotlyComponent';\nimport Plotly from './plotly/Plotly';\nimport ChartModel from './ChartModel';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\nimport DownsamplingError from './DownsamplingError';\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 Plotly: typeof Plotly;\n containerRef?: React.RefObject<HTMLDivElement>;\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<Data>[] | null;\n /** An error specific to downsampling */\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n\n /** Any other kind of error */\n error: unknown;\n shownError: string | null;\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 Plotly,\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.handleErrorClose = this.handleErrorClose.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.handleResize = this.handleResize.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.PlotComponent = createPlotlyComponent(props.Plotly);\n this.plot = React.createRef();\n this.plotWrapper = props.containerRef ?? 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 this.resizeObserver = new window.ResizeObserver(this.handleResize);\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n error: null,\n shownError: null,\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, model } = this.props;\n if (isActive) {\n this.subscribe(model);\n }\n if (this.plotWrapper.current != null) {\n this.resizeObserver.observe(this.plotWrapper.current);\n }\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, model, settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (model !== prevProps.model) {\n this.unsubscribe(prevProps.model);\n this.subscribe(model);\n }\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.updateDimensions();\n this.subscribe(model);\n } else {\n this.unsubscribe(model);\n }\n }\n }\n\n componentWillUnmount(): void {\n const { model } = this.props;\n this.unsubscribe(model);\n\n this.resizeObserver.disconnect();\n }\n\n currentSeries: number;\n\n PlotComponent: React.ComponentType<PlotParams>;\n\n plot: RefObject<typeof this.PlotComponent>;\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 // Listen for resizing of the element and update the canvas appropriately\n resizeObserver: ResizeObserver;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean,\n data: Partial<Data>[],\n error: unknown\n ): Partial<PlotlyConfig> => {\n const customButtons: ModeBarButtonAny[] = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n title: 'Downsampling failed',\n click: () => {\n this.toggleErrorMessage(`${downsamplingError}`);\n },\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n const hasError = Boolean(error);\n if (hasError) {\n customButtons.push({\n name: `Error: ${error}`,\n title: `Error`,\n click: () => {\n this.toggleErrorMessage(`${error}`);\n },\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 title: 'Downsampling status',\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n const has2D = data.some(\n ({ type }) => type != null && !type.includes('3d')\n );\n const has3D = data.some(\n ({ type }) => type != null && type.includes('3d')\n );\n\n const buttons2D = [\n 'zoomIn2d',\n 'zoomOut2d',\n 'autoScale2d',\n 'resetScale2d',\n ] as const;\n const buttons3D = [\n 'orbitRotation',\n 'tableRotation',\n 'resetCameraDefault3d',\n ] as const;\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 || hasError\n ? true\n : ('hover' as const),\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'], // These work the same for both 2d and 3d\n [...(has2D ? buttons2D : []), ...(has3D ? buttons3D : [])],\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(model: ChartModel): void {\n if (this.isSubscribed) {\n return;\n }\n\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(model: ChartModel): void {\n if (!this.isSubscribed) {\n return;\n }\n\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 handleErrorClose(): void {\n this.setState({ shownError: null });\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 DownsamplingError(downsamplingError));\n break;\n }\n case ChartModel.EVENT_ERROR: {\n const error = `${detail}`;\n this.setState({ error });\n const { onError } = this.props;\n onError(new Error(error));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: Readonly<{ layout: Partial<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 handleResize(): void {\n this.updateDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: readonly [\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 as Partial<PlotData>[]).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 * Toggle the error message. If it is already being displayed, then hide it.\n */\n toggleErrorMessage(error: string): void {\n this.setState(({ shownError }) => ({\n shownError: shownError === error ? null : error,\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(model);\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 =\n FormatterUtils.getDateTimeFormatterOptions(settings);\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 { model } = this.props;\n const formatter = new Formatter(\n model.dh,\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n const { Plotly: PlotlyProp } = this.props;\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 PlotlyProp.relayout(\n (this.plot.current as unknown as { el: HTMLElement }).el,\n {\n autosize: true,\n }\n ).catch((e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n\n render(): ReactElement {\n const { PlotComponent } = this;\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n error,\n shownError,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n data ?? [],\n error\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <PlotComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\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 <Popper\n className=\"chart-error-popper\"\n options={{ placement: 'top' }}\n isShown={shownError != null}\n onExited={this.handleErrorClose}\n closeOnBlur\n interactive\n >\n {shownError != null && (\n <>\n <div className=\"chart-error\">{shownError}</div>\n <CopyButton tooltip=\"Copy Error\" copy={shownError}>\n Copy Error\n </CopyButton>\n </>\n )}\n </Popper>\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,SAASC,UAAU,EAAEC,MAAM,QAAQ,uBAAuB;AAC1D,SACEC,SAAS,EACTC,eAAe,EACfC,eAAe,QAEV,kBAAkB;AACzB,SACEC,SAAS,EACTC,cAAc,EACdC,SAAS,QAOJ,wBAAwB;AAC/B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAU1BC,qBAAqB;AAAA,OACrBC,MAAM;AAAA,OACNC,UAAU;AAAA,OACVC,UAAU;AAAA;AAAA,OAEVC,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExB,IAAMC,GAAG,GAAGZ,GAAG,CAACa,MAAM,CAAC,OAAO,CAAC;AAoC/B,OAAO,MAAMC,KAAK,SAASzB,SAAS,CAAyB;EAkB3D;AACF;AACA;AACA;EACE,OAAO0B,WAAWA,CAACC,MAAsB,EAAQ;IAC/C,IAAM,CAACC,KAAK,KAAQC,IAAI,CAAC,GAAGF,MAAM,CAACG,IAAI;IACvC;IACA;IACA,IAAMC,UAAU,MAAAC,MAAA,CAAMH,IAAI,CAAE;IAC5B,OAAO;M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C5BwG,QAAQ,EAAE,IAAI,CAAC9H,gBAAiB;QAChC+H,WAAW;QACXC,WAAW;QAAAX,QAAA,EAEV/F,UAAU,IAAI,IAAI,iBACjB1E,KAAA,CAAAF,SAAA;UAAA2K,QAAA,gBACE7K,IAAA;YAAK2K,SAAS,EAAC,aAAa;YAAAE,QAAA,EAAE/F;UAAU,CAAM,CAAC,eAC/C9E,IAAA,CAACf,UAAU;YAACwM,OAAO,EAAC,YAAY;YAACC,IAAI,EAAE5G,UAAW;YAAA+F,QAAA,EAAC;UAEnD,CAAY,CAAC;QAAA,CACb;MACH,CACK,CAAC;IAAA,CACN,CAAC;EAEV;AACF;AAACnJ,eAAA,CArnBYnB,KAAK,kBACM;EACpBgF,QAAQ,EAAE,IAAI;EACdO,QAAQ,EAAE;IACR6F,QAAQ,EAAE,kBAAkB;IAC5BC,qBAAqB,EAAEpM,SAAS,CAACqM,gBAAgB;IACjDC,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAE,IAAI;IACpBjC,SAAS,EAAE;EACb,CAAC;EACDnK,MAAM;EACN4H,YAAY,EAAEA,CAAA,KAAYjG,SAAS;EACnCmG,WAAW,EAAEA,CAAA,KAAYnG,SAAS;EAClC6F,QAAQ,EAAEA,CAAA,KAAY7F,SAAS;EAC/B0G,OAAO,EAAEA,CAAA,KAAY1G,SAAS;EAC9BoH,iBAAiB,EAAEA,CAAA,KAAYpH;AACjC,CAAC;AAumBH,eAAef,KAAK"}
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","Component","deepEqual","memoize","CopyButton","Popper","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","bindAllMethods","createPlotlyComponent","Plotly","ChartModel","ChartUtils","DownsamplingError","useChartTheme","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","Chart","convertIcon","faIcon","width","path","icon","stringPath","concat","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","_props$containerRef","_defineProperty","downsamplingError","isDownsampleFinished","data","error","customButtons","hasDownsampleError","Boolean","push","name","title","click","toggleErrorMessage","attr","hasError","handleDownsampleClick","has2D","some","_ref","type","includes","has3D","_ref2","buttons2D","buttons3D","displaylogo","displayModeBar","modeBarButtons","PlotComponent","plot","createRef","plotWrapper","containerRef","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","isSubscribed","isLoadedFired","currentSeries","resizeObserver","window","ResizeObserver","handleResize","state","shownError","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","model","subscribe","current","observe","handleThemeChange","componentDidUpdate","prevProps","settings","theme","updateFormatterSettings","unsubscribe","componentWillUnmount","disconnect","getPlotRect","_this$plotWrapper$cur","_this$plotWrapper$cur2","getBoundingClientRect","setState","_ref3","getData","_objectSpread","getLayout","rect","height","debug2","handleModelEvent","handleAfterPlot","_ref4","setDownsamplingDisabled","handleErrorClose","event","detail","EVENT_UPDATED","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","_detail$message","message","onError","EVENT_ERROR","Error","debug","handlePlotUpdate","figure","ranges","getLayoutRanges","isRangesChanged","handleRelayout","changes","hiddenlabels","onSettingsChanged","hiddenSeries","handleRestyle","_ref5","seriesIndexes","Object","keys","reduce","acc","_ref6","visible","dh","chartUtils","_ref7","template","makeDefaultTemplate","_ref8","force","arguments","length","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","PlotlyProp","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","className","ref","children","onAfterPlot","onRelayout","onRestyle","useResizeHandler","style","options","placement","isShown","onExited","closeOnBlur","interactive","tooltip","copy","timeZone","defaultDateTimeFormat","FULL_DATE_FORMAT","showTimeZone","showTSeparator","ChartContainer","chartTheme"],"sources":["../src/Chart.tsx"],"sourcesContent":["import React, { Component, ReactElement, RefObject } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport { CopyButton, Popper } from '@deephaven/components';\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 {\n Config as PlotlyConfig,\n Layout,\n Icon,\n Data,\n PlotData,\n ModeBarButtonAny,\n} from 'plotly.js';\nimport type { PlotParams } from 'react-plotly.js';\nimport { bindAllMethods } from '@deephaven/utils';\nimport createPlotlyComponent from './plotly/createPlotlyComponent';\nimport Plotly from './plotly/Plotly';\nimport ChartModel from './ChartModel';\nimport { ChartTheme } from './ChartTheme';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\nimport DownsamplingError from './DownsamplingError';\nimport useChartTheme from './useChartTheme';\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 theme: ChartTheme;\n settings: FormatterSettings;\n isActive: boolean;\n Plotly: typeof Plotly;\n containerRef?: React.RefObject<HTMLDivElement>;\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\n// All of the ChartProps have default values except for model in the Chart\n// component, hence the Partial here.\ninterface ChartContainerProps extends Partial<Omit<ChartProps, 'theme'>> {\n model: ChartModel;\n}\n\ninterface ChartState {\n data: Partial<Data>[] | null;\n /** An error specific to downsampling */\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n\n /** Any other kind of error */\n error: unknown;\n shownError: string | null;\n layout: Partial<Layout>;\n revision: number;\n}\n\nclass 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 Plotly,\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 bindAllMethods(this);\n\n this.PlotComponent = createPlotlyComponent(props.Plotly);\n this.plot = React.createRef();\n this.plotWrapper = props.containerRef ?? 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 this.resizeObserver = new window.ResizeObserver(this.handleResize);\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n error: null,\n shownError: null,\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, model } = this.props;\n if (isActive) {\n this.subscribe(model);\n }\n if (this.plotWrapper.current != null) {\n this.resizeObserver.observe(this.plotWrapper.current);\n }\n\n this.handleThemeChange();\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, model, settings, theme } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (model !== prevProps.model) {\n this.unsubscribe(prevProps.model);\n this.subscribe(model);\n }\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.updateDimensions();\n this.subscribe(model);\n } else {\n this.unsubscribe(model);\n }\n }\n\n if (theme !== prevProps.theme) {\n this.handleThemeChange();\n }\n }\n\n componentWillUnmount(): void {\n const { model } = this.props;\n this.unsubscribe(model);\n\n this.resizeObserver.disconnect();\n }\n\n currentSeries: number;\n\n PlotComponent: React.ComponentType<PlotParams>;\n\n plot: RefObject<typeof this.PlotComponent>;\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 // Listen for resizing of the element and update the canvas appropriately\n resizeObserver: ResizeObserver;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean,\n data: Partial<Data>[],\n error: unknown\n ): Partial<PlotlyConfig> => {\n const customButtons: ModeBarButtonAny[] = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n title: 'Downsampling failed',\n click: () => {\n this.toggleErrorMessage(`${downsamplingError}`);\n },\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n const hasError = Boolean(error);\n if (hasError) {\n customButtons.push({\n name: `Error: ${error}`,\n title: `Error`,\n click: () => {\n this.toggleErrorMessage(`${error}`);\n },\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 title: 'Downsampling status',\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n const has2D = data.some(\n ({ type }) => type != null && !type.includes('3d')\n );\n const has3D = data.some(\n ({ type }) => type != null && type.includes('3d')\n );\n\n const buttons2D = [\n 'zoomIn2d',\n 'zoomOut2d',\n 'autoScale2d',\n 'resetScale2d',\n ] as const;\n const buttons3D = [\n 'orbitRotation',\n 'tableRotation',\n 'resetCameraDefault3d',\n ] as const;\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 || hasError\n ? true\n : ('hover' as const),\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'], // These work the same for both 2d and 3d\n [...(has2D ? buttons2D : []), ...(has3D ? buttons3D : [])],\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\n this.setState(({ layout }) => ({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n }));\n }\n\n subscribe(model: ChartModel): void {\n if (this.isSubscribed) {\n return;\n }\n\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(model: ChartModel): void {\n if (!this.isSubscribed) {\n return;\n }\n\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 handleErrorClose(): void {\n this.setState({ shownError: null });\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 DownsamplingError(downsamplingError));\n break;\n }\n case ChartModel.EVENT_ERROR: {\n const error = `${detail}`;\n this.setState({ error });\n const { onError } = this.props;\n onError(new Error(error));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: Readonly<{ layout: Partial<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 handleResize(): void {\n this.updateDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: readonly [\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 as Partial<PlotData>[]).reduce(\n (acc: string[], { name, visible }) =>\n name != null && visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n }\n\n handleThemeChange(): void {\n const { theme, model } = this.props;\n const { dh } = model;\n const chartUtils = new ChartUtils(dh);\n\n this.setState(({ layout }) => ({\n layout: {\n ...layout,\n template: chartUtils.makeDefaultTemplate(theme),\n },\n }));\n }\n\n /**\n * Toggle the error message. If it is already being displayed, then hide it.\n */\n toggleErrorMessage(error: string): void {\n this.setState(({ shownError }) => ({\n shownError: shownError === error ? null : error,\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(model);\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 =\n FormatterUtils.getDateTimeFormatterOptions(settings);\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 { model } = this.props;\n const formatter = new Formatter(\n model.dh,\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n const { Plotly: PlotlyProp } = this.props;\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 PlotlyProp.relayout(\n (this.plot.current as unknown as { el: HTMLElement }).el,\n {\n autosize: true,\n }\n ).catch((e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n\n render(): ReactElement {\n const { PlotComponent } = this;\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n error,\n shownError,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n data ?? [],\n error\n );\n const isPlotShown = data != null;\n\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <PlotComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\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 <Popper\n className=\"chart-error-popper\"\n options={{ placement: 'top' }}\n isShown={shownError != null}\n onExited={this.handleErrorClose}\n closeOnBlur\n interactive\n >\n {shownError != null && (\n <>\n <div className=\"chart-error\">{shownError}</div>\n <CopyButton tooltip=\"Copy Error\" copy={shownError}>\n Copy Error\n </CopyButton>\n </>\n )}\n </Popper>\n </div>\n );\n }\n}\n\nexport default function ChartContainer(\n props: ChartContainerProps\n): JSX.Element {\n const chartTheme = useChartTheme();\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <Chart {...props} theme={chartTheme} />;\n}\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAiC,OAAO;AACjE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,aAAa;AACjC,SAASC,UAAU,EAAEC,MAAM,QAAQ,uBAAuB;AAC1D,SACEC,SAAS,EACTC,eAAe,EACfC,eAAe,QAEV,kBAAkB;AACzB,SACEC,SAAS,EACTC,cAAc,EACdC,SAAS,QAOJ,wBAAwB;AAC/B,OAAOC,GAAG,MAAM,gBAAgB;AAUhC,SAASC,cAAc,QAAQ,kBAAkB;AAAC,OAC3CC,qBAAqB;AAAA,OACrBC,MAAM;AAAA,OACNC,UAAU;AAAA,OAEVC,UAAU;AAAA;AAAA,OAEVC,iBAAiB;AAAA,OACjBC,aAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEpB,IAAMC,GAAG,GAAGd,GAAG,CAACe,MAAM,CAAC,OAAO,CAAC;;AAsB/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b,IAAM+K,UAAU,GAAGzM,aAAa,CAAC,CAAC;EAClC;EACA,oBAAOE,IAAA,CAACO,KAAK,EAAA8F,aAAA,CAAAA,aAAA,KAAK7E,KAAK;IAAEiE,KAAK,EAAE8G;EAAW,EAAE,CAAC;AAChD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { dh as DhType, Figure, Table } from '@deephaven/jsapi-types';
|
|
2
2
|
import { ChartModelSettings } from './ChartUtils';
|
|
3
|
-
import { ChartTheme } from './ChartTheme';
|
|
4
3
|
import ChartModel from './ChartModel';
|
|
5
4
|
declare class ChartModelFactory {
|
|
6
5
|
/**
|
|
@@ -14,12 +13,11 @@ declare class ChartModelFactory {
|
|
|
14
13
|
* @param settings.xAxis The column name to use for the x-axis
|
|
15
14
|
* @param [settings.hiddenSeries] Array of hidden series names
|
|
16
15
|
* @param table The table to build the model for
|
|
17
|
-
* @param theme The theme for the figure
|
|
18
16
|
* @returns The ChartModel Promise representing the figure
|
|
19
17
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
20
18
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
21
19
|
*/
|
|
22
|
-
static makeModelFromSettings(dh: DhType, settings: ChartModelSettings, table: Table
|
|
20
|
+
static makeModelFromSettings(dh: DhType, settings: ChartModelSettings, table: Table): Promise<ChartModel>;
|
|
23
21
|
/**
|
|
24
22
|
* Creates a model from the settings provided.
|
|
25
23
|
* Tries to create a Figure in the API with it.
|
|
@@ -45,12 +43,11 @@ declare class ChartModelFactory {
|
|
|
45
43
|
* @param settings.xAxis The column name to use for the x-axis
|
|
46
44
|
* @param [settings.hiddenSeries] Array of hidden series names
|
|
47
45
|
* @param figure The figure to build the model for
|
|
48
|
-
* @param theme The theme for the figure
|
|
49
46
|
* @returns The FigureChartModel representing the figure
|
|
50
47
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
51
48
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
52
49
|
*/
|
|
53
|
-
static makeModel(dh: DhType, settings: ChartModelSettings | undefined, figure: Figure
|
|
50
|
+
static makeModel(dh: DhType, settings: ChartModelSettings | undefined, figure: Figure): Promise<ChartModel>;
|
|
54
51
|
}
|
|
55
52
|
export default ChartModelFactory;
|
|
56
53
|
//# sourceMappingURL=ChartModelFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartModelFactory.d.ts","sourceRoot":"","sources":["../src/ChartModelFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"ChartModelFactory.d.ts","sourceRoot":"","sources":["../src/ChartModelFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,cAAM,iBAAiB;IACrB;;;;;;;;;;;;;;OAcG;WACU,qBAAqB,CAChC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,UAAU,CAAC;IAStB;;;;;;;;;;;;OAYG;WACU,sBAAsB,CACjC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,MAAM,CAAC;IAelB;;;;;;;;;;;;;;OAcG;WACU,SAAS,CACpB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC;CAGvB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -14,15 +14,14 @@ class ChartModelFactory {
|
|
|
14
14
|
* @param settings.xAxis The column name to use for the x-axis
|
|
15
15
|
* @param [settings.hiddenSeries] Array of hidden series names
|
|
16
16
|
* @param table The table to build the model for
|
|
17
|
-
* @param theme The theme for the figure
|
|
18
17
|
* @returns The ChartModel Promise representing the figure
|
|
19
18
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
20
19
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
21
20
|
*/
|
|
22
|
-
static makeModelFromSettings(dh, settings, table
|
|
21
|
+
static makeModelFromSettings(dh, settings, table) {
|
|
23
22
|
return _asyncToGenerator(function* () {
|
|
24
23
|
var figure = yield ChartModelFactory.makeFigureFromSettings(dh, settings, table);
|
|
25
|
-
return new FigureChartModel(dh, figure,
|
|
24
|
+
return new FigureChartModel(dh, figure, settings);
|
|
26
25
|
})();
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -64,14 +63,13 @@ class ChartModelFactory {
|
|
|
64
63
|
* @param settings.xAxis The column name to use for the x-axis
|
|
65
64
|
* @param [settings.hiddenSeries] Array of hidden series names
|
|
66
65
|
* @param figure The figure to build the model for
|
|
67
|
-
* @param theme The theme for the figure
|
|
68
66
|
* @returns The FigureChartModel representing the figure
|
|
69
67
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
70
68
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
71
69
|
*/
|
|
72
|
-
static makeModel(dh, settings, figure
|
|
70
|
+
static makeModel(dh, settings, figure) {
|
|
73
71
|
return _asyncToGenerator(function* () {
|
|
74
|
-
return new FigureChartModel(dh, figure,
|
|
72
|
+
return new FigureChartModel(dh, figure, settings);
|
|
75
73
|
})();
|
|
76
74
|
}
|
|
77
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartModelFactory.js","names":["ChartUtils","FigureChartModel","ChartModelFactory","makeModelFromSettings","dh","settings","table","
|
|
1
|
+
{"version":3,"file":"ChartModelFactory.js","names":["ChartUtils","FigureChartModel","ChartModelFactory","makeModelFromSettings","dh","settings","table","_asyncToGenerator","figure","makeFigureFromSettings","tableCopy","copy","applyCustomColumns","customColumns","applyFilter","filter","applySort","sort","plot","Figure","create","makeFigureSettings","makeModel"],"sources":["../src/ChartModelFactory.ts"],"sourcesContent":["import type { dh as DhType, Figure, Table } from '@deephaven/jsapi-types';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport FigureChartModel from './FigureChartModel';\nimport ChartModel from './ChartModel';\n\nclass ChartModelFactory {\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @returns The ChartModel Promise representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static async makeModelFromSettings(\n dh: DhType,\n settings: ChartModelSettings,\n table: Table\n ): Promise<ChartModel> {\n const figure = await ChartModelFactory.makeFigureFromSettings(\n dh,\n settings,\n table\n );\n return new FigureChartModel(dh, figure, settings);\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @returns The Figure created with the settings provided\n */\n static async makeFigureFromSettings(\n dh: DhType,\n settings: ChartModelSettings,\n table: Table\n ): Promise<Figure> {\n // Copy the table first and then re-apply the filters from the original table\n // When we add table linking we'll want to listen to the original table and update\n // the copied table with any changes that occur.\n // The table gets owned by the Figure that gets created, which closes the table\n const tableCopy = await table.copy();\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n\n return dh.plot.Figure.create(\n new ChartUtils(dh).makeFigureSettings(settings, tableCopy)\n );\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param figure The figure to build the model for\n * @returns The FigureChartModel representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static async makeModel(\n dh: DhType,\n settings: ChartModelSettings | undefined,\n figure: Figure\n ): Promise<ChartModel> {\n return new FigureChartModel(dh, figure, settings);\n }\n}\n\nexport default ChartModelFactory;\n"],"mappings":";;OACOA,UAAU;AAAA,OACVC,gBAAgB;AAGvB,MAAMC,iBAAiB,CAAC;EACtB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAaC,qBAAqBA,CAChCC,EAAU,EACVC,QAA4B,EAC5BC,KAAY,EACS;IAAA,OAAAC,iBAAA;MACrB,I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