@fluentui/react-charts 0.0.0-nightly-20251107-0407.1 → 0.0.0-nightly-20251110-0407.1
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.md +13 -13
- package/dist/index.d.ts +211 -0
- package/lib/AnnotationOnlyChart.js +1 -0
- package/lib/AnnotationOnlyChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +208 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/index.js +2 -0
- package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +31 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +23 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +3 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +617 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/index.js +2 -0
- package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +173 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +126 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +31 -6
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/index.js +2 -0
- package/lib/components/CommonComponents/index.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +17 -4
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +14 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +39 -19
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +4 -8
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +588 -40
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +3 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +3 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +3 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +3 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +3 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +3 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/ChartAnnotation.js +1 -0
- package/lib/types/ChartAnnotation.js.map +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/image-export-utils.js +108 -0
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/AnnotationOnlyChart.js +6 -0
- package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +219 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +6 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.js +7 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +56 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +33 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +3 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +628 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +4 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/index.js +7 -0
- package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +265 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +161 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +31 -6
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/index.js +2 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +16 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +14 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +38 -18
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +574 -6
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +3 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +3 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +3 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +3 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +3 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js +6 -0
- package/lib-commonjs/types/ChartAnnotation.js.map +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 +108 -0
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/package.json +12 -12
|
@@ -182,8 +182,7 @@ const getSecondaryYAxisValues = (data, layout)=>{
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
};
|
|
185
|
-
export const _getGaugeAxisColor = (colorway, colorwayType, color,
|
|
186
|
-
colorMap, isDarkTheme)=>{
|
|
185
|
+
export const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
|
|
187
186
|
const extractedColors = extractColor(colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
188
187
|
return resolveColor(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
|
|
189
188
|
};
|
|
@@ -244,6 +243,526 @@ export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNum
|
|
|
244
243
|
}
|
|
245
244
|
return flattened;
|
|
246
245
|
};
|
|
246
|
+
const encodeHtmlEntities = (value)=>value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
247
|
+
const toFiniteNumber = (value)=>{
|
|
248
|
+
if (value === undefined || value === null) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
const numeric = typeof value === 'number' ? value : Number(value);
|
|
252
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
|
|
256
|
+
*/ const normalizeAxisRef = (ref, axis)=>{
|
|
257
|
+
if (!ref) {
|
|
258
|
+
return axis;
|
|
259
|
+
}
|
|
260
|
+
const normalized = ref.toLowerCase();
|
|
261
|
+
if (normalized === axis || normalized === `${axis}axis` || normalized === `${axis}axis1` || normalized === `${axis}1`) {
|
|
262
|
+
return axis;
|
|
263
|
+
}
|
|
264
|
+
const match = normalized.match(/^([xy])(axis)?(\d+)$/);
|
|
265
|
+
if (match && match[1] === axis && match[3]) {
|
|
266
|
+
return match[3] === '1' ? axis : `${axis}${match[3]}`;
|
|
267
|
+
}
|
|
268
|
+
return normalized;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
|
|
272
|
+
*/ const getAxisNumericRangeFromData = (axis, ref, layout, data)=>{
|
|
273
|
+
if (!data || data.length === 0) {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
const axisLayout = getAxisLayoutByRef(layout, ref, axis);
|
|
277
|
+
const targetRef = normalizeAxisRef(ref, axis);
|
|
278
|
+
const traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
|
|
279
|
+
let minValue;
|
|
280
|
+
let maxValue;
|
|
281
|
+
data.forEach((trace)=>{
|
|
282
|
+
const plotTrace = trace;
|
|
283
|
+
const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
|
|
284
|
+
if (traceAxisRef !== targetRef) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const values = axis === 'x' ? plotTrace.x : plotTrace.y;
|
|
288
|
+
if (!isArrayOrTypedArray(values)) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const arrayLike = values;
|
|
292
|
+
for(let index = 0; index < arrayLike.length; index++){
|
|
293
|
+
const value = arrayLike[index];
|
|
294
|
+
const numeric = toNumericValue(convertDataValue(value, axisLayout));
|
|
295
|
+
if (numeric === undefined || Number.isNaN(numeric)) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
|
|
299
|
+
maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
|
|
303
|
+
return undefined;
|
|
304
|
+
}
|
|
305
|
+
return [
|
|
306
|
+
minValue,
|
|
307
|
+
maxValue
|
|
308
|
+
];
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
|
|
312
|
+
*/ const transformRelativeYForChart = (value)=>{
|
|
313
|
+
if (value === undefined) {
|
|
314
|
+
return undefined;
|
|
315
|
+
}
|
|
316
|
+
if (!Number.isFinite(value)) {
|
|
317
|
+
return undefined;
|
|
318
|
+
}
|
|
319
|
+
return 1 - value;
|
|
320
|
+
};
|
|
321
|
+
const mapHorizontalAlign = (anchor)=>{
|
|
322
|
+
switch((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()){
|
|
323
|
+
case 'left':
|
|
324
|
+
return 'start';
|
|
325
|
+
case 'center':
|
|
326
|
+
return 'center';
|
|
327
|
+
case 'right':
|
|
328
|
+
return 'end';
|
|
329
|
+
default:
|
|
330
|
+
return undefined;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
const mapVerticalAlign = (anchor)=>{
|
|
334
|
+
switch((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()){
|
|
335
|
+
case 'top':
|
|
336
|
+
return 'top';
|
|
337
|
+
case 'middle':
|
|
338
|
+
return 'middle';
|
|
339
|
+
case 'bottom':
|
|
340
|
+
return 'bottom';
|
|
341
|
+
default:
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
const appendPx = (value)=>{
|
|
346
|
+
if (value === undefined || value === null) {
|
|
347
|
+
return undefined;
|
|
348
|
+
}
|
|
349
|
+
if (typeof value === 'string') {
|
|
350
|
+
return value;
|
|
351
|
+
}
|
|
352
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
353
|
+
return `${value}px`;
|
|
354
|
+
}
|
|
355
|
+
return undefined;
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* Maps Plotly's axis reference string to one of our coordinate interpretation modes (axis, relative, or pixel).
|
|
359
|
+
*/ const resolveRefType = (ref, axis)=>{
|
|
360
|
+
if (!ref) {
|
|
361
|
+
return 'axis';
|
|
362
|
+
}
|
|
363
|
+
const normalized = ref.toLowerCase();
|
|
364
|
+
if (normalized === 'pixel') {
|
|
365
|
+
return 'pixel';
|
|
366
|
+
}
|
|
367
|
+
if (normalized === 'paper') {
|
|
368
|
+
return 'relative';
|
|
369
|
+
}
|
|
370
|
+
if (normalized.endsWith(' domain')) {
|
|
371
|
+
return normalized.startsWith(axis) ? 'relative' : undefined;
|
|
372
|
+
}
|
|
373
|
+
const match = normalized.match(/^([xy])(\d*)$/);
|
|
374
|
+
if (match && match[1] === axis) {
|
|
375
|
+
return 'axis';
|
|
376
|
+
}
|
|
377
|
+
return undefined;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
|
|
381
|
+
*/ const getAxisLayoutByRef = (layout, ref, axis)=>{
|
|
382
|
+
if (!layout) {
|
|
383
|
+
return undefined;
|
|
384
|
+
}
|
|
385
|
+
const defaultAxisKey = `${axis}axis`;
|
|
386
|
+
if (!ref) {
|
|
387
|
+
return layout[defaultAxisKey];
|
|
388
|
+
}
|
|
389
|
+
const normalized = ref.toLowerCase();
|
|
390
|
+
if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
|
|
391
|
+
return layout[defaultAxisKey];
|
|
392
|
+
}
|
|
393
|
+
const match = normalized.match(/^([xy])(\d*)$/);
|
|
394
|
+
if (match && match[1] === axis) {
|
|
395
|
+
const index = match[2];
|
|
396
|
+
if (index && index !== '' && index !== '1') {
|
|
397
|
+
const axisKey = `${axis}axis${index}`;
|
|
398
|
+
return layout[axisKey];
|
|
399
|
+
}
|
|
400
|
+
return layout[defaultAxisKey];
|
|
401
|
+
}
|
|
402
|
+
return layout[defaultAxisKey];
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
|
|
406
|
+
*/ const convertDataValue = (value, axisLayout)=>{
|
|
407
|
+
if (value === undefined || value === null) {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || isDate(value)) {
|
|
411
|
+
const dateValue = value instanceof Date ? value : new Date(value);
|
|
412
|
+
return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
|
|
413
|
+
}
|
|
414
|
+
if (typeof value === 'number') {
|
|
415
|
+
return value;
|
|
416
|
+
}
|
|
417
|
+
if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
|
|
418
|
+
const numeric = Number(value);
|
|
419
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
420
|
+
}
|
|
421
|
+
if (value instanceof Date) {
|
|
422
|
+
return value;
|
|
423
|
+
}
|
|
424
|
+
return value;
|
|
425
|
+
};
|
|
426
|
+
const toNumericValue = (value)=>{
|
|
427
|
+
if (value instanceof Date) {
|
|
428
|
+
const timestamp = value.getTime();
|
|
429
|
+
return Number.isFinite(timestamp) ? timestamp : undefined;
|
|
430
|
+
}
|
|
431
|
+
if (typeof value === 'number') {
|
|
432
|
+
return Number.isFinite(value) ? value : undefined;
|
|
433
|
+
}
|
|
434
|
+
if (typeof value === 'string') {
|
|
435
|
+
const numeric = Number(value);
|
|
436
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
437
|
+
}
|
|
438
|
+
return undefined;
|
|
439
|
+
};
|
|
440
|
+
const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
|
|
441
|
+
const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
|
|
442
|
+
let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
|
|
443
|
+
let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
|
|
444
|
+
if ((start === undefined || end === undefined || start === end) && fallbackRange) {
|
|
445
|
+
[start, end] = fallbackRange;
|
|
446
|
+
}
|
|
447
|
+
const current = toNumericValue(convertDataValue(value, axisLayout));
|
|
448
|
+
if (start === undefined || end === undefined || current === undefined || start === end) {
|
|
449
|
+
return undefined;
|
|
450
|
+
}
|
|
451
|
+
const relative = (current - start) / (end - start);
|
|
452
|
+
return Number.isFinite(relative) ? relative : undefined;
|
|
453
|
+
};
|
|
454
|
+
const createAnnotationId = (text, index)=>{
|
|
455
|
+
const normalized = text.replace(/\s+/g, ' ').trim();
|
|
456
|
+
if (normalized) {
|
|
457
|
+
const slug = normalized.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32);
|
|
458
|
+
if (slug) {
|
|
459
|
+
return `annotation-${index}-${slug}`;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return `annotation-${index}`;
|
|
463
|
+
};
|
|
464
|
+
const DEFAULT_ARROW_OFFSET = -40;
|
|
465
|
+
const mapArrowsideToArrow = (annotation)=>{
|
|
466
|
+
let includeStart = false;
|
|
467
|
+
let includeEnd = false;
|
|
468
|
+
const arrowSide = typeof (annotation === null || annotation === void 0 ? void 0 : annotation.arrowside) === 'string' ? annotation === null || annotation === void 0 ? void 0 : annotation.arrowside.toLowerCase() : undefined;
|
|
469
|
+
if (arrowSide) {
|
|
470
|
+
includeStart = arrowSide.includes('start');
|
|
471
|
+
includeEnd = arrowSide.includes('end');
|
|
472
|
+
}
|
|
473
|
+
const endHead = toFiniteNumber(annotation === null || annotation === void 0 ? void 0 : annotation.arrowhead);
|
|
474
|
+
const startHead = toFiniteNumber(annotation.startarrowhead);
|
|
475
|
+
if (endHead !== undefined && endHead > 0) {
|
|
476
|
+
includeEnd = true;
|
|
477
|
+
}
|
|
478
|
+
if (startHead !== undefined && startHead > 0) {
|
|
479
|
+
includeStart = true;
|
|
480
|
+
}
|
|
481
|
+
if (includeStart && includeEnd) {
|
|
482
|
+
return 'both';
|
|
483
|
+
}
|
|
484
|
+
if (includeStart) {
|
|
485
|
+
return 'start';
|
|
486
|
+
}
|
|
487
|
+
if (includeEnd) {
|
|
488
|
+
return 'end';
|
|
489
|
+
}
|
|
490
|
+
return 'none';
|
|
491
|
+
};
|
|
492
|
+
const mapArrowDashToPattern = (value)=>{
|
|
493
|
+
if (!value) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
const normalized = value.trim().toLowerCase();
|
|
497
|
+
switch(normalized){
|
|
498
|
+
case 'solid':
|
|
499
|
+
return undefined;
|
|
500
|
+
case 'dot':
|
|
501
|
+
return '1, 5';
|
|
502
|
+
case 'dash':
|
|
503
|
+
return '5, 5';
|
|
504
|
+
case 'longdash':
|
|
505
|
+
return '10, 5';
|
|
506
|
+
case 'dashdot':
|
|
507
|
+
return '5, 5, 1, 5';
|
|
508
|
+
case 'longdashdot':
|
|
509
|
+
return '10, 5, 1, 5';
|
|
510
|
+
default:
|
|
511
|
+
if (/^\d+(\s|,)*\d*$/.test(normalized.replace(/\s+/g, ' '))) {
|
|
512
|
+
return normalized.replace(/\s+/g, ' ');
|
|
513
|
+
}
|
|
514
|
+
return value;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
|
|
519
|
+
* layout alignment, styling, and connector metadata while skipping unsupported configurations.
|
|
520
|
+
*/ const convertPlotlyAnnotation = (annotation, layout, data, index)=>{
|
|
521
|
+
if (!annotation || annotation.visible === false) {
|
|
522
|
+
return undefined;
|
|
523
|
+
}
|
|
524
|
+
const xRefType = resolveRefType(annotation.xref, 'x');
|
|
525
|
+
const yRefType = resolveRefType(annotation.yref, 'y');
|
|
526
|
+
if (!xRefType || !yRefType) {
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
529
|
+
let coordinates;
|
|
530
|
+
if (xRefType === 'axis' && yRefType === 'axis') {
|
|
531
|
+
const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
532
|
+
const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
533
|
+
const xValue = convertDataValue(annotation.x, xAxisLayout);
|
|
534
|
+
const yValue = convertDataValue(annotation.y, yAxisLayout);
|
|
535
|
+
if (xValue === undefined || yValue === undefined) {
|
|
536
|
+
return undefined;
|
|
537
|
+
}
|
|
538
|
+
const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
|
|
539
|
+
coordinates = {
|
|
540
|
+
type: 'data',
|
|
541
|
+
x: xValue,
|
|
542
|
+
y: yValue,
|
|
543
|
+
...yRefNormalized === 'y2' ? {
|
|
544
|
+
yAxis: 'secondary'
|
|
545
|
+
} : {}
|
|
546
|
+
};
|
|
547
|
+
} else if (xRefType === 'relative' && yRefType === 'relative') {
|
|
548
|
+
const xValue = toFiniteNumber(annotation.x);
|
|
549
|
+
const yValue = toFiniteNumber(annotation.y);
|
|
550
|
+
const chartRelativeY = transformRelativeYForChart(yValue);
|
|
551
|
+
if (xValue === undefined || chartRelativeY === undefined) {
|
|
552
|
+
return undefined;
|
|
553
|
+
}
|
|
554
|
+
coordinates = {
|
|
555
|
+
type: 'relative',
|
|
556
|
+
x: xValue,
|
|
557
|
+
y: chartRelativeY
|
|
558
|
+
};
|
|
559
|
+
} else if (xRefType === 'relative' && yRefType === 'axis') {
|
|
560
|
+
const xValue = toFiniteNumber(annotation.x);
|
|
561
|
+
const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
562
|
+
const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
|
|
563
|
+
const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
|
|
564
|
+
const chartRelativeY = transformRelativeYForChart(yRelative);
|
|
565
|
+
if (xValue === undefined || chartRelativeY === undefined) {
|
|
566
|
+
return undefined;
|
|
567
|
+
}
|
|
568
|
+
coordinates = {
|
|
569
|
+
type: 'relative',
|
|
570
|
+
x: xValue,
|
|
571
|
+
y: chartRelativeY
|
|
572
|
+
};
|
|
573
|
+
} else if (xRefType === 'axis' && yRefType === 'relative') {
|
|
574
|
+
const yValue = toFiniteNumber(annotation.y);
|
|
575
|
+
const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
576
|
+
const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
|
|
577
|
+
const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
|
|
578
|
+
const chartRelativeY = transformRelativeYForChart(yValue);
|
|
579
|
+
if (xRelative === undefined || chartRelativeY === undefined) {
|
|
580
|
+
return undefined;
|
|
581
|
+
}
|
|
582
|
+
coordinates = {
|
|
583
|
+
type: 'relative',
|
|
584
|
+
x: xRelative,
|
|
585
|
+
y: chartRelativeY
|
|
586
|
+
};
|
|
587
|
+
} else if (xRefType === 'pixel' && yRefType === 'pixel') {
|
|
588
|
+
const xValue = toFiniteNumber(annotation.x);
|
|
589
|
+
const yValue = toFiniteNumber(annotation.y);
|
|
590
|
+
if (xValue === undefined || yValue === undefined) {
|
|
591
|
+
return undefined;
|
|
592
|
+
}
|
|
593
|
+
coordinates = {
|
|
594
|
+
type: 'pixel',
|
|
595
|
+
x: xValue,
|
|
596
|
+
y: yValue
|
|
597
|
+
};
|
|
598
|
+
} else {
|
|
599
|
+
return undefined;
|
|
600
|
+
}
|
|
601
|
+
const textValue = annotation.text;
|
|
602
|
+
const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
|
|
603
|
+
const encodedText = encodeHtmlEntities(rawText);
|
|
604
|
+
const chartAnnotation = {
|
|
605
|
+
id: createAnnotationId(encodedText, index),
|
|
606
|
+
text: encodedText,
|
|
607
|
+
coordinates
|
|
608
|
+
};
|
|
609
|
+
const layoutProps = {};
|
|
610
|
+
const styleProps = {};
|
|
611
|
+
const showArrow = annotation.showarrow === undefined ? false : !!annotation.showarrow;
|
|
612
|
+
const clipOnAxis = annotation.cliponaxis;
|
|
613
|
+
if (clipOnAxis !== undefined) {
|
|
614
|
+
layoutProps.clipToBounds = !!clipOnAxis;
|
|
615
|
+
} else if (coordinates.type === 'data') {
|
|
616
|
+
layoutProps.clipToBounds = true;
|
|
617
|
+
}
|
|
618
|
+
const horizontalAlign = mapHorizontalAlign(annotation.xanchor);
|
|
619
|
+
if (horizontalAlign) {
|
|
620
|
+
layoutProps.align = horizontalAlign;
|
|
621
|
+
}
|
|
622
|
+
if (!layoutProps.align) {
|
|
623
|
+
const alignProp = mapHorizontalAlign(annotation.align);
|
|
624
|
+
if (alignProp) {
|
|
625
|
+
layoutProps.align = alignProp;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
const verticalAlign = mapVerticalAlign(annotation.yanchor);
|
|
629
|
+
if (verticalAlign) {
|
|
630
|
+
layoutProps.verticalAlign = verticalAlign;
|
|
631
|
+
}
|
|
632
|
+
if (!layoutProps.verticalAlign) {
|
|
633
|
+
const valignProp = mapVerticalAlign(annotation.valign);
|
|
634
|
+
if (valignProp) {
|
|
635
|
+
layoutProps.verticalAlign = valignProp;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const offsetXComponents = [];
|
|
639
|
+
let hasExplicitOffset = false;
|
|
640
|
+
const ax = toFiniteNumber(annotation.ax);
|
|
641
|
+
const axRef = typeof annotation.axref === 'string' ? annotation.axref.toLowerCase() : undefined;
|
|
642
|
+
if (ax !== undefined && (axRef === undefined || axRef === 'pixel')) {
|
|
643
|
+
offsetXComponents.push(ax);
|
|
644
|
+
hasExplicitOffset = true;
|
|
645
|
+
}
|
|
646
|
+
const xShift = toFiniteNumber(annotation.xshift);
|
|
647
|
+
if (xShift !== undefined) {
|
|
648
|
+
offsetXComponents.push(xShift);
|
|
649
|
+
hasExplicitOffset = true;
|
|
650
|
+
}
|
|
651
|
+
if (offsetXComponents.length > 0) {
|
|
652
|
+
const offsetX = offsetXComponents.reduce((sum, value)=>sum + value, 0);
|
|
653
|
+
if (offsetX !== 0) {
|
|
654
|
+
layoutProps.offsetX = offsetX;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const offsetYComponents = [];
|
|
658
|
+
const ay = toFiniteNumber(annotation.ay);
|
|
659
|
+
const ayRef = typeof annotation.ayref === 'string' ? annotation.ayref.toLowerCase() : undefined;
|
|
660
|
+
if (ay !== undefined && (ayRef === undefined || ayRef === 'pixel')) {
|
|
661
|
+
offsetYComponents.push(ay);
|
|
662
|
+
hasExplicitOffset = true;
|
|
663
|
+
}
|
|
664
|
+
const yShift = toFiniteNumber(annotation.yshift);
|
|
665
|
+
if (yShift !== undefined) {
|
|
666
|
+
offsetYComponents.push(yShift);
|
|
667
|
+
hasExplicitOffset = true;
|
|
668
|
+
}
|
|
669
|
+
if (offsetYComponents.length > 0) {
|
|
670
|
+
const offsetY = offsetYComponents.reduce((sum, value)=>sum + value, 0);
|
|
671
|
+
if (offsetY !== 0) {
|
|
672
|
+
layoutProps.offsetY = offsetY;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
if (showArrow && !hasExplicitOffset && layoutProps.offsetY === undefined) {
|
|
676
|
+
layoutProps.offsetY = DEFAULT_ARROW_OFFSET;
|
|
677
|
+
}
|
|
678
|
+
const maxWidth = toFiniteNumber(annotation.width);
|
|
679
|
+
if (maxWidth !== undefined) {
|
|
680
|
+
layoutProps.maxWidth = maxWidth;
|
|
681
|
+
}
|
|
682
|
+
if (annotation.bgcolor) {
|
|
683
|
+
styleProps.backgroundColor = annotation.bgcolor;
|
|
684
|
+
}
|
|
685
|
+
if (annotation.bordercolor) {
|
|
686
|
+
styleProps.borderColor = annotation.bordercolor;
|
|
687
|
+
}
|
|
688
|
+
const borderWidth = toFiniteNumber(annotation.borderwidth);
|
|
689
|
+
if (borderWidth !== undefined) {
|
|
690
|
+
styleProps.borderWidth = borderWidth;
|
|
691
|
+
}
|
|
692
|
+
const borderPad = appendPx(annotation.borderpad);
|
|
693
|
+
if (borderPad) {
|
|
694
|
+
styleProps.padding = borderPad;
|
|
695
|
+
}
|
|
696
|
+
const opacity = toFiniteNumber(annotation.opacity);
|
|
697
|
+
if (opacity !== undefined) {
|
|
698
|
+
styleProps.opacity = opacity;
|
|
699
|
+
}
|
|
700
|
+
if (annotation.font) {
|
|
701
|
+
const font = annotation.font;
|
|
702
|
+
if (font === null || font === void 0 ? void 0 : font.color) {
|
|
703
|
+
styleProps.textColor = font.color;
|
|
704
|
+
}
|
|
705
|
+
const fontSize = appendPx(font === null || font === void 0 ? void 0 : font.size);
|
|
706
|
+
if (fontSize) {
|
|
707
|
+
styleProps.fontSize = fontSize;
|
|
708
|
+
}
|
|
709
|
+
if (font === null || font === void 0 ? void 0 : font.weight) {
|
|
710
|
+
styleProps.fontWeight = font.weight;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
const textAngle = annotation === null || annotation === void 0 ? void 0 : annotation.textangle;
|
|
714
|
+
if (typeof textAngle === 'number' && !Number.isNaN(textAngle)) {
|
|
715
|
+
styleProps.rotation = textAngle;
|
|
716
|
+
} else if (typeof textAngle === 'string' && textAngle.toLowerCase() !== 'auto') {
|
|
717
|
+
const parsedAngle = Number(textAngle);
|
|
718
|
+
if (!Number.isNaN(parsedAngle)) {
|
|
719
|
+
styleProps.rotation = parsedAngle;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
if (Object.keys(layoutProps).length > 0) {
|
|
723
|
+
chartAnnotation.layout = layoutProps;
|
|
724
|
+
}
|
|
725
|
+
if (Object.keys(styleProps).length > 0) {
|
|
726
|
+
chartAnnotation.style = styleProps;
|
|
727
|
+
}
|
|
728
|
+
if (showArrow) {
|
|
729
|
+
var _annotation_arrowcolor;
|
|
730
|
+
const arrowColor = (_annotation_arrowcolor = annotation.arrowcolor) !== null && _annotation_arrowcolor !== void 0 ? _annotation_arrowcolor : styleProps.textColor;
|
|
731
|
+
const arrowWidth = toFiniteNumber(annotation.arrowwidth);
|
|
732
|
+
const endPadding = toFiniteNumber(annotation.standoff);
|
|
733
|
+
const startPadding = toFiniteNumber(annotation.startstandoff);
|
|
734
|
+
const dashPattern = mapArrowDashToPattern(annotation.arrowdash);
|
|
735
|
+
chartAnnotation.connector = {
|
|
736
|
+
...arrowColor ? {
|
|
737
|
+
strokeColor: arrowColor
|
|
738
|
+
} : {},
|
|
739
|
+
...arrowWidth !== undefined ? {
|
|
740
|
+
strokeWidth: arrowWidth
|
|
741
|
+
} : {},
|
|
742
|
+
...endPadding !== undefined ? {
|
|
743
|
+
endPadding: Math.max(endPadding, 0)
|
|
744
|
+
} : {},
|
|
745
|
+
...startPadding !== undefined ? {
|
|
746
|
+
startPadding: Math.max(startPadding, 0)
|
|
747
|
+
} : {},
|
|
748
|
+
...dashPattern ? {
|
|
749
|
+
dashArray: dashPattern
|
|
750
|
+
} : {},
|
|
751
|
+
arrow: mapArrowsideToArrow(annotation)
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
return chartAnnotation;
|
|
755
|
+
};
|
|
756
|
+
const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
|
|
757
|
+
if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
|
|
758
|
+
return undefined;
|
|
759
|
+
}
|
|
760
|
+
const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
|
|
761
|
+
layout.annotations
|
|
762
|
+
];
|
|
763
|
+
const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, data, index)).filter((annotation)=>annotation !== undefined);
|
|
764
|
+
return converted.length > 0 ? converted : undefined;
|
|
765
|
+
};
|
|
247
766
|
/**
|
|
248
767
|
* Normalizes an array of objects by flattening nested structures and creating grouped data
|
|
249
768
|
* Uses json_normalize approach with D3 color detection and filtering
|
|
@@ -320,8 +839,35 @@ export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNum
|
|
|
320
839
|
x
|
|
321
840
|
};
|
|
322
841
|
};
|
|
323
|
-
export const
|
|
324
|
-
|
|
842
|
+
export const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
|
|
843
|
+
var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
|
|
844
|
+
var _getChartAnnotationsFromLayout;
|
|
845
|
+
const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
|
|
846
|
+
const titles = getTitles(input.layout);
|
|
847
|
+
const layoutTitle = titles.chartTitle || undefined;
|
|
848
|
+
const layoutWithMeta = input.layout;
|
|
849
|
+
const description = typeof (layoutWithMeta === null || layoutWithMeta === void 0 ? void 0 : (_layoutWithMeta_meta = layoutWithMeta.meta) === null || _layoutWithMeta_meta === void 0 ? void 0 : _layoutWithMeta_meta.description) === 'string' ? layoutWithMeta.meta.description : undefined;
|
|
850
|
+
const width = typeof ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) === 'number' ? input.layout.width : undefined;
|
|
851
|
+
const height = typeof ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) === 'number' ? input.layout.height : undefined;
|
|
852
|
+
const paperBackgroundColor = typeof ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.paper_bgcolor) === 'string' ? input.layout.paper_bgcolor : undefined;
|
|
853
|
+
const plotBackgroundColor = typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.plot_bgcolor) === 'string' ? input.layout.plot_bgcolor : undefined;
|
|
854
|
+
const fontColor = typeof ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_font = _input_layout4.font) === null || _input_layout_font === void 0 ? void 0 : _input_layout_font.color) === 'string' ? input.layout.font.color : undefined;
|
|
855
|
+
const fontFamily = typeof ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_font1 = _input_layout5.font) === null || _input_layout_font1 === void 0 ? void 0 : _input_layout_font1.family) === 'string' ? input.layout.font.family : undefined;
|
|
856
|
+
const margin = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.margin;
|
|
857
|
+
return {
|
|
858
|
+
annotations,
|
|
859
|
+
chartTitle: layoutTitle,
|
|
860
|
+
description,
|
|
861
|
+
width,
|
|
862
|
+
height,
|
|
863
|
+
paperBackgroundColor,
|
|
864
|
+
plotBackgroundColor,
|
|
865
|
+
fontColor,
|
|
866
|
+
fontFamily,
|
|
867
|
+
margin
|
|
868
|
+
};
|
|
869
|
+
};
|
|
870
|
+
export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
325
871
|
var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
|
|
326
872
|
const firstData = input.data[0];
|
|
327
873
|
var _input_layout_piecolorway, _input_layout_piecolorway1;
|
|
@@ -410,8 +956,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
410
956
|
order: 'sorted'
|
|
411
957
|
};
|
|
412
958
|
};
|
|
413
|
-
export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot,
|
|
414
|
-
colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
959
|
+
export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
415
960
|
var _input_layout, _input_layout1, _input_layout2, _vsbcData_;
|
|
416
961
|
const mapXToDataPoints = {};
|
|
417
962
|
let yMaxValue = 0;
|
|
@@ -561,6 +1106,7 @@ colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
|
561
1106
|
});
|
|
562
1107
|
});
|
|
563
1108
|
const vsbcData = Object.values(mapXToDataPoints);
|
|
1109
|
+
const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
564
1110
|
var _input_layout_height;
|
|
565
1111
|
return {
|
|
566
1112
|
data: vsbcData,
|
|
@@ -585,11 +1131,13 @@ colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
|
585
1131
|
...getAxisCategoryOrderProps(input.data, input.layout),
|
|
586
1132
|
...getBarProps(input.data, input.layout),
|
|
587
1133
|
...getYMinMaxValues(input.data[0], input.layout),
|
|
588
|
-
...getAxisTickProps(input.data, input.layout)
|
|
1134
|
+
...getAxisTickProps(input.data, input.layout),
|
|
1135
|
+
...annotations ? {
|
|
1136
|
+
annotations
|
|
1137
|
+
} : {}
|
|
589
1138
|
};
|
|
590
1139
|
};
|
|
591
|
-
export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot,
|
|
592
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1140
|
+
export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
593
1141
|
var _processedInput_layout, _processedInput_layout1;
|
|
594
1142
|
// Handle object arrays in y values by normalizing the data first
|
|
595
1143
|
let processedInput = {
|
|
@@ -693,6 +1241,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
693
1241
|
});
|
|
694
1242
|
}
|
|
695
1243
|
});
|
|
1244
|
+
const annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
|
|
696
1245
|
var _processedInput_layout_height;
|
|
697
1246
|
return {
|
|
698
1247
|
dataV2: gvbcDataV2,
|
|
@@ -711,11 +1260,13 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
711
1260
|
...getXAxisTickFormat(processedInput.data[0], processedInput.layout),
|
|
712
1261
|
...yAxisTickFormat,
|
|
713
1262
|
...getBarProps(processedInput.data, processedInput.layout),
|
|
714
|
-
...getAxisTickProps(processedInput.data, processedInput.layout)
|
|
1263
|
+
...getAxisTickProps(processedInput.data, processedInput.layout),
|
|
1264
|
+
...annotations ? {
|
|
1265
|
+
annotations
|
|
1266
|
+
} : {}
|
|
715
1267
|
};
|
|
716
1268
|
};
|
|
717
|
-
export const transformPlotlyJsonToVBCProps = (input, isMultiPlot,
|
|
718
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1269
|
+
export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
719
1270
|
var _input_layout, _input_layout1, _vbcData_;
|
|
720
1271
|
const vbcData = [];
|
|
721
1272
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
@@ -777,6 +1328,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
777
1328
|
});
|
|
778
1329
|
});
|
|
779
1330
|
});
|
|
1331
|
+
const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
780
1332
|
var _input_layout_height;
|
|
781
1333
|
return {
|
|
782
1334
|
data: vbcData,
|
|
@@ -790,19 +1342,19 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
790
1342
|
roundCorners: true,
|
|
791
1343
|
...getTitles(input.layout),
|
|
792
1344
|
...getYMinMaxValues(input.data[0], input.layout),
|
|
793
|
-
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
1345
|
+
...getAxisCategoryOrderProps(input.data, input.layout),
|
|
1346
|
+
...annotations ? {
|
|
1347
|
+
annotations
|
|
1348
|
+
} : {}
|
|
794
1349
|
};
|
|
795
1350
|
};
|
|
796
|
-
export const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot,
|
|
797
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1351
|
+
export const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
798
1352
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
|
|
799
1353
|
};
|
|
800
|
-
export const transformPlotlyJsonToLineChartProps = (input, isMultiPlot,
|
|
801
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1354
|
+
export const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
802
1355
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'line', colorMap, colorwayType, isDarkTheme);
|
|
803
1356
|
};
|
|
804
|
-
export const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot,
|
|
805
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1357
|
+
export const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
806
1358
|
return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
|
|
807
1359
|
};
|
|
808
1360
|
const mapColorFillBars = (layout)=>{
|
|
@@ -826,8 +1378,7 @@ const mapColorFillBars = (layout)=>{
|
|
|
826
1378
|
};
|
|
827
1379
|
});
|
|
828
1380
|
};
|
|
829
|
-
const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType,
|
|
830
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1381
|
+
const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
|
|
831
1382
|
var _input_data_, _chartData__data_, _chartData_, _chartData__data_1, _chartData_1, _chartData__data_2, _chartData_2, _chartData__data_3, _chartData_3, _input_layout, _input_layout1, _input_layout2;
|
|
832
1383
|
const isScatterMarkers = [
|
|
833
1384
|
'text',
|
|
@@ -985,6 +1536,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
985
1536
|
const scatterChartProps = {
|
|
986
1537
|
scatterChartData: chartData
|
|
987
1538
|
};
|
|
1539
|
+
const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
988
1540
|
var _input_layout_height;
|
|
989
1541
|
const commonProps = {
|
|
990
1542
|
supportNegativeData: true,
|
|
@@ -994,13 +1546,16 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
994
1546
|
hideTickOverlap: true,
|
|
995
1547
|
hideLegend,
|
|
996
1548
|
useUTC: false,
|
|
997
|
-
|
|
1549
|
+
wrapXAxisLabels: shouldWrapLabels,
|
|
998
1550
|
optimizeLargeData: numDataPoints > 1000,
|
|
999
1551
|
...getTitles(input.layout),
|
|
1000
1552
|
...getXAxisTickFormat(input.data[0], input.layout),
|
|
1001
1553
|
...yAxisTickFormat,
|
|
1002
1554
|
...getAxisScaleTypeProps(input.data, input.layout),
|
|
1003
|
-
...getAxisTickProps(input.data, input.layout)
|
|
1555
|
+
...getAxisTickProps(input.data, input.layout),
|
|
1556
|
+
...annotations ? {
|
|
1557
|
+
annotations
|
|
1558
|
+
} : {}
|
|
1004
1559
|
};
|
|
1005
1560
|
if (isAreaChart) {
|
|
1006
1561
|
return {
|
|
@@ -1027,8 +1582,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
1027
1582
|
};
|
|
1028
1583
|
}
|
|
1029
1584
|
};
|
|
1030
|
-
export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot,
|
|
1031
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1585
|
+
export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1032
1586
|
var _input_layout, _input_layout_margin, _input_layout1, _input_layout_margin1, _input_layout2, _input_layout_yaxis2, _input_layout3, _input_layout_yaxis21, _input_layout4, _input_layout_yaxis2_title, _input_layout_yaxis22, _input_layout5, _input_layout6;
|
|
1033
1587
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
1034
1588
|
let colorScale = undefined;
|
|
@@ -1086,8 +1640,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
1086
1640
|
...getAxisTickProps(input.data, input.layout)
|
|
1087
1641
|
};
|
|
1088
1642
|
};
|
|
1089
|
-
export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot,
|
|
1090
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1643
|
+
export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1091
1644
|
var _input_layout, _input_layout1;
|
|
1092
1645
|
const data = input.data.filter((series)=>series.type !== 'scatter' || series.mode !== 'markers');
|
|
1093
1646
|
const { legends, hideLegend } = getLegendProps(data, input.layout, isMultiPlot);
|
|
@@ -1169,8 +1722,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
1169
1722
|
...getAxisTickProps(data, input.layout)
|
|
1170
1723
|
};
|
|
1171
1724
|
};
|
|
1172
|
-
export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot,
|
|
1173
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1725
|
+
export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1174
1726
|
var _input_layout, _input_layout_coloraxis, _input_layout1, _input_layout_template_layout, _input_layout_template, _input_layout2, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout3, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout4, _input_layout5, _input_layout6;
|
|
1175
1727
|
const firstData = input.data[0];
|
|
1176
1728
|
const heatmapDataPoints = [];
|
|
@@ -1305,8 +1857,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
1305
1857
|
...getAxisTickProps(input.data, input.layout)
|
|
1306
1858
|
};
|
|
1307
1859
|
};
|
|
1308
|
-
export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot,
|
|
1309
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1860
|
+
export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1310
1861
|
var _input_layout_template_layout, _input_layout_template, _input_layout, _node_label, _input_layout1, _input_layout2;
|
|
1311
1862
|
const { link, node } = input.data[0];
|
|
1312
1863
|
var _link_value;
|
|
@@ -1356,8 +1907,7 @@ colorMap, colorwayType, isDarkTheme)=>{
|
|
|
1356
1907
|
height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
|
|
1357
1908
|
};
|
|
1358
1909
|
};
|
|
1359
|
-
export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot,
|
|
1360
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
1910
|
+
export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1361
1911
|
var _firstData_gauge, _input_layout_template_layout, _input_layout_template, _input_layout, _firstData_gauge_steps, _firstData_gauge1, _firstData_gauge_axis_range, _firstData_gauge_axis, _firstData_gauge2, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _firstData_gauge_axis1, _firstData_gauge3, _firstData_gauge_axis_range1, _firstData_gauge_axis2, _firstData_gauge4, _firstData_delta, _firstData_gauge_axis_range2, _firstData_gauge_axis3, _firstData_gauge5, _firstData_gauge_axis_range3, _firstData_gauge_axis4, _firstData_gauge6, _firstData_gauge_axis_range4, _firstData_gauge_axis5, _firstData_gauge7, _firstData_gauge_axis_range5, _firstData_gauge_axis6, _firstData_gauge8, _input_layout2, _input_layout3, _firstData_gauge_steps1, _firstData_gauge9;
|
|
1362
1912
|
const firstData = input.data[0];
|
|
1363
1913
|
const stepsColors = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : _firstData_gauge.steps) ? firstData.gauge.steps.map((step)=>step.color) : undefined;
|
|
@@ -1483,8 +2033,7 @@ function mergeCells(tableCells, templateCells) {
|
|
|
1483
2033
|
suffix: (_tableCells_suffix = tableCells === null || tableCells === void 0 ? void 0 : tableCells.suffix) !== null && _tableCells_suffix !== void 0 ? _tableCells_suffix : templateCells === null || templateCells === void 0 ? void 0 : templateCells.suffix
|
|
1484
2034
|
};
|
|
1485
2035
|
}
|
|
1486
|
-
export const transformPlotlyJsonToChartTableProps = (input, isMultiPlot,
|
|
1487
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
2036
|
+
export const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1488
2037
|
var _tableData_cells, _input_layout_template_data_table_, _input_layout_template_data_table, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _input_layout_template_data_table_1, _input_layout_template_data_table1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _tableData_header, _input_layout3, _input_layout4;
|
|
1489
2038
|
const tableData = input.data[0];
|
|
1490
2039
|
const normalizeHeaders = (values, header)=>{
|
|
@@ -1637,8 +2186,7 @@ function getCategoriesAndValues(series) {
|
|
|
1637
2186
|
}
|
|
1638
2187
|
}
|
|
1639
2188
|
}
|
|
1640
|
-
export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot,
|
|
1641
|
-
colorMap, colorwayType, isDarkTheme)=>{
|
|
2189
|
+
export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1642
2190
|
var _input_layout, _input_layout1, _input_data_, _input_layout2;
|
|
1643
2191
|
const funnelData = [];
|
|
1644
2192
|
// Determine if data is stacked based on multiple series with multiple values per series
|
|
@@ -2035,8 +2583,7 @@ const getLegendShape = (series)=>{
|
|
|
2035
2583
|
}
|
|
2036
2584
|
return 'default';
|
|
2037
2585
|
};
|
|
2038
|
-
export const getAllupLegendsProps = (input,
|
|
2039
|
-
colorMap, colorwayType, traceInfo, isDarkTheme)=>{
|
|
2586
|
+
export const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
|
|
2040
2587
|
const allupLegends = [];
|
|
2041
2588
|
// reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
|
|
2042
2589
|
const toShowLegend = input.data.reduce((acc, series)=>{
|
|
@@ -2145,7 +2692,8 @@ export const isNonPlotType = (chartType)=>{
|
|
|
2145
2692
|
return [
|
|
2146
2693
|
'donut',
|
|
2147
2694
|
'sankey',
|
|
2148
|
-
'pie'
|
|
2695
|
+
'pie',
|
|
2696
|
+
'annotation'
|
|
2149
2697
|
].includes(chartType);
|
|
2150
2698
|
};
|
|
2151
2699
|
export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|