@fluentui/react-charts 9.1.8 → 9.1.10
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 +34 -2
- package/dist/index.d.ts +309 -8
- package/lib/AreaChart.js.map +1 -1
- package/lib/CartesianChart.js.map +1 -1
- package/lib/DeclarativeChart.js.map +1 -1
- package/lib/DonutChart.js.map +1 -1
- package/lib/FunnelChart.js +1 -0
- package/lib/FunnelChart.js.map +1 -0
- package/lib/GanttChart.js +1 -0
- package/lib/GanttChart.js.map +1 -0
- package/lib/GaugeChart.js.map +1 -1
- package/lib/GroupedVerticalBarChart.js.map +1 -1
- package/lib/HeatMapChart.js.map +1 -1
- package/lib/HorizontalBarChart.js.map +1 -1
- package/lib/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/Legends.js.map +1 -1
- package/lib/LineChart.js.map +1 -1
- package/lib/Popover.js.map +1 -1
- package/lib/ResponsiveContainer.js.map +1 -1
- package/lib/SankeyChart.js.map +1 -1
- package/lib/ScatterChart.js.map +1 -1
- package/lib/Sparkline.js.map +1 -1
- package/lib/VerticalBarChart.js.map +1 -1
- package/lib/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.js +13 -5
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -1
- package/lib/components/AreaChart/index.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +10 -7
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/CommonComponents/index.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib/components/DeclarativeChart/index.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +5 -5
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib/components/DonutChart/Arc/index.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +7 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/index.js.map +1 -1
- package/lib/components/DonutChart/index.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +391 -0
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -0
- package/lib/components/FunnelChart/FunnelChart.types.js +1 -0
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -0
- package/lib/components/FunnelChart/funnelGeometry.js +220 -0
- package/lib/components/FunnelChart/funnelGeometry.js.map +1 -0
- package/lib/components/FunnelChart/index.js +2 -0
- package/lib/components/FunnelChart/index.js.map +1 -0
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +59 -0
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.js +530 -0
- package/lib/components/GanttChart/GanttChart.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.types.js +4 -0
- package/lib/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib/components/GanttChart/index.js +2 -0
- package/lib/components/GanttChart/index.js.map +1 -0
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +25 -0
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GaugeChart/index.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +10 -5
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/index.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/HeatMapChart/index.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +5 -3
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChart/index.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -3
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/Legends/index.js.map +1 -1
- package/lib/components/Legends/shape.js +3 -3
- package/lib/components/Legends/shape.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +14 -7
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js +2 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib/components/LineChart/index.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib/components/ResponsiveContainer/index.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/index.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +8 -2
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/index.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.types.js.map +1 -1
- package/lib/components/Sparkline/index.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +10 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/index.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +4 -4
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +3 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/types/EventAnnotation.js.map +1 -1
- package/lib/types/LegendDataItem.js.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/KeyCodes.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/async-utils.js.map +1 -1
- package/lib/utilities/colors.js +12 -0
- package/lib/utilities/colors.js.map +1 -1
- package/lib/utilities/getWindow.js.map +1 -1
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/overflow-utils.js.map +1 -1
- package/lib/utilities/string.js.map +1 -1
- package/lib/utilities/test-data.js +236 -0
- package/lib/utilities/test-data.js.map +1 -1
- package/lib/utilities/utilities.js +90 -22
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +2 -2
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/AreaChart.js.map +1 -1
- package/lib-commonjs/CartesianChart.js.map +1 -1
- package/lib-commonjs/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/DonutChart.js.map +1 -1
- package/lib-commonjs/FunnelChart.js +6 -0
- package/lib-commonjs/FunnelChart.js.map +1 -0
- package/lib-commonjs/GanttChart.js +6 -0
- package/lib-commonjs/GanttChart.js.map +1 -0
- package/lib-commonjs/GaugeChart.js.map +1 -1
- package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/HeatMapChart.js.map +1 -1
- package/lib-commonjs/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/Legends.js.map +1 -1
- package/lib-commonjs/LineChart.js.map +1 -1
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/SankeyChart.js.map +1 -1
- package/lib-commonjs/ScatterChart.js.map +1 -1
- package/lib-commonjs/Sparkline.js.map +1 -1
- package/lib-commonjs/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +13 -5
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -1
- package/lib-commonjs/components/AreaChart/index.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +9 -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/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +5 -5
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/index.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +402 -0
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -0
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js +6 -0
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -0
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js +248 -0
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -0
- package/lib-commonjs/components/FunnelChart/index.js +7 -0
- package/lib-commonjs/components/FunnelChart/index.js.map +1 -0
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +79 -0
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js +541 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.js +7 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib-commonjs/components/GanttChart/index.js +7 -0
- package/lib-commonjs/components/GanttChart/index.js.map +1 -0
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +39 -0
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +10 -5
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +3 -3
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -3
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -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/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Legends/index.js.map +1 -1
- package/lib-commonjs/components/Legends/shape.js +2 -2
- package/lib-commonjs/components/Legends/shape.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +14 -7
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +2 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-commonjs/components/LineChart/index.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +8 -2
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -1
- package/lib-commonjs/components/Sparkline/index.js.map +1 -1
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +10 -4
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +4 -4
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +2 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +3 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/types/EventAnnotation.js.map +1 -1
- package/lib-commonjs/types/LegendDataItem.js.map +1 -1
- package/lib-commonjs/types/index.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/KeyCodes.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/async-utils.js.map +1 -1
- package/lib-commonjs/utilities/colors.js +18 -0
- package/lib-commonjs/utilities/colors.js.map +1 -1
- package/lib-commonjs/utilities/getWindow.js.map +1 -1
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/overflow-utils.js.map +1 -1
- package/lib-commonjs/utilities/string.js.map +1 -1
- package/lib-commonjs/utilities/test-data.js +245 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +86 -17
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +2 -2
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PlotlySchemaAdapter.ts"],"sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport {\n bin as d3Bin,\n extent as d3Extent,\n sum as d3Sum,\n min as d3Min,\n max as d3Max,\n range as d3Range,\n Bin,\n} from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { DonutChartProps } from '../DonutChart/index';\nimport {\n ChartDataPoint,\n ChartProps,\n HorizontalBarChartWithAxisDataPoint,\n LineChartPoints,\n VerticalStackedChartProps,\n HeatMapChartData,\n HeatMapChartDataPoint,\n GroupedVerticalBarChartData,\n VerticalBarChartDataPoint,\n SankeyChartData,\n LineChartLineOptions,\n} from '../../types/DataPoint';\nimport { SankeyChartProps } from '../SankeyChart/index';\nimport { VerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { HorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { LineChartProps } from '../LineChart/index';\nimport { AreaChartProps } from '../AreaChart/index';\nimport { HeatMapChartProps } from '../HeatMapChart/index';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { GaugeChartProps, GaugeChartSegment } from '../GaugeChart/index';\nimport { GroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChartProps } from '../VerticalBarChart/index';\nimport { findNumericMinMaxOfY } from '../../utilities/utilities';\nimport type {\n Datum,\n Layout,\n PlotlySchema,\n PieData,\n PlotData,\n SankeyData,\n ScatterLine,\n TypedArray,\n Data,\n} from '@fluentui/chart-utilities';\nimport {\n isArrayOfType,\n isArrayOrTypedArray,\n isDate,\n isDateArray,\n isNumberArray,\n isYearArray,\n} from '@fluentui/chart-utilities';\nimport { curveCardinal as d3CurveCardinal } from 'd3-shape';\n\ninterface SecondaryYAxisValues {\n secondaryYAxistitle?: string;\n secondaryYScaleOptions?: { yMinValue?: number; yMaxValue?: number };\n}\n\nconst dashOptions = {\n dot: {\n strokeDasharray: '1, 5',\n strokeLinecap: 'round',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dash: {\n strokeDasharray: '5, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdash: {\n strokeDasharray: '10, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dashdot: {\n strokeDasharray: '5, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdashdot: {\n strokeDasharray: '10, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n solid: {\n strokeDasharray: '0',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n} as const;\n\nconst getLegend = (series: Partial<PlotData>, index: number): string => {\n return series.name || `Series ${index + 1}`;\n};\n\nfunction getTitles(layout: Partial<Layout> | undefined) {\n const titles = {\n chartTitle: typeof layout?.title === 'string' ? layout.title : layout?.title?.text ?? '',\n xAxisTitle: typeof layout?.xaxis?.title === 'string' ? layout?.xaxis?.title : layout?.xaxis?.title?.text ?? '',\n yAxisTitle: typeof layout?.yaxis?.title === 'string' ? layout?.yaxis?.title : layout?.yaxis?.title?.text ?? '',\n };\n return titles;\n}\n\nexport const correctYearMonth = (xValues: Datum[] | Datum[][] | TypedArray): any[] => {\n const presentYear = new Date().getFullYear();\n if (xValues.length > 0 && Array.isArray(xValues[0])) {\n throw new Error('updateXValues:: 2D array not supported');\n }\n const dates = (xValues as Datum[]).map(possiblyMonthValue => {\n const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;\n return isDate(parsedDate) ? new Date(parsedDate) : null;\n });\n for (let i = dates.length - 1; i > 0; i--) {\n const currentMonth = dates[i]!.getMonth();\n const previousMonth = dates[i - 1]!.getMonth();\n const currentYear = dates[i]!.getFullYear();\n const previousYear = dates[i - 1]!.getFullYear();\n if (previousMonth >= currentMonth) {\n dates[i - 1]!.setFullYear(dates[i]!.getFullYear() - 1);\n } else if (previousYear > currentYear) {\n dates[i - 1]!.setFullYear(currentYear);\n }\n }\n xValues = (xValues as Datum[]).map((month, index) => {\n return `${month} 01, ${dates[index]!.getFullYear()}`;\n });\n return xValues;\n};\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nconst usesSecondaryYScale = (series: Partial<PlotData>): boolean => {\n return series.yaxis === 'y2';\n};\n\nconst getSecondaryYAxisValues = (\n data: Data[],\n layout: Partial<Layout> | undefined,\n maxAllowedMinY?: number,\n minAllowedMaxY?: number,\n): SecondaryYAxisValues => {\n let containsSecondaryYAxis = false;\n let yMinValue: number | undefined;\n let yMaxValue: number | undefined;\n\n data.forEach((series: Partial<PlotData>) => {\n if (usesSecondaryYScale(series)) {\n containsSecondaryYAxis = true;\n const yValues = series.y as number[];\n if (yValues) {\n yMinValue = Math.min(...yValues);\n yMaxValue = Math.max(...yValues);\n }\n }\n });\n\n if (!containsSecondaryYAxis) {\n return {};\n }\n\n if (typeof yMinValue === 'number' && typeof maxAllowedMinY === 'number') {\n yMinValue = Math.min(yMinValue, maxAllowedMinY);\n }\n if (typeof yMaxValue === 'number' && typeof minAllowedMaxY === 'number') {\n yMaxValue = Math.max(yMaxValue, minAllowedMaxY);\n }\n if (layout?.yaxis2?.range) {\n yMinValue = layout.yaxis2.range[0];\n yMaxValue = layout.yaxis2.range[1];\n }\n\n return {\n secondaryYAxistitle:\n typeof layout?.yaxis2?.title === 'string'\n ? layout.yaxis2.title\n : typeof layout?.yaxis2?.title?.text === 'string'\n ? layout.yaxis2.title.text\n : undefined,\n secondaryYScaleOptions: {\n yMinValue,\n yMaxValue,\n },\n };\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): DonutChartProps => {\n const firstData = input.data[0] as PieData;\n\n const mapLegendToDataPoint: Record<string, ChartDataPoint> = {};\n firstData.labels?.forEach((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n //ToDo how to handle string data?\n const value = typeof firstData.values?.[index] === 'number' ? (firstData.values[index] as number) : 1;\n\n if (!mapLegendToDataPoint[label]) {\n mapLegendToDataPoint[label] = {\n legend: label,\n data: value,\n color,\n };\n } else {\n mapLegendToDataPoint[label].data! += value;\n }\n });\n\n const width: number = input.layout?.width ?? 440;\n const height: number = input.layout?.height ?? 220;\n const hideLabels: boolean = firstData.textinfo\n ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)\n : false;\n const donutMarginHorizontal: number = hideLabels ? 0 : 80;\n const donutMarginVertical: number = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n chartData: Object.values(mapLegendToDataPoint),\n },\n hideLegend: input.layout?.showlegend === false ? true : false,\n width: input.layout?.width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n fallbackVSBC?: boolean,\n): VerticalStackedBarChartProps => {\n const mapXToDataPoints: { [key: string]: VerticalStackedChartProps } = {};\n let yMaxValue = 0;\n const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);\n let yMinValue = 0;\n input.data.forEach((series: PlotData, index1: number) => {\n const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };\n }\n const legend: string = getLegend(series, index1);\n const yVal: number = (series.y?.[index2] as number) ?? 0;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: yVal,\n color,\n });\n yMaxValue = Math.max(yMaxValue, yVal);\n } else if (series.type === 'scatter' || !!fallbackVSBC) {\n const color = getColor(legend, colorMap, isDarkTheme);\n const lineOptions = getLineOptions(series.line);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: yVal,\n color,\n ...(lineOptions ? { lineOptions } : {}),\n useSecondaryYScale: usesSecondaryYScale(series),\n });\n if (!usesSecondaryYScale(series)) {\n yMaxValue = Math.max(yMaxValue, yVal);\n }\n }\n\n yMaxValue = Math.max(yMaxValue, yVal);\n yMinValue = Math.min(yMinValue, yVal);\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n yMaxValue,\n yMinValue,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n hideTickOverlap: true,\n barGapMax: 2,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GroupedVerticalBarChartProps => {\n const mapXToDataPoints: Record<string, GroupedVerticalBarChartData> = {};\n const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);\n input.data.forEach((series: PlotData, index1: number) => {\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = getLegend(series, index1);\n const color = getColor(legend, colorMap, isDarkTheme);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: (series.y?.[index2] as number) ?? 0,\n xAxisCalloutData: x as string,\n color,\n legend,\n useSecondaryYScale: usesSecondaryYScale(series),\n });\n }\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): VerticalBarChartProps => {\n const vbcData: VerticalBarChartDataPoint[] = [];\n\n input.data.forEach((series: Partial<PlotData>, seriesIdx: number) => {\n if (!series.x) {\n return;\n }\n\n const isXString = isStringArray(series.x);\n const xBins = createBins(series.x, series.xbins?.start, series.xbins?.end, series.xbins?.size);\n const yBins: number[][] = xBins.map(() => []);\n let total = 0;\n\n series.x.forEach((xVal, index) => {\n const binIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n if (binIdx !== -1) {\n yBins[binIdx].push((series.y?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const y = yBins.map(bin => {\n const yVal = calculateHistFunc(series.histfunc, bin);\n total += yVal;\n return yVal;\n });\n\n xBins.forEach((bin, index) => {\n const legend: string = getLegend(series, seriesIdx);\n const color: string = getColor(legend, colorMap, isDarkTheme);\n const yVal = calculateHistNorm(\n series.histnorm,\n y[index],\n total,\n isXString ? bin.length : getBinSize(bin as Bin<number, number>),\n );\n\n vbcData.push({\n x: isXString ? bin.join(', ') : getBinCenter(bin as Bin<number, number>),\n y: yVal,\n legend,\n color,\n ...(isXString\n ? {}\n : { xAxisCalloutData: `[${(bin as Bin<number, number>).x0} - ${(bin as Bin<number, number>).x1})` }),\n });\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: vbcData,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n input: PlotlySchema,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): LineChartProps | AreaChartProps => {\n const secondaryYAxisValues = getSecondaryYAxisValues(\n input.data,\n input.layout,\n isAreaChart ? 0 : undefined,\n isAreaChart ? 0 : undefined,\n );\n let mode: string = 'tonexty';\n const chartData: LineChartPoints[] = input.data.map((series: PlotData, index: number) => {\n const xValues = series.x as Datum[];\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend: string = getLegend(series, index);\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';\n const lineOptions = getLineOptions(series.line);\n\n return {\n legend,\n data: xValues.map((x, i: number) => ({\n x: isString ? (isXDate ? new Date(x as string) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n ...(Array.isArray(series.marker?.size)\n ? { markerSize: series.marker.size[i] }\n : typeof series.marker?.size === 'number'\n ? { markerSize: series.marker.size }\n : {}),\n })),\n color: lineColor,\n ...(lineOptions ? { lineOptions } : {}),\n useSecondaryYScale: usesSecondaryYScale(series),\n } as LineChartPoints;\n });\n\n const yMinMaxValues = findNumericMinMaxOfY(chartData);\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n const chartProps: ChartProps = {\n chartTitle,\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n ...secondaryYAxisValues,\n mode,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n useUTC: false,\n } as AreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n ...secondaryYAxisValues,\n roundedTicks: true,\n yMinValue: yMinMaxValues.startValue,\n yMaxValue: yMinMaxValues.endValue,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n useUTC: false,\n } as LineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): HorizontalBarChartWithAxisProps => {\n const chartData: HorizontalBarChartWithAxisDataPoint[] = input.data\n .map((series: PlotData, index: number) => {\n return (series.y as Datum[]).map((yValue: string, i: number) => {\n const legendName = series.name ?? yValue;\n const color = getColor(legendName, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: legendName,\n color,\n } as HorizontalBarChartWithAxisDataPoint;\n });\n })\n .flat()\n //reversing the order to invert the Y bars order as required by plotly.\n .reverse();\n\n const chartHeight: number = input.layout?.height ?? 450;\n const margin: number = input.layout?.margin?.l ?? 0;\n const padding: number = input.layout?.margin?.pad ?? 0;\n const availableHeight: number = chartHeight - margin - padding;\n const numberOfRows = new Set(chartData.map(d => d.y)).size || 1;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfRows);\n const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: chartData,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle:\n typeof input.layout?.yaxis2?.title === 'string'\n ? input.layout?.yaxis2?.title\n : input.layout?.yaxis2?.title?.text || '',\n barHeight,\n showYAxisLables: true,\n height: chartHeight,\n width: input.layout?.width,\n hideTickOverlap: true,\n noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: true,\n };\n};\n\nexport const transformPlotlyJsonToHeatmapProps = (input: PlotlySchema): HeatMapChartProps => {\n const firstData = input.data[0] as Partial<PlotData>;\n const heatmapDataPoints: HeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n if (firstData.type === 'histogram2d') {\n const isXString = isStringArray(firstData.x);\n const isYString = isStringArray(firstData.y);\n const xBins = createBins(firstData.x, firstData.xbins?.start, firstData.xbins?.end, firstData.xbins?.size);\n const yBins = createBins(firstData.y, firstData.ybins?.start, firstData.ybins?.end, firstData.ybins?.size);\n const zBins: number[][][] = yBins.map(() => xBins.map(() => []));\n let total = 0;\n\n firstData.x?.forEach((xVal, index) => {\n const xBinIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n const yBinIdx = findBinIndex(yBins, firstData.y?.[index] as string | number | null | undefined, isYString);\n\n if (xBinIdx !== -1 && yBinIdx !== -1) {\n zBins[yBinIdx][xBinIdx].push((firstData.z?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const z = zBins.map(row => {\n return row.map(bin => {\n const zVal = calculateHistFunc(firstData.histfunc, bin);\n total += zVal;\n return zVal;\n });\n });\n\n xBins.forEach((xBin, xIdx) => {\n yBins.forEach((yBin, yIdx) => {\n const zVal = calculateHistNorm(\n firstData.histnorm,\n z[yIdx][xIdx],\n total,\n isXString ? xBin.length : getBinSize(xBin as Bin<number, number>),\n isYString ? yBin.length : getBinSize(yBin as Bin<number, number>),\n );\n\n heatmapDataPoints.push({\n x: isXString ? xBin.join(', ') : getBinCenter(xBin as Bin<number, number>),\n y: isYString ? yBin.join(', ') : getBinCenter(yBin as Bin<number, number>),\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n } else {\n (firstData.x as Datum[])?.forEach((xVal, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = (firstData.z as number[][])?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: input.layout?.xaxis?.type === 'date' ? (xVal as Date) : xVal ?? 0,\n y: input.layout?.yaxis?.type === 'date' ? (yVal as Date) : yVal,\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n }\n\n const heatmapData: HeatMapChartData = {\n legend: firstData.name ?? '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Initialize domain and range to default values\n const defaultDomain = [zMin, (zMax + zMin) / 2, zMax];\n const defaultRange = [\n getColorFromToken(DataVizPalette.color1),\n getColorFromToken(DataVizPalette.color2),\n getColorFromToken(DataVizPalette.color3),\n ];\n const domainValuesForColorScale: number[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[0] * (zMax - zMin) + zMin)\n : defaultDomain;\n\n const rangeValuesForColorScale: string[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[1])\n : defaultRange;\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n showYAxisLables: true,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n sortOrder: 'none',\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): SankeyChartProps => {\n const { link, node } = input.data[0] as SankeyData;\n const validLinks = (link?.value ?? [])\n .map((val: number, index: number) => ({\n value: val,\n source: link?.source![index],\n target: link?.target![index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n // Filter out negative nodes, unequal nodes and self-references (circular links)\n .filter(x => x.source >= 0 && x.target >= 0 && x.source !== x.target);\n\n const sankeyChartData = {\n nodes: node.label?.map((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n } as SankeyChartData;\n\n // const styles: SankeyChartProps['styles'] = {\n // root: {\n // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n SankeyChartData: sankeyChartData,\n },\n width: input.layout?.width,\n height: input.layout?.height ?? 468,\n // TODO\n // styles,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GaugeChartProps => {\n const firstData = input.data[0] as PlotData;\n\n const segments = firstData.gauge?.steps?.length\n ? firstData.gauge.steps.map((step: any, index: number): GaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n })\n : [\n {\n legend: 'Current',\n size: firstData.value ?? 0 - (firstData.gauge?.axis?.range?.[0] ?? 0),\n color: getColor('Current', colorMap, isDarkTheme),\n },\n {\n legend: 'Target',\n size: (firstData.gauge?.axis?.range?.[1] ?? 100) - (firstData.value ?? 0),\n color: DataVizPalette.disabled,\n },\n ];\n\n let sublabel: string | undefined;\n // let sublabelColor: string | undefined;\n if (firstData.delta?.reference) {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n // const color = getColorFromToken(DataVizPalette.success, isDarkTheme);\n // sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n // const color = getColorFromToken(DataVizPalette.error, isDarkTheme);\n // sublabelColor = color;\n }\n }\n\n // const styles: GaugeChartProps['styles'] = {\n // sublabel: {\n // fill: sublabelColor,\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n segments,\n chartValue: firstData.value ?? 0,\n chartTitle,\n sublabel,\n // range values can be null\n minValue: typeof firstData.gauge?.axis?.range?.[0] === 'number' ? firstData.gauge?.axis?.range?.[0] : undefined,\n maxValue: typeof firstData.gauge?.axis?.range?.[1] === 'number' ? firstData.gauge?.axis?.range?.[1] : undefined,\n chartValueFormat: () => firstData.value?.toString() ?? '',\n width: input.layout?.width,\n height: input.layout?.height ?? 220,\n // TODO\n // styles,\n variant: firstData.gauge?.steps?.length ? 'multiple-segments' : 'single-segment',\n };\n};\n\nfunction isPlainObject(obj: any) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n\nfunction getLineOptions(line: Partial<ScatterLine> | undefined): LineChartLineOptions | undefined {\n if (!line) {\n return;\n }\n\n let lineOptions: LineChartLineOptions = {};\n if (line.dash) {\n lineOptions = { ...lineOptions, ...dashOptions[line.dash] };\n }\n\n switch (line.shape) {\n case 'spline':\n const smoothing = typeof line.smoothing === 'number' ? line.smoothing : 1;\n lineOptions.curve = d3CurveCardinal.tension(1 - smoothing / 1.3);\n break;\n case 'hv':\n lineOptions.curve = 'stepAfter';\n break;\n case 'vh':\n lineOptions.curve = 'stepBefore';\n break;\n case 'hvh':\n lineOptions.curve = 'step';\n break;\n default:\n lineOptions.curve = 'linear';\n }\n\n return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;\n}\n\nconst isStringArray = (arr: any) => {\n return isArrayOfType(arr, (value: any) => typeof value === 'string');\n};\n\n// TODO: Use binary search to find the appropriate bin for numeric value.\nconst findBinIndex = (\n bins: string[][] | Bin<number, number>[],\n value: string | number | null | undefined,\n isString: boolean,\n) => {\n if (typeof value === 'undefined' || value === null) {\n return -1;\n }\n\n return isString\n ? (bins as string[][]).findIndex(bin => bin.includes(value as string))\n : (bins as Bin<number, number>[]).findIndex(bin => (value as number) >= bin.x0! && (value as number) < bin.x1!);\n};\n\nconst getBinSize = (bin: Bin<number, number>) => {\n return bin.x1! - bin.x0!;\n};\n\nconst getBinCenter = (bin: Bin<number, number>) => {\n return (bin.x1! + bin.x0!) / 2;\n};\n\n// TODO: Add support for date axes\nconst createBins = (\n data: TypedArray | Datum[] | Datum[][] | undefined,\n binStart?: number | string,\n binEnd?: number | string,\n binSize?: number | string,\n) => {\n if (!data || data.length === 0) {\n return [];\n }\n\n if (isStringArray(data)) {\n const categories = Array.from(new Set(data as string[]));\n const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;\n const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;\n const step = typeof binSize === 'number' ? binSize : 1;\n\n return d3Range(start, stop, step).map(i => categories.slice(i, i + step));\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(data as number[]) as [number, number])\n .nice();\n let [minVal, maxVal] = scale.domain();\n\n minVal = typeof binStart === 'number' ? binStart : minVal;\n maxVal = typeof binEnd === 'number' ? binEnd : maxVal;\n\n const binGenerator = d3Bin().domain([minVal, maxVal]);\n\n if (typeof binSize === 'number') {\n const thresholds: number[] = [];\n let th = minVal;\n const tolerance = 1 / Math.pow(10, binSize.toString().split('.')[1]?.length ?? 0);\n\n while (maxVal + binSize - th > tolerance) {\n thresholds.push(th);\n th += binSize;\n }\n\n minVal = thresholds[0];\n maxVal = thresholds[thresholds.length - 1];\n binGenerator.domain([minVal, maxVal]).thresholds(thresholds);\n }\n\n // NOTE: The last bin generated by d3Bin often has identical x0 and x1 values (both inclusive) and\n // can be ignored if the highest value is already included in the previous bin.\n return binGenerator(data as number[]);\n};\n\nconst calculateHistFunc = (histfunc: PlotData['histfunc'] | undefined, bin: number[]) => {\n switch (histfunc) {\n case 'sum':\n return d3Sum(bin);\n case 'avg':\n return bin.length === 0 ? 0 : d3Sum(bin) / bin.length;\n case 'min':\n return d3Min(bin) ?? 0;\n case 'max':\n return d3Max(bin) ?? 0;\n default:\n return bin.length;\n }\n};\n\nconst calculateHistNorm = (\n histnorm: PlotData['histnorm'] | undefined,\n value: number,\n total: number,\n dx: number,\n dy: number = 1,\n) => {\n switch (histnorm) {\n case 'percent':\n return total === 0 ? 0 : (value / total) * 100;\n case 'probability':\n return total === 0 ? 0 : value / total;\n case 'density':\n return dx * dy === 0 ? 0 : value / (dx * dy);\n case 'probability density':\n return total * dx * dy === 0 ? 0 : value / (total * dx * dy);\n default:\n return value;\n }\n};\n"],"names":["React","bin","d3Bin","extent","d3Extent","sum","d3Sum","min","d3Min","max","d3Max","range","d3Range","scaleLinear","d3ScaleLinear","DataVizPalette","getColorFromToken","getNextColor","findNumericMinMaxOfY","isArrayOfType","isArrayOrTypedArray","isDate","isDateArray","isNumberArray","isYearArray","curveCardinal","d3CurveCardinal","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","getLegend","series","index","name","getTitles","layout","titles","chartTitle","title","text","xAxisTitle","xaxis","yAxisTitle","yaxis","correctYearMonth","xValues","presentYear","Date","getFullYear","length","Array","isArray","Error","dates","map","possiblyMonthValue","parsedDate","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","getColor","legendLabel","colorMap","isDarkTheme","current","has","nextColor","size","set","get","usesSecondaryYScale","getSecondaryYAxisValues","data","maxAllowedMinY","minAllowedMaxY","containsSecondaryYAxis","yMinValue","yMaxValue","forEach","yValues","y","Math","yaxis2","secondaryYAxistitle","undefined","secondaryYScaleOptions","transformPlotlyJsonToDonutProps","input","firstData","mapLegendToDataPoint","labels","label","color","value","values","legend","width","height","hideLabels","textinfo","includes","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","Object","hideLegend","showlegend","showLabelsInPercent","transformPlotlyJsonToVSBCProps","fallbackVSBC","mapXToDataPoints","secondaryYAxisValues","index1","isXYearCategory","x","index2","xAxisPoint","toString","lineData","yVal","type","push","lineOptions","getLineOptions","line","useSecondaryYScale","barWidth","mode","hideTickOverlap","barGapMax","transformPlotlyJsonToGVBCProps","key","xAxisCalloutData","transformPlotlyJsonToVBCProps","vbcData","seriesIdx","isXString","isStringArray","xBins","createBins","xbins","start","end","yBins","total","xVal","binIdx","findBinIndex","calculateHistFunc","histfunc","calculateHistNorm","histnorm","getBinSize","join","getBinCenter","x0","x1","transformPlotlyJsonToScatterChartProps","isAreaChart","isString","isXDate","isXNumber","lineColor","fill","parseFloat","marker","markerSize","yMinMaxValues","chartProps","lineChartData","supportNegativeData","useUTC","roundedTicks","startValue","endValue","transformPlotlyJsonToHorizontalBarWithAxisProps","yValue","legendName","flat","reverse","chartHeight","margin","l","padding","pad","availableHeight","numberOfRows","Set","d","scalingFactor","gapFactor","barHeight","showYAxisLables","noOfCharsToTruncate","showYAxisLablesTooltip","transformPlotlyJsonToHeatmapProps","heatmapDataPoints","zMin","Number","POSITIVE_INFINITY","zMax","NEGATIVE_INFINITY","isYString","ybins","zBins","xBinIdx","yBinIdx","z","row","zVal","xBin","xIdx","yBin","yIdx","rectText","heatmapData","defaultDomain","defaultRange","color1","color2","color3","domainValuesForColorScale","colorscale","arr","rangeValuesForColorScale","sortOrder","transformPlotlyJsonToSankeyProps","node","link","validLinks","val","source","target","filter","sankeyChartData","nodes","nodeId","links","validLink","SankeyChartData","transformPlotlyJsonToGaugeProps","segments","gauge","steps","step","axis","disabled","sublabel","delta","reference","diff","abs","chartValue","minValue","maxValue","chartValueFormat","variant","isPlainObject","obj","prototype","call","getPrototypeOf","hasOwnProperty","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","findArrayAttributes","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j","shape","smoothing","curve","tension","keys","bins","findIndex","binStart","binEnd","binSize","categories","from","ceil","stop","floor","slice","scale","domain","nice","minVal","maxVal","binGenerator","thresholds","th","tolerance","pow","split","dx","dy"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK;YACH,OAAOhK,QAAQ+J,KAAKC,OAAO,IAAI,IAAIrN,QAASqD,CAAAA,QAAQ+J,KAAKC,EAAC;QAC5D;YACE,OAAOrN;IACX;AACF"}
|
|
1
|
+
{"version":3,"sources":["PlotlySchemaAdapter.ts"],"sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport {\n bin as d3Bin,\n extent as d3Extent,\n sum as d3Sum,\n min as d3Min,\n max as d3Max,\n range as d3Range,\n Bin,\n} from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { DonutChartProps } from '../DonutChart/index';\nimport {\n ChartDataPoint,\n ChartProps,\n HorizontalBarChartWithAxisDataPoint,\n LineChartPoints,\n VerticalStackedChartProps,\n HeatMapChartData,\n HeatMapChartDataPoint,\n GroupedVerticalBarChartData,\n VerticalBarChartDataPoint,\n SankeyChartData,\n LineChartLineOptions,\n} from '../../types/DataPoint';\nimport { SankeyChartProps } from '../SankeyChart/index';\nimport { VerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { HorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { LineChartProps } from '../LineChart/index';\nimport { AreaChartProps } from '../AreaChart/index';\nimport { HeatMapChartProps } from '../HeatMapChart/index';\nimport { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';\nimport { GaugeChartProps, GaugeChartSegment } from '../GaugeChart/index';\nimport { GroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChartProps } from '../VerticalBarChart/index';\nimport { findNumericMinMaxOfY } from '../../utilities/utilities';\nimport type {\n Datum,\n Layout,\n PlotlySchema,\n PieData,\n PlotData,\n SankeyData,\n ScatterLine,\n TypedArray,\n Data,\n} from '@fluentui/chart-utilities';\nimport {\n isArrayOfType,\n isArrayOrTypedArray,\n isDate,\n isDateArray,\n isNumberArray,\n isYearArray,\n} from '@fluentui/chart-utilities';\nimport { curveCardinal as d3CurveCardinal } from 'd3-shape';\n\ninterface SecondaryYAxisValues {\n secondaryYAxistitle?: string;\n secondaryYScaleOptions?: { yMinValue?: number; yMaxValue?: number };\n}\n\nconst dashOptions = {\n dot: {\n strokeDasharray: '1, 5',\n strokeLinecap: 'round',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dash: {\n strokeDasharray: '5, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdash: {\n strokeDasharray: '10, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dashdot: {\n strokeDasharray: '5, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdashdot: {\n strokeDasharray: '10, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n solid: {\n strokeDasharray: '0',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n} as const;\n\nconst getLegend = (series: Partial<PlotData>, index: number): string => {\n return series.name || `Series ${index + 1}`;\n};\n\nfunction getTitles(layout: Partial<Layout> | undefined) {\n const titles = {\n chartTitle: typeof layout?.title === 'string' ? layout.title : layout?.title?.text ?? '',\n xAxisTitle: typeof layout?.xaxis?.title === 'string' ? layout?.xaxis?.title : layout?.xaxis?.title?.text ?? '',\n yAxisTitle: typeof layout?.yaxis?.title === 'string' ? layout?.yaxis?.title : layout?.yaxis?.title?.text ?? '',\n };\n return titles;\n}\n\nexport const correctYearMonth = (xValues: Datum[] | Datum[][] | TypedArray): any[] => {\n const presentYear = new Date().getFullYear();\n if (xValues.length > 0 && Array.isArray(xValues[0])) {\n throw new Error('updateXValues:: 2D array not supported');\n }\n const dates = (xValues as Datum[]).map(possiblyMonthValue => {\n const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;\n return isDate(parsedDate) ? new Date(parsedDate) : null;\n });\n for (let i = dates.length - 1; i > 0; i--) {\n const currentMonth = dates[i]!.getMonth();\n const previousMonth = dates[i - 1]!.getMonth();\n const currentYear = dates[i]!.getFullYear();\n const previousYear = dates[i - 1]!.getFullYear();\n if (previousMonth >= currentMonth) {\n dates[i - 1]!.setFullYear(dates[i]!.getFullYear() - 1);\n } else if (previousYear > currentYear) {\n dates[i - 1]!.setFullYear(currentYear);\n }\n }\n xValues = (xValues as Datum[]).map((month, index) => {\n return `${month} 01, ${dates[index]!.getFullYear()}`;\n });\n return xValues;\n};\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nconst usesSecondaryYScale = (series: Partial<PlotData>): boolean => {\n return series.yaxis === 'y2';\n};\n\nconst getSecondaryYAxisValues = (\n data: Data[],\n layout: Partial<Layout> | undefined,\n maxAllowedMinY?: number,\n minAllowedMaxY?: number,\n): SecondaryYAxisValues => {\n let containsSecondaryYAxis = false;\n let yMinValue: number | undefined;\n let yMaxValue: number | undefined;\n\n data.forEach((series: Partial<PlotData>) => {\n if (usesSecondaryYScale(series)) {\n containsSecondaryYAxis = true;\n const yValues = series.y as number[];\n if (yValues) {\n yMinValue = Math.min(...yValues);\n yMaxValue = Math.max(...yValues);\n }\n }\n });\n\n if (!containsSecondaryYAxis) {\n return {};\n }\n\n if (typeof yMinValue === 'number' && typeof maxAllowedMinY === 'number') {\n yMinValue = Math.min(yMinValue, maxAllowedMinY);\n }\n if (typeof yMaxValue === 'number' && typeof minAllowedMaxY === 'number') {\n yMaxValue = Math.max(yMaxValue, minAllowedMaxY);\n }\n if (layout?.yaxis2?.range) {\n yMinValue = layout.yaxis2.range[0];\n yMaxValue = layout.yaxis2.range[1];\n }\n\n return {\n secondaryYAxistitle:\n typeof layout?.yaxis2?.title === 'string'\n ? layout.yaxis2.title\n : typeof layout?.yaxis2?.title?.text === 'string'\n ? layout.yaxis2.title.text\n : undefined,\n secondaryYScaleOptions: {\n yMinValue,\n yMaxValue,\n },\n };\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): DonutChartProps => {\n const firstData = input.data[0] as PieData;\n\n const mapLegendToDataPoint: Record<string, ChartDataPoint> = {};\n firstData.labels?.forEach((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n //ToDo how to handle string data?\n const value = typeof firstData.values?.[index] === 'number' ? (firstData.values[index] as number) : 1;\n\n if (!mapLegendToDataPoint[label]) {\n mapLegendToDataPoint[label] = {\n legend: label,\n data: value,\n color,\n };\n } else {\n mapLegendToDataPoint[label].data! += value;\n }\n });\n\n const width: number = input.layout?.width ?? 440;\n const height: number = input.layout?.height ?? 220;\n const hideLabels: boolean = firstData.textinfo\n ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)\n : false;\n const donutMarginHorizontal: number = hideLabels ? 0 : 80;\n const donutMarginVertical: number = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n chartData: Object.values(mapLegendToDataPoint),\n },\n hideLegend: input.layout?.showlegend === false ? true : false,\n width: input.layout?.width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n fallbackVSBC?: boolean,\n): VerticalStackedBarChartProps => {\n const mapXToDataPoints: { [key: string]: VerticalStackedChartProps } = {};\n let yMaxValue = 0;\n const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);\n let yMinValue = 0;\n input.data.forEach((series: PlotData, index1: number) => {\n const isXYearCategory = isYearArray(series.x); // Consider year as categorical not numeric continuous axis\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: isXYearCategory ? x.toString() : x, chartData: [], lineData: [] };\n }\n const legend: string = getLegend(series, index1);\n const yVal: number = (series.y?.[index2] as number) ?? 0;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: yVal,\n color,\n });\n yMaxValue = Math.max(yMaxValue, yVal);\n } else if (series.type === 'scatter' || !!fallbackVSBC) {\n const color = getColor(legend, colorMap, isDarkTheme);\n const lineOptions = getLineOptions(series.line);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: yVal,\n color,\n ...(lineOptions ? { lineOptions } : {}),\n useSecondaryYScale: usesSecondaryYScale(series),\n });\n if (!usesSecondaryYScale(series)) {\n yMaxValue = Math.max(yMaxValue, yVal);\n }\n }\n\n yMaxValue = Math.max(yMaxValue, yVal);\n yMinValue = Math.min(yMinValue, yVal);\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n yMaxValue,\n yMinValue,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n hideTickOverlap: true,\n barGapMax: 2,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GroupedVerticalBarChartProps => {\n const mapXToDataPoints: Record<string, GroupedVerticalBarChartData> = {};\n const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);\n input.data.forEach((series: PlotData, index1: number) => {\n (series.x as Datum[])?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = getLegend(series, index1);\n const color = getColor(legend, colorMap, isDarkTheme);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: (series.y?.[index2] as number) ?? 0,\n xAxisCalloutData: x as string,\n color,\n legend,\n useSecondaryYScale: usesSecondaryYScale(series),\n });\n }\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: Object.values(mapXToDataPoints),\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n barWidth: 'auto',\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n ...secondaryYAxisValues,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): VerticalBarChartProps => {\n const vbcData: VerticalBarChartDataPoint[] = [];\n\n input.data.forEach((series: Partial<PlotData>, seriesIdx: number) => {\n if (!series.x) {\n return;\n }\n\n const isXString = isStringArray(series.x);\n const xBins = createBins(series.x, series.xbins?.start, series.xbins?.end, series.xbins?.size);\n const yBins: number[][] = xBins.map(() => []);\n let total = 0;\n\n series.x.forEach((xVal, index) => {\n const binIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n if (binIdx !== -1) {\n yBins[binIdx].push((series.y?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const y = yBins.map(bin => {\n const yVal = calculateHistFunc(series.histfunc, bin);\n total += yVal;\n return yVal;\n });\n\n xBins.forEach((bin, index) => {\n const legend: string = getLegend(series, seriesIdx);\n const color: string = getColor(legend, colorMap, isDarkTheme);\n const yVal = calculateHistNorm(\n series.histnorm,\n y[index],\n total,\n isXString ? bin.length : getBinSize(bin as Bin<number, number>),\n );\n\n vbcData.push({\n x: isXString ? bin.join(', ') : getBinCenter(bin as Bin<number, number>),\n y: yVal,\n legend,\n color,\n ...(isXString\n ? {}\n : { xAxisCalloutData: `[${(bin as Bin<number, number>).x0} - ${(bin as Bin<number, number>).x1})` }),\n });\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: vbcData,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n mode: 'plotly',\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n input: PlotlySchema,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): LineChartProps | AreaChartProps => {\n const secondaryYAxisValues = getSecondaryYAxisValues(\n input.data,\n input.layout,\n isAreaChart ? 0 : undefined,\n isAreaChart ? 0 : undefined,\n );\n let mode: string = 'tonexty';\n const chartData: LineChartPoints[] = input.data.map((series: PlotData, index: number) => {\n const xValues = series.x as Datum[];\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend: string = getLegend(series, index);\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';\n const lineOptions = getLineOptions(series.line);\n\n return {\n legend,\n data: xValues.map((x, i: number) => ({\n x: isString ? (isXDate ? new Date(x as string) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n ...(Array.isArray(series.marker?.size)\n ? { markerSize: series.marker.size[i] }\n : typeof series.marker?.size === 'number'\n ? { markerSize: series.marker.size }\n : {}),\n })),\n color: lineColor,\n ...(lineOptions ? { lineOptions } : {}),\n useSecondaryYScale: usesSecondaryYScale(series),\n } as LineChartPoints;\n });\n\n const yMinMaxValues = findNumericMinMaxOfY(chartData);\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n const chartProps: ChartProps = {\n chartTitle,\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n ...secondaryYAxisValues,\n mode,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n useUTC: false,\n } as AreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n ...secondaryYAxisValues,\n roundedTicks: true,\n yMinValue: yMinMaxValues.startValue,\n yMaxValue: yMinMaxValues.endValue,\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n useUTC: false,\n } as LineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): HorizontalBarChartWithAxisProps => {\n const chartData: HorizontalBarChartWithAxisDataPoint[] = input.data\n .map((series: PlotData, index: number) => {\n return (series.y as Datum[]).map((yValue: string, i: number) => {\n const legendName = series.name ?? yValue;\n const color = getColor(legendName, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: legendName,\n color,\n } as HorizontalBarChartWithAxisDataPoint;\n });\n })\n .flat()\n //reversing the order to invert the Y bars order as required by plotly.\n .reverse();\n\n const chartHeight: number = input.layout?.height ?? 450;\n const margin: number = input.layout?.margin?.l ?? 0;\n const padding: number = input.layout?.margin?.pad ?? 0;\n const availableHeight: number = chartHeight - margin - padding;\n const numberOfRows = new Set(chartData.map(d => d.y)).size || 1;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfRows);\n const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: chartData,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle:\n typeof input.layout?.yaxis2?.title === 'string'\n ? input.layout?.yaxis2?.title\n : input.layout?.yaxis2?.title?.text || '',\n barHeight,\n showYAxisLables: true,\n height: chartHeight,\n width: input.layout?.width,\n hideTickOverlap: true,\n noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: true,\n };\n};\n\nexport const transformPlotlyJsonToHeatmapProps = (input: PlotlySchema): HeatMapChartProps => {\n const firstData = input.data[0] as Partial<PlotData>;\n const heatmapDataPoints: HeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n if (firstData.type === 'histogram2d') {\n const isXString = isStringArray(firstData.x);\n const isYString = isStringArray(firstData.y);\n const xBins = createBins(firstData.x, firstData.xbins?.start, firstData.xbins?.end, firstData.xbins?.size);\n const yBins = createBins(firstData.y, firstData.ybins?.start, firstData.ybins?.end, firstData.ybins?.size);\n const zBins: number[][][] = yBins.map(() => xBins.map(() => []));\n let total = 0;\n\n firstData.x?.forEach((xVal, index) => {\n const xBinIdx = findBinIndex(xBins, xVal as string | number | null, isXString);\n const yBinIdx = findBinIndex(yBins, firstData.y?.[index] as string | number | null | undefined, isYString);\n\n if (xBinIdx !== -1 && yBinIdx !== -1) {\n zBins[yBinIdx][xBinIdx].push((firstData.z?.[index] as number | null | undefined) ?? 1);\n }\n });\n\n const z = zBins.map(row => {\n return row.map(bin => {\n const zVal = calculateHistFunc(firstData.histfunc, bin);\n total += zVal;\n return zVal;\n });\n });\n\n xBins.forEach((xBin, xIdx) => {\n yBins.forEach((yBin, yIdx) => {\n const zVal = calculateHistNorm(\n firstData.histnorm,\n z[yIdx][xIdx],\n total,\n isXString ? xBin.length : getBinSize(xBin as Bin<number, number>),\n isYString ? yBin.length : getBinSize(yBin as Bin<number, number>),\n );\n\n heatmapDataPoints.push({\n x: isXString ? xBin.join(', ') : getBinCenter(xBin as Bin<number, number>),\n y: isYString ? yBin.join(', ') : getBinCenter(yBin as Bin<number, number>),\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n } else {\n (firstData.x as Datum[])?.forEach((xVal, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = (firstData.z as number[][])?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: input.layout?.xaxis?.type === 'date' ? (xVal as Date) : xVal ?? 0,\n y: input.layout?.yaxis?.type === 'date' ? (yVal as Date) : yVal,\n value: zVal,\n rectText: zVal,\n });\n\n if (typeof zVal === 'number') {\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n }\n });\n });\n }\n\n const heatmapData: HeatMapChartData = {\n legend: firstData.name ?? '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Initialize domain and range to default values\n const defaultDomain = [zMin, (zMax + zMin) / 2, zMax];\n const defaultRange = [\n getColorFromToken(DataVizPalette.color1),\n getColorFromToken(DataVizPalette.color2),\n getColorFromToken(DataVizPalette.color3),\n ];\n const domainValuesForColorScale: number[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[0] * (zMax - zMin) + zMin)\n : defaultDomain;\n\n const rangeValuesForColorScale: string[] = Array.isArray(firstData.colorscale)\n ? (firstData.colorscale as Array<[number, string]>).map(arr => arr[1])\n : defaultRange;\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n showYAxisLables: true,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n sortOrder: 'none',\n width: input.layout?.width,\n height: input.layout?.height ?? 350,\n hideTickOverlap: true,\n noOfCharsToTruncate: 20,\n showYAxisLablesTooltip: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): SankeyChartProps => {\n const { link, node } = input.data[0] as SankeyData;\n const validLinks = (link?.value ?? [])\n .map((val: number, index: number) => ({\n value: val,\n source: link?.source![index],\n target: link?.target![index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n // Filter out negative nodes, unequal nodes and self-references (circular links)\n .filter(x => x.source >= 0 && x.target >= 0 && x.source !== x.target);\n\n const sankeyChartData = {\n nodes: node.label?.map((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n } as SankeyChartData;\n\n // const styles: SankeyChartProps['styles'] = {\n // root: {\n // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n SankeyChartData: sankeyChartData,\n },\n width: input.layout?.width,\n height: input.layout?.height ?? 468,\n // TODO\n // styles,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): GaugeChartProps => {\n const firstData = input.data[0] as PlotData;\n\n const segments = firstData.gauge?.steps?.length\n ? firstData.gauge.steps.map((step: any, index: number): GaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n })\n : [\n {\n legend: 'Current',\n size: firstData.value ?? 0 - (firstData.gauge?.axis?.range?.[0] ?? 0),\n color: getColor('Current', colorMap, isDarkTheme),\n },\n {\n legend: 'Target',\n size: (firstData.gauge?.axis?.range?.[1] ?? 100) - (firstData.value ?? 0),\n color: DataVizPalette.disabled,\n },\n ];\n\n let sublabel: string | undefined;\n // let sublabelColor: string | undefined;\n if (firstData.delta?.reference) {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n // const color = getColorFromToken(DataVizPalette.success, isDarkTheme);\n // sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n // const color = getColorFromToken(DataVizPalette.error, isDarkTheme);\n // sublabelColor = color;\n }\n }\n\n // const styles: GaugeChartProps['styles'] = {\n // sublabel: {\n // fill: sublabelColor,\n // },\n // };\n\n const { chartTitle } = getTitles(input.layout);\n\n return {\n segments,\n chartValue: firstData.value ?? 0,\n chartTitle,\n sublabel,\n // range values can be null\n minValue: typeof firstData.gauge?.axis?.range?.[0] === 'number' ? firstData.gauge?.axis?.range?.[0] : undefined,\n maxValue: typeof firstData.gauge?.axis?.range?.[1] === 'number' ? firstData.gauge?.axis?.range?.[1] : undefined,\n chartValueFormat: () => firstData.value?.toString() ?? '',\n width: input.layout?.width,\n height: input.layout?.height ?? 220,\n // TODO\n // styles,\n variant: firstData.gauge?.steps?.length ? 'multiple-segments' : 'single-segment',\n };\n};\n\nfunction isPlainObject(obj: any) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n\nfunction getLineOptions(line: Partial<ScatterLine> | undefined): LineChartLineOptions | undefined {\n if (!line) {\n return;\n }\n\n let lineOptions: LineChartLineOptions = {};\n if (line.dash) {\n lineOptions = { ...lineOptions, ...dashOptions[line.dash] };\n }\n\n switch (line.shape) {\n case 'spline':\n const smoothing = typeof line.smoothing === 'number' ? line.smoothing : 1;\n lineOptions.curve = d3CurveCardinal.tension(1 - smoothing / 1.3);\n break;\n case 'hv':\n lineOptions.curve = 'stepAfter';\n break;\n case 'vh':\n lineOptions.curve = 'stepBefore';\n break;\n case 'hvh':\n lineOptions.curve = 'step';\n break;\n default:\n lineOptions.curve = 'linear';\n }\n\n return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;\n}\n\nconst isStringArray = (arr: any) => {\n return isArrayOfType(arr, (value: any) => typeof value === 'string');\n};\n\n// TODO: Use binary search to find the appropriate bin for numeric value.\nconst findBinIndex = (\n bins: string[][] | Bin<number, number>[],\n value: string | number | null | undefined,\n isString: boolean,\n) => {\n if (typeof value === 'undefined' || value === null) {\n return -1;\n }\n\n return isString\n ? (bins as string[][]).findIndex(bin => bin.includes(value as string))\n : (bins as Bin<number, number>[]).findIndex(bin => (value as number) >= bin.x0! && (value as number) < bin.x1!);\n};\n\nconst getBinSize = (bin: Bin<number, number>) => {\n return bin.x1! - bin.x0!;\n};\n\nconst getBinCenter = (bin: Bin<number, number>) => {\n return (bin.x1! + bin.x0!) / 2;\n};\n\n// TODO: Add support for date axes\nconst createBins = (\n data: TypedArray | Datum[] | Datum[][] | undefined,\n binStart?: number | string,\n binEnd?: number | string,\n binSize?: number | string,\n) => {\n if (!data || data.length === 0) {\n return [];\n }\n\n if (isStringArray(data)) {\n const categories = Array.from(new Set(data as string[]));\n const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;\n const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;\n const step = typeof binSize === 'number' ? binSize : 1;\n\n return d3Range(start, stop, step).map(i => categories.slice(i, i + step));\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(data as number[]) as [number, number])\n .nice();\n let [minVal, maxVal] = scale.domain();\n\n minVal = typeof binStart === 'number' ? binStart : minVal;\n maxVal = typeof binEnd === 'number' ? binEnd : maxVal;\n\n const binGenerator = d3Bin().domain([minVal, maxVal]);\n\n if (typeof binSize === 'number') {\n const thresholds: number[] = [];\n let th = minVal;\n const tolerance = 1 / Math.pow(10, binSize.toString().split('.')[1]?.length ?? 0);\n\n while (maxVal + binSize - th > tolerance) {\n thresholds.push(th);\n th += binSize;\n }\n\n minVal = thresholds[0];\n maxVal = thresholds[thresholds.length - 1];\n binGenerator.domain([minVal, maxVal]).thresholds(thresholds);\n }\n\n // NOTE: The last bin generated by d3Bin often has identical x0 and x1 values (both inclusive) and\n // can be ignored if the highest value is already included in the previous bin.\n return binGenerator(data as number[]);\n};\n\nconst calculateHistFunc = (histfunc: PlotData['histfunc'] | undefined, bin: number[]) => {\n switch (histfunc) {\n case 'sum':\n return d3Sum(bin);\n case 'avg':\n return bin.length === 0 ? 0 : d3Sum(bin) / bin.length;\n case 'min':\n return d3Min(bin) ?? 0;\n case 'max':\n return d3Max(bin) ?? 0;\n default:\n return bin.length;\n }\n};\n\nconst calculateHistNorm = (\n histnorm: PlotData['histnorm'] | undefined,\n value: number,\n total: number,\n dx: number,\n dy: number = 1,\n) => {\n switch (histnorm) {\n case 'percent':\n return total === 0 ? 0 : (value / total) * 100;\n case 'probability':\n return total === 0 ? 0 : value / total;\n case 'density':\n return dx * dy === 0 ? 0 : value / (dx * dy);\n case 'probability density':\n return total * dx * dy === 0 ? 0 : value / (total * dx * dy);\n default:\n return value;\n }\n};\n"],"names":["React","bin","d3Bin","extent","d3Extent","sum","d3Sum","min","d3Min","max","d3Max","range","d3Range","scaleLinear","d3ScaleLinear","DataVizPalette","getColorFromToken","getNextColor","findNumericMinMaxOfY","isArrayOfType","isArrayOrTypedArray","isDate","isDateArray","isNumberArray","isYearArray","curveCardinal","d3CurveCardinal","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","getLegend","series","index","name","getTitles","layout","titles","chartTitle","title","text","xAxisTitle","xaxis","yAxisTitle","yaxis","correctYearMonth","xValues","presentYear","Date","getFullYear","length","Array","isArray","Error","dates","map","possiblyMonthValue","parsedDate","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","getColor","legendLabel","colorMap","isDarkTheme","current","has","nextColor","size","set","get","usesSecondaryYScale","getSecondaryYAxisValues","data","maxAllowedMinY","minAllowedMaxY","containsSecondaryYAxis","yMinValue","yMaxValue","forEach","yValues","y","Math","yaxis2","secondaryYAxistitle","undefined","secondaryYScaleOptions","transformPlotlyJsonToDonutProps","input","firstData","mapLegendToDataPoint","labels","label","color","value","values","legend","width","height","hideLabels","textinfo","includes","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","Object","hideLegend","showlegend","showLabelsInPercent","transformPlotlyJsonToVSBCProps","fallbackVSBC","mapXToDataPoints","secondaryYAxisValues","index1","isXYearCategory","x","index2","xAxisPoint","toString","lineData","yVal","type","push","lineOptions","getLineOptions","line","useSecondaryYScale","barWidth","mode","hideTickOverlap","barGapMax","transformPlotlyJsonToGVBCProps","key","xAxisCalloutData","transformPlotlyJsonToVBCProps","vbcData","seriesIdx","isXString","isStringArray","xBins","createBins","xbins","start","end","yBins","total","xVal","binIdx","findBinIndex","calculateHistFunc","histfunc","calculateHistNorm","histnorm","getBinSize","join","getBinCenter","x0","x1","transformPlotlyJsonToScatterChartProps","isAreaChart","isString","isXDate","isXNumber","lineColor","fill","parseFloat","marker","markerSize","yMinMaxValues","chartProps","lineChartData","supportNegativeData","useUTC","roundedTicks","startValue","endValue","transformPlotlyJsonToHorizontalBarWithAxisProps","yValue","legendName","flat","reverse","chartHeight","margin","l","padding","pad","availableHeight","numberOfRows","Set","d","scalingFactor","gapFactor","barHeight","showYAxisLables","noOfCharsToTruncate","showYAxisLablesTooltip","transformPlotlyJsonToHeatmapProps","heatmapDataPoints","zMin","Number","POSITIVE_INFINITY","zMax","NEGATIVE_INFINITY","isYString","ybins","zBins","xBinIdx","yBinIdx","z","row","zVal","xBin","xIdx","yBin","yIdx","rectText","heatmapData","defaultDomain","defaultRange","color1","color2","color3","domainValuesForColorScale","colorscale","arr","rangeValuesForColorScale","sortOrder","transformPlotlyJsonToSankeyProps","node","link","validLinks","val","source","target","filter","sankeyChartData","nodes","nodeId","links","validLink","SankeyChartData","transformPlotlyJsonToGaugeProps","segments","gauge","steps","step","axis","disabled","sublabel","delta","reference","diff","abs","chartValue","minValue","maxValue","chartValueFormat","variant","isPlainObject","obj","prototype","call","getPrototypeOf","hasOwnProperty","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","findArrayAttributes","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j","shape","smoothing","curve","tension","keys","bins","findIndex","binStart","binEnd","binSize","categories","from","ceil","stop","floor","slice","scale","domain","nice","minVal","maxVal","binGenerator","thresholds","th","tolerance","pow","split","dx","dy"],"mappings":"AAAA,0BAA0B,GAC1B,8BAA8B,GAC9B,yBAAyB,GACzB,qDAAqD,GACrD,YAAYA,WAAW,QAAQ;AAC/B,SACEC,OAAOC,KAAK,EACZC,UAAUC,QAAQ,EAClBC,OAAOC,KAAK,EACZC,OAAOC,KAAK,EACZC,OAAOC,KAAK,EACZC,SAASC,OAAO,QAEX,WAAW;AAClB,SAASC,eAAeC,aAAa,QAAQ,WAAW;AAqBxD,SAASC,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AAIzF,SAASC,oBAAoB,QAAQ,4BAA4B;AAYjE,SACEC,aAAa,EACbC,mBAAmB,EACnBC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,WAAW,QACN,4BAA4B;A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C/E,OAAOD,aAAanO;AACtB;AAEA,MAAM8E,oBAAoB,CAACC,UAA4CnK;IACrE,OAAQmK;QACN,KAAK;YACH,OAAO9J,MAAML;QACf,KAAK;YACH,OAAOA,IAAIwD,MAAM,KAAK,IAAI,IAAInD,MAAML,OAAOA,IAAIwD,MAAM;QACvD,KAAK;gBACIjD;YAAP,OAAOA,CAAAA,SAAAA,MAAMP,kBAANO,oBAAAA,SAAc;QACvB,KAAK;gBACIE;YAAP,OAAOA,CAAAA,SAAAA,MAAMT,kBAANS,oBAAAA,SAAc;QACvB;YACE,OAAOT,IAAIwD,MAAM;IACrB;AACF;AAEA,MAAM4G,oBAAoB,CACxBC,UACA5D,OACAqD,OACA+J,IACAC,KAAa,CAAC;IAEd,OAAQzJ;QACN,KAAK;YACH,OAAOP,UAAU,IAAI,IAAI,AAACrD,QAAQqD,QAAS;QAC7C,KAAK;YACH,OAAOA,UAAU,IAAI,IAAIrD,QAAQqD;QACnC,KAAK;YACH,OAAO+J,KAAKC,OAAO,IAAI,IAAIrN,QAASoN,CAAAA,KAAKC,EAAC;QAC5C,KAAK;YACH,OAAOhK,QAAQ+J,KAAKC,OAAO,IAAI,IAAIrN,QAASqD,CAAAA,QAAQ+J,KAAKC,EAAC;QAC5D;YACE,OAAOrN;IACX;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["imageExporter.ts"],"sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { resolveCSSVariables } from '../../utilities/index';\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface ImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\nexport function toImage(chartContainer?: HTMLElement | null, opts: ImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n if (!chartContainer) {\n return reject(new Error('Chart container is not defined'));\n }\n\n try {\n const background =\n typeof opts.background === 'string' ? resolveCSSVariables(chartContainer, opts.background) : 'transparent';\n const svg = toSVG(chartContainer, background);\n\n const svgData = new XMLSerializer().serializeToString(svg.node);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n\n svgToPng(svgDataUrl, {\n width: opts.width || svg.width,\n height: opts.height || svg.height,\n scale: opts.scale,\n })\n .then(resolve)\n .catch(reject);\n } catch (err) {\n return reject(err);\n }\n });\n}\n\nconst SVG_STYLE_PROPERTIES = ['display', 'fill', 'fill-opacity', 'opacity', 'stroke', 'stroke-width', 'transform'];\nconst SVG_TEXT_STYLE_PROPERTIES = ['font-family', 'font-size', 'font-weight', 'text-anchor'];\n\nfunction toSVG(chartContainer: HTMLElement, background: string) {\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n const clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n const svgElements = svg.getElementsByTagName('*');\n const clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n for (let i = 0; i < svgElements.length; i++) {\n if (svgElements[i].tagName.toLowerCase() === 'text') {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n const { width: svgWidth, height: svgHeight } = svg.getBoundingClientRect();\n const legendGroup = cloneLegendsToSVG(chartContainer, svgWidth, svgHeight);\n const w1 = Math.max(svgWidth, legendGroup.width);\n const h1 = svgHeight + legendGroup.height;\n\n if (legendGroup.node) {\n clonedSvg.append(() => legendGroup.node);\n }\n clonedSvg\n .insert('rect', ':first-child')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', w1)\n .attr('height', h1)\n .attr('fill', background);\n clonedSvg.attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n\n return {\n node: clonedSvg.node()!,\n width: w1,\n height: h1,\n };\n}\n\nconst LEGEND_RECT_STYLE_PROPERTIES_MAP = {\n 'background-color': 'fill',\n 'border-color': 'stroke',\n};\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n opacity: 'opacity',\n};\n\nfunction cloneLegendsToSVG(chartContainer: HTMLElement, svgWidth: number, svgHeight: number) {\n const legendButtons = chartContainer.querySelectorAll<HTMLElement>(`\n button.fui-legend__legend:not([data-overflowing]),\n .fui-donut__legendContainer button.fui-MenuButton,\n .fui-cart__legendContainer button.fui-MenuButton\n `);\n if (legendButtons.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = 0;\n let legendY = 8;\n let legendLine: Selection<SVGGElement, unknown, null, undefined>[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n\n for (let i = 0; i < legendButtons.length; i++) {\n const { width: legendWidth } = legendButtons[i].getBoundingClientRect();\n const legendItem = legendGroup.append('g');\n\n legendLine.push(legendItem);\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [legendItem];\n legendX = 0;\n legendY += 32;\n }\n\n let legendText: HTMLDivElement | HTMLButtonElement | null;\n let textOffset = 0;\n\n if (!legendButtons[i].hasAttribute('data-overflow-menu')) {\n const legendRect = legendButtons[i].querySelector<HTMLDivElement>('.fui-legend__rect');\n\n legendText = legendButtons[i].querySelector<HTMLDivElement>('.fui-legend__text');\n legendItem\n .append('rect')\n .attr('x', legendX + 8)\n .attr('y', svgHeight + legendY + 8)\n .attr('width', 12)\n .attr('height', 12)\n .attr('stroke-width', 1)\n .call(selection => copyStyle(LEGEND_RECT_STYLE_PROPERTIES_MAP, legendRect!, selection.node()!));\n textOffset = 28;\n } else {\n legendText = legendButtons[i] as HTMLButtonElement;\n console.log(legendText!.textContent);\n textOffset = 8;\n }\n\n legendItem\n .append('text')\n .attr('x', legendX + textOffset)\n .attr('y', svgHeight + legendY + 8)\n .attr('dominant-baseline', 'hanging')\n .text(legendText!.textContent)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText!, selection.node()!));\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += 32;\n\n const centerLegends = true;\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const offsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n ln.forEach(item => {\n item.attr('transform', `translate(${offsetX}, 0)`);\n });\n });\n }\n\n return {\n node: legendGroup.node(),\n width: Math.max(...legendLineWidths),\n height: legendY,\n };\n}\n\nfunction svgToPng(svgDataUrl: string, opts: ImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n const scale = opts.scale || 1;\n const w0 = opts.width || 300;\n const h0 = opts.height || 150;\n const w1 = scale * w0;\n const h1 = scale * h0;\n\n const canvas = document.createElement('canvas');\n const img = new Image();\n\n canvas.width = w1;\n canvas.height = h1;\n\n img.onload = function () {\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return reject(new Error('Canvas context is null'));\n }\n\n ctx.clearRect(0, 0, w1, h1);\n ctx.drawImage(img, 0, 0, w1, h1);\n\n const imgData = canvas.toDataURL('image/png');\n resolve(imgData);\n };\n\n img.onerror = function (err) {\n reject(err);\n };\n\n img.src = svgDataUrl;\n });\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n\nfunction copyStyle(properties: string[] | Record<string, string>, fromEl: Element, toEl: Element) {\n const styles = getComputedStyle(fromEl);\n if (Array.isArray(properties)) {\n properties.forEach(prop => {\n d3Select(toEl).style(prop, styles.getPropertyValue(prop));\n });\n } else {\n Object.entries(properties).forEach(([fromProp, toProp]) => {\n d3Select(toEl).style(toProp, styles.getPropertyValue(fromProp));\n });\n }\n}\n"],"names":["create","d3Create","select","d3Select","resolveCSSVariables","toImage","chartContainer","opts","Promise","resolve","reject","Error","background","svg","toSVG","svgData","XMLSerializer","serializeToString","node","svgDataUrl","btoa","unescapePonyfill","encodeURIComponent","svgToPng","width","height","scale","then","catch","err","SVG_STYLE_PROPERTIES","SVG_TEXT_STYLE_PROPERTIES","querySelector","clonedSvg","cloneNode","attr","svgElements","getElementsByTagName","clonedSvgElements","i","length","tagName","toLowerCase","copyStyle","svgWidth","svgHeight","getBoundingClientRect","legendGroup","cloneLegendsToSVG","w1","Math","max","h1","append","insert","LEGEND_RECT_STYLE_PROPERTIES_MAP","LEGEND_TEXT_STYLE_PROPERTIES_MAP","color","opacity","legendButtons","querySelectorAll","legendX","legendY","legendLine","legendLines","legendLineWidths","legendWidth","legendItem","push","pop","legendText","textOffset","hasAttribute","legendRect","call","selection","console","log","textContent","text","centerLegends","forEach","ln","idx","offsetX","item","w0","h0","canvas","document","createElement","img","Image","onload","ctx","getContext","clearRect","drawImage","imgData","toDataURL","onerror","src","hex2","hex4","str","result","index","chr","part","charAt","slice","exec","String","fromCharCode","parseInt","properties","fromEl","toEl","styles","getComputedStyle","Array","isArray","prop","style","getPropertyValue","Object","entries","fromProp","toProp"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAUC,QAAQ,EAAEC,UAAUC,QAAQ,QAAmB,eAAe;AACjF,SAASC,mBAAmB,QAAQ,wBAAwB;AAY5D,OAAO,SAASC,QAAQC,cAAmC,EAAEC,OAA2B,CAAC,CAAC;IACxF,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3B,IAAI,CAACJ,gBAAgB;YACnB,OAAOI,OAAO,IAAIC,MAAM;QAC1B;QAEA,IAAI;YACF,MAAMC,aACJ,OAAOL,KAAKK,UAAU,KAAK,WAAWR,oBAAoBE,gBAAgBC,KAAKK,UAAU,IAAI;YAC/F,MAAMC,MAAMC,MAAMR,gBAAgBM;YAElC,MAAMG,UAAU,IAAIC,gBAAgBC,iBAAiB,CAACJ,IAAIK,IAAI;YAC9D,MAAMC,aAAa,+BAA+BC,KAAKC,iBAAiBC,mBAAmBP;YAE3FQ,SAASJ,YAAY;gBACnBK,OAAOjB,KAAKiB,KAAK,IAAIX,IAAIW,KAAK;gBAC9BC,QAAQlB,KAAKkB,MAAM,IAAIZ,IAAIY,MAAM;gBACjCC,OAAOnB,KAAKmB,KAAK;YACnB,GACGC,IAAI,CAAClB,SACLmB,KAAK,CAAClB;QACX,EAAE,OAAOmB,KAAK;YACZ,OAAOnB,OAAOmB;QAChB;IACF;AACF;AAEA,MAAMC,uBAAuB;IAAC;IAAW;IAAQ;IAAgB;IAAW;IAAU;IAAgB;CAAY;AAClH,MAAMC,4BAA4B;I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I,CAACH,OAAO;oBACnBH,UAAUO,OAAOC,YAAY,CAACC,SAASN,MAAM;oBAC7CF,SAAS;oBACT;gBACF;YACF,OAAO;gBACLE,OAAOJ,IAAIM,KAAK,CAACJ,OAAOA,QAAQ;gBAChC,IAAIJ,KAAKS,IAAI,CAACH,OAAO;oBACnBH,UAAUO,OAAOC,YAAY,CAACC,SAASN,MAAM;oBAC7CF,SAAS;oBACT;gBACF;YACF;QACF;QACAD,UAAUE;IACZ;IACA,OAAOF;AACT;AAEA,SAAS9D,UAAUwE,UAA6C,EAAEC,MAAe,EAAEC,IAAa;IAC9F,MAAMC,SAASC,iBAAiBH;IAChC,IAAII,MAAMC,OAAO,CAACN,aAAa;QAC7BA,WAAWlC,OAAO,CAACyC,CAAAA;YACjBvH,SAASkH,MAAMM,KAAK,CAACD,MAAMJ,OAAOM,gBAAgB,CAACF;QACrD;IACF,OAAO;QACLG,OAAOC,OAAO,CAACX,YAAYlC,OAAO,CAAC,CAAC,CAAC8C,UAAUC,OAAO;YACpD7H,SAASkH,MAAMM,KAAK,CAACK,QAAQV,OAAOM,gBAAgB,CAACG;QACvD;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["imageExporter.ts"],"sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { resolveCSSVariables } from '../../utilities/index';\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface ImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\nexport function toImage(chartContainer?: HTMLElement | null, opts: ImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n if (!chartContainer) {\n return reject(new Error('Chart container is not defined'));\n }\n\n try {\n const background =\n typeof opts.background === 'string' ? resolveCSSVariables(chartContainer, opts.background) : 'transparent';\n const svg = toSVG(chartContainer, background);\n\n const svgData = new XMLSerializer().serializeToString(svg.node);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n\n svgToPng(svgDataUrl, {\n width: opts.width || svg.width,\n height: opts.height || svg.height,\n scale: opts.scale,\n })\n .then(resolve)\n .catch(reject);\n } catch (err) {\n return reject(err);\n }\n });\n}\n\nconst SVG_STYLE_PROPERTIES = ['display', 'fill', 'fill-opacity', 'opacity', 'stroke', 'stroke-width', 'transform'];\nconst SVG_TEXT_STYLE_PROPERTIES = ['font-family', 'font-size', 'font-weight', 'text-anchor'];\n\nfunction toSVG(chartContainer: HTMLElement, background: string) {\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n const clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n const svgElements = svg.getElementsByTagName('*');\n const clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n for (let i = 0; i < svgElements.length; i++) {\n if (svgElements[i].tagName.toLowerCase() === 'text') {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n const { width: svgWidth, height: svgHeight } = svg.getBoundingClientRect();\n const legendGroup = cloneLegendsToSVG(chartContainer, svgWidth, svgHeight);\n const w1 = Math.max(svgWidth, legendGroup.width);\n const h1 = svgHeight + legendGroup.height;\n\n if (legendGroup.node) {\n clonedSvg.append(() => legendGroup.node);\n }\n clonedSvg\n .insert('rect', ':first-child')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', w1)\n .attr('height', h1)\n .attr('fill', background);\n clonedSvg.attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n\n return {\n node: clonedSvg.node()!,\n width: w1,\n height: h1,\n };\n}\n\nconst LEGEND_RECT_STYLE_PROPERTIES_MAP = {\n 'background-color': 'fill',\n 'border-color': 'stroke',\n};\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n opacity: 'opacity',\n};\n\nfunction cloneLegendsToSVG(chartContainer: HTMLElement, svgWidth: number, svgHeight: number) {\n const legendButtons = chartContainer.querySelectorAll<HTMLElement>(`\n button.fui-legend__legend:not([data-overflowing]),\n .fui-donut__legendContainer button.fui-MenuButton,\n .fui-cart__legendContainer button.fui-MenuButton\n `);\n if (legendButtons.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = 0;\n let legendY = 8;\n let legendLine: Selection<SVGGElement, unknown, null, undefined>[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n\n for (let i = 0; i < legendButtons.length; i++) {\n const { width: legendWidth } = legendButtons[i].getBoundingClientRect();\n const legendItem = legendGroup.append('g');\n\n legendLine.push(legendItem);\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [legendItem];\n legendX = 0;\n legendY += 32;\n }\n\n let legendText: HTMLDivElement | HTMLButtonElement | null;\n let textOffset = 0;\n\n if (!legendButtons[i].hasAttribute('data-overflow-menu')) {\n const legendRect = legendButtons[i].querySelector<HTMLDivElement>('.fui-legend__rect');\n\n legendText = legendButtons[i].querySelector<HTMLDivElement>('.fui-legend__text');\n legendItem\n .append('rect')\n .attr('x', legendX + 8)\n .attr('y', svgHeight + legendY + 8)\n .attr('width', 12)\n .attr('height', 12)\n .attr('stroke-width', 1)\n .call(selection => copyStyle(LEGEND_RECT_STYLE_PROPERTIES_MAP, legendRect!, selection.node()!));\n textOffset = 28;\n } else {\n legendText = legendButtons[i] as HTMLButtonElement;\n console.log(legendText!.textContent);\n textOffset = 8;\n }\n\n legendItem\n .append('text')\n .attr('x', legendX + textOffset)\n .attr('y', svgHeight + legendY + 8)\n .attr('dominant-baseline', 'hanging')\n .text(legendText!.textContent)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText!, selection.node()!));\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += 32;\n\n const centerLegends = true;\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const offsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n ln.forEach(item => {\n item.attr('transform', `translate(${offsetX}, 0)`);\n });\n });\n }\n\n return {\n node: legendGroup.node(),\n width: Math.max(...legendLineWidths),\n height: legendY,\n };\n}\n\nfunction svgToPng(svgDataUrl: string, opts: ImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n const scale = opts.scale || 1;\n const w0 = opts.width || 300;\n const h0 = opts.height || 150;\n const w1 = scale * w0;\n const h1 = scale * h0;\n\n const canvas = document.createElement('canvas');\n const img = new Image();\n\n canvas.width = w1;\n canvas.height = h1;\n\n img.onload = function () {\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return reject(new Error('Canvas context is null'));\n }\n\n ctx.clearRect(0, 0, w1, h1);\n ctx.drawImage(img, 0, 0, w1, h1);\n\n const imgData = canvas.toDataURL('image/png');\n resolve(imgData);\n };\n\n img.onerror = function (err) {\n reject(err);\n };\n\n img.src = svgDataUrl;\n });\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n\nfunction copyStyle(properties: string[] | Record<string, string>, fromEl: Element, toEl: Element) {\n const styles = getComputedStyle(fromEl);\n if (Array.isArray(properties)) {\n properties.forEach(prop => {\n d3Select(toEl).style(prop, styles.getPropertyValue(prop));\n });\n } else {\n Object.entries(properties).forEach(([fromProp, toProp]) => {\n d3Select(toEl).style(toProp, styles.getPropertyValue(fromProp));\n });\n }\n}\n"],"names":["create","d3Create","select","d3Select","resolveCSSVariables","toImage","chartContainer","opts","Promise","resolve","reject","Error","background","svg","toSVG","svgData","XMLSerializer","serializeToString","node","svgDataUrl","btoa","unescapePonyfill","encodeURIComponent","svgToPng","width","height","scale","then","catch","err","SVG_STYLE_PROPERTIES","SVG_TEXT_STYLE_PROPERTIES","querySelector","clonedSvg","cloneNode","attr","svgElements","getElementsByTagName","clonedSvgElements","i","length","tagName","toLowerCase","copyStyle","svgWidth","svgHeight","getBoundingClientRect","legendGroup","cloneLegendsToSVG","w1","Math","max","h1","append","insert","LEGEND_RECT_STYLE_PROPERTIES_MAP","LEGEND_TEXT_STYLE_PROPERTIES_MAP","color","opacity","legendButtons","querySelectorAll","legendX","legendY","legendLine","legendLines","legendLineWidths","legendWidth","legendItem","push","pop","legendText","textOffset","hasAttribute","legendRect","call","selection","console","log","textContent","text","centerLegends","forEach","ln","idx","offsetX","item","w0","h0","canvas","document","createElement","img","Image","onload","ctx","getContext","clearRect","drawImage","imgData","toDataURL","onerror","src","hex2","hex4","str","result","index","chr","part","charAt","slice","exec","String","fromCharCode","parseInt","properties","fromEl","toEl","styles","getComputedStyle","Array","isArray","prop","style","getPropertyValue","Object","entries","fromProp","toProp"],"mappings":"AAAA,SAASA,UAAUC,QAAQ,EAAEC,UAAUC,QAAQ,QAA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;IAChC,IAAII,MAAMC,OAAO,CAACN,aAAa;QAC7BA,WAAWlC,OAAO,CAACyC,CAAAA;YACjBvH,SAASkH,MAAMM,KAAK,CAACD,MAAMJ,OAAOM,gBAAgB,CAACF;QACrD;IACF,OAAO;QACLG,OAAOC,OAAO,CAACX,YAAYlC,OAAO,CAAC,CAAC,CAAC8C,UAAUC,OAAO;YACpD7H,SAASkH,MAAMM,KAAK,CAACK,QAAQV,OAAOM,gBAAgB,CAACG;QACvD;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './DeclarativeChart';\nexport type { ImageExportOptions } from './imageExporter';\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './DeclarativeChart';\nexport type { ImageExportOptions } from './imageExporter';\n"],"names":[],"mappings":"AAAA,cAAc,qBAAqB"}
|
|
@@ -18,8 +18,8 @@ import { formatScientificLimitWidth, useRtl } from '../../../utilities/index';
|
|
|
18
18
|
}, [
|
|
19
19
|
props
|
|
20
20
|
]);
|
|
21
|
-
function _onFocus(data, id) {
|
|
22
|
-
props.onFocusCallback(data, id, currentRef.current);
|
|
21
|
+
function _onFocus(data, id, event) {
|
|
22
|
+
props.onFocusCallback(data, id, event, currentRef.current);
|
|
23
23
|
}
|
|
24
24
|
function _hoverOn(data, mouseEvent) {
|
|
25
25
|
mouseEvent.persist();
|
|
@@ -101,10 +101,10 @@ import { formatScientificLimitWidth, useRtl } from '../../../utilities/index';
|
|
|
101
101
|
fill: props.color,
|
|
102
102
|
cursor: href ? 'pointer' : 'default'
|
|
103
103
|
},
|
|
104
|
-
onFocus: _onFocus
|
|
104
|
+
onFocus: (event)=>_onFocus(props.data.data, id, event),
|
|
105
105
|
"data-is-focusable": props.activeArc === props.data.data.legend || props.activeArc === '',
|
|
106
|
-
onMouseOver: _hoverOn
|
|
107
|
-
onMouseMove: _hoverOn
|
|
106
|
+
onMouseOver: (event)=>_hoverOn(props.data.data, event),
|
|
107
|
+
onMouseMove: (event)=>_hoverOn(props.data.data, event),
|
|
108
108
|
onMouseLeave: _hoverOff,
|
|
109
109
|
tabIndex: _shouldHighlightArc(props.data.data.legend) ? 0 : undefined,
|
|
110
110
|
onBlur: _onBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatScientificLimitWidth, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string): void {\n props.onFocusCallback!(data, id, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _shouldHighlightArc(legend?: string): boolean {\n const { activeArc } = props;\n // If no activeArc is provided, highlight all arcs. Otherwise, only highlight the arcs that are active.\n return !activeArc || activeArc.length === 0 || legend === undefined || activeArc.includes(legend);\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatScientificLimitWidth(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id =\n props.uniqText! +\n (typeof props.data!.data.legend === 'string' ? props.data!.data.legend.replace(/\\s+/g, '') : '') +\n props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n const cornerRadius = props.roundCorners ? 3 : 0;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={_onFocus.bind(this, props.data!.data, id)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={_hoverOn.bind(this, props.data!.data)}\n onMouseMove={_hoverOn.bind(this, props.data!.data)}\n onMouseLeave={_hoverOff}\n tabIndex={_shouldHighlightArc(props.data!.data.legend!) ? 0 : undefined}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["React","arc","d3Arc","useArcStyles","format","d3Format","formatScientificLimitWidth","useRtl","Arc","forwardRef","props","forwardedRef","currentRef","createRef","_isRTL","classes","useEffect","_updateChart","_onFocus","data","id","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_shouldHighlightArc","activeArc","length","undefined","includes","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","text","x","y","textAnchor","dominantBaseline","aria-hidden","newProps","href","focusedArcId","uniqText","replace","opacity","cornerRadius","roundCorners","g","ref","path","d","focusRing","root","style","fill","color","cursor","onFocus","bind","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","tabIndex","onBlur","onClick","aria-label","role","arcLabel","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ChC;QAEFF,WAAW9B,QAAQsE,IAAI;QACvBC,OAAO;YAAEC,MAAM7E,MAAM8E,KAAK;YAAEC,QAAQhB,OAAO,YAAY;QAAU;QACjEiB,SAASxE,SAASyE,IAAI,CAAC,IAAI,EAAEjF,MAAMS,IAAI,CAAEA,IAAI,EAAEC;QAC/CwE,qBAAmBlF,MAAM8B,SAAS,KAAK9B,MAAMS,IAAI,CAAEA,IAAI,CAACc,MAAM,IAAIvB,MAAM8B,SAAS,KAAK;QACtFqD,aAAatE,SAASoE,IAAI,CAAC,IAAI,EAAEjF,MAAMS,IAAI,CAAEA,IAAI;QACjD2E,aAAavE,SAASoE,IAAI,CAAC,IAAI,EAAEjF,MAAMS,IAAI,CAAEA,IAAI;QACjD4E,cAAcpE;QACdqE,UAAUzD,oBAAoB7B,MAAMS,IAAI,CAAEA,IAAI,CAACc,MAAM,IAAK,IAAIS;QAC9DuD,QAAQpE;QACRgD,SAASA;QACTqB,OAAO,GAAExF,cAAAA,MAAMS,IAAI,cAAVT,kCAAAA,YAAYS,IAAI,CAAC+E,OAAO;QACjCC,cAAYpE;QACZqE,MAAK;QAENxD,gBAAgB7B,QAAQsF,QAAQ;AAGvC,GACA;AACF7F,IAAI8F,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatScientificLimitWidth, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string, event: React.FocusEvent<SVGPathElement, Element>): void {\n props.onFocusCallback!(data, id, event, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _shouldHighlightArc(legend?: string): boolean {\n const { activeArc } = props;\n // If no activeArc is provided, highlight all arcs. Otherwise, only highlight the arcs that are active.\n return !activeArc || activeArc.length === 0 || legend === undefined || activeArc.includes(legend);\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatScientificLimitWidth(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id =\n props.uniqText! +\n (typeof props.data!.data.legend === 'string' ? props.data!.data.legend.replace(/\\s+/g, '') : '') +\n props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n const cornerRadius = props.roundCorners ? 3 : 0;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={event => _onFocus(props.data!.data, id, event)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={event => _hoverOn(props.data!.data, event)}\n onMouseMove={event => _hoverOn(props.data!.data, event)}\n onMouseLeave={_hoverOff}\n tabIndex={_shouldHighlightArc(props.data!.data.legend!) ? 0 : undefined}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["React","arc","d3Arc","useArcStyles","format","d3Format","formatScientificLimitWidth","useRtl","Arc","forwardRef","props","forwardedRef","currentRef","createRef","_isRTL","classes","useEffect","_updateChart","_onFocus","data","id","event","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_shouldHighlightArc","activeArc","length","undefined","includes","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","text","x","y","textAnchor","dominantBaseline","aria-hidden","newProps","href","focusedArcId","uniqText","replace","opacity","cornerRadius","roundCorners","g","ref","path","d","focusRing","root","style","fill","color","cursor","onFocus","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","tabIndex","onBlur","onClick","aria-label","role","arcLabel","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AACxC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,0BAA0B,EAAEC,MAAM,QAAQ,2BAA2B;AAE9E,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,oBAAyCR,MAAMS,UAAU,CACpE,CAACC,OAAOC;QA4HSD;IA3Hf,MAAMT,MAAMC;IACZ,MAAMU,2BAAaZ,MAAMa,SAAS;IAClC,MAAMC,SAAkBP;IACxB,MAAMQ,UAAUZ,aAAaO;IAE7BV,MAAMgB,SAAS,CAAC;QACdC,aAAaP;IACf,GAAG;QAACA;KAAM;IAEV,SAASQ,SAASC,IAAoB,EAAEC,EAAU,EAAEC,KAAgD;QAClGX,MAAMY,eAAe,CAAEH,MAAMC,IAAIC,OAAOT,WAAWW,OAAO;IAC5D;IAEA,SAASC,SAASL,IAAoB,EAAEM,UAA4C;QAClFA,WAAWC,OAAO;QAClBhB,MAAMiB,eAAe,CAAER,MAAMM;IAC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
1
|
-
{"version":3,"sources":["Arc.types.ts"],"sourcesContent":["import { ChartDataPoint } from '../index';\nexport interface ArcProps {\n /**\n * Data to render in the Arc.\n */\n data?: ArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: ArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: ArcStyles;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n}\n\nexport interface ArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: ChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface ArcStyles {\n /**\n * Style set for the card header component root\n */\n root: string;\n\n /**\n * styles for the focus\n */\n focusRing: string;\n\n /**\n * Style for the arc labels\n */\n arcLabel: string;\n}\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["Arc.types.ts"],"sourcesContent":["import { ChartDataPoint } from '../index';\nexport interface ArcProps {\n /**\n * Data to render in the Arc.\n */\n data?: ArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: ArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: ArcStyles;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n}\n\nexport interface ArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: ChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface ArcStyles {\n /**\n * Style set for the card header component root\n */\n root: string;\n\n /**\n * styles for the focus\n */\n focusRing: string;\n\n /**\n * Style for the arc labels\n */\n arcLabel: string;\n}\n"],"names":[],"mappings":"AA6IA,WAeC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Arc';\nexport * from './Arc.types';\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Arc';\nexport * from './Arc.types';\n"],"names":[],"mappings":"AAAA,cAAc,QAAQ;AACtB,cAAc,cAAc"}
|
|
@@ -99,7 +99,13 @@ const MIN_LEGEND_CONTAINER_HEIGHT = 40;
|
|
|
99
99
|
});
|
|
100
100
|
return legends;
|
|
101
101
|
}
|
|
102
|
-
function _focusCallback(data, id,
|
|
102
|
+
function _focusCallback(data, id, e) {
|
|
103
|
+
let cx = 0;
|
|
104
|
+
let cy = 0;
|
|
105
|
+
const targetRect = e.target.getBoundingClientRect();
|
|
106
|
+
cx = targetRect.left + targetRect.width / 2;
|
|
107
|
+
cy = targetRect.top + targetRect.height / 2;
|
|
108
|
+
updatePosition(cx, cy);
|
|
103
109
|
setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);
|
|
104
110
|
setValue(data.data.toString());
|
|
105
111
|
setLegend(data.legend);
|