@deephaven/chart 0.15.5-beta.0 → 0.15.5-beta.4
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 +90 -84
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +50 -47
- package/dist/Chart.js.map +1 -1
- package/dist/ChartModel.d.ts +26 -19
- package/dist/ChartModel.d.ts.map +1 -1
- package/dist/ChartModel.js +15 -6
- package/dist/ChartModel.js.map +1 -1
- package/dist/ChartModelFactory.d.ts +72 -43
- package/dist/ChartModelFactory.d.ts.map +1 -1
- package/dist/ChartModelFactory.js +27 -27
- package/dist/ChartModelFactory.js.map +1 -1
- package/dist/ChartTheme.d.ts +17 -17
- package/dist/ChartTheme.d.ts.map +1 -1
- package/dist/ChartTheme.js.map +1 -1
- package/dist/ChartUtils.d.ts +4 -4
- package/dist/ChartUtils.d.ts.map +1 -1
- package/dist/ChartUtils.js +3 -0
- package/dist/ChartUtils.js.map +1 -1
- package/dist/MockChartModel.d.ts +8 -8
- package/dist/declaration.d.js +2 -0
- package/dist/declaration.d.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/isFigureChartModel.d.ts +4 -0
- package/dist/isFigureChartModel.d.ts.map +1 -0
- package/dist/isFigureChartModel.js +4 -0
- package/dist/isFigureChartModel.js.map +1 -0
- package/dist/plotly/Plotly.d.ts +1 -0
- package/package.json +12 -8
package/dist/Chart.d.ts
CHANGED
|
@@ -1,32 +1,76 @@
|
|
|
1
|
-
|
|
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
|
|
56
|
+
* @param faIcon The icon to convert
|
|
5
57
|
*/
|
|
6
|
-
static convertIcon(faIcon:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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():
|
|
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:
|
|
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
|
package/dist/Chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,EAIL,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIL,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,EACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,IAAI,MAAM,eAAe,CAAC;AAEjC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,cAAc,CAAC;AAStB,UAAU,UAAU;IAClB,KAAK,EAAE,UAAU,CAAC;IAElB,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrC,QAAQ,EAAE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C,GAAG;QACrC,oBAAoB,EAAE,6BAA6B,CAAC;QACpD,oBAAoB,EAAE,6BAA6B,CAAC;KACrD,GACA,IAAI;IAqBP,eAAe,IAAI,IAAI;IAYvB,gBAAgB,IAAI,IAAI;IAkBxB,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
|
|
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 (
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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
|
-
|
|
511
|
-
|
|
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,"sources":["../src/Chart.jsx"],"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"],"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,SAApC,QAAqD,wBAArD;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,M;OACAC,I;OAEAC,U;OACAC,U;;AAGP,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ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AQ,EAAE,IADS;AAEnBI,EAAAA,QAAQ,EAAE;AACRuE,IAAAA,QAAQ,EAAE,kBADF;AAERE,IAAAA,qBAAqB,EAAE3I,SAAS,CAACmJ,gBAFzB;AAGRP,IAAAA,YAAY,EAAE,KAHN;AAIRE,IAAAA,cAAc,EAAE,IAJR;AAKRrB,IAAAA,SAAS,EAAE;AALH,GAFS;AASnBhC,EAAAA,YAAY,EAAE,MAAM,CAAE,CATH;AAUnBE,EAAAA,WAAW,EAAE,MAAM,CAAE,CAVF;AAWnBN,EAAAA,QAAQ,EAAE,MAAM,CAAE,CAXC;AAYnBY,EAAAA,OAAO,EAAE,MAAM,CAAE,CAZE;AAanBU,EAAAA,iBAAiB,EAAE,MAAM,CAAE;AAbR,CAArB;AAgBA,eAAenG,KAAf","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"],"file":"Chart.js"}
|
|
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,EAAE,CAJJ;AAKLC,MAAAA,SAAS;AALJ,KAAP;AAOD;;AAE2B,SAArBC,qBAAqB,CAC1BC,sBA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A,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"}
|
package/dist/ChartModel.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
constructor();
|
|
19
|
+
listeners: ((event: ChartEvent) => void)[];
|
|
20
|
+
formatter?: Formatter;
|
|
21
|
+
rect?: DOMRect;
|
|
19
22
|
isDownsamplingDisabled: boolean;
|
|
20
|
-
title
|
|
21
|
-
getData():
|
|
23
|
+
title?: string;
|
|
24
|
+
getData(): {
|
|
25
|
+
name: string;
|
|
26
|
+
visible: string;
|
|
27
|
+
}[];
|
|
22
28
|
getDefaultTitle(): string;
|
|
23
|
-
getLayout():
|
|
24
|
-
getFilterColumnMap(): Map<
|
|
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
|
|
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:
|
|
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:
|
|
52
|
-
unsubscribe(callback:
|
|
53
|
-
fireEvent(event:
|
|
54
|
-
fireUpdate(data:
|
|
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:
|
|
58
|
-
fireDownsampleFinish(detail:
|
|
59
|
-
fireDownsampleFail(detail:
|
|
60
|
-
fireDownsampleNeeded(detail:
|
|
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
|
package/dist/ChartModel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartModel.d.ts","sourceRoot":"","sources":["../src/ChartModel.
|
|
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;AACH,cAAM,UAAU;IACd,MAAM,CAAC,aAAa,SAA8B;IAElD,MAAM,CAAC,gBAAgB,SAAiC;IAExD,MAAM,CAAC,eAAe,SAAgC;IAEtD,MAAM,CAAC,uBAAuB,SAAwC;IAEtE,MAAM,CAAC,wBAAwB,S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