@fluentui/react-charts 0.0.0-nightly-20251106-0410.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 +31 -13
- package/dist/index.d.ts +213 -2
- 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/ChartTable/ChartTable.js +3 -1
- package/lib/components/ChartTable/ChartTable.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 +56 -27
- 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.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +571 -6
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +12 -7
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +5 -5
- package/lib/components/FunnelChart/FunnelChart.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/GaugeChart/GaugeChart.js +3 -1
- package/lib/components/GaugeChart/GaugeChart.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/HeatMapChart.js +5 -5
- package/lib/components/HeatMapChart/HeatMapChart.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/HorizontalBarChart/HorizontalBarChart.js +3 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.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/Legends/Legends.js +3 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +5 -4
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.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/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1 -1
- package/lib/components/SankeyChart/SankeyChart.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/VerticalBarChart.js +3 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.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/VerticalStackedBarChart.js +12 -4
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.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/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +8 -8
- package/lib/utilities/SVGTooltipText.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/ChartTable/ChartTable.js +3 -1
- package/lib-commonjs/components/ChartTable/ChartTable.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 +56 -27
- 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/DonutChart/DonutChart.js +12 -7
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -5
- package/lib-commonjs/components/FunnelChart/FunnelChart.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/GaugeChart/GaugeChart.js +3 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.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/HeatMapChart.js +5 -5
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.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/HorizontalBarChart/HorizontalBarChart.js +3 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.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/Legends/Legends.js +3 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +5 -4
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.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/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.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/VerticalBarChart.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.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/VerticalStackedBarChart.js +12 -4
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.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/FocusableTooltipText.js +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +8 -8
- package/lib-commonjs/utilities/SVGTooltipText.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
|
@@ -49,6 +49,9 @@ _export(exports, {
|
|
|
49
49
|
resolveXAxisPoint: function() {
|
|
50
50
|
return resolveXAxisPoint;
|
|
51
51
|
},
|
|
52
|
+
transformPlotlyJsonToAnnotationChartProps: function() {
|
|
53
|
+
return transformPlotlyJsonToAnnotationChartProps;
|
|
54
|
+
},
|
|
52
55
|
transformPlotlyJsonToAreaChartProps: function() {
|
|
53
56
|
return transformPlotlyJsonToAreaChartProps;
|
|
54
57
|
},
|
|
@@ -336,6 +339,526 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
|
|
|
336
339
|
}
|
|
337
340
|
return flattened;
|
|
338
341
|
};
|
|
342
|
+
const encodeHtmlEntities = (value)=>value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
343
|
+
const toFiniteNumber = (value)=>{
|
|
344
|
+
if (value === undefined || value === null) {
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
const numeric = typeof value === 'number' ? value : Number(value);
|
|
348
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
|
|
352
|
+
*/ const normalizeAxisRef = (ref, axis)=>{
|
|
353
|
+
if (!ref) {
|
|
354
|
+
return axis;
|
|
355
|
+
}
|
|
356
|
+
const normalized = ref.toLowerCase();
|
|
357
|
+
if (normalized === axis || normalized === `${axis}axis` || normalized === `${axis}axis1` || normalized === `${axis}1`) {
|
|
358
|
+
return axis;
|
|
359
|
+
}
|
|
360
|
+
const match = normalized.match(/^([xy])(axis)?(\d+)$/);
|
|
361
|
+
if (match && match[1] === axis && match[3]) {
|
|
362
|
+
return match[3] === '1' ? axis : `${axis}${match[3]}`;
|
|
363
|
+
}
|
|
364
|
+
return normalized;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
|
|
368
|
+
*/ const getAxisNumericRangeFromData = (axis, ref, layout, data)=>{
|
|
369
|
+
if (!data || data.length === 0) {
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
const axisLayout = getAxisLayoutByRef(layout, ref, axis);
|
|
373
|
+
const targetRef = normalizeAxisRef(ref, axis);
|
|
374
|
+
const traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
|
|
375
|
+
let minValue;
|
|
376
|
+
let maxValue;
|
|
377
|
+
data.forEach((trace)=>{
|
|
378
|
+
const plotTrace = trace;
|
|
379
|
+
const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
|
|
380
|
+
if (traceAxisRef !== targetRef) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const values = axis === 'x' ? plotTrace.x : plotTrace.y;
|
|
384
|
+
if (!(0, _chartutilities.isArrayOrTypedArray)(values)) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const arrayLike = values;
|
|
388
|
+
for(let index = 0; index < arrayLike.length; index++){
|
|
389
|
+
const value = arrayLike[index];
|
|
390
|
+
const numeric = toNumericValue(convertDataValue(value, axisLayout));
|
|
391
|
+
if (numeric === undefined || Number.isNaN(numeric)) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
|
|
395
|
+
maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
|
|
399
|
+
return undefined;
|
|
400
|
+
}
|
|
401
|
+
return [
|
|
402
|
+
minValue,
|
|
403
|
+
maxValue
|
|
404
|
+
];
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
|
|
408
|
+
*/ const transformRelativeYForChart = (value)=>{
|
|
409
|
+
if (value === undefined) {
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
if (!Number.isFinite(value)) {
|
|
413
|
+
return undefined;
|
|
414
|
+
}
|
|
415
|
+
return 1 - value;
|
|
416
|
+
};
|
|
417
|
+
const mapHorizontalAlign = (anchor)=>{
|
|
418
|
+
switch((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()){
|
|
419
|
+
case 'left':
|
|
420
|
+
return 'start';
|
|
421
|
+
case 'center':
|
|
422
|
+
return 'center';
|
|
423
|
+
case 'right':
|
|
424
|
+
return 'end';
|
|
425
|
+
default:
|
|
426
|
+
return undefined;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
const mapVerticalAlign = (anchor)=>{
|
|
430
|
+
switch((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()){
|
|
431
|
+
case 'top':
|
|
432
|
+
return 'top';
|
|
433
|
+
case 'middle':
|
|
434
|
+
return 'middle';
|
|
435
|
+
case 'bottom':
|
|
436
|
+
return 'bottom';
|
|
437
|
+
default:
|
|
438
|
+
return undefined;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
const appendPx = (value)=>{
|
|
442
|
+
if (value === undefined || value === null) {
|
|
443
|
+
return undefined;
|
|
444
|
+
}
|
|
445
|
+
if (typeof value === 'string') {
|
|
446
|
+
return value;
|
|
447
|
+
}
|
|
448
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
449
|
+
return `${value}px`;
|
|
450
|
+
}
|
|
451
|
+
return undefined;
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Maps Plotly's axis reference string to one of our coordinate interpretation modes (axis, relative, or pixel).
|
|
455
|
+
*/ const resolveRefType = (ref, axis)=>{
|
|
456
|
+
if (!ref) {
|
|
457
|
+
return 'axis';
|
|
458
|
+
}
|
|
459
|
+
const normalized = ref.toLowerCase();
|
|
460
|
+
if (normalized === 'pixel') {
|
|
461
|
+
return 'pixel';
|
|
462
|
+
}
|
|
463
|
+
if (normalized === 'paper') {
|
|
464
|
+
return 'relative';
|
|
465
|
+
}
|
|
466
|
+
if (normalized.endsWith(' domain')) {
|
|
467
|
+
return normalized.startsWith(axis) ? 'relative' : undefined;
|
|
468
|
+
}
|
|
469
|
+
const match = normalized.match(/^([xy])(\d*)$/);
|
|
470
|
+
if (match && match[1] === axis) {
|
|
471
|
+
return 'axis';
|
|
472
|
+
}
|
|
473
|
+
return undefined;
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
|
|
477
|
+
*/ const getAxisLayoutByRef = (layout, ref, axis)=>{
|
|
478
|
+
if (!layout) {
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
const defaultAxisKey = `${axis}axis`;
|
|
482
|
+
if (!ref) {
|
|
483
|
+
return layout[defaultAxisKey];
|
|
484
|
+
}
|
|
485
|
+
const normalized = ref.toLowerCase();
|
|
486
|
+
if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
|
|
487
|
+
return layout[defaultAxisKey];
|
|
488
|
+
}
|
|
489
|
+
const match = normalized.match(/^([xy])(\d*)$/);
|
|
490
|
+
if (match && match[1] === axis) {
|
|
491
|
+
const index = match[2];
|
|
492
|
+
if (index && index !== '' && index !== '1') {
|
|
493
|
+
const axisKey = `${axis}axis${index}`;
|
|
494
|
+
return layout[axisKey];
|
|
495
|
+
}
|
|
496
|
+
return layout[defaultAxisKey];
|
|
497
|
+
}
|
|
498
|
+
return layout[defaultAxisKey];
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
|
|
502
|
+
*/ const convertDataValue = (value, axisLayout)=>{
|
|
503
|
+
if (value === undefined || value === null) {
|
|
504
|
+
return undefined;
|
|
505
|
+
}
|
|
506
|
+
if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || (0, _chartutilities.isDate)(value)) {
|
|
507
|
+
const dateValue = value instanceof Date ? value : new Date(value);
|
|
508
|
+
return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
|
|
509
|
+
}
|
|
510
|
+
if (typeof value === 'number') {
|
|
511
|
+
return value;
|
|
512
|
+
}
|
|
513
|
+
if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
|
|
514
|
+
const numeric = Number(value);
|
|
515
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
516
|
+
}
|
|
517
|
+
if (value instanceof Date) {
|
|
518
|
+
return value;
|
|
519
|
+
}
|
|
520
|
+
return value;
|
|
521
|
+
};
|
|
522
|
+
const toNumericValue = (value)=>{
|
|
523
|
+
if (value instanceof Date) {
|
|
524
|
+
const timestamp = value.getTime();
|
|
525
|
+
return Number.isFinite(timestamp) ? timestamp : undefined;
|
|
526
|
+
}
|
|
527
|
+
if (typeof value === 'number') {
|
|
528
|
+
return Number.isFinite(value) ? value : undefined;
|
|
529
|
+
}
|
|
530
|
+
if (typeof value === 'string') {
|
|
531
|
+
const numeric = Number(value);
|
|
532
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
533
|
+
}
|
|
534
|
+
return undefined;
|
|
535
|
+
};
|
|
536
|
+
const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
|
|
537
|
+
const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
|
|
538
|
+
let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
|
|
539
|
+
let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
|
|
540
|
+
if ((start === undefined || end === undefined || start === end) && fallbackRange) {
|
|
541
|
+
[start, end] = fallbackRange;
|
|
542
|
+
}
|
|
543
|
+
const current = toNumericValue(convertDataValue(value, axisLayout));
|
|
544
|
+
if (start === undefined || end === undefined || current === undefined || start === end) {
|
|
545
|
+
return undefined;
|
|
546
|
+
}
|
|
547
|
+
const relative = (current - start) / (end - start);
|
|
548
|
+
return Number.isFinite(relative) ? relative : undefined;
|
|
549
|
+
};
|
|
550
|
+
const createAnnotationId = (text, index)=>{
|
|
551
|
+
const normalized = text.replace(/\s+/g, ' ').trim();
|
|
552
|
+
if (normalized) {
|
|
553
|
+
const slug = normalized.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32);
|
|
554
|
+
if (slug) {
|
|
555
|
+
return `annotation-${index}-${slug}`;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return `annotation-${index}`;
|
|
559
|
+
};
|
|
560
|
+
const DEFAULT_ARROW_OFFSET = -40;
|
|
561
|
+
const mapArrowsideToArrow = (annotation)=>{
|
|
562
|
+
let includeStart = false;
|
|
563
|
+
let includeEnd = false;
|
|
564
|
+
const arrowSide = typeof (annotation === null || annotation === void 0 ? void 0 : annotation.arrowside) === 'string' ? annotation === null || annotation === void 0 ? void 0 : annotation.arrowside.toLowerCase() : undefined;
|
|
565
|
+
if (arrowSide) {
|
|
566
|
+
includeStart = arrowSide.includes('start');
|
|
567
|
+
includeEnd = arrowSide.includes('end');
|
|
568
|
+
}
|
|
569
|
+
const endHead = toFiniteNumber(annotation === null || annotation === void 0 ? void 0 : annotation.arrowhead);
|
|
570
|
+
const startHead = toFiniteNumber(annotation.startarrowhead);
|
|
571
|
+
if (endHead !== undefined && endHead > 0) {
|
|
572
|
+
includeEnd = true;
|
|
573
|
+
}
|
|
574
|
+
if (startHead !== undefined && startHead > 0) {
|
|
575
|
+
includeStart = true;
|
|
576
|
+
}
|
|
577
|
+
if (includeStart && includeEnd) {
|
|
578
|
+
return 'both';
|
|
579
|
+
}
|
|
580
|
+
if (includeStart) {
|
|
581
|
+
return 'start';
|
|
582
|
+
}
|
|
583
|
+
if (includeEnd) {
|
|
584
|
+
return 'end';
|
|
585
|
+
}
|
|
586
|
+
return 'none';
|
|
587
|
+
};
|
|
588
|
+
const mapArrowDashToPattern = (value)=>{
|
|
589
|
+
if (!value) {
|
|
590
|
+
return undefined;
|
|
591
|
+
}
|
|
592
|
+
const normalized = value.trim().toLowerCase();
|
|
593
|
+
switch(normalized){
|
|
594
|
+
case 'solid':
|
|
595
|
+
return undefined;
|
|
596
|
+
case 'dot':
|
|
597
|
+
return '1, 5';
|
|
598
|
+
case 'dash':
|
|
599
|
+
return '5, 5';
|
|
600
|
+
case 'longdash':
|
|
601
|
+
return '10, 5';
|
|
602
|
+
case 'dashdot':
|
|
603
|
+
return '5, 5, 1, 5';
|
|
604
|
+
case 'longdashdot':
|
|
605
|
+
return '10, 5, 1, 5';
|
|
606
|
+
default:
|
|
607
|
+
if (/^\d+(\s|,)*\d*$/.test(normalized.replace(/\s+/g, ' '))) {
|
|
608
|
+
return normalized.replace(/\s+/g, ' ');
|
|
609
|
+
}
|
|
610
|
+
return value;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
/**
|
|
614
|
+
* Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
|
|
615
|
+
* layout alignment, styling, and connector metadata while skipping unsupported configurations.
|
|
616
|
+
*/ const convertPlotlyAnnotation = (annotation, layout, data, index)=>{
|
|
617
|
+
if (!annotation || annotation.visible === false) {
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
const xRefType = resolveRefType(annotation.xref, 'x');
|
|
621
|
+
const yRefType = resolveRefType(annotation.yref, 'y');
|
|
622
|
+
if (!xRefType || !yRefType) {
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
let coordinates;
|
|
626
|
+
if (xRefType === 'axis' && yRefType === 'axis') {
|
|
627
|
+
const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
628
|
+
const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
629
|
+
const xValue = convertDataValue(annotation.x, xAxisLayout);
|
|
630
|
+
const yValue = convertDataValue(annotation.y, yAxisLayout);
|
|
631
|
+
if (xValue === undefined || yValue === undefined) {
|
|
632
|
+
return undefined;
|
|
633
|
+
}
|
|
634
|
+
const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
|
|
635
|
+
coordinates = {
|
|
636
|
+
type: 'data',
|
|
637
|
+
x: xValue,
|
|
638
|
+
y: yValue,
|
|
639
|
+
...yRefNormalized === 'y2' ? {
|
|
640
|
+
yAxis: 'secondary'
|
|
641
|
+
} : {}
|
|
642
|
+
};
|
|
643
|
+
} else if (xRefType === 'relative' && yRefType === 'relative') {
|
|
644
|
+
const xValue = toFiniteNumber(annotation.x);
|
|
645
|
+
const yValue = toFiniteNumber(annotation.y);
|
|
646
|
+
const chartRelativeY = transformRelativeYForChart(yValue);
|
|
647
|
+
if (xValue === undefined || chartRelativeY === undefined) {
|
|
648
|
+
return undefined;
|
|
649
|
+
}
|
|
650
|
+
coordinates = {
|
|
651
|
+
type: 'relative',
|
|
652
|
+
x: xValue,
|
|
653
|
+
y: chartRelativeY
|
|
654
|
+
};
|
|
655
|
+
} else if (xRefType === 'relative' && yRefType === 'axis') {
|
|
656
|
+
const xValue = toFiniteNumber(annotation.x);
|
|
657
|
+
const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
658
|
+
const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
|
|
659
|
+
const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
|
|
660
|
+
const chartRelativeY = transformRelativeYForChart(yRelative);
|
|
661
|
+
if (xValue === undefined || chartRelativeY === undefined) {
|
|
662
|
+
return undefined;
|
|
663
|
+
}
|
|
664
|
+
coordinates = {
|
|
665
|
+
type: 'relative',
|
|
666
|
+
x: xValue,
|
|
667
|
+
y: chartRelativeY
|
|
668
|
+
};
|
|
669
|
+
} else if (xRefType === 'axis' && yRefType === 'relative') {
|
|
670
|
+
const yValue = toFiniteNumber(annotation.y);
|
|
671
|
+
const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
672
|
+
const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
|
|
673
|
+
const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
|
|
674
|
+
const chartRelativeY = transformRelativeYForChart(yValue);
|
|
675
|
+
if (xRelative === undefined || chartRelativeY === undefined) {
|
|
676
|
+
return undefined;
|
|
677
|
+
}
|
|
678
|
+
coordinates = {
|
|
679
|
+
type: 'relative',
|
|
680
|
+
x: xRelative,
|
|
681
|
+
y: chartRelativeY
|
|
682
|
+
};
|
|
683
|
+
} else if (xRefType === 'pixel' && yRefType === 'pixel') {
|
|
684
|
+
const xValue = toFiniteNumber(annotation.x);
|
|
685
|
+
const yValue = toFiniteNumber(annotation.y);
|
|
686
|
+
if (xValue === undefined || yValue === undefined) {
|
|
687
|
+
return undefined;
|
|
688
|
+
}
|
|
689
|
+
coordinates = {
|
|
690
|
+
type: 'pixel',
|
|
691
|
+
x: xValue,
|
|
692
|
+
y: yValue
|
|
693
|
+
};
|
|
694
|
+
} else {
|
|
695
|
+
return undefined;
|
|
696
|
+
}
|
|
697
|
+
const textValue = annotation.text;
|
|
698
|
+
const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
|
|
699
|
+
const encodedText = encodeHtmlEntities(rawText);
|
|
700
|
+
const chartAnnotation = {
|
|
701
|
+
id: createAnnotationId(encodedText, index),
|
|
702
|
+
text: encodedText,
|
|
703
|
+
coordinates
|
|
704
|
+
};
|
|
705
|
+
const layoutProps = {};
|
|
706
|
+
const styleProps = {};
|
|
707
|
+
const showArrow = annotation.showarrow === undefined ? false : !!annotation.showarrow;
|
|
708
|
+
const clipOnAxis = annotation.cliponaxis;
|
|
709
|
+
if (clipOnAxis !== undefined) {
|
|
710
|
+
layoutProps.clipToBounds = !!clipOnAxis;
|
|
711
|
+
} else if (coordinates.type === 'data') {
|
|
712
|
+
layoutProps.clipToBounds = true;
|
|
713
|
+
}
|
|
714
|
+
const horizontalAlign = mapHorizontalAlign(annotation.xanchor);
|
|
715
|
+
if (horizontalAlign) {
|
|
716
|
+
layoutProps.align = horizontalAlign;
|
|
717
|
+
}
|
|
718
|
+
if (!layoutProps.align) {
|
|
719
|
+
const alignProp = mapHorizontalAlign(annotation.align);
|
|
720
|
+
if (alignProp) {
|
|
721
|
+
layoutProps.align = alignProp;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const verticalAlign = mapVerticalAlign(annotation.yanchor);
|
|
725
|
+
if (verticalAlign) {
|
|
726
|
+
layoutProps.verticalAlign = verticalAlign;
|
|
727
|
+
}
|
|
728
|
+
if (!layoutProps.verticalAlign) {
|
|
729
|
+
const valignProp = mapVerticalAlign(annotation.valign);
|
|
730
|
+
if (valignProp) {
|
|
731
|
+
layoutProps.verticalAlign = valignProp;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
const offsetXComponents = [];
|
|
735
|
+
let hasExplicitOffset = false;
|
|
736
|
+
const ax = toFiniteNumber(annotation.ax);
|
|
737
|
+
const axRef = typeof annotation.axref === 'string' ? annotation.axref.toLowerCase() : undefined;
|
|
738
|
+
if (ax !== undefined && (axRef === undefined || axRef === 'pixel')) {
|
|
739
|
+
offsetXComponents.push(ax);
|
|
740
|
+
hasExplicitOffset = true;
|
|
741
|
+
}
|
|
742
|
+
const xShift = toFiniteNumber(annotation.xshift);
|
|
743
|
+
if (xShift !== undefined) {
|
|
744
|
+
offsetXComponents.push(xShift);
|
|
745
|
+
hasExplicitOffset = true;
|
|
746
|
+
}
|
|
747
|
+
if (offsetXComponents.length > 0) {
|
|
748
|
+
const offsetX = offsetXComponents.reduce((sum, value)=>sum + value, 0);
|
|
749
|
+
if (offsetX !== 0) {
|
|
750
|
+
layoutProps.offsetX = offsetX;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
const offsetYComponents = [];
|
|
754
|
+
const ay = toFiniteNumber(annotation.ay);
|
|
755
|
+
const ayRef = typeof annotation.ayref === 'string' ? annotation.ayref.toLowerCase() : undefined;
|
|
756
|
+
if (ay !== undefined && (ayRef === undefined || ayRef === 'pixel')) {
|
|
757
|
+
offsetYComponents.push(ay);
|
|
758
|
+
hasExplicitOffset = true;
|
|
759
|
+
}
|
|
760
|
+
const yShift = toFiniteNumber(annotation.yshift);
|
|
761
|
+
if (yShift !== undefined) {
|
|
762
|
+
offsetYComponents.push(yShift);
|
|
763
|
+
hasExplicitOffset = true;
|
|
764
|
+
}
|
|
765
|
+
if (offsetYComponents.length > 0) {
|
|
766
|
+
const offsetY = offsetYComponents.reduce((sum, value)=>sum + value, 0);
|
|
767
|
+
if (offsetY !== 0) {
|
|
768
|
+
layoutProps.offsetY = offsetY;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (showArrow && !hasExplicitOffset && layoutProps.offsetY === undefined) {
|
|
772
|
+
layoutProps.offsetY = DEFAULT_ARROW_OFFSET;
|
|
773
|
+
}
|
|
774
|
+
const maxWidth = toFiniteNumber(annotation.width);
|
|
775
|
+
if (maxWidth !== undefined) {
|
|
776
|
+
layoutProps.maxWidth = maxWidth;
|
|
777
|
+
}
|
|
778
|
+
if (annotation.bgcolor) {
|
|
779
|
+
styleProps.backgroundColor = annotation.bgcolor;
|
|
780
|
+
}
|
|
781
|
+
if (annotation.bordercolor) {
|
|
782
|
+
styleProps.borderColor = annotation.bordercolor;
|
|
783
|
+
}
|
|
784
|
+
const borderWidth = toFiniteNumber(annotation.borderwidth);
|
|
785
|
+
if (borderWidth !== undefined) {
|
|
786
|
+
styleProps.borderWidth = borderWidth;
|
|
787
|
+
}
|
|
788
|
+
const borderPad = appendPx(annotation.borderpad);
|
|
789
|
+
if (borderPad) {
|
|
790
|
+
styleProps.padding = borderPad;
|
|
791
|
+
}
|
|
792
|
+
const opacity = toFiniteNumber(annotation.opacity);
|
|
793
|
+
if (opacity !== undefined) {
|
|
794
|
+
styleProps.opacity = opacity;
|
|
795
|
+
}
|
|
796
|
+
if (annotation.font) {
|
|
797
|
+
const font = annotation.font;
|
|
798
|
+
if (font === null || font === void 0 ? void 0 : font.color) {
|
|
799
|
+
styleProps.textColor = font.color;
|
|
800
|
+
}
|
|
801
|
+
const fontSize = appendPx(font === null || font === void 0 ? void 0 : font.size);
|
|
802
|
+
if (fontSize) {
|
|
803
|
+
styleProps.fontSize = fontSize;
|
|
804
|
+
}
|
|
805
|
+
if (font === null || font === void 0 ? void 0 : font.weight) {
|
|
806
|
+
styleProps.fontWeight = font.weight;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const textAngle = annotation === null || annotation === void 0 ? void 0 : annotation.textangle;
|
|
810
|
+
if (typeof textAngle === 'number' && !Number.isNaN(textAngle)) {
|
|
811
|
+
styleProps.rotation = textAngle;
|
|
812
|
+
} else if (typeof textAngle === 'string' && textAngle.toLowerCase() !== 'auto') {
|
|
813
|
+
const parsedAngle = Number(textAngle);
|
|
814
|
+
if (!Number.isNaN(parsedAngle)) {
|
|
815
|
+
styleProps.rotation = parsedAngle;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if (Object.keys(layoutProps).length > 0) {
|
|
819
|
+
chartAnnotation.layout = layoutProps;
|
|
820
|
+
}
|
|
821
|
+
if (Object.keys(styleProps).length > 0) {
|
|
822
|
+
chartAnnotation.style = styleProps;
|
|
823
|
+
}
|
|
824
|
+
if (showArrow) {
|
|
825
|
+
var _annotation_arrowcolor;
|
|
826
|
+
const arrowColor = (_annotation_arrowcolor = annotation.arrowcolor) !== null && _annotation_arrowcolor !== void 0 ? _annotation_arrowcolor : styleProps.textColor;
|
|
827
|
+
const arrowWidth = toFiniteNumber(annotation.arrowwidth);
|
|
828
|
+
const endPadding = toFiniteNumber(annotation.standoff);
|
|
829
|
+
const startPadding = toFiniteNumber(annotation.startstandoff);
|
|
830
|
+
const dashPattern = mapArrowDashToPattern(annotation.arrowdash);
|
|
831
|
+
chartAnnotation.connector = {
|
|
832
|
+
...arrowColor ? {
|
|
833
|
+
strokeColor: arrowColor
|
|
834
|
+
} : {},
|
|
835
|
+
...arrowWidth !== undefined ? {
|
|
836
|
+
strokeWidth: arrowWidth
|
|
837
|
+
} : {},
|
|
838
|
+
...endPadding !== undefined ? {
|
|
839
|
+
endPadding: Math.max(endPadding, 0)
|
|
840
|
+
} : {},
|
|
841
|
+
...startPadding !== undefined ? {
|
|
842
|
+
startPadding: Math.max(startPadding, 0)
|
|
843
|
+
} : {},
|
|
844
|
+
...dashPattern ? {
|
|
845
|
+
dashArray: dashPattern
|
|
846
|
+
} : {},
|
|
847
|
+
arrow: mapArrowsideToArrow(annotation)
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
return chartAnnotation;
|
|
851
|
+
};
|
|
852
|
+
const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
|
|
853
|
+
if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
|
|
854
|
+
return undefined;
|
|
855
|
+
}
|
|
856
|
+
const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
|
|
857
|
+
layout.annotations
|
|
858
|
+
];
|
|
859
|
+
const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, data, index)).filter((annotation)=>annotation !== undefined);
|
|
860
|
+
return converted.length > 0 ? converted : undefined;
|
|
861
|
+
};
|
|
339
862
|
const normalizeObjectArrayForGVBC = (data, xLabels)=>{
|
|
340
863
|
if (!data || data.length === 0) {
|
|
341
864
|
return {
|
|
@@ -407,6 +930,34 @@ const normalizeObjectArrayForGVBC = (data, xLabels)=>{
|
|
|
407
930
|
x
|
|
408
931
|
};
|
|
409
932
|
};
|
|
933
|
+
const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
|
|
934
|
+
var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
|
|
935
|
+
var _getChartAnnotationsFromLayout;
|
|
936
|
+
const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
|
|
937
|
+
const titles = getTitles(input.layout);
|
|
938
|
+
const layoutTitle = titles.chartTitle || undefined;
|
|
939
|
+
const layoutWithMeta = input.layout;
|
|
940
|
+
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;
|
|
941
|
+
const width = typeof ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) === 'number' ? input.layout.width : undefined;
|
|
942
|
+
const height = typeof ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) === 'number' ? input.layout.height : undefined;
|
|
943
|
+
const paperBackgroundColor = typeof ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.paper_bgcolor) === 'string' ? input.layout.paper_bgcolor : undefined;
|
|
944
|
+
const plotBackgroundColor = typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.plot_bgcolor) === 'string' ? input.layout.plot_bgcolor : undefined;
|
|
945
|
+
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;
|
|
946
|
+
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;
|
|
947
|
+
const margin = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.margin;
|
|
948
|
+
return {
|
|
949
|
+
annotations,
|
|
950
|
+
chartTitle: layoutTitle,
|
|
951
|
+
description,
|
|
952
|
+
width,
|
|
953
|
+
height,
|
|
954
|
+
paperBackgroundColor,
|
|
955
|
+
plotBackgroundColor,
|
|
956
|
+
fontColor,
|
|
957
|
+
fontFamily,
|
|
958
|
+
margin
|
|
959
|
+
};
|
|
960
|
+
};
|
|
410
961
|
const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
411
962
|
var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
|
|
412
963
|
const firstData = input.data[0];
|
|
@@ -646,6 +1197,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
646
1197
|
});
|
|
647
1198
|
});
|
|
648
1199
|
const vsbcData = Object.values(mapXToDataPoints);
|
|
1200
|
+
const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
649
1201
|
var _input_layout_height;
|
|
650
1202
|
return {
|
|
651
1203
|
data: vsbcData,
|
|
@@ -670,7 +1222,10 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
670
1222
|
...getAxisCategoryOrderProps(input.data, input.layout),
|
|
671
1223
|
...getBarProps(input.data, input.layout),
|
|
672
1224
|
...getYMinMaxValues(input.data[0], input.layout),
|
|
673
|
-
...getAxisTickProps(input.data, input.layout)
|
|
1225
|
+
...getAxisTickProps(input.data, input.layout),
|
|
1226
|
+
...annotations ? {
|
|
1227
|
+
annotations
|
|
1228
|
+
} : {}
|
|
674
1229
|
};
|
|
675
1230
|
};
|
|
676
1231
|
const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -777,6 +1332,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
777
1332
|
});
|
|
778
1333
|
}
|
|
779
1334
|
});
|
|
1335
|
+
const annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
|
|
780
1336
|
var _processedInput_layout_height;
|
|
781
1337
|
return {
|
|
782
1338
|
dataV2: gvbcDataV2,
|
|
@@ -795,7 +1351,10 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
795
1351
|
...getXAxisTickFormat(processedInput.data[0], processedInput.layout),
|
|
796
1352
|
...yAxisTickFormat,
|
|
797
1353
|
...getBarProps(processedInput.data, processedInput.layout),
|
|
798
|
-
...getAxisTickProps(processedInput.data, processedInput.layout)
|
|
1354
|
+
...getAxisTickProps(processedInput.data, processedInput.layout),
|
|
1355
|
+
...annotations ? {
|
|
1356
|
+
annotations
|
|
1357
|
+
} : {}
|
|
799
1358
|
};
|
|
800
1359
|
};
|
|
801
1360
|
const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -860,6 +1419,7 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
860
1419
|
});
|
|
861
1420
|
});
|
|
862
1421
|
});
|
|
1422
|
+
const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
863
1423
|
var _input_layout_height;
|
|
864
1424
|
return {
|
|
865
1425
|
data: vbcData,
|
|
@@ -873,7 +1433,10 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
873
1433
|
roundCorners: true,
|
|
874
1434
|
...getTitles(input.layout),
|
|
875
1435
|
...getYMinMaxValues(input.data[0], input.layout),
|
|
876
|
-
...getAxisCategoryOrderProps(input.data, input.layout)
|
|
1436
|
+
...getAxisCategoryOrderProps(input.data, input.layout),
|
|
1437
|
+
...annotations ? {
|
|
1438
|
+
annotations
|
|
1439
|
+
} : {}
|
|
877
1440
|
};
|
|
878
1441
|
};
|
|
879
1442
|
const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -1064,6 +1627,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1064
1627
|
const scatterChartProps = {
|
|
1065
1628
|
scatterChartData: chartData
|
|
1066
1629
|
};
|
|
1630
|
+
const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
|
|
1067
1631
|
var _input_layout_height;
|
|
1068
1632
|
const commonProps = {
|
|
1069
1633
|
supportNegativeData: true,
|
|
@@ -1073,13 +1637,16 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1073
1637
|
hideTickOverlap: true,
|
|
1074
1638
|
hideLegend,
|
|
1075
1639
|
useUTC: false,
|
|
1076
|
-
|
|
1640
|
+
wrapXAxisLabels: shouldWrapLabels,
|
|
1077
1641
|
optimizeLargeData: numDataPoints > 1000,
|
|
1078
1642
|
...getTitles(input.layout),
|
|
1079
1643
|
...getXAxisTickFormat(input.data[0], input.layout),
|
|
1080
1644
|
...yAxisTickFormat,
|
|
1081
1645
|
...getAxisScaleTypeProps(input.data, input.layout),
|
|
1082
|
-
...getAxisTickProps(input.data, input.layout)
|
|
1646
|
+
...getAxisTickProps(input.data, input.layout),
|
|
1647
|
+
...annotations ? {
|
|
1648
|
+
annotations
|
|
1649
|
+
} : {}
|
|
1083
1650
|
};
|
|
1084
1651
|
if (isAreaChart) {
|
|
1085
1652
|
return {
|
|
@@ -2210,7 +2777,8 @@ const isNonPlotType = (chartType)=>{
|
|
|
2210
2777
|
return [
|
|
2211
2778
|
'donut',
|
|
2212
2779
|
'sankey',
|
|
2213
|
-
'pie'
|
|
2780
|
+
'pie',
|
|
2781
|
+
'annotation'
|
|
2214
2782
|
].includes(chartType);
|
|
2215
2783
|
};
|
|
2216
2784
|
const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|