@deephaven/js-plugin-plotly-express 0.15.0 → 0.16.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/DashboardPlugin.d.ts +4 -0
- package/dist/DashboardPlugin.d.ts.map +1 -0
- package/dist/DashboardPlugin.js +39 -0
- package/dist/DashboardPlugin.js.map +1 -0
- package/dist/PlotlyExpressChart.d.ts +5 -0
- package/dist/PlotlyExpressChart.d.ts.map +1 -0
- package/dist/PlotlyExpressChart.js +38 -0
- package/dist/PlotlyExpressChart.js.map +1 -0
- package/dist/PlotlyExpressChartModel.d.ts +163 -0
- package/dist/PlotlyExpressChartModel.d.ts.map +1 -0
- package/dist/PlotlyExpressChartModel.js +609 -0
- package/dist/PlotlyExpressChartModel.js.map +1 -0
- package/dist/PlotlyExpressChartPanel.d.ts +5 -0
- package/dist/PlotlyExpressChartPanel.d.ts.map +1 -0
- package/dist/PlotlyExpressChartPanel.js +36 -0
- package/dist/PlotlyExpressChartPanel.js.map +1 -0
- package/dist/PlotlyExpressChartUtils.d.ts +222 -0
- package/dist/PlotlyExpressChartUtils.d.ts.map +1 -0
- package/dist/PlotlyExpressChartUtils.js +432 -0
- package/dist/PlotlyExpressChartUtils.js.map +1 -0
- package/dist/PlotlyExpressPlugin.d.ts +5 -0
- package/dist/PlotlyExpressPlugin.d.ts.map +1 -0
- package/dist/PlotlyExpressPlugin.js +14 -0
- package/dist/PlotlyExpressPlugin.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/useHandleSceneTicks.d.ts +4 -0
- package/dist/useHandleSceneTicks.d.ts.map +1 -0
- package/dist/useHandleSceneTicks.js +36 -0
- package/dist/useHandleSceneTicks.js.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { ChartUtils } from '@deephaven/chart';
|
|
2
|
+
/**
|
|
3
|
+
* Traces that are at least partially powered by WebGL and have no SVG equivalent.
|
|
4
|
+
* https://plotly.com/python/webgl-vs-svg/
|
|
5
|
+
*/
|
|
6
|
+
const UNREPLACEABLE_WEBGL_TRACE_TYPES = new Set([
|
|
7
|
+
'splom',
|
|
8
|
+
'parcoords',
|
|
9
|
+
'scatter3d',
|
|
10
|
+
'surface',
|
|
11
|
+
'mesh3d',
|
|
12
|
+
'cone',
|
|
13
|
+
'streamtube',
|
|
14
|
+
'scattermapbox',
|
|
15
|
+
'choroplethmapbox',
|
|
16
|
+
'densitymapbox',
|
|
17
|
+
]);
|
|
18
|
+
/*
|
|
19
|
+
* A map of trace type to attributes that should be set to a single value instead
|
|
20
|
+
* of an array in the Figure object. The attributes should be relative to the trace
|
|
21
|
+
* within the plotly/data/ array.
|
|
22
|
+
*/
|
|
23
|
+
const SINGLE_VALUE_REPLACEMENTS = {
|
|
24
|
+
indicator: new Set(['value', 'delta/reference', 'title/text']),
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A prefix for the number format to indicate it is in Java format and should be
|
|
28
|
+
* transformed to a d3 format
|
|
29
|
+
*/
|
|
30
|
+
export const FORMAT_PREFIX = 'DEEPHAVEN_JAVA_FORMAT=';
|
|
31
|
+
export function getWidgetData(widgetInfo) {
|
|
32
|
+
return JSON.parse(widgetInfo.getDataAsString());
|
|
33
|
+
}
|
|
34
|
+
export function getDataMappings(widgetData) {
|
|
35
|
+
const data = widgetData.figure;
|
|
36
|
+
// Maps a reference index to a map of column name to an array of the paths where its data should be
|
|
37
|
+
const tableColumnReplacementMap = new Map();
|
|
38
|
+
data.deephaven.mappings.forEach(({ table: tableIndex, data_columns: dataColumns }) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const existingColumnMap = (_a = tableColumnReplacementMap.get(tableIndex)) !== null && _a !== void 0 ? _a : new Map();
|
|
41
|
+
tableColumnReplacementMap.set(tableIndex, existingColumnMap);
|
|
42
|
+
// For each { columnName: [replacePaths] } in the object, add to the tableColumnReplacementMap
|
|
43
|
+
Object.entries(dataColumns).forEach(([columnName, paths]) => {
|
|
44
|
+
const existingPaths = existingColumnMap.get(columnName);
|
|
45
|
+
if (existingPaths !== undefined) {
|
|
46
|
+
existingPaths.push(...paths);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
existingColumnMap.set(columnName, [...paths]);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return tableColumnReplacementMap;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Removes the default colors from the data
|
|
57
|
+
* Data color is not removed if the user set the color specifically or the plot type sets it
|
|
58
|
+
*
|
|
59
|
+
* This only checks if the marker or line color is set to a color in the colorway.
|
|
60
|
+
* This means it is not possible to change the order of the colorway and use the same colors.
|
|
61
|
+
*
|
|
62
|
+
* @param colorway The colorway from plotly
|
|
63
|
+
* @param data The data to remove the colorway from. This will be mutated
|
|
64
|
+
*/
|
|
65
|
+
export function removeColorsFromData(colorway, data) {
|
|
66
|
+
const plotlyColors = new Set(colorway.map(color => color.toUpperCase()));
|
|
67
|
+
// Just check if the colors are in the colorway at any point
|
|
68
|
+
// Plotly has many different ways to layer/order series
|
|
69
|
+
for (let i = 0; i < data.length; i += 1) {
|
|
70
|
+
const trace = data[i];
|
|
71
|
+
// There are multiple datatypes in plotly and some don't contain marker or marker.color
|
|
72
|
+
if ('marker' in trace &&
|
|
73
|
+
trace.marker != null &&
|
|
74
|
+
'color' in trace.marker &&
|
|
75
|
+
typeof trace.marker.color === 'string') {
|
|
76
|
+
if (plotlyColors.has(trace.marker.color.toUpperCase())) {
|
|
77
|
+
delete trace.marker.color;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if ('line' in trace &&
|
|
81
|
+
trace.line != null &&
|
|
82
|
+
'color' in trace.line &&
|
|
83
|
+
typeof trace.line.color === 'string') {
|
|
84
|
+
if (plotlyColors.has(trace.line.color.toUpperCase())) {
|
|
85
|
+
delete trace.line.color;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Gets the path parts from a path replacement string from the widget data.
|
|
92
|
+
* The parts start with the plotly data array as the root.
|
|
93
|
+
* E.g. /plotly/data/0/x -> ['0', 'x']
|
|
94
|
+
* @param path The path from the widget data
|
|
95
|
+
* @returns The path parts within the plotly data array
|
|
96
|
+
*/
|
|
97
|
+
export function getPathParts(path) {
|
|
98
|
+
return path
|
|
99
|
+
.split('/')
|
|
100
|
+
.filter(part => part !== '' && part !== 'plotly' && part !== 'data');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Checks if a plotly series is a line series without markers
|
|
104
|
+
* @param data The plotly data to check
|
|
105
|
+
* @returns True if the data is a line series without markers
|
|
106
|
+
*/
|
|
107
|
+
export function isLineSeries(data) {
|
|
108
|
+
return ((data.type === 'scatter' || data.type === 'scattergl') &&
|
|
109
|
+
data.mode === 'lines');
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Checks if a plotly axis type is automatically determined based on the data
|
|
113
|
+
* @param axis The plotly axis to check
|
|
114
|
+
* @returns True if the axis type is determined based on the data
|
|
115
|
+
*/
|
|
116
|
+
export function isAutoAxis(axis) {
|
|
117
|
+
return axis.type == null || axis.type === '-';
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Checks if a plotly axis type is linear
|
|
121
|
+
* @param axis The plotly axis to check
|
|
122
|
+
* @returns True if the axis is a linear axis
|
|
123
|
+
*/
|
|
124
|
+
export function isLinearAxis(axis) {
|
|
125
|
+
return axis.type === 'linear' || axis.type === 'date';
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Check if 2 axis ranges are the same
|
|
129
|
+
* A null range indicates an auto range
|
|
130
|
+
* @param range1 The first axis range options
|
|
131
|
+
* @param range2 The second axis range options
|
|
132
|
+
* @returns True if the range options describe the same range
|
|
133
|
+
*/
|
|
134
|
+
export function areSameAxisRange(range1, range2) {
|
|
135
|
+
return ((range1 === null && range2 === null) ||
|
|
136
|
+
(range1 != null &&
|
|
137
|
+
range2 != null &&
|
|
138
|
+
range1[0] === range2[0] &&
|
|
139
|
+
range1[1] === range2[1]));
|
|
140
|
+
}
|
|
141
|
+
export function downsample(dh, info) {
|
|
142
|
+
var _a;
|
|
143
|
+
return dh.plot.Downsample.runChartDownsample(info.originalTable, info.xCol, info.yCols, info.width, (_a = info.range) === null || _a === void 0 ? void 0 : _a.map(val => info.rangeType === 'date'
|
|
144
|
+
? dh.DateWrapper.ofJsDate(new Date(val))
|
|
145
|
+
: dh.LongWrapper.ofString(val)));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the indexes of the replaceable WebGL traces in the data
|
|
149
|
+
* A replaceable WebGL has a type that ends with 'gl' which indicates it has a SVG equivalent
|
|
150
|
+
* @param data The data to check
|
|
151
|
+
* @returns The indexes of the WebGL traces
|
|
152
|
+
*/
|
|
153
|
+
export function getReplaceableWebGlTraceIndices(data) {
|
|
154
|
+
const webGlTraceIndexes = new Set();
|
|
155
|
+
data.forEach((trace, index) => {
|
|
156
|
+
if (trace.type && trace.type.endsWith('gl')) {
|
|
157
|
+
webGlTraceIndexes.add(index);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return webGlTraceIndexes;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Check if the data contains any traces that are at least partially powered by WebGL and have no SVG equivalent.
|
|
164
|
+
* @param data The data to check for WebGL traces
|
|
165
|
+
* @returns True if the data contains any unreplaceable WebGL traces
|
|
166
|
+
*/
|
|
167
|
+
export function hasUnreplaceableWebGlTraces(data) {
|
|
168
|
+
return data.some(trace => trace.type && UNREPLACEABLE_WEBGL_TRACE_TYPES.has(trace.type));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Set traces to use WebGL if WebGL is enabled and the trace was originally WebGL
|
|
172
|
+
* or swap out WebGL for SVG if WebGL is disabled and the trace was originally WebGL
|
|
173
|
+
* @param data The plotly figure data to update
|
|
174
|
+
* @param webgl True if WebGL is enabled
|
|
175
|
+
* @param webGlTraceIndices The indexes of the traces that are originally WebGL traces
|
|
176
|
+
*/
|
|
177
|
+
export function setWebGlTraceType(data, webgl, webGlTraceIndices) {
|
|
178
|
+
webGlTraceIndices.forEach(index => {
|
|
179
|
+
const trace = data[index];
|
|
180
|
+
if (webgl && trace.type && !trace.type.endsWith('gl')) {
|
|
181
|
+
// If WebGL is enabled and the trace is not already a WebGL trace, make it one
|
|
182
|
+
trace.type = `${trace.type}gl`;
|
|
183
|
+
}
|
|
184
|
+
else if (!webgl && trace.type && trace.type.endsWith('gl')) {
|
|
185
|
+
// If WebGL is disabled and the trace is a WebGL trace, remove the 'gl'
|
|
186
|
+
trace.type = trace.type.substring(0, trace.type.length - 2);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Create rangebreaks from a business calendar
|
|
192
|
+
* @param formatter The formatter to use for the rangebreak calculations
|
|
193
|
+
* @param calendar The business calendar to create the rangebreaks from
|
|
194
|
+
* @param layout The layout to update with the rangebreaks
|
|
195
|
+
* @param chartUtils The chart utils to use for the rangebreaks
|
|
196
|
+
* @returns The updated layout with the rangebreaks added
|
|
197
|
+
*/
|
|
198
|
+
export function setRangebreaksFromCalendar(formatter, calendar, layout, chartUtils) {
|
|
199
|
+
if (formatter != null && calendar != null) {
|
|
200
|
+
const layoutUpdate = {};
|
|
201
|
+
Object.keys(layout)
|
|
202
|
+
.filter(key => key.includes('axis'))
|
|
203
|
+
.forEach(key => {
|
|
204
|
+
var _a;
|
|
205
|
+
const axis = layout[key];
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
207
|
+
const rangebreaks = (_a = axis === null || axis === void 0 ? void 0 : axis.rangebreaks) !== null && _a !== void 0 ? _a : [];
|
|
208
|
+
const updatedRangebreaks = chartUtils.createRangeBreaksFromBusinessCalendar(calendar, formatter);
|
|
209
|
+
const updatedAxis = Object.assign(Object.assign({}, (typeof axis === 'object' ? axis : {})), { rangebreaks: [...rangebreaks, ...updatedRangebreaks] });
|
|
210
|
+
layoutUpdate[key] = updatedAxis;
|
|
211
|
+
});
|
|
212
|
+
return layoutUpdate;
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Check if the data at the selector should be replaced with a single value instead of an array
|
|
218
|
+
* @param data The data to check
|
|
219
|
+
* @param selector The selector to check
|
|
220
|
+
* @returns True if the data at the selector should be replaced with a single value
|
|
221
|
+
*/
|
|
222
|
+
export function isSingleValue(data, selector) {
|
|
223
|
+
var _a, _b;
|
|
224
|
+
const index = parseInt(selector[0], 10);
|
|
225
|
+
const type = data[index].type;
|
|
226
|
+
const path = selector.slice(1).join('/');
|
|
227
|
+
return (_b = (_a = SINGLE_VALUE_REPLACEMENTS[type]) === null || _a === void 0 ? void 0 : _a.has(path)) !== null && _b !== void 0 ? _b : false;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Set the default value formats for all traces that require it
|
|
231
|
+
* @param plotlyData The plotly data to update
|
|
232
|
+
* @param defaultValueFormatSet The set of updates to make
|
|
233
|
+
* @param dataTypeMap The map of path to column type to pull the correct default format from
|
|
234
|
+
* @param formatter The formatter to use to get the default format
|
|
235
|
+
*/
|
|
236
|
+
export function setDefaultValueFormat(plotlyData, defaultValueFormatSet, dataTypeMap, formatter = null) {
|
|
237
|
+
defaultValueFormatSet.forEach(({ index, path, typeFrom, options }) => {
|
|
238
|
+
const types = typeFrom.map(type => dataTypeMap.get(`${index}/${type}`));
|
|
239
|
+
let columnType = null;
|
|
240
|
+
if (types.some(type => type === 'double')) {
|
|
241
|
+
// if any of the types are decimal, use decimal since it's the most specific
|
|
242
|
+
columnType = 'double';
|
|
243
|
+
}
|
|
244
|
+
else if (types.some(type => type === 'int')) {
|
|
245
|
+
columnType = 'int';
|
|
246
|
+
}
|
|
247
|
+
if (columnType == null) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const typeFormatter = formatter === null || formatter === void 0 ? void 0 : formatter.getColumnTypeFormatter(columnType);
|
|
251
|
+
if (typeFormatter == null || !('defaultFormatString' in typeFormatter)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const valueFormat = typeFormatter.defaultFormatString;
|
|
255
|
+
if (valueFormat == null) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const trace = plotlyData[index];
|
|
259
|
+
// This object should be safe to cast to PlotNumber or Delta due
|
|
260
|
+
// to the checks when originally added to the set
|
|
261
|
+
const convertData = trace[path];
|
|
262
|
+
convertToPlotlyNumberFormat(convertData, valueFormat, options);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Convert the number format to a d3 number format
|
|
267
|
+
* @param data The data to update
|
|
268
|
+
* @param valueFormat The number format to convert to a d3 format
|
|
269
|
+
* @param options Options of what to update
|
|
270
|
+
*/
|
|
271
|
+
export function convertToPlotlyNumberFormat(data, valueFormat, options = {}) {
|
|
272
|
+
var _a, _b, _c;
|
|
273
|
+
// by default, everything should be updated dependent on updateFormat
|
|
274
|
+
const updateFormat = (_a = options === null || options === void 0 ? void 0 : options.format) !== null && _a !== void 0 ? _a : true;
|
|
275
|
+
const updatePrefix = (_b = options === null || options === void 0 ? void 0 : options.prefix) !== null && _b !== void 0 ? _b : updateFormat;
|
|
276
|
+
const updateSuffix = (_c = options === null || options === void 0 ? void 0 : options.suffix) !== null && _c !== void 0 ? _c : updateFormat;
|
|
277
|
+
const formatResults = ChartUtils.getPlotlyNumberFormat(null, '', valueFormat);
|
|
278
|
+
if (updateFormat &&
|
|
279
|
+
(formatResults === null || formatResults === void 0 ? void 0 : formatResults.tickformat) != null &&
|
|
280
|
+
(formatResults === null || formatResults === void 0 ? void 0 : formatResults.tickformat) !== '') {
|
|
281
|
+
// eslint-disable-next-line no-param-reassign
|
|
282
|
+
data.valueformat = formatResults.tickformat;
|
|
283
|
+
}
|
|
284
|
+
if (updatePrefix) {
|
|
285
|
+
// there may be no prefix now, so remove the preexisting one
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-param-reassign
|
|
287
|
+
data.prefix = '';
|
|
288
|
+
// prefix and suffix might already be set, which should take precedence
|
|
289
|
+
if ((formatResults === null || formatResults === void 0 ? void 0 : formatResults.tickprefix) != null && (formatResults === null || formatResults === void 0 ? void 0 : formatResults.tickprefix) !== '') {
|
|
290
|
+
// eslint-disable-next-line no-param-reassign, @typescript-eslint/no-explicit-any
|
|
291
|
+
data.prefix = formatResults.tickprefix;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (updateSuffix) {
|
|
295
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-param-reassign
|
|
296
|
+
data.suffix = '';
|
|
297
|
+
// prefix and suffix might already be set, which should take precedence
|
|
298
|
+
if ((formatResults === null || formatResults === void 0 ? void 0 : formatResults.ticksuffix) != null && (formatResults === null || formatResults === void 0 ? void 0 : formatResults.ticksuffix) !== '') {
|
|
299
|
+
// eslint-disable-next-line no-param-reassign, @typescript-eslint/no-explicit-any
|
|
300
|
+
data.suffix = formatResults.ticksuffix;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Transform the number format to a d3 number format, which is used by Plotly
|
|
306
|
+
* @param numberFormat The number format to transform
|
|
307
|
+
* @returns The d3 number format
|
|
308
|
+
*/
|
|
309
|
+
export function transformValueFormat(data) {
|
|
310
|
+
let valueFormat = data === null || data === void 0 ? void 0 : data.valueformat;
|
|
311
|
+
if (valueFormat == null) {
|
|
312
|
+
// if there's no format, note this so that the default format can be used
|
|
313
|
+
// prefix and suffix should only be updated if the default format is used and they are not already set
|
|
314
|
+
return {
|
|
315
|
+
format: true,
|
|
316
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
317
|
+
prefix: (data === null || data === void 0 ? void 0 : data.prefix) == null,
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
319
|
+
suffix: (data === null || data === void 0 ? void 0 : data.suffix) == null,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (valueFormat.startsWith(FORMAT_PREFIX)) {
|
|
323
|
+
valueFormat = valueFormat.substring(FORMAT_PREFIX.length);
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
// don't transform if it's not a deephaven format
|
|
327
|
+
return {
|
|
328
|
+
format: false,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
// transform once but don't transform again, so false is returned for format
|
|
332
|
+
const options = {
|
|
333
|
+
format: true,
|
|
334
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
|
+
prefix: (data === null || data === void 0 ? void 0 : data.prefix) == null,
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
|
+
suffix: (data === null || data === void 0 ? void 0 : data.suffix) == null,
|
|
338
|
+
};
|
|
339
|
+
convertToPlotlyNumberFormat(data, valueFormat, options);
|
|
340
|
+
return {
|
|
341
|
+
format: false,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Replace the number formats in the data with a d3 number format
|
|
346
|
+
* @param data The data to update
|
|
347
|
+
*/
|
|
348
|
+
export function replaceValueFormat(plotlyData) {
|
|
349
|
+
const defaultValueFormatSet = new Set();
|
|
350
|
+
plotlyData.forEach((trace, i) => {
|
|
351
|
+
if (trace.type === 'indicator') {
|
|
352
|
+
if ((trace === null || trace === void 0 ? void 0 : trace.number) == null) {
|
|
353
|
+
// eslint-disable-next-line no-param-reassign
|
|
354
|
+
trace.number = {};
|
|
355
|
+
}
|
|
356
|
+
const numberFormatOptions = transformValueFormat(trace.number);
|
|
357
|
+
if (numberFormatOptions.format) {
|
|
358
|
+
defaultValueFormatSet.add({
|
|
359
|
+
index: i,
|
|
360
|
+
path: 'number',
|
|
361
|
+
typeFrom: ['value', 'delta/reference'],
|
|
362
|
+
options: numberFormatOptions,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
if ((trace === null || trace === void 0 ? void 0 : trace.delta) == null) {
|
|
366
|
+
// eslint-disable-next-line no-param-reassign
|
|
367
|
+
trace.delta = {};
|
|
368
|
+
}
|
|
369
|
+
const deltaFormatOptions = transformValueFormat(trace.delta);
|
|
370
|
+
if (deltaFormatOptions.format) {
|
|
371
|
+
defaultValueFormatSet.add({
|
|
372
|
+
index: i,
|
|
373
|
+
path: 'delta',
|
|
374
|
+
typeFrom: ['value', 'delta/reference'],
|
|
375
|
+
options: deltaFormatOptions,
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
return defaultValueFormatSet;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Get the types of variables assocated with columns in the data
|
|
384
|
+
* For example, if the path /plotly/data/0/value is associated with a column of type int,
|
|
385
|
+
* the map will have the entry '0/value' -> 'int'
|
|
386
|
+
* @param deephavenData The deephaven data from the widget to get path and column name from
|
|
387
|
+
* @param tableReferenceMap The map of table index to table reference.
|
|
388
|
+
* Types are pulled from the table reference
|
|
389
|
+
* @returns A map of path to column type
|
|
390
|
+
*/
|
|
391
|
+
export function getDataTypeMap(deephavenData, tableReferenceMap) {
|
|
392
|
+
const dataTypeMap = new Map();
|
|
393
|
+
const { mappings } = deephavenData;
|
|
394
|
+
mappings.forEach(({ table: tableIndex, data_columns: dataColumns }) => {
|
|
395
|
+
const table = tableReferenceMap.get(tableIndex);
|
|
396
|
+
Object.entries(dataColumns).forEach(([columnName, paths]) => {
|
|
397
|
+
const column = table === null || table === void 0 ? void 0 : table.findColumn(columnName);
|
|
398
|
+
if (column == null) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const columnType = column.type;
|
|
402
|
+
paths.forEach(path => {
|
|
403
|
+
const cleanPath = getPathParts(path).join('/');
|
|
404
|
+
dataTypeMap.set(cleanPath, columnType);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
return dataTypeMap;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Check if WebGL is supported in the current environment.
|
|
412
|
+
* Most modern browsers do support WebGL, but it's possible to disable it and it is also not available
|
|
413
|
+
* in some headless environments, which can affect e2e tests.
|
|
414
|
+
*
|
|
415
|
+
* https://github.com/microsoft/playwright/issues/13146
|
|
416
|
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=1375585
|
|
417
|
+
*
|
|
418
|
+
* @returns True if WebGL is supported, false otherwise
|
|
419
|
+
*/
|
|
420
|
+
export function isWebGLSupported() {
|
|
421
|
+
try {
|
|
422
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/By_example/Detect_WebGL
|
|
423
|
+
const canvas = document.createElement('canvas');
|
|
424
|
+
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
|
|
425
|
+
return gl != null && gl instanceof WebGLRenderingContext;
|
|
426
|
+
}
|
|
427
|
+
catch (e) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
export const IS_WEBGL_SUPPORTED = isWebGLSupported();
|
|
432
|
+
//# sourceMappingURL=PlotlyExpressChartUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlotlyExpressChartUtils.js","sourceRoot":"","sources":["../src/PlotlyExpressChartUtils.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;GAGG;AACH,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,OAAO;IACP,WAAW;IACX,WAAW;IACX,SAAS;IACT,QAAQ;IACR,MAAM;IACN,YAAY;IACZ,eAAe;IACf,kBAAkB;IAClB,eAAe;CAChB,CAAC,CAAC;AAEH;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;;;GASG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI;QACF,qFAAqF;QACrF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,EAAE,GACN,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACxE,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,YAAY,qBAAqB,CAAC;KAC1D;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlotlyExpressPlugin.d.ts","sourceRoot":"","sources":["../src/PlotlyExpressPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,mBAAmB,CAAC;AAElE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,EAAE,CAAC,MAAM,CAOvD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PluginType } from '@deephaven/plugin';
|
|
2
|
+
import { vsGraph } from '@deephaven/icons';
|
|
3
|
+
import { PlotlyExpressChart } from './PlotlyExpressChart.js';
|
|
4
|
+
import { PlotlyExpressChartPanel } from './PlotlyExpressChartPanel.js';
|
|
5
|
+
export const PlotlyExpressPlugin = {
|
|
6
|
+
name: '@deephaven/plotly-express',
|
|
7
|
+
type: PluginType.WIDGET_PLUGIN,
|
|
8
|
+
supportedTypes: 'deephaven.plot.express.DeephavenFigure',
|
|
9
|
+
component: PlotlyExpressChart,
|
|
10
|
+
panelComponent: PlotlyExpressChartPanel,
|
|
11
|
+
icon: vsGraph,
|
|
12
|
+
};
|
|
13
|
+
export default PlotlyExpressPlugin;
|
|
14
|
+
//# sourceMappingURL=PlotlyExpressPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlotlyExpressPlugin.js","sourceRoot":"","sources":["../src/PlotlyExpressPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAA4B;IAC1D,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,UAAU,CAAC,aAAa;IAC9B,cAAc,EAAE,wCAAwC;IACxD,SAAS,EAAE,kBAAkB;IAC7B,cAAc,EAAE,uBAAuB;IACvC,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlotlyExpressPlugin } from './PlotlyExpressPlugin.js';
|
|
2
|
+
export * from './DashboardPlugin.js';
|
|
3
|
+
export * from './PlotlyExpressChartModel.js';
|
|
4
|
+
export * from './PlotlyExpressChartUtils.js';
|
|
5
|
+
export default PlotlyExpressPlugin;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAE7C,eAAe,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PlotlyExpressPlugin } from './PlotlyExpressPlugin.js';
|
|
2
|
+
// Export legacy dashboard plugin as named export for backwards compatibility
|
|
3
|
+
export * from './DashboardPlugin.js';
|
|
4
|
+
export * from './PlotlyExpressChartModel.js';
|
|
5
|
+
export * from './PlotlyExpressChartUtils.js';
|
|
6
|
+
export default PlotlyExpressPlugin;
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,6EAA6E;AAC7E,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAE7C,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import PlotlyExpressChartModel from './PlotlyExpressChartModel.js';
|
|
2
|
+
export declare function useHandleSceneTicks(model: PlotlyExpressChartModel | undefined, container: HTMLDivElement | null): void;
|
|
3
|
+
export default useHandleSceneTicks;
|
|
4
|
+
//# sourceMappingURL=useHandleSceneTicks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandleSceneTicks.d.ts","sourceRoot":"","sources":["../src/useHandleSceneTicks.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,uBAAuB,GAAG,SAAS,EAC1C,SAAS,EAAE,cAAc,GAAG,IAAI,GAC/B,IAAI,CAsCN;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export function useHandleSceneTicks(model, container) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
// Plotly scenes and geo views reset when our data ticks
|
|
5
|
+
// Pause rendering data updates when the user is manipulating a scene
|
|
6
|
+
if (!model || !container || !model.shouldPauseOnUserInteraction()) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
function handleMouseDown() {
|
|
10
|
+
model === null || model === void 0 ? void 0 : model.pauseUpdates();
|
|
11
|
+
// The once option removes the listener after it is called
|
|
12
|
+
window.addEventListener('mouseup', handleMouseUp, { once: true });
|
|
13
|
+
}
|
|
14
|
+
function handleMouseUp() {
|
|
15
|
+
model === null || model === void 0 ? void 0 : model.resumeUpdates();
|
|
16
|
+
}
|
|
17
|
+
let wheelTimeout = 0;
|
|
18
|
+
function handleWheel() {
|
|
19
|
+
model === null || model === void 0 ? void 0 : model.pauseUpdates();
|
|
20
|
+
window.clearTimeout(wheelTimeout);
|
|
21
|
+
wheelTimeout = window.setTimeout(() => {
|
|
22
|
+
model === null || model === void 0 ? void 0 : model.resumeUpdates();
|
|
23
|
+
}, 300);
|
|
24
|
+
}
|
|
25
|
+
container.addEventListener('mousedown', handleMouseDown);
|
|
26
|
+
container.addEventListener('wheel', handleWheel);
|
|
27
|
+
return () => {
|
|
28
|
+
window.clearTimeout(wheelTimeout);
|
|
29
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
30
|
+
container.removeEventListener('mousedown', handleMouseDown);
|
|
31
|
+
container.removeEventListener('wheel', handleWheel);
|
|
32
|
+
};
|
|
33
|
+
}, [model, container]);
|
|
34
|
+
}
|
|
35
|
+
export default useHandleSceneTicks;
|
|
36
|
+
//# sourceMappingURL=useHandleSceneTicks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandleSceneTicks.js","sourceRoot":"","sources":["../src/useHandleSceneTicks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,MAAM,UAAU,mBAAmB,CACjC,KAA0C,EAC1C,SAAgC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACb,wDAAwD;QACxD,qEAAqE;QACrE,IAAI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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/js-plugin-plotly-express",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Deephaven plotly express plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Deephaven",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"homepage": "https://github.com/deephaven/deephaven-plugins",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"start": "vite build --watch",
|
|
35
|
-
"build": "
|
|
35
|
+
"build": "run-s build:*",
|
|
36
|
+
"build:transpile": "tsc",
|
|
37
|
+
"build:bundle": "vite build",
|
|
36
38
|
"update-dh-packages": "node ../../../../tools/update-dh-packages.mjs"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
@@ -77,5 +79,5 @@
|
|
|
77
79
|
"files": [
|
|
78
80
|
"dist"
|
|
79
81
|
],
|
|
80
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "a917374b95e27f98328ae4178f9f7d609800825f"
|
|
81
83
|
}
|