@fluentui/react-charting 5.24.39 → 5.25.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/CHANGELOG.json +60 -1
- package/CHANGELOG.md +21 -2
- package/dist/react-charting.d.ts +127 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +74 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +343 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +17 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/index.d.ts +2 -0
- package/lib/components/CommonComponents/index.js +2 -0
- package/lib/components/CommonComponents/index.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IChartAnnotation.d.ts +99 -0
- package/lib/types/IChartAnnotation.js +2 -0
- package/lib/types/IChartAnnotation.js.map +1 -0
- package/lib/types/IDataPoint.d.ts +4 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/image-export-utils.js +55 -0
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +72 -20
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +344 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +17 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/CommonComponents/index.d.ts +2 -0
- package/lib-amd/components/CommonComponents/index.js +3 -1
- package/lib-amd/components/CommonComponents/index.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IChartAnnotation.d.ts +99 -0
- package/lib-amd/types/IChartAnnotation.js +5 -0
- package/lib-amd/types/IChartAnnotation.js.map +1 -0
- package/lib-amd/types/IDataPoint.d.ts +4 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/types/index.d.ts +1 -0
- package/lib-amd/types/index.js +2 -1
- package/lib-amd/types/index.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.js +55 -0
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/utilities/utilities.js +72 -20
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +346 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +17 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
- package/lib-commonjs/components/CommonComponents/index.js +2 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
- package/lib-commonjs/types/IChartAnnotation.js +3 -0
- package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
- package/lib-commonjs/types/IDataPoint.d.ts +4 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/types/index.d.ts +1 -0
- package/lib-commonjs/types/index.js +1 -0
- package/lib-commonjs/types/index.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +55 -0
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +72 -20
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
- package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
- package/src/components/CommonComponents/CartesianChart.types.ts +21 -0
|
@@ -251,6 +251,508 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
251
251
|
}
|
|
252
252
|
return flattened;
|
|
253
253
|
};
|
|
254
|
+
var toFiniteNumber = function (value) {
|
|
255
|
+
if (value === undefined || value === null) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
var numeric = typeof value === 'number' ? value : Number(value);
|
|
259
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
|
|
263
|
+
*/
|
|
264
|
+
var normalizeAxisRef = function (ref, axis) {
|
|
265
|
+
if (!ref) {
|
|
266
|
+
return axis;
|
|
267
|
+
}
|
|
268
|
+
var normalized = ref.toLowerCase();
|
|
269
|
+
if (normalized === axis ||
|
|
270
|
+
normalized === "".concat(axis, "axis") ||
|
|
271
|
+
normalized === "".concat(axis, "axis1") ||
|
|
272
|
+
normalized === "".concat(axis, "1")) {
|
|
273
|
+
return axis;
|
|
274
|
+
}
|
|
275
|
+
var match = normalized.match(/^([xy])(axis)?(\d+)$/);
|
|
276
|
+
if (match && match[1] === axis && match[3]) {
|
|
277
|
+
return match[3] === '1' ? axis : "".concat(axis).concat(match[3]);
|
|
278
|
+
}
|
|
279
|
+
return normalized;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
|
|
283
|
+
*/
|
|
284
|
+
var getAxisNumericRangeFromData = function (axis, ref, layout, data) {
|
|
285
|
+
if (!data || data.length === 0) {
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
var axisLayout = getAxisLayoutByRef(layout, ref, axis);
|
|
289
|
+
var targetRef = normalizeAxisRef(ref, axis);
|
|
290
|
+
var traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
|
|
291
|
+
var minValue;
|
|
292
|
+
var maxValue;
|
|
293
|
+
data.forEach(function (trace) {
|
|
294
|
+
var plotTrace = trace;
|
|
295
|
+
var traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
|
|
296
|
+
if (traceAxisRef !== targetRef) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
var values = (axis === 'x' ? plotTrace.x : plotTrace.y);
|
|
300
|
+
if (!(0, chart_utilities_1.isArrayOrTypedArray)(values)) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
var arrayLike = values;
|
|
304
|
+
for (var index = 0; index < arrayLike.length; index++) {
|
|
305
|
+
var value = arrayLike[index];
|
|
306
|
+
var numeric = toNumericValue(convertDataValue(value, axisLayout));
|
|
307
|
+
if (numeric === undefined || Number.isNaN(numeric)) {
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
|
|
311
|
+
maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
|
|
315
|
+
return undefined;
|
|
316
|
+
}
|
|
317
|
+
return [minValue, maxValue];
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
|
|
321
|
+
*/
|
|
322
|
+
var transformRelativeYForChart = function (value) {
|
|
323
|
+
if (value === undefined) {
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
if (!Number.isFinite(value)) {
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
return 1 - value;
|
|
330
|
+
};
|
|
331
|
+
var mapHorizontalAlign = function (anchor) {
|
|
332
|
+
switch ((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()) {
|
|
333
|
+
case 'left':
|
|
334
|
+
return 'start';
|
|
335
|
+
case 'center':
|
|
336
|
+
return 'center';
|
|
337
|
+
case 'right':
|
|
338
|
+
return 'end';
|
|
339
|
+
default:
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var mapVerticalAlign = function (anchor) {
|
|
344
|
+
switch ((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()) {
|
|
345
|
+
case 'top':
|
|
346
|
+
return 'top';
|
|
347
|
+
case 'middle':
|
|
348
|
+
return 'middle';
|
|
349
|
+
case 'bottom':
|
|
350
|
+
return 'bottom';
|
|
351
|
+
default:
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var appendPx = function (value) {
|
|
356
|
+
if (value === undefined || value === null) {
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
if (typeof value === 'string') {
|
|
360
|
+
return value;
|
|
361
|
+
}
|
|
362
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
363
|
+
return "".concat(value, "px");
|
|
364
|
+
}
|
|
365
|
+
return undefined;
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* Maps Plotly's axis reference string to one of our coordinate interpretation modes (axis, relative, or pixel).
|
|
369
|
+
*/
|
|
370
|
+
var resolveRefType = function (ref, axis) {
|
|
371
|
+
if (!ref) {
|
|
372
|
+
return 'axis';
|
|
373
|
+
}
|
|
374
|
+
var normalized = ref.toLowerCase();
|
|
375
|
+
if (normalized === 'pixel') {
|
|
376
|
+
return 'pixel';
|
|
377
|
+
}
|
|
378
|
+
if (normalized === 'paper') {
|
|
379
|
+
return 'relative';
|
|
380
|
+
}
|
|
381
|
+
if (normalized.endsWith(' domain')) {
|
|
382
|
+
return normalized.startsWith(axis) ? 'relative' : undefined;
|
|
383
|
+
}
|
|
384
|
+
var match = normalized.match(/^([xy])(\d*)$/);
|
|
385
|
+
if (match && match[1] === axis) {
|
|
386
|
+
return 'axis';
|
|
387
|
+
}
|
|
388
|
+
return undefined;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
|
|
392
|
+
*/
|
|
393
|
+
var getAxisLayoutByRef = function (layout, ref, axis) {
|
|
394
|
+
if (!layout) {
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
397
|
+
var defaultAxisKey = "".concat(axis, "axis");
|
|
398
|
+
if (!ref) {
|
|
399
|
+
return layout[defaultAxisKey];
|
|
400
|
+
}
|
|
401
|
+
var normalized = ref.toLowerCase();
|
|
402
|
+
if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
|
|
403
|
+
return layout[defaultAxisKey];
|
|
404
|
+
}
|
|
405
|
+
var match = normalized.match(/^([xy])(\d*)$/);
|
|
406
|
+
if (match && match[1] === axis) {
|
|
407
|
+
var index = match[2];
|
|
408
|
+
if (index && index !== '' && index !== '1') {
|
|
409
|
+
var axisKey = "".concat(axis, "axis").concat(index);
|
|
410
|
+
return layout[axisKey];
|
|
411
|
+
}
|
|
412
|
+
return layout[defaultAxisKey];
|
|
413
|
+
}
|
|
414
|
+
return layout[defaultAxisKey];
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
|
|
418
|
+
*/
|
|
419
|
+
var convertDataValue = function (value, axisLayout) {
|
|
420
|
+
if (value === undefined || value === null) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || (0, chart_utilities_1.isDate)(value)) {
|
|
424
|
+
var dateValue = value instanceof Date ? value : new Date(value);
|
|
425
|
+
return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
|
|
426
|
+
}
|
|
427
|
+
if (typeof value === 'number') {
|
|
428
|
+
return value;
|
|
429
|
+
}
|
|
430
|
+
if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
|
|
431
|
+
var numeric = Number(value);
|
|
432
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
433
|
+
}
|
|
434
|
+
if (value instanceof Date) {
|
|
435
|
+
return value;
|
|
436
|
+
}
|
|
437
|
+
return value;
|
|
438
|
+
};
|
|
439
|
+
var toNumericValue = function (value) {
|
|
440
|
+
if (value instanceof Date) {
|
|
441
|
+
var timestamp = value.getTime();
|
|
442
|
+
return Number.isFinite(timestamp) ? timestamp : undefined;
|
|
443
|
+
}
|
|
444
|
+
if (typeof value === 'number') {
|
|
445
|
+
return Number.isFinite(value) ? value : undefined;
|
|
446
|
+
}
|
|
447
|
+
if (typeof value === 'string') {
|
|
448
|
+
var numeric = Number(value);
|
|
449
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
450
|
+
}
|
|
451
|
+
return undefined;
|
|
452
|
+
};
|
|
453
|
+
var toRelativeCoordinate = function (value, axisLayout, fallbackRange) {
|
|
454
|
+
var range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
|
|
455
|
+
var start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
|
|
456
|
+
var end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
|
|
457
|
+
if ((start === undefined || end === undefined || start === end) && fallbackRange) {
|
|
458
|
+
start = fallbackRange[0], end = fallbackRange[1];
|
|
459
|
+
}
|
|
460
|
+
var current = toNumericValue(convertDataValue(value, axisLayout));
|
|
461
|
+
if (start === undefined || end === undefined || current === undefined || start === end) {
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
var relative = (current - start) / (end - start);
|
|
465
|
+
return Number.isFinite(relative) ? relative : undefined;
|
|
466
|
+
};
|
|
467
|
+
var createAnnotationId = function (text, index) {
|
|
468
|
+
var normalized = text.replace(/\s+/g, ' ').trim();
|
|
469
|
+
if (normalized) {
|
|
470
|
+
var slug = normalized
|
|
471
|
+
.toLowerCase()
|
|
472
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
473
|
+
.replace(/^-+|-+$/g, '')
|
|
474
|
+
.slice(0, 32);
|
|
475
|
+
if (slug) {
|
|
476
|
+
return "annotation-".concat(index, "-").concat(slug);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return "annotation-".concat(index);
|
|
480
|
+
};
|
|
481
|
+
var DEFAULT_ARROW_OFFSET = -40;
|
|
482
|
+
var mapArrowsideToArrow = function (annotation) {
|
|
483
|
+
var includeStart = false;
|
|
484
|
+
var includeEnd = false;
|
|
485
|
+
var arrowSide = typeof (annotation === null || annotation === void 0 ? void 0 : annotation.arrowside) === 'string' ? annotation === null || annotation === void 0 ? void 0 : annotation.arrowside.toLowerCase() : undefined;
|
|
486
|
+
if (arrowSide) {
|
|
487
|
+
includeStart = arrowSide.includes('start');
|
|
488
|
+
includeEnd = arrowSide.includes('end');
|
|
489
|
+
}
|
|
490
|
+
var endHead = toFiniteNumber(annotation === null || annotation === void 0 ? void 0 : annotation.arrowhead);
|
|
491
|
+
var startHead = toFiniteNumber(annotation.startarrowhead);
|
|
492
|
+
if (endHead !== undefined && endHead > 0) {
|
|
493
|
+
includeEnd = true;
|
|
494
|
+
}
|
|
495
|
+
if (startHead !== undefined && startHead > 0) {
|
|
496
|
+
includeStart = true;
|
|
497
|
+
}
|
|
498
|
+
if (includeStart && includeEnd) {
|
|
499
|
+
return 'both';
|
|
500
|
+
}
|
|
501
|
+
if (includeStart) {
|
|
502
|
+
return 'start';
|
|
503
|
+
}
|
|
504
|
+
if (includeEnd) {
|
|
505
|
+
return 'end';
|
|
506
|
+
}
|
|
507
|
+
return 'none';
|
|
508
|
+
};
|
|
509
|
+
var mapArrowDashToPattern = function (value) {
|
|
510
|
+
if (!value) {
|
|
511
|
+
return undefined;
|
|
512
|
+
}
|
|
513
|
+
var normalized = value.trim().toLowerCase();
|
|
514
|
+
switch (normalized) {
|
|
515
|
+
case 'solid':
|
|
516
|
+
return undefined;
|
|
517
|
+
case 'dot':
|
|
518
|
+
return '1, 5';
|
|
519
|
+
case 'dash':
|
|
520
|
+
return '5, 5';
|
|
521
|
+
case 'longdash':
|
|
522
|
+
return '10, 5';
|
|
523
|
+
case 'dashdot':
|
|
524
|
+
return '5, 5, 1, 5';
|
|
525
|
+
case 'longdashdot':
|
|
526
|
+
return '10, 5, 1, 5';
|
|
527
|
+
default:
|
|
528
|
+
if (/^\d+(\s|,)*\d*$/.test(normalized.replace(/\s+/g, ' '))) {
|
|
529
|
+
return normalized.replace(/\s+/g, ' ');
|
|
530
|
+
}
|
|
531
|
+
return value;
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
|
|
536
|
+
* layout alignment, styling, and connector metadata while skipping unsupported configurations.
|
|
537
|
+
*/
|
|
538
|
+
var convertPlotlyAnnotation = function (annotation, layout, data, index) {
|
|
539
|
+
var _a;
|
|
540
|
+
if (!annotation || annotation.visible === false) {
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
var xRefType = resolveRefType(annotation.xref, 'x');
|
|
544
|
+
var yRefType = resolveRefType(annotation.yref, 'y');
|
|
545
|
+
if (!xRefType || !yRefType) {
|
|
546
|
+
return undefined;
|
|
547
|
+
}
|
|
548
|
+
var coordinates;
|
|
549
|
+
if (xRefType === 'axis' && yRefType === 'axis') {
|
|
550
|
+
var xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
551
|
+
var yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
552
|
+
var xValue = convertDataValue(annotation.x, xAxisLayout);
|
|
553
|
+
var yValue = convertDataValue(annotation.y, yAxisLayout);
|
|
554
|
+
if (xValue === undefined || yValue === undefined) {
|
|
555
|
+
return undefined;
|
|
556
|
+
}
|
|
557
|
+
var yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
|
|
558
|
+
coordinates = tslib_1.__assign({ type: 'data', x: xValue, y: yValue }, (yRefNormalized === 'y2' ? { yAxis: 'secondary' } : {}));
|
|
559
|
+
}
|
|
560
|
+
else if (xRefType === 'relative' && yRefType === 'relative') {
|
|
561
|
+
var xValue = toFiniteNumber(annotation.x);
|
|
562
|
+
var yValue = toFiniteNumber(annotation.y);
|
|
563
|
+
var chartRelativeY = transformRelativeYForChart(yValue);
|
|
564
|
+
if (xValue === undefined || chartRelativeY === undefined) {
|
|
565
|
+
return undefined;
|
|
566
|
+
}
|
|
567
|
+
coordinates = {
|
|
568
|
+
type: 'relative',
|
|
569
|
+
x: xValue,
|
|
570
|
+
y: chartRelativeY,
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
else if (xRefType === 'relative' && yRefType === 'axis') {
|
|
574
|
+
var xValue = toFiniteNumber(annotation.x);
|
|
575
|
+
var yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
576
|
+
var yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
|
|
577
|
+
var yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
|
|
578
|
+
var chartRelativeY = transformRelativeYForChart(yRelative);
|
|
579
|
+
if (xValue === undefined || chartRelativeY === undefined) {
|
|
580
|
+
return undefined;
|
|
581
|
+
}
|
|
582
|
+
coordinates = {
|
|
583
|
+
type: 'relative',
|
|
584
|
+
x: xValue,
|
|
585
|
+
y: chartRelativeY,
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
else if (xRefType === 'axis' && yRefType === 'relative') {
|
|
589
|
+
var yValue = toFiniteNumber(annotation.y);
|
|
590
|
+
var xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
591
|
+
var xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
|
|
592
|
+
var xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
|
|
593
|
+
var chartRelativeY = transformRelativeYForChart(yValue);
|
|
594
|
+
if (xRelative === undefined || chartRelativeY === undefined) {
|
|
595
|
+
return undefined;
|
|
596
|
+
}
|
|
597
|
+
coordinates = {
|
|
598
|
+
type: 'relative',
|
|
599
|
+
x: xRelative,
|
|
600
|
+
y: chartRelativeY,
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
else if (xRefType === 'pixel' && yRefType === 'pixel') {
|
|
604
|
+
var xValue = toFiniteNumber(annotation.x);
|
|
605
|
+
var yValue = toFiniteNumber(annotation.y);
|
|
606
|
+
if (xValue === undefined || yValue === undefined) {
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
609
|
+
coordinates = {
|
|
610
|
+
type: 'pixel',
|
|
611
|
+
x: xValue,
|
|
612
|
+
y: yValue,
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
return undefined;
|
|
617
|
+
}
|
|
618
|
+
var textValue = annotation.text;
|
|
619
|
+
var text = textValue === undefined || textValue === null ? '' : String(textValue);
|
|
620
|
+
var chartAnnotation = {
|
|
621
|
+
id: createAnnotationId(text, index),
|
|
622
|
+
text: text,
|
|
623
|
+
coordinates: coordinates,
|
|
624
|
+
};
|
|
625
|
+
var layoutProps = {};
|
|
626
|
+
var styleProps = {};
|
|
627
|
+
var showArrow = annotation.showarrow === undefined ? false : !!annotation.showarrow;
|
|
628
|
+
var clipOnAxis = annotation.cliponaxis;
|
|
629
|
+
if (clipOnAxis !== undefined) {
|
|
630
|
+
layoutProps.clipToBounds = !!clipOnAxis;
|
|
631
|
+
}
|
|
632
|
+
else if (coordinates.type === 'data') {
|
|
633
|
+
layoutProps.clipToBounds = true;
|
|
634
|
+
}
|
|
635
|
+
var horizontalAlign = mapHorizontalAlign(annotation.xanchor);
|
|
636
|
+
if (horizontalAlign) {
|
|
637
|
+
layoutProps.align = horizontalAlign;
|
|
638
|
+
}
|
|
639
|
+
if (!layoutProps.align) {
|
|
640
|
+
var alignProp = mapHorizontalAlign(annotation.align);
|
|
641
|
+
if (alignProp) {
|
|
642
|
+
layoutProps.align = alignProp;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
var verticalAlign = mapVerticalAlign(annotation.yanchor);
|
|
646
|
+
if (verticalAlign) {
|
|
647
|
+
layoutProps.verticalAlign = verticalAlign;
|
|
648
|
+
}
|
|
649
|
+
if (!layoutProps.verticalAlign) {
|
|
650
|
+
var valignProp = mapVerticalAlign(annotation.valign);
|
|
651
|
+
if (valignProp) {
|
|
652
|
+
layoutProps.verticalAlign = valignProp;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
var offsetXComponents = [];
|
|
656
|
+
var hasExplicitOffset = false;
|
|
657
|
+
var ax = toFiniteNumber(annotation.ax);
|
|
658
|
+
var axRef = typeof annotation.axref === 'string' ? annotation.axref.toLowerCase() : undefined;
|
|
659
|
+
if (ax !== undefined && (axRef === undefined || axRef === 'pixel')) {
|
|
660
|
+
offsetXComponents.push(ax);
|
|
661
|
+
hasExplicitOffset = true;
|
|
662
|
+
}
|
|
663
|
+
var xShift = toFiniteNumber(annotation.xshift);
|
|
664
|
+
if (xShift !== undefined) {
|
|
665
|
+
offsetXComponents.push(xShift);
|
|
666
|
+
hasExplicitOffset = true;
|
|
667
|
+
}
|
|
668
|
+
if (offsetXComponents.length > 0) {
|
|
669
|
+
var offsetX = offsetXComponents.reduce(function (sum, value) { return sum + value; }, 0);
|
|
670
|
+
if (offsetX !== 0) {
|
|
671
|
+
layoutProps.offsetX = offsetX;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
var offsetYComponents = [];
|
|
675
|
+
var ay = toFiniteNumber(annotation.ay);
|
|
676
|
+
var ayRef = typeof annotation.ayref === 'string' ? annotation.ayref.toLowerCase() : undefined;
|
|
677
|
+
if (ay !== undefined && (ayRef === undefined || ayRef === 'pixel')) {
|
|
678
|
+
offsetYComponents.push(ay);
|
|
679
|
+
hasExplicitOffset = true;
|
|
680
|
+
}
|
|
681
|
+
var yShift = toFiniteNumber(annotation.yshift);
|
|
682
|
+
if (yShift !== undefined) {
|
|
683
|
+
offsetYComponents.push(yShift);
|
|
684
|
+
hasExplicitOffset = true;
|
|
685
|
+
}
|
|
686
|
+
if (offsetYComponents.length > 0) {
|
|
687
|
+
var offsetY = offsetYComponents.reduce(function (sum, value) { return sum + value; }, 0);
|
|
688
|
+
if (offsetY !== 0) {
|
|
689
|
+
layoutProps.offsetY = offsetY;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if (showArrow && !hasExplicitOffset && layoutProps.offsetY === undefined) {
|
|
693
|
+
layoutProps.offsetY = DEFAULT_ARROW_OFFSET;
|
|
694
|
+
}
|
|
695
|
+
var maxWidth = toFiniteNumber(annotation.width);
|
|
696
|
+
if (maxWidth !== undefined) {
|
|
697
|
+
layoutProps.maxWidth = maxWidth;
|
|
698
|
+
}
|
|
699
|
+
if (annotation.bgcolor) {
|
|
700
|
+
styleProps.backgroundColor = annotation.bgcolor;
|
|
701
|
+
}
|
|
702
|
+
if (annotation.bordercolor) {
|
|
703
|
+
styleProps.borderColor = annotation.bordercolor;
|
|
704
|
+
}
|
|
705
|
+
var borderWidth = toFiniteNumber(annotation.borderwidth);
|
|
706
|
+
if (borderWidth !== undefined) {
|
|
707
|
+
styleProps.borderWidth = borderWidth;
|
|
708
|
+
}
|
|
709
|
+
var borderPad = appendPx(annotation.borderpad);
|
|
710
|
+
if (borderPad) {
|
|
711
|
+
styleProps.padding = borderPad;
|
|
712
|
+
}
|
|
713
|
+
var opacity = toFiniteNumber(annotation.opacity);
|
|
714
|
+
if (opacity !== undefined) {
|
|
715
|
+
styleProps.opacity = opacity;
|
|
716
|
+
}
|
|
717
|
+
if (annotation.font) {
|
|
718
|
+
var font = annotation.font;
|
|
719
|
+
if (font === null || font === void 0 ? void 0 : font.color) {
|
|
720
|
+
styleProps.textColor = font.color;
|
|
721
|
+
}
|
|
722
|
+
var fontSize = appendPx(font === null || font === void 0 ? void 0 : font.size);
|
|
723
|
+
if (fontSize) {
|
|
724
|
+
styleProps.fontSize = fontSize;
|
|
725
|
+
}
|
|
726
|
+
if (font === null || font === void 0 ? void 0 : font.weight) {
|
|
727
|
+
styleProps.fontWeight = font.weight;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (Object.keys(layoutProps).length > 0) {
|
|
731
|
+
chartAnnotation.layout = layoutProps;
|
|
732
|
+
}
|
|
733
|
+
if (Object.keys(styleProps).length > 0) {
|
|
734
|
+
chartAnnotation.style = styleProps;
|
|
735
|
+
}
|
|
736
|
+
if (showArrow) {
|
|
737
|
+
var arrowColor = (_a = annotation.arrowcolor) !== null && _a !== void 0 ? _a : styleProps.textColor;
|
|
738
|
+
var arrowWidth = toFiniteNumber(annotation.arrowwidth);
|
|
739
|
+
var endPadding = toFiniteNumber(annotation.standoff);
|
|
740
|
+
var startPadding = toFiniteNumber(annotation.startstandoff);
|
|
741
|
+
var dashPattern = mapArrowDashToPattern(annotation.arrowdash);
|
|
742
|
+
chartAnnotation.connector = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (arrowColor ? { strokeColor: arrowColor } : {})), (arrowWidth !== undefined ? { strokeWidth: arrowWidth } : {})), (endPadding !== undefined ? { endPadding: Math.max(endPadding, 0) } : {})), (startPadding !== undefined ? { startPadding: Math.max(startPadding, 0) } : {})), (dashPattern ? { dashArray: dashPattern } : {})), { arrow: mapArrowsideToArrow(annotation) });
|
|
743
|
+
}
|
|
744
|
+
return chartAnnotation;
|
|
745
|
+
};
|
|
746
|
+
var getChartAnnotationsFromLayout = function (layout, data, isMultiPlot) {
|
|
747
|
+
if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
|
|
748
|
+
return undefined;
|
|
749
|
+
}
|
|
750
|
+
var annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [layout.annotations];
|
|
751
|
+
var converted = annotationsArray
|
|
752
|
+
.map(function (annotation, index) { return convertPlotlyAnnotation(annotation, layout, data, index); })
|
|
753
|
+
.filter(function (annotation) { return annotation !== undefined; });
|
|
754
|
+
return converted.length > 0 ? converted : undefined;
|
|
755
|
+
};
|
|
254
756
|
/**
|
|
255
757
|
* Normalizes an array of objects by flattening nested structures and creating grouped data
|
|
256
758
|
* Uses json_normalize approach with D3 color detection and filtering
|
|
@@ -415,7 +917,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
415
917
|
var _j = getLegendProps(input.data, input.layout, isMultiPlot), legends = _j.legends, hideLegend = _j.hideLegend;
|
|
416
918
|
var colorScale = undefined;
|
|
417
919
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
418
|
-
var
|
|
920
|
+
var resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
|
|
419
921
|
input.data.forEach(function (series, index1) {
|
|
420
922
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
421
923
|
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
@@ -423,7 +925,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
423
925
|
var extractedBarColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
424
926
|
// extract line colors for each series only once
|
|
425
927
|
var extractedLineColors = (0, PlotlyColorAdapter_1.extractColor)((_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, colorwayType, (_h = series.line) === null || _h === void 0 ? void 0 : _h.color, colorMap, isDarkTheme);
|
|
426
|
-
var validXYRanges = (0, exports.getValidXYRanges)(series,
|
|
928
|
+
var validXYRanges = (0, exports.getValidXYRanges)(series, resolveXValue);
|
|
427
929
|
validXYRanges.forEach(function (_a, rangeIdx) {
|
|
428
930
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
429
931
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
@@ -432,7 +934,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
432
934
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
433
935
|
if (!mapXToDataPoints[x]) {
|
|
434
936
|
mapXToDataPoints[x] = {
|
|
435
|
-
xAxisPoint:
|
|
937
|
+
xAxisPoint: resolveXValue(x),
|
|
436
938
|
chartData: [],
|
|
437
939
|
lineData: [],
|
|
438
940
|
};
|
|
@@ -485,7 +987,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
485
987
|
.forEach(function (shape, shapeIdx) {
|
|
486
988
|
var _a, _b, _c;
|
|
487
989
|
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
488
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
489
990
|
var resolveX = function (val) {
|
|
490
991
|
if (typeof val === 'number' && Array.isArray(xCategories) && xCategories[val] !== undefined) {
|
|
491
992
|
return xCategories[val];
|
|
@@ -494,7 +995,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
494
995
|
};
|
|
495
996
|
var x0Key = resolveX(shape.x0);
|
|
496
997
|
var x1Key = resolveX(shape.x1);
|
|
497
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
998
|
var resolveY = function (val) {
|
|
499
999
|
if (shape.yref === 'paper') {
|
|
500
1000
|
if (val === 0) {
|
|
@@ -503,7 +1003,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
503
1003
|
if (val === 1) {
|
|
504
1004
|
return yMaxValue;
|
|
505
1005
|
}
|
|
506
|
-
|
|
1006
|
+
if (typeof val === 'number') {
|
|
1007
|
+
return yMinValue + val * (yMaxValue - yMinValue);
|
|
1008
|
+
}
|
|
1009
|
+
return val;
|
|
507
1010
|
}
|
|
508
1011
|
return val;
|
|
509
1012
|
};
|
|
@@ -525,7 +1028,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
525
1028
|
});
|
|
526
1029
|
});
|
|
527
1030
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
528
|
-
|
|
1031
|
+
var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1032
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_e = input.layout) === null || _e === void 0 ? void 0 : _e.width, height: (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_h = vsbcData[0]) === null || _h === void 0 ? void 0 : _h.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
529
1033
|
};
|
|
530
1034
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
531
1035
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -624,7 +1128,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
624
1128
|
});
|
|
625
1129
|
}
|
|
626
1130
|
});
|
|
627
|
-
|
|
1131
|
+
var annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
|
|
1132
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ dataV2: gvbcDataV2, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: true }), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout)), getAxisTickProps(processedInput.data, processedInput.layout)), (annotations ? { annotations: annotations } : {}));
|
|
628
1133
|
};
|
|
629
1134
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
630
1135
|
var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -684,7 +1189,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
684
1189
|
: { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
|
|
685
1190
|
});
|
|
686
1191
|
});
|
|
687
|
-
|
|
1192
|
+
var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1193
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, supportNegativeData: true, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = vbcData[0]) === null || _d === void 0 ? void 0 : _d.x) === 'string' }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
688
1194
|
};
|
|
689
1195
|
exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
|
|
690
1196
|
var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -699,7 +1205,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
699
1205
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
700
1206
|
};
|
|
701
1207
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
702
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
703
1208
|
var mapColorFillBars = function (layout) {
|
|
704
1209
|
if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
|
|
705
1210
|
return [];
|
|
@@ -719,7 +1224,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
719
1224
|
});
|
|
720
1225
|
};
|
|
721
1226
|
var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
|
|
722
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1227
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
723
1228
|
var isScatterMarkers = [
|
|
724
1229
|
'text',
|
|
725
1230
|
'markers',
|
|
@@ -734,10 +1239,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
734
1239
|
var isScatterChart = chartType === 'scatter';
|
|
735
1240
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
736
1241
|
var mode = 'tonexty';
|
|
737
|
-
var
|
|
1242
|
+
var _q = getLegendProps(input.data, input.layout, isMultiPlot), legends = _q.legends, hideLegend = _q.hideLegend;
|
|
738
1243
|
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
739
|
-
var
|
|
740
|
-
var
|
|
1244
|
+
var xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
|
|
1245
|
+
var resolveXValue = getAxisValueResolver(xAxisType);
|
|
1246
|
+
var shouldWrapLabels = xAxisType === 'category';
|
|
741
1247
|
var chartData = input.data
|
|
742
1248
|
.map(function (series, index) {
|
|
743
1249
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
@@ -757,7 +1263,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
757
1263
|
// if mode contains 'text', we prioritize showing the text over curving the line
|
|
758
1264
|
var lineOptions = !((_l = series.mode) === null || _l === void 0 ? void 0 : _l.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
|
|
759
1265
|
var legendShape = getLegendShape(series);
|
|
760
|
-
var validXYRanges = (0, exports.getValidXYRanges)(series,
|
|
1266
|
+
var validXYRanges = (0, exports.getValidXYRanges)(series, resolveXValue);
|
|
761
1267
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
762
1268
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
763
1269
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
@@ -777,7 +1283,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
777
1283
|
legendShape: legendShape,
|
|
778
1284
|
data: rangeXValues.map(function (x, i) {
|
|
779
1285
|
var _a, _b;
|
|
780
|
-
return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x:
|
|
1286
|
+
return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x: resolveXValue(x), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
|
|
781
1287
|
? { markerSize: markerSizes[i] }
|
|
782
1288
|
: typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
|
|
783
1289
|
? { markerSize: series.marker.size }
|
|
@@ -800,16 +1306,49 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
800
1306
|
});
|
|
801
1307
|
})
|
|
802
1308
|
.flat();
|
|
803
|
-
var
|
|
1309
|
+
var xMinValue = (_c = (_b = chartData[0]) === null || _b === void 0 ? void 0 : _b.data[0]) === null || _c === void 0 ? void 0 : _c.x;
|
|
1310
|
+
var xMaxValue = (_e = (_d = chartData[0]) === null || _d === void 0 ? void 0 : _d.data[chartData[0].data.length - 1]) === null || _e === void 0 ? void 0 : _e.x;
|
|
1311
|
+
var yMinValue = (_g = (_f = chartData[0]) === null || _f === void 0 ? void 0 : _f.data[0]) === null || _g === void 0 ? void 0 : _g.y;
|
|
1312
|
+
var yMaxValue = (_j = (_h = chartData[0]) === null || _h === void 0 ? void 0 : _h.data[chartData[0].data.length - 1]) === null || _j === void 0 ? void 0 : _j.y;
|
|
1313
|
+
var lineShape = ((_l = (_k = input.layout) === null || _k === void 0 ? void 0 : _k.shapes) !== null && _l !== void 0 ? _l : [])
|
|
804
1314
|
.filter(function (shape) { return shape.type === 'line'; })
|
|
805
1315
|
.map(function (shape, shapeIdx) {
|
|
806
1316
|
var _a, _b;
|
|
807
1317
|
var lineColor = (_a = shape.line) === null || _a === void 0 ? void 0 : _a.color;
|
|
1318
|
+
var resolveX = function (val) {
|
|
1319
|
+
if (shape.xref === 'paper') {
|
|
1320
|
+
if (val === 0) {
|
|
1321
|
+
return xMinValue;
|
|
1322
|
+
}
|
|
1323
|
+
if (val === 1) {
|
|
1324
|
+
return xMaxValue;
|
|
1325
|
+
}
|
|
1326
|
+
return typeof xMinValue === 'number' && typeof xMaxValue === 'number' && typeof val === 'number'
|
|
1327
|
+
? xMinValue + val * (xMaxValue - xMinValue)
|
|
1328
|
+
: val;
|
|
1329
|
+
}
|
|
1330
|
+
return val;
|
|
1331
|
+
};
|
|
1332
|
+
var resolveY = function (val) {
|
|
1333
|
+
if (shape.yref === 'paper') {
|
|
1334
|
+
if (val === 0) {
|
|
1335
|
+
return yMinValue;
|
|
1336
|
+
}
|
|
1337
|
+
if (val === 1) {
|
|
1338
|
+
return yMaxValue;
|
|
1339
|
+
}
|
|
1340
|
+
if (typeof val === 'number') {
|
|
1341
|
+
return yMinValue + val * (yMaxValue - yMinValue);
|
|
1342
|
+
}
|
|
1343
|
+
return val;
|
|
1344
|
+
}
|
|
1345
|
+
return val;
|
|
1346
|
+
};
|
|
808
1347
|
return {
|
|
809
1348
|
legend: "Reference_".concat(shapeIdx),
|
|
810
1349
|
data: [
|
|
811
|
-
{ x: shape.x0, y: shape.y0 },
|
|
812
|
-
{ x: shape.x1, y: shape.y1 },
|
|
1350
|
+
{ x: resolveX(shape.x0), y: resolveY(shape.y0) },
|
|
1351
|
+
{ x: resolveX(shape.x1), y: resolveY(shape.y1) },
|
|
813
1352
|
],
|
|
814
1353
|
color: (_b = (0, d3_color_1.rgb)(lineColor).formatHex8()) !== null && _b !== void 0 ? _b : lineColor,
|
|
815
1354
|
lineOptions: getLineOptions(shape.line),
|
|
@@ -829,15 +1368,18 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
829
1368
|
var scatterChartProps = {
|
|
830
1369
|
scatterChartData: chartData,
|
|
831
1370
|
};
|
|
832
|
-
var
|
|
1371
|
+
var annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1372
|
+
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_m = input.layout) === null || _m === void 0 ? void 0 : _m.width, height: (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000, shouldWrapLabels: shouldWrapLabels }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout)), (annotations ? { annotations: annotations } : {}));
|
|
833
1373
|
if (isAreaChart) {
|
|
834
1374
|
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
835
1375
|
}
|
|
836
1376
|
else {
|
|
837
1377
|
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
838
|
-
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart &&
|
|
839
|
-
|
|
840
|
-
|
|
1378
|
+
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {})), (!isScatterChart &&
|
|
1379
|
+
(function () {
|
|
1380
|
+
var bars = mapColorFillBars(input.layout);
|
|
1381
|
+
return bars && !bars.includes(null) ? { colorFillBars: bars } : {};
|
|
1382
|
+
})()));
|
|
841
1383
|
}
|
|
842
1384
|
};
|
|
843
1385
|
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -889,49 +1431,71 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
889
1431
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
890
1432
|
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
891
1433
|
var _a, _b, _c;
|
|
892
|
-
var
|
|
1434
|
+
var data = input.data.filter(function (series) { return series.type !== 'scatter' || series.mode !== 'markers'; });
|
|
1435
|
+
var _d = getLegendProps(data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
893
1436
|
var colorScale = undefined;
|
|
894
|
-
var
|
|
895
|
-
var
|
|
896
|
-
|
|
1437
|
+
var xAxisType = getAxisType(data, getAxisObjects(data, input.layout).x);
|
|
1438
|
+
var resolveXValue = getAxisValueResolver(xAxisType, parseLocalDate);
|
|
1439
|
+
var resolveGanttXValue = function (value) {
|
|
1440
|
+
var resolvedValue = resolveXValue(value);
|
|
1441
|
+
return typeof resolvedValue === 'string' ? 0 : resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : 0;
|
|
1442
|
+
};
|
|
1443
|
+
var isXDate = xAxisType === 'date';
|
|
1444
|
+
var ganttData = [];
|
|
1445
|
+
data.forEach(function (series, index) {
|
|
897
1446
|
var _a, _b, _c, _d;
|
|
898
|
-
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
899
|
-
// extract colors for each series only once
|
|
900
|
-
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
901
1447
|
var legend = legends[index];
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1448
|
+
if (series.type === 'bar') {
|
|
1449
|
+
colorScale = (0, PlotlyColorAdapter_1.createColorScale)(input.layout, series, colorScale);
|
|
1450
|
+
// extract colors for each series only once
|
|
1451
|
+
var extractedColors_1 = (0, PlotlyColorAdapter_1.extractColor)((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
|
|
1452
|
+
series.y.forEach(function (yVal, i) {
|
|
1453
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1454
|
+
if ((0, chart_utilities_1.isInvalidValue)(yVal)) {
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
1458
|
+
var color = colorScale
|
|
1459
|
+
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_a = series.marker) === null || _a === void 0 ? void 0 : _a.color)
|
|
1460
|
+
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
1461
|
+
: 0)
|
|
1462
|
+
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors_1, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
|
|
1463
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
1464
|
+
var base = +resolveGanttXValue((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
|
|
1465
|
+
var xVal = +resolveGanttXValue((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
|
|
1466
|
+
ganttData.push({
|
|
1467
|
+
x: {
|
|
1468
|
+
start: isXDate ? new Date(base) : base,
|
|
1469
|
+
end: isXDate ? new Date(base + xVal) : base + xVal,
|
|
1470
|
+
},
|
|
1471
|
+
y: yVal,
|
|
1472
|
+
legend: legend,
|
|
1473
|
+
color: (_k = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
|
|
1474
|
+
});
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
else if (series.type === 'scatter' && series.mode === 'none' && series.fill === 'toself') {
|
|
1478
|
+
for (var i = 0; i < series.y.length; i += 5) {
|
|
1479
|
+
if ((0, chart_utilities_1.isInvalidValue)(series.y[i]) || (0, chart_utilities_1.isInvalidValue)(series.y[i + 3])) {
|
|
1480
|
+
continue;
|
|
1481
|
+
}
|
|
1482
|
+
var x0 = resolveGanttXValue(series.x[i]);
|
|
1483
|
+
var x1 = resolveGanttXValue(series.x[i + 1]);
|
|
1484
|
+
var y0 = series.y[i];
|
|
1485
|
+
var y1 = series.y[i + 3];
|
|
1486
|
+
ganttData.push({
|
|
1487
|
+
x: {
|
|
1488
|
+
start: x0,
|
|
1489
|
+
end: x1,
|
|
1490
|
+
},
|
|
1491
|
+
y: Math.round((y0 + y1) / 2),
|
|
1492
|
+
legend: legend,
|
|
1493
|
+
color: series.fillcolor,
|
|
1494
|
+
});
|
|
911
1495
|
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[i % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
916
|
-
: 0)
|
|
917
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, (_g = (_f = (_e = input.layout) === null || _e === void 0 ? void 0 : _e.template) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.colorway, isDarkTheme);
|
|
918
|
-
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
919
|
-
var base = convertXValueToNumber((_h = series.base) === null || _h === void 0 ? void 0 : _h[i]);
|
|
920
|
-
var xVal = convertXValueToNumber((_j = series.x) === null || _j === void 0 ? void 0 : _j[i]);
|
|
921
|
-
return {
|
|
922
|
-
x: {
|
|
923
|
-
start: isXDate ? new Date(base) : base,
|
|
924
|
-
end: isXDate ? new Date(base + xVal) : base + xVal,
|
|
925
|
-
},
|
|
926
|
-
y: yVal,
|
|
927
|
-
legend: legend,
|
|
928
|
-
color: (_k = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _k !== void 0 ? _k : color,
|
|
929
|
-
};
|
|
930
|
-
})
|
|
931
|
-
.filter(function (point) { return point !== null; });
|
|
932
|
-
})
|
|
933
|
-
.flat();
|
|
934
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: ganttData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(data, input.layout)), getBarProps(data, input.layout, true)), getAxisTickProps(data, input.layout));
|
|
935
1499
|
};
|
|
936
1500
|
exports.transformPlotlyJsonToGanttChartProps = transformPlotlyJsonToGanttChartProps;
|
|
937
1501
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -2116,9 +2680,15 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
2116
2680
|
var tickValues = axType === 'date' ? ax.tickvals.map(function (v) { return new Date(v); }) : ax.tickvals;
|
|
2117
2681
|
if (axId === 'x') {
|
|
2118
2682
|
props.tickValues = tickValues;
|
|
2683
|
+
props.xAxis = {
|
|
2684
|
+
tickText: ax.ticktext,
|
|
2685
|
+
};
|
|
2119
2686
|
}
|
|
2120
2687
|
else if (axId === 'y') {
|
|
2121
2688
|
props.yAxisTickValues = tickValues;
|
|
2689
|
+
props.yAxis = {
|
|
2690
|
+
tickText: ax.ticktext,
|
|
2691
|
+
};
|
|
2122
2692
|
}
|
|
2123
2693
|
return;
|
|
2124
2694
|
}
|
|
@@ -2232,16 +2802,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
2232
2802
|
}
|
|
2233
2803
|
return axisObjects;
|
|
2234
2804
|
};
|
|
2235
|
-
function
|
|
2805
|
+
var getAxisType = function (data, ax) {
|
|
2236
2806
|
var _a;
|
|
2237
|
-
var ax;
|
|
2238
|
-
if (arg2 && typeof arg2 === 'object' && '_id' in arg2) {
|
|
2239
|
-
ax = arg2;
|
|
2240
|
-
}
|
|
2241
|
-
else if (typeof arg3 === 'string') {
|
|
2242
|
-
var layout = arg2;
|
|
2243
|
-
ax = getAxisObjects(data, layout)[arg3];
|
|
2244
|
-
}
|
|
2245
2807
|
if (!ax) {
|
|
2246
2808
|
return 'category';
|
|
2247
2809
|
}
|
|
@@ -2268,9 +2830,12 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
2268
2830
|
return 'date';
|
|
2269
2831
|
}
|
|
2270
2832
|
return 'category';
|
|
2271
|
-
}
|
|
2272
|
-
var getAxisValueResolver = function (
|
|
2273
|
-
var
|
|
2833
|
+
};
|
|
2834
|
+
var getAxisValueResolver = function (axType, dateParser) {
|
|
2835
|
+
var toDate = function (value) {
|
|
2836
|
+
var date = dateParser ? dateParser(value) : new Date(value);
|
|
2837
|
+
return isNaN(date.getTime()) ? null : date;
|
|
2838
|
+
};
|
|
2274
2839
|
return function (value) {
|
|
2275
2840
|
if ((0, chart_utilities_1.isInvalidValue)(value)) {
|
|
2276
2841
|
return null;
|
|
@@ -2281,10 +2846,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
2281
2846
|
return (0, chart_utilities_1.isNumber)(value) ? +value : null;
|
|
2282
2847
|
case 'date':
|
|
2283
2848
|
if ((0, chart_utilities_1.isNumber)(value)) {
|
|
2284
|
-
return
|
|
2849
|
+
return toDate(+value);
|
|
2285
2850
|
}
|
|
2286
2851
|
if (typeof value === 'string') {
|
|
2287
|
-
return
|
|
2852
|
+
return toDate(value);
|
|
2288
2853
|
}
|
|
2289
2854
|
return null;
|
|
2290
2855
|
case 'category':
|