@deephaven/chart 0.15.5-vite.12 → 0.15.6-beta.3
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 +84 -85
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +56 -49
- package/dist/Chart.js.map +1 -1
- package/dist/ChartModel.d.ts +30 -22
- package/dist/ChartModel.d.ts.map +1 -1
- package/dist/ChartModel.js +18 -9
- package/dist/ChartModel.js.map +1 -1
- package/dist/ChartModelFactory.d.ts +67 -43
- package/dist/ChartModelFactory.d.ts.map +1 -1
- package/dist/ChartModelFactory.js +27 -27
- package/dist/ChartModelFactory.js.map +1 -1
- package/dist/ChartTestUtils.d.ts +16 -15
- package/dist/ChartTestUtils.d.ts.map +1 -1
- package/dist/ChartTestUtils.js +5 -0
- package/dist/ChartTestUtils.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 +252 -225
- package/dist/ChartUtils.d.ts.map +1 -1
- package/dist/ChartUtils.js +219 -174
- package/dist/ChartUtils.js.map +1 -1
- package/dist/FigureChartModel.d.ts +70 -106
- package/dist/FigureChartModel.d.ts.map +1 -1
- package/dist/FigureChartModel.js +90 -36
- package/dist/FigureChartModel.js.map +1 -1
- package/dist/MockChartModel.d.ts +11 -209
- package/dist/MockChartModel.d.ts.map +1 -1
- package/dist/MockChartModel.js.map +1 -1
- package/dist/declaration.d.js +2 -0
- package/dist/declaration.d.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -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/Plot.js.map +1 -1
- package/dist/plotly/Plotly.d.ts +1 -0
- package/dist/plotly/Plotly.js.map +1 -1
- package/package.json +11 -8
|
@@ -1,124 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
import memoize from 'memoizee';
|
|
2
|
+
import { Axis, Chart, Figure, OneClick, Series, SourceType } from '@deephaven/jsapi-shim';
|
|
3
|
+
import { Range } from '@deephaven/utils';
|
|
4
|
+
import { Layout, PlotData } from 'plotly.js';
|
|
5
|
+
import { Formatter } from '@deephaven/jsapi-utils';
|
|
6
|
+
import ChartModel, { ChartEvent, FilterColumnMap } from './ChartModel';
|
|
7
|
+
import { ChartModelSettings } from './ChartUtils';
|
|
8
|
+
import ChartTheme from './ChartTheme';
|
|
2
9
|
/**
|
|
3
10
|
* Takes a Figure object from a widget to make a model for a chart
|
|
4
11
|
*/
|
|
5
12
|
declare class FigureChartModel extends ChartModel {
|
|
6
13
|
static ADD_SERIES_DEBOUNCE: number;
|
|
7
14
|
/**
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
15
|
+
* @param figure The figure object created by the API
|
|
16
|
+
* @param settings Chart settings
|
|
10
17
|
*/
|
|
11
|
-
constructor(figure:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
autosize: boolean;
|
|
28
|
-
colorway: string[];
|
|
29
|
-
font: {
|
|
30
|
-
family: string;
|
|
31
|
-
};
|
|
32
|
-
title: {
|
|
33
|
-
font: {
|
|
34
|
-
color: any;
|
|
35
|
-
};
|
|
36
|
-
yanchor: string;
|
|
37
|
-
pad: {
|
|
38
|
-
t: number;
|
|
39
|
-
};
|
|
40
|
-
y: number;
|
|
41
|
-
};
|
|
42
|
-
legend: {
|
|
43
|
-
font: {
|
|
44
|
-
color: any;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
margin: {
|
|
48
|
-
l: number;
|
|
49
|
-
r: number;
|
|
50
|
-
t: number;
|
|
51
|
-
b: number;
|
|
52
|
-
pad: number;
|
|
53
|
-
};
|
|
54
|
-
xaxis: {
|
|
55
|
-
automargin: boolean;
|
|
56
|
-
gridcolor: any;
|
|
57
|
-
linecolor: any;
|
|
58
|
-
rangeslider: {
|
|
59
|
-
visible: boolean;
|
|
60
|
-
};
|
|
61
|
-
showline: boolean;
|
|
62
|
-
ticklen: number;
|
|
63
|
-
tickcolor: any;
|
|
64
|
-
tickfont: {
|
|
65
|
-
color: any;
|
|
66
|
-
};
|
|
67
|
-
title: {
|
|
68
|
-
font: {
|
|
69
|
-
color: any;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
yaxis: {
|
|
74
|
-
automargin: boolean;
|
|
75
|
-
gridcolor: any;
|
|
76
|
-
linecolor: any;
|
|
77
|
-
rangeslider: {
|
|
78
|
-
visible: boolean;
|
|
79
|
-
};
|
|
80
|
-
showline: boolean;
|
|
81
|
-
ticklen: number;
|
|
82
|
-
tickcolor: any;
|
|
83
|
-
tickfont: {
|
|
84
|
-
color: any;
|
|
85
|
-
};
|
|
86
|
-
title: {
|
|
87
|
-
font: {
|
|
88
|
-
color: any;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
seriesDataMap: Map<any, any>;
|
|
94
|
-
pendingSeries: any[];
|
|
95
|
-
oneClicks: any[];
|
|
96
|
-
filterColumnMap: Map<any, any>;
|
|
97
|
-
lastFilter: Map<any, any>;
|
|
18
|
+
constructor(figure: Figure, settings?: Partial<ChartModelSettings>, theme?: typeof ChartTheme);
|
|
19
|
+
figure: Figure;
|
|
20
|
+
settings: Partial<ChartModelSettings>;
|
|
21
|
+
theme: typeof ChartTheme;
|
|
22
|
+
data: Partial<PlotData>[];
|
|
23
|
+
layout: Partial<Layout>;
|
|
24
|
+
seriesDataMap: Map<string, Partial<PlotData> & {
|
|
25
|
+
xLow?: number[];
|
|
26
|
+
xHigh?: number[];
|
|
27
|
+
yLow?: number[];
|
|
28
|
+
yHigh?: number[];
|
|
29
|
+
}>;
|
|
30
|
+
pendingSeries: Series[];
|
|
31
|
+
oneClicks: OneClick[];
|
|
32
|
+
filterColumnMap: FilterColumnMap;
|
|
33
|
+
lastFilter: Map<string, string>;
|
|
98
34
|
isConnected: boolean;
|
|
99
|
-
seriesToProcess: Set<
|
|
35
|
+
seriesToProcess: Set<unknown>;
|
|
36
|
+
close(): void;
|
|
37
|
+
getDefaultTitle(): string;
|
|
100
38
|
initAllSeries(): void;
|
|
101
|
-
addSeries(series:
|
|
39
|
+
addSeries(series: Series): void;
|
|
40
|
+
addPendingSeries: import("lodash").DebouncedFunc<() => void>;
|
|
41
|
+
subscribe(callback: (event: ChartEvent) => void): void;
|
|
42
|
+
unsubscribe(callback: (event: ChartEvent) => void): void;
|
|
102
43
|
subscribeFigure(): void;
|
|
103
44
|
unsubscribeFigure(): void;
|
|
104
45
|
startListeningFigure(): void;
|
|
105
46
|
stopListeningFigure(): void;
|
|
106
47
|
getTimeZone: ((columnType: any, formatter: any) => any) & memoize.Memoized<(columnType: any, formatter: any) => any>;
|
|
107
|
-
getValueTranslator: ((columnType: any, formatter: any) => (value:
|
|
48
|
+
getValueTranslator: ((columnType: any, formatter: any) => (value: unknown) => unknown) & memoize.Memoized<(columnType: any, formatter: any) => (value: unknown) => unknown>;
|
|
108
49
|
/** Gets the parser for a value with the provided column type */
|
|
109
|
-
getValueParser: ((columnType: any, formatter: any) => (value:
|
|
50
|
+
getValueParser: ((columnType: any, formatter: any) => (value: unknown) => unknown) & memoize.Memoized<(columnType: any, formatter: any) => (value: unknown) => unknown>;
|
|
110
51
|
/**
|
|
111
52
|
* Gets the range parser for a particular column type
|
|
112
53
|
*/
|
|
113
|
-
getRangeParser: ((columnType:
|
|
54
|
+
getRangeParser: ((columnType: string, formatter?: Formatter | undefined) => (range: Range) => unknown[]) & memoize.Memoized<(columnType: string, formatter?: Formatter | undefined) => (range: Range) => unknown[]>;
|
|
114
55
|
/**
|
|
115
56
|
* Gets the parser for parsing the range from an axis within the given chart
|
|
116
57
|
*/
|
|
117
|
-
getAxisRangeParser: ((chart:
|
|
58
|
+
getAxisRangeParser: ((chart: Chart, formatter?: Formatter | undefined) => (axis: Axis) => (range: Range) => unknown[]) & memoize.Memoized<(chart: Chart, formatter?: Formatter | undefined) => (axis: Axis) => (range: Range) => unknown[]>;
|
|
59
|
+
handleDownsampleStart(event: ChartEvent): void;
|
|
60
|
+
handleDownsampleFinish(event: ChartEvent): void;
|
|
61
|
+
handleDownsampleFail(event: ChartEvent): void;
|
|
62
|
+
handleDownsampleNeeded(event: ChartEvent): void;
|
|
63
|
+
handleFigureUpdated(event: ChartEvent): void;
|
|
64
|
+
handleRequestFailed(event: ChartEvent): void;
|
|
118
65
|
/**
|
|
119
66
|
* Resubscribe to the figure, should be done if settings change
|
|
120
67
|
*/
|
|
121
68
|
resubscribe(): void;
|
|
69
|
+
setFormatter(formatter: Formatter): void;
|
|
70
|
+
setDownsamplingDisabled(isDownsamplingDisabled: boolean): void;
|
|
71
|
+
handleFigureDisconnected(event: CustomEvent): void;
|
|
72
|
+
handleFigureReconnected(event: CustomEvent): void;
|
|
73
|
+
handleFigureSeriesAdded(event: {
|
|
74
|
+
detail: Series;
|
|
75
|
+
}): void;
|
|
76
|
+
setDimensions(rect: DOMRect): void;
|
|
77
|
+
setTitle(title: string): void;
|
|
122
78
|
getPlotWidth(): number;
|
|
123
79
|
getPlotHeight(): number;
|
|
124
80
|
updateAxisPositions(): void;
|
|
@@ -128,21 +84,29 @@ declare class FigureChartModel extends ChartModel {
|
|
|
128
84
|
updateLayoutFormats(): void;
|
|
129
85
|
/**
|
|
130
86
|
* Set a specific array for the array of series properties specified.
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
87
|
+
* @param series The series to set the data array for.
|
|
88
|
+
* @param sourceType The source type within that series to set the data for.
|
|
89
|
+
* @param dataArray The array to use for the data for this series source.
|
|
134
90
|
*/
|
|
135
|
-
setDataArrayForSeries(series:
|
|
91
|
+
setDataArrayForSeries(series: Series, sourceType: SourceType, dataArray: unknown[]): void;
|
|
136
92
|
/**
|
|
137
93
|
* After setting all the data in the series data, we may need to adjust some other properties
|
|
138
94
|
* Eg. Calculating the width from the xLow/xHigh values; Plot.ly uses `width` instead of a low/high
|
|
139
95
|
* value for x.
|
|
140
|
-
* @param
|
|
96
|
+
* @param series The series to clean the data for
|
|
97
|
+
*/
|
|
98
|
+
cleanSeries(series: Series): void;
|
|
99
|
+
getData(): Partial<PlotData>[];
|
|
100
|
+
getLayout(): Partial<Layout>;
|
|
101
|
+
getFilterColumnMap(): FilterColumnMap;
|
|
102
|
+
isFilterRequired(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the filter on the model. Will only set the values that have changed.
|
|
105
|
+
* @param filterMap Map of filter column names to values
|
|
141
106
|
*/
|
|
142
|
-
|
|
143
|
-
setFigure(figure:
|
|
144
|
-
updateSettings(settings:
|
|
107
|
+
setFilter(filterMap: Map<string, string>): void;
|
|
108
|
+
setFigure(figure: Figure): void;
|
|
109
|
+
updateSettings(settings: Partial<ChartModelSettings>): void;
|
|
145
110
|
}
|
|
146
|
-
|
|
147
|
-
import memoize from "memoizee";
|
|
111
|
+
export default FigureChartModel;
|
|
148
112
|
//# sourceMappingURL=FigureChartModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigureChartModel.d.ts","sourceRoot":"","sources":["../src/FigureChartModel.
|
|
1
|
+
{"version":3,"file":"FigureChartModel.d.ts","sourceRoot":"","sources":["../src/FigureChartModel.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,UAAU,CAAC;AAG/B,OAAW,EACT,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,UAAU,EACX,MAAM,uBAAuB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AAG,IAAI;IAejD,uBAAuB,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAQxD,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAMlC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IA4B7B,YAAY,IAAI,MAAM;IAatB,aAAa,IAAI,MAAM;IAavB,mBAAmB,IAAI,IAAI;IAkB3B;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAoB3B;;;;;OAKG;IACH,qBAAqB,CACnB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,OAAO,EAAE,GACnB,IAAI;IAWP;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAyCjC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;IAI9B,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,kBAAkB,IAAI,eAAe;IAIrC,gBAAgB,IAAI,OAAO;IAO3B;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IA2B/C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAc/B,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;CAG5D;AAED,eAAe,gBAAgB,CAAC"}
|
package/dist/FigureChartModel.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
1
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; }
|
|
2
6
|
|
|
3
7
|
/* eslint class-methods-use-this: "off" */
|
|
@@ -8,6 +12,7 @@ import dh from '@deephaven/jsapi-shim';
|
|
|
8
12
|
import Log from '@deephaven/log';
|
|
9
13
|
import ChartModel from "./ChartModel.js";
|
|
10
14
|
import ChartUtils from "./ChartUtils.js";
|
|
15
|
+
import ChartTheme from "./ChartTheme.js";
|
|
11
16
|
var log = Log.module('FigureChartModel');
|
|
12
17
|
/**
|
|
13
18
|
* Takes a Figure object from a widget to make a model for a chart
|
|
@@ -15,14 +20,52 @@ var log = Log.module('FigureChartModel');
|
|
|
15
20
|
|
|
16
21
|
class FigureChartModel extends ChartModel {
|
|
17
22
|
/**
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
23
|
+
* @param figure The figure object created by the API
|
|
24
|
+
* @param settings Chart settings
|
|
20
25
|
*/
|
|
21
26
|
constructor(figure) {
|
|
22
27
|
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
23
|
-
var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
28
|
+
var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ChartTheme;
|
|
24
29
|
super();
|
|
25
30
|
|
|
31
|
+
_defineProperty(this, "figure", void 0);
|
|
32
|
+
|
|
33
|
+
_defineProperty(this, "settings", void 0);
|
|
34
|
+
|
|
35
|
+
_defineProperty(this, "theme", void 0);
|
|
36
|
+
|
|
37
|
+
_defineProperty(this, "data", void 0);
|
|
38
|
+
|
|
39
|
+
_defineProperty(this, "layout", void 0);
|
|
40
|
+
|
|
41
|
+
_defineProperty(this, "seriesDataMap", void 0);
|
|
42
|
+
|
|
43
|
+
_defineProperty(this, "pendingSeries", void 0);
|
|
44
|
+
|
|
45
|
+
_defineProperty(this, "oneClicks", void 0);
|
|
46
|
+
|
|
47
|
+
_defineProperty(this, "filterColumnMap", void 0);
|
|
48
|
+
|
|
49
|
+
_defineProperty(this, "lastFilter", void 0);
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "isConnected", void 0);
|
|
52
|
+
|
|
53
|
+
_defineProperty(this, "seriesToProcess", void 0);
|
|
54
|
+
|
|
55
|
+
_defineProperty(this, "addPendingSeries", debounce(() => {
|
|
56
|
+
var {
|
|
57
|
+
pendingSeries
|
|
58
|
+
} = this;
|
|
59
|
+
|
|
60
|
+
for (var i = 0; i < pendingSeries.length; i += 1) {
|
|
61
|
+
var series = pendingSeries[i];
|
|
62
|
+
this.addSeries(series);
|
|
63
|
+
series.subscribe(); // We'll get an update with the data after subscribing
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this.pendingSeries = [];
|
|
67
|
+
}, FigureChartModel.ADD_SERIES_DEBOUNCE));
|
|
68
|
+
|
|
26
69
|
_defineProperty(this, "getTimeZone", memoize((columnType, formatter) => {
|
|
27
70
|
if (formatter != null) {
|
|
28
71
|
var dataFormatter = formatter.getColumnTypeFormatter(columnType);
|
|
@@ -74,7 +117,6 @@ class FigureChartModel extends ChartModel {
|
|
|
74
117
|
this.handleRequestFailed = this.handleRequestFailed.bind(this); // We need to debounce adding series so we subscribe to them all in the same tick
|
|
75
118
|
// This should no longer be necessary after IDS-5049 lands
|
|
76
119
|
|
|
77
|
-
this.addPendingSeries = debounce(this.addPendingSeries.bind(this), FigureChartModel.ADD_SERIES_DEBOUNCE);
|
|
78
120
|
this.figure = figure;
|
|
79
121
|
this.settings = settings;
|
|
80
122
|
this.theme = theme;
|
|
@@ -131,7 +173,7 @@ class FigureChartModel extends ChartModel {
|
|
|
131
173
|
var allSeriesNames = [...this.seriesDataMap.keys()];
|
|
132
174
|
var inactiveSeriesNames = allSeriesNames.filter(seriesName => activeSeriesNames.indexOf(seriesName) < 0);
|
|
133
175
|
|
|
134
|
-
for (var _i = 0; _i < inactiveSeriesNames; _i += 1) {
|
|
176
|
+
for (var _i = 0; _i < inactiveSeriesNames.length; _i += 1) {
|
|
135
177
|
var seriesName = inactiveSeriesNames[_i];
|
|
136
178
|
this.seriesDataMap.delete(seriesName);
|
|
137
179
|
}
|
|
@@ -178,22 +220,8 @@ class FigureChartModel extends ChartModel {
|
|
|
178
220
|
this.updateLayoutFormats();
|
|
179
221
|
}
|
|
180
222
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
pendingSeries
|
|
184
|
-
} = this;
|
|
185
|
-
|
|
186
|
-
for (var i = 0; i < pendingSeries.length; i += 1) {
|
|
187
|
-
var series = pendingSeries[i];
|
|
188
|
-
this.addSeries(series);
|
|
189
|
-
series.subscribe(); // We'll get an update with the data after subscribing
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
this.pendingSeries = [];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
subscribe() {
|
|
196
|
-
super.subscribe(...arguments);
|
|
223
|
+
subscribe(callback) {
|
|
224
|
+
super.subscribe(callback);
|
|
197
225
|
|
|
198
226
|
if (this.listeners.length === 1) {
|
|
199
227
|
// Need to initialize the series here as we may have missed some series when not subscribed
|
|
@@ -202,8 +230,8 @@ class FigureChartModel extends ChartModel {
|
|
|
202
230
|
}
|
|
203
231
|
}
|
|
204
232
|
|
|
205
|
-
unsubscribe() {
|
|
206
|
-
super.unsubscribe(
|
|
233
|
+
unsubscribe(callback) {
|
|
234
|
+
super.unsubscribe(callback);
|
|
207
235
|
|
|
208
236
|
if (this.listeners.length === 0) {
|
|
209
237
|
this.unsubscribeFigure();
|
|
@@ -332,8 +360,8 @@ class FigureChartModel extends ChartModel {
|
|
|
332
360
|
this.resubscribe();
|
|
333
361
|
}
|
|
334
362
|
|
|
335
|
-
setDownsamplingDisabled() {
|
|
336
|
-
super.setDownsamplingDisabled(
|
|
363
|
+
setDownsamplingDisabled(isDownsamplingDisabled) {
|
|
364
|
+
super.setDownsamplingDisabled(isDownsamplingDisabled);
|
|
337
365
|
this.resubscribe();
|
|
338
366
|
}
|
|
339
367
|
|
|
@@ -381,25 +409,44 @@ class FigureChartModel extends ChartModel {
|
|
|
381
409
|
// Plotly doesn't handle positioning it correctly, and it's an undocumented feature
|
|
382
410
|
|
|
383
411
|
var subtitleCount = (_match$length = (_match = (title !== null && title !== void 0 ? title : '').match(/<br>/g)) === null || _match === void 0 ? void 0 : _match.length) !== null && _match$length !== void 0 ? _match$length : 0;
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
this.layout.
|
|
412
|
+
var margin = ChartUtils.DEFAULT_MARGIN.t + subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT;
|
|
413
|
+
|
|
414
|
+
if (this.layout.margin) {
|
|
415
|
+
this.layout.margin.t = margin;
|
|
416
|
+
} else {
|
|
417
|
+
this.layout.margin = {
|
|
418
|
+
t: margin
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (typeof this.layout.title === 'string') {
|
|
423
|
+
this.layout.title = title;
|
|
424
|
+
} else {
|
|
425
|
+
this.layout.title = _objectSpread({}, this.layout.title);
|
|
426
|
+
this.layout.title.text = title;
|
|
427
|
+
this.layout.title.pad = _objectSpread({}, this.layout.title.pad);
|
|
428
|
+
this.layout.title.pad.t = ChartUtils.DEFAULT_TITLE_PADDING.t + subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT * 0.5;
|
|
429
|
+
}
|
|
387
430
|
}
|
|
388
431
|
|
|
389
432
|
getPlotWidth() {
|
|
433
|
+
var _this$layout$margin$l, _this$layout$margin, _this$layout$margin$r, _this$layout$margin2;
|
|
434
|
+
|
|
390
435
|
if (!this.rect || !this.rect.width) {
|
|
391
436
|
return 0;
|
|
392
437
|
}
|
|
393
438
|
|
|
394
|
-
return Math.max(this.rect.width - this.layout.margin.l - this.layout.margin.r, 0);
|
|
439
|
+
return Math.max(this.rect.width - ((_this$layout$margin$l = (_this$layout$margin = this.layout.margin) === null || _this$layout$margin === void 0 ? void 0 : _this$layout$margin.l) !== null && _this$layout$margin$l !== void 0 ? _this$layout$margin$l : 0) - ((_this$layout$margin$r = (_this$layout$margin2 = this.layout.margin) === null || _this$layout$margin2 === void 0 ? void 0 : _this$layout$margin2.r) !== null && _this$layout$margin$r !== void 0 ? _this$layout$margin$r : 0), 0);
|
|
395
440
|
}
|
|
396
441
|
|
|
397
442
|
getPlotHeight() {
|
|
443
|
+
var _this$layout$margin$t, _this$layout$margin3, _this$layout$margin$b, _this$layout$margin4;
|
|
444
|
+
|
|
398
445
|
if (!this.rect || !this.rect.height) {
|
|
399
446
|
return 0;
|
|
400
447
|
}
|
|
401
448
|
|
|
402
|
-
return Math.max(this.rect.height - this.layout.margin.t - this.layout.margin.b, 0);
|
|
449
|
+
return Math.max(this.rect.height - ((_this$layout$margin$t = (_this$layout$margin3 = this.layout.margin) === null || _this$layout$margin3 === void 0 ? void 0 : _this$layout$margin3.t) !== null && _this$layout$margin$t !== void 0 ? _this$layout$margin$t : 0) - ((_this$layout$margin$b = (_this$layout$margin4 = this.layout.margin) === null || _this$layout$margin4 === void 0 ? void 0 : _this$layout$margin4.b) !== null && _this$layout$margin$b !== void 0 ? _this$layout$margin$b : 0), 0);
|
|
403
450
|
}
|
|
404
451
|
|
|
405
452
|
updateAxisPositions() {
|
|
@@ -435,9 +482,9 @@ class FigureChartModel extends ChartModel {
|
|
|
435
482
|
}
|
|
436
483
|
/**
|
|
437
484
|
* Set a specific array for the array of series properties specified.
|
|
438
|
-
* @param
|
|
439
|
-
* @param
|
|
440
|
-
* @param
|
|
485
|
+
* @param series The series to set the data array for.
|
|
486
|
+
* @param sourceType The source type within that series to set the data for.
|
|
487
|
+
* @param dataArray The array to use for the data for this series source.
|
|
441
488
|
*/
|
|
442
489
|
|
|
443
490
|
|
|
@@ -448,13 +495,16 @@ class FigureChartModel extends ChartModel {
|
|
|
448
495
|
} = series;
|
|
449
496
|
var seriesData = this.seriesDataMap.get(name);
|
|
450
497
|
var property = ChartUtils.getPlotlyProperty(plotStyle, sourceType);
|
|
451
|
-
|
|
498
|
+
|
|
499
|
+
if (seriesData) {
|
|
500
|
+
set(seriesData, property, dataArray);
|
|
501
|
+
}
|
|
452
502
|
}
|
|
453
503
|
/**
|
|
454
504
|
* After setting all the data in the series data, we may need to adjust some other properties
|
|
455
505
|
* Eg. Calculating the width from the xLow/xHigh values; Plot.ly uses `width` instead of a low/high
|
|
456
506
|
* value for x.
|
|
457
|
-
* @param
|
|
507
|
+
* @param series The series to clean the data for
|
|
458
508
|
*/
|
|
459
509
|
|
|
460
510
|
|
|
@@ -465,6 +515,10 @@ class FigureChartModel extends ChartModel {
|
|
|
465
515
|
} = series;
|
|
466
516
|
var seriesData = this.seriesDataMap.get(name);
|
|
467
517
|
|
|
518
|
+
if (seriesData == null) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
|
|
468
522
|
if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {
|
|
469
523
|
var {
|
|
470
524
|
xLow,
|
|
@@ -528,7 +582,7 @@ class FigureChartModel extends ChartModel {
|
|
|
528
582
|
}
|
|
529
583
|
/**
|
|
530
584
|
* Sets the filter on the model. Will only set the values that have changed.
|
|
531
|
-
* @param
|
|
585
|
+
* @param filterMap Map of filter column names to values
|
|
532
586
|
*/
|
|
533
587
|
|
|
534
588
|
|