@fluentui/react-charts 1.2.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +177 -15
- package/LICENSE +11 -17
- package/README.md +174 -23
- package/dist/index.d.ts +2143 -0
- package/lib/CartesianChart.js +1 -0
- package/lib/CartesianChart.js.map +1 -0
- package/lib/DeclarativeChart.js +1 -0
- package/lib/DeclarativeChart.js.map +1 -0
- package/lib/DonutChart.js +1 -0
- package/lib/DonutChart.js.map +1 -0
- package/lib/HorizontalBarChart.js +1 -0
- package/lib/HorizontalBarChart.js.map +1 -0
- package/lib/Legends.js +1 -0
- package/lib/Legends.js.map +1 -0
- package/lib/LineChart.js +1 -0
- package/lib/LineChart.js.map +1 -0
- package/lib/Popover.js +1 -0
- package/lib/Popover.js.map +1 -0
- package/lib/ResponsiveContainer.js +1 -0
- package/lib/ResponsiveContainer.js.map +1 -0
- package/lib/Sparkline.js +1 -0
- package/lib/Sparkline.js.map +1 -0
- package/lib/VerticalBarChart.js +1 -0
- package/lib/VerticalBarChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +462 -0
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.js +187 -0
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib/components/CommonComponents/index.js +4 -0
- package/lib/components/CommonComponents/index.js.map +1 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +229 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +178 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +150 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchema.js +7 -0
- package/lib/components/DeclarativeChart/PlotlySchema.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +400 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/imageExporter.js +221 -0
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib/components/DeclarativeChart/index.js +1 -0
- package/lib/components/DeclarativeChart/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.js +110 -0
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib/components/DonutChart/Arc/index.js +2 -0
- package/lib/components/DonutChart/Arc/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +54 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.js +291 -0
- package/lib/components/DonutChart/DonutChart.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.types.js +1 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.js +72 -0
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/index.js +2 -0
- package/lib/components/DonutChart/Pie/index.js.map +1 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js +44 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/index.js +3 -0
- package/lib/components/DonutChart/index.js.map +1 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +58 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +402 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +6 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib/components/HorizontalBarChart/index.js +3 -0
- package/lib/components/HorizontalBarChart/index.js.map +1 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +163 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +302 -0
- package/lib/components/Legends/Legends.js.map +1 -0
- package/lib/components/Legends/Legends.types.js +1 -0
- package/lib/components/Legends/Legends.types.js.map +1 -0
- package/lib/components/Legends/OverflowMenu.js +25 -0
- package/lib/components/Legends/OverflowMenu.js.map +1 -0
- package/lib/components/Legends/index.js +3 -0
- package/lib/components/Legends/index.js.map +1 -0
- package/lib/components/Legends/shape.js +35 -0
- package/lib/components/Legends/shape.js.map +1 -0
- package/lib/components/Legends/useLegendsStyles.styles.js +147 -0
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib/components/LineChart/LineChart.js +1026 -0
- package/lib/components/LineChart/LineChart.js.map +1 -0
- package/lib/components/LineChart/LineChart.types.js +3 -0
- package/lib/components/LineChart/LineChart.types.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +119 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +57 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js +40 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib/components/LineChart/index.js +4 -0
- package/lib/components/LineChart/index.js.map +1 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js +65 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +65 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib/components/ResponsiveContainer/index.js +1 -0
- package/lib/components/ResponsiveContainer/index.js.map +1 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +23 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.js +119 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.types.js +4 -0
- package/lib/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib/components/Sparkline/index.js +3 -0
- package/lib/components/Sparkline/index.js.map +1 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js +49 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js +849 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js +4 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib/components/VerticalBarChart/index.js +3 -0
- package/lib/components/VerticalBarChart/index.js.map +1 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +74 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +12 -8
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +3 -0
- package/lib/types/DataPoint.js.map +1 -0
- package/lib/types/EventAnnotation.js +1 -0
- package/lib/types/EventAnnotation.js.map +1 -0
- package/lib/types/LegendDataItem.js +1 -0
- package/lib/types/LegendDataItem.js.map +1 -0
- package/lib/types/index.js +2 -2
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +65 -0
- package/lib/utilities/FocusableTooltipText.js.map +1 -0
- package/lib/utilities/KeyCodes.js +8 -0
- package/lib/utilities/KeyCodes.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js +138 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -0
- package/lib/utilities/async-utils.js +380 -0
- package/lib/utilities/async-utils.js.map +1 -0
- package/lib/utilities/colors.js +249 -0
- package/lib/utilities/colors.js.map +1 -0
- package/lib/utilities/getWindow.js +25 -0
- package/lib/utilities/getWindow.js.map +1 -0
- package/lib/utilities/index.js +3 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib/utilities/locale-util.js +15 -0
- package/lib/utilities/locale-util.js.map +1 -0
- package/lib/utilities/overflow-utils.js +27 -0
- package/lib/utilities/overflow-utils.js.map +1 -0
- package/lib/utilities/test-data.js +276 -0
- package/lib/utilities/test-data.js.map +1 -0
- package/lib/utilities/utilities.js +1215 -0
- package/lib/utilities/utilities.js.map +1 -0
- package/lib/utilities/vbc-utils.js +27 -0
- package/lib/utilities/vbc-utils.js.map +1 -0
- package/lib-commonjs/CartesianChart.js +6 -0
- package/lib-commonjs/CartesianChart.js.map +1 -0
- package/lib-commonjs/DeclarativeChart.js +6 -0
- package/lib-commonjs/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/DonutChart.js +6 -0
- package/lib-commonjs/DonutChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChart.js +6 -0
- package/lib-commonjs/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/Legends.js +6 -0
- package/lib-commonjs/Legends.js.map +1 -0
- package/lib-commonjs/LineChart.js +6 -0
- package/lib-commonjs/LineChart.js.map +1 -0
- package/lib-commonjs/Popover.js +6 -0
- package/lib-commonjs/Popover.js.map +1 -0
- package/lib-commonjs/ResponsiveContainer.js +6 -0
- package/lib-commonjs/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/Sparkline.js +6 -0
- package/lib-commonjs/Sparkline.js.map +1 -0
- package/lib-commonjs/VerticalBarChart.js +6 -0
- package/lib-commonjs/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +469 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +6 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +197 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +4 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/index.js +9 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +356 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +261 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +158 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +10 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +445 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +231 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/index.js +6 -0
- package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +117 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +83 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js +298 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js +6 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +79 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +61 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/index.js +8 -0
- package/lib-commonjs/components/DonutChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +82 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +408 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +17 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +251 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +313 -0
- package/lib-commonjs/components/Legends/Legends.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.types.js +6 -0
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js +36 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -0
- package/lib-commonjs/components/Legends/index.js +8 -0
- package/lib-commonjs/components/Legends/index.js.map +1 -0
- package/lib-commonjs/components/Legends/shape.js +46 -0
- package/lib-commonjs/components/Legends/shape.js.map +1 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +304 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.js +1032 -0
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js +6 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +129 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +68 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +51 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib-commonjs/components/LineChart/index.js +9 -0
- package/lib-commonjs/components/LineChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +96 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +76 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +47 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js +125 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js +7 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib-commonjs/components/Sparkline/index.js +8 -0
- package/lib-commonjs/components/Sparkline/index.js.map +1 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +77 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +851 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +117 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +17 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js +6 -0
- package/lib-commonjs/types/DataPoint.js.map +1 -0
- package/lib-commonjs/types/EventAnnotation.js +6 -0
- package/lib-commonjs/types/EventAnnotation.js.map +1 -0
- package/lib-commonjs/types/LegendDataItem.js +4 -0
- package/lib-commonjs/types/LegendDataItem.js.map +1 -0
- package/lib-commonjs/types/index.js +7 -0
- package/lib-commonjs/types/index.js.map +1 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js +75 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/KeyCodes.js +18 -0
- package/lib-commonjs/utilities/KeyCodes.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js +148 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/async-utils.js +382 -0
- package/lib-commonjs/utilities/async-utils.js.map +1 -0
- package/lib-commonjs/utilities/colors.js +270 -0
- package/lib-commonjs/utilities/colors.js.map +1 -0
- package/lib-commonjs/utilities/getWindow.js +28 -0
- package/lib-commonjs/utilities/getWindow.js.map +1 -0
- package/lib-commonjs/utilities/index.js +8 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/lib-commonjs/utilities/locale-util.js +25 -0
- package/lib-commonjs/utilities/locale-util.js.map +1 -0
- package/lib-commonjs/utilities/overflow-utils.js +36 -0
- package/lib-commonjs/utilities/overflow-utils.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +324 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +1184 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -0
- package/lib-commonjs/utilities/vbc-utils.js +45 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -0
- package/package.json +80 -72
- package/CHANGELOG.json +0 -65
- package/lib/chart/chart-legend.d.ts +0 -6
- package/lib/chart/chart-legend.js +0 -445
- package/lib/chart/chart-legend.js.map +0 -1
- package/lib/chart/chart-render.d.ts +0 -3
- package/lib/chart/chart-render.js +0 -50
- package/lib/chart/chart-render.js.map +0 -1
- package/lib/chart/chart.d.ts +0 -3
- package/lib/chart/chart.js +0 -10
- package/lib/chart/chart.js.map +0 -1
- package/lib/chart/index.d.ts +0 -1
- package/lib/chart/index.js +0 -2
- package/lib/chart/index.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/lib/builder.d.ts +0 -89
- package/lib/lib/builder.js +0 -379
- package/lib/lib/builder.js.map +0 -1
- package/lib/lib/datasets.d.ts +0 -123
- package/lib/lib/datasets.js +0 -285
- package/lib/lib/datasets.js.map +0 -1
- package/lib/lib/patterns.d.ts +0 -43
- package/lib/lib/patterns.js +0 -433
- package/lib/lib/patterns.js.map +0 -1
- package/lib/lib/plugins.d.ts +0 -11
- package/lib/lib/plugins.js +0 -403
- package/lib/lib/plugins.js.map +0 -1
- package/lib/lib/settings.d.ts +0 -12
- package/lib/lib/settings.js +0 -368
- package/lib/lib/settings.js.map +0 -1
- package/lib/lib/storybook.d.ts +0 -11
- package/lib/lib/storybook.js +0 -13
- package/lib/lib/storybook.js.map +0 -1
- package/lib/lib/utils.d.ts +0 -34
- package/lib/lib/utils.js +0 -253
- package/lib/lib/utils.js.map +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/types.d.ts +0 -101
- package/lib/types/types.js +0 -41
- package/lib/types/types.js.map +0 -1
|
@@ -0,0 +1,1184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
ChartTypes: function() {
|
|
13
|
+
return ChartTypes;
|
|
14
|
+
},
|
|
15
|
+
CustomPoints: function() {
|
|
16
|
+
return CustomPoints;
|
|
17
|
+
},
|
|
18
|
+
HighContrastSelector: function() {
|
|
19
|
+
return HighContrastSelector;
|
|
20
|
+
},
|
|
21
|
+
HighContrastSelectorBlack: function() {
|
|
22
|
+
return HighContrastSelectorBlack;
|
|
23
|
+
},
|
|
24
|
+
HighContrastSelectorWhite: function() {
|
|
25
|
+
return HighContrastSelectorWhite;
|
|
26
|
+
},
|
|
27
|
+
Points: function() {
|
|
28
|
+
return Points;
|
|
29
|
+
},
|
|
30
|
+
XAxisTypes: function() {
|
|
31
|
+
return XAxisTypes;
|
|
32
|
+
},
|
|
33
|
+
YAxisType: function() {
|
|
34
|
+
return YAxisType;
|
|
35
|
+
},
|
|
36
|
+
calculateLongestLabelWidth: function() {
|
|
37
|
+
return calculateLongestLabelWidth;
|
|
38
|
+
},
|
|
39
|
+
calloutData: function() {
|
|
40
|
+
return calloutData;
|
|
41
|
+
},
|
|
42
|
+
convertToLocaleString: function() {
|
|
43
|
+
return convertToLocaleString;
|
|
44
|
+
},
|
|
45
|
+
createDateXAxis: function() {
|
|
46
|
+
return createDateXAxis;
|
|
47
|
+
},
|
|
48
|
+
createNumericXAxis: function() {
|
|
49
|
+
return createNumericXAxis;
|
|
50
|
+
},
|
|
51
|
+
createStringXAxis: function() {
|
|
52
|
+
return createStringXAxis;
|
|
53
|
+
},
|
|
54
|
+
createStringYAxis: function() {
|
|
55
|
+
return createStringYAxis;
|
|
56
|
+
},
|
|
57
|
+
createStringYAxisForHorizontalBarChartWithAxis: function() {
|
|
58
|
+
return createStringYAxisForHorizontalBarChartWithAxis;
|
|
59
|
+
},
|
|
60
|
+
createStringYAxisForOtherCharts: function() {
|
|
61
|
+
return createStringYAxisForOtherCharts;
|
|
62
|
+
},
|
|
63
|
+
createWrapOfXLabels: function() {
|
|
64
|
+
return createWrapOfXLabels;
|
|
65
|
+
},
|
|
66
|
+
createYAxis: function() {
|
|
67
|
+
return createYAxis;
|
|
68
|
+
},
|
|
69
|
+
createYAxisForHorizontalBarChartWithAxis: function() {
|
|
70
|
+
return createYAxisForHorizontalBarChartWithAxis;
|
|
71
|
+
},
|
|
72
|
+
createYAxisForOtherCharts: function() {
|
|
73
|
+
return createYAxisForOtherCharts;
|
|
74
|
+
},
|
|
75
|
+
createYAxisLabels: function() {
|
|
76
|
+
return createYAxisLabels;
|
|
77
|
+
},
|
|
78
|
+
domainRageOfVerticalNumeric: function() {
|
|
79
|
+
return domainRageOfVerticalNumeric;
|
|
80
|
+
},
|
|
81
|
+
domainRangeOfDateForAreaLineVerticalBarChart: function() {
|
|
82
|
+
return domainRangeOfDateForAreaLineVerticalBarChart;
|
|
83
|
+
},
|
|
84
|
+
domainRangeOfNumericForAreaChart: function() {
|
|
85
|
+
return domainRangeOfNumericForAreaChart;
|
|
86
|
+
},
|
|
87
|
+
domainRangeOfNumericForHorizontalBarChartWithAxis: function() {
|
|
88
|
+
return domainRangeOfNumericForHorizontalBarChartWithAxis;
|
|
89
|
+
},
|
|
90
|
+
domainRangeOfVSBCNumeric: function() {
|
|
91
|
+
return domainRangeOfVSBCNumeric;
|
|
92
|
+
},
|
|
93
|
+
domainRangeOfXStringAxis: function() {
|
|
94
|
+
return domainRangeOfXStringAxis;
|
|
95
|
+
},
|
|
96
|
+
find: function() {
|
|
97
|
+
return find;
|
|
98
|
+
},
|
|
99
|
+
findHBCWANumericMinMaxOfY: function() {
|
|
100
|
+
return findHBCWANumericMinMaxOfY;
|
|
101
|
+
},
|
|
102
|
+
findIndex: function() {
|
|
103
|
+
return findIndex;
|
|
104
|
+
},
|
|
105
|
+
findNumericMinMaxOfY: function() {
|
|
106
|
+
return findNumericMinMaxOfY;
|
|
107
|
+
},
|
|
108
|
+
findVSBCNumericMinMaxOfY: function() {
|
|
109
|
+
return findVSBCNumericMinMaxOfY;
|
|
110
|
+
},
|
|
111
|
+
findVerticalNumericMinMaxOfY: function() {
|
|
112
|
+
return findVerticalNumericMinMaxOfY;
|
|
113
|
+
},
|
|
114
|
+
formatDate: function() {
|
|
115
|
+
return formatDate;
|
|
116
|
+
},
|
|
117
|
+
formatValueWithSIPrefix: function() {
|
|
118
|
+
return formatValueWithSIPrefix;
|
|
119
|
+
},
|
|
120
|
+
getAccessibleDataObject: function() {
|
|
121
|
+
return getAccessibleDataObject;
|
|
122
|
+
},
|
|
123
|
+
getBarWidth: function() {
|
|
124
|
+
return getBarWidth;
|
|
125
|
+
},
|
|
126
|
+
getDomainNRangeValues: function() {
|
|
127
|
+
return getDomainNRangeValues;
|
|
128
|
+
},
|
|
129
|
+
getMinMaxOfYAxis: function() {
|
|
130
|
+
return getMinMaxOfYAxis;
|
|
131
|
+
},
|
|
132
|
+
getScalePadding: function() {
|
|
133
|
+
return getScalePadding;
|
|
134
|
+
},
|
|
135
|
+
getTypeOfAxis: function() {
|
|
136
|
+
return getTypeOfAxis;
|
|
137
|
+
},
|
|
138
|
+
getUnique: function() {
|
|
139
|
+
return getUnique;
|
|
140
|
+
},
|
|
141
|
+
getXAxisType: function() {
|
|
142
|
+
return getXAxisType;
|
|
143
|
+
},
|
|
144
|
+
isScalePaddingDefined: function() {
|
|
145
|
+
return isScalePaddingDefined;
|
|
146
|
+
},
|
|
147
|
+
pointTypes: function() {
|
|
148
|
+
return pointTypes;
|
|
149
|
+
},
|
|
150
|
+
prepareDatapoints: function() {
|
|
151
|
+
return prepareDatapoints;
|
|
152
|
+
},
|
|
153
|
+
resolveCSSVariables: function() {
|
|
154
|
+
return resolveCSSVariables;
|
|
155
|
+
},
|
|
156
|
+
rotateXAxisLabels: function() {
|
|
157
|
+
return rotateXAxisLabels;
|
|
158
|
+
},
|
|
159
|
+
silceOrAppendToArray: function() {
|
|
160
|
+
return silceOrAppendToArray;
|
|
161
|
+
},
|
|
162
|
+
tooltipOfXAxislabels: function() {
|
|
163
|
+
return tooltipOfXAxislabels;
|
|
164
|
+
},
|
|
165
|
+
useRtl: function() {
|
|
166
|
+
return useRtl;
|
|
167
|
+
},
|
|
168
|
+
wrapContent: function() {
|
|
169
|
+
return wrapContent;
|
|
170
|
+
},
|
|
171
|
+
wrapTextInsideDonut: function() {
|
|
172
|
+
return wrapTextInsideDonut;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const _d3axis = require("d3-axis");
|
|
176
|
+
const _d3array = require("d3-array");
|
|
177
|
+
const _d3scale = require("d3-scale");
|
|
178
|
+
const _d3selection = require("d3-selection");
|
|
179
|
+
const _d3format = require("d3-format");
|
|
180
|
+
const _d3timeformat = require("d3-time-format");
|
|
181
|
+
const _d3time = require("d3-time");
|
|
182
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
183
|
+
var ChartTypes;
|
|
184
|
+
(function(ChartTypes) {
|
|
185
|
+
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
186
|
+
ChartTypes[ChartTypes["LineChart"] = 1] = "LineChart";
|
|
187
|
+
ChartTypes[ChartTypes["VerticalBarChart"] = 2] = "VerticalBarChart";
|
|
188
|
+
ChartTypes[ChartTypes["VerticalStackedBarChart"] = 3] = "VerticalStackedBarChart";
|
|
189
|
+
ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
|
|
190
|
+
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
191
|
+
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
192
|
+
})(ChartTypes || (ChartTypes = {}));
|
|
193
|
+
var XAxisTypes;
|
|
194
|
+
(function(XAxisTypes) {
|
|
195
|
+
XAxisTypes[XAxisTypes["NumericAxis"] = 0] = "NumericAxis";
|
|
196
|
+
XAxisTypes[XAxisTypes["DateAxis"] = 1] = "DateAxis";
|
|
197
|
+
XAxisTypes[XAxisTypes["StringAxis"] = 2] = "StringAxis";
|
|
198
|
+
})(XAxisTypes || (XAxisTypes = {}));
|
|
199
|
+
var YAxisType;
|
|
200
|
+
(function(YAxisType) {
|
|
201
|
+
YAxisType[YAxisType["NumericAxis"] = 0] = "NumericAxis";
|
|
202
|
+
YAxisType[YAxisType["DateAxis"] = 1] = "DateAxis";
|
|
203
|
+
YAxisType[YAxisType["StringAxis"] = 2] = "StringAxis";
|
|
204
|
+
})(YAxisType || (YAxisType = {}));
|
|
205
|
+
function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
206
|
+
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap } = xAxisParams;
|
|
207
|
+
const xAxisScale = (0, _d3scale.scaleLinear)().domain([
|
|
208
|
+
domainNRangeValues.dStartValue,
|
|
209
|
+
domainNRangeValues.dEndValue
|
|
210
|
+
]).range([
|
|
211
|
+
domainNRangeValues.rStartValue,
|
|
212
|
+
domainNRangeValues.rEndValue
|
|
213
|
+
]);
|
|
214
|
+
showRoundOffXTickValues && xAxisScale.nice();
|
|
215
|
+
let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
216
|
+
const tickFormat = (domainValue, _index)=>{
|
|
217
|
+
if (tickParams.tickFormat) {
|
|
218
|
+
return (0, _d3format.format)(tickParams.tickFormat)(domainValue);
|
|
219
|
+
}
|
|
220
|
+
const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
221
|
+
return convertToLocaleString(xAxisValue, culture);
|
|
222
|
+
};
|
|
223
|
+
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
224
|
+
const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 20;
|
|
225
|
+
const [start, end] = xAxisScale.range();
|
|
226
|
+
tickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
|
|
227
|
+
}
|
|
228
|
+
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
229
|
+
if (chartType === 6) {
|
|
230
|
+
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
231
|
+
}
|
|
232
|
+
if (tickParams.tickValues) {
|
|
233
|
+
xAxis.tickValues(tickParams.tickValues);
|
|
234
|
+
}
|
|
235
|
+
if (xAxisElement) {
|
|
236
|
+
(0, _d3selection.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
237
|
+
}
|
|
238
|
+
var _tickParams_tickValues;
|
|
239
|
+
const tickValues = ((_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
240
|
+
return {
|
|
241
|
+
xScale: xAxisScale,
|
|
242
|
+
tickValues
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function multiFormat(date, locale, useUTC) {
|
|
246
|
+
const timeFormat = locale ? useUTC ? locale.utcFormat : locale.format : useUTC ? _d3timeformat.utcFormat : _d3timeformat.timeFormat;
|
|
247
|
+
const formatMillisecond = timeFormat('.%L');
|
|
248
|
+
const formatSecond = timeFormat(':%S');
|
|
249
|
+
const formatMinute = timeFormat('%I:%M');
|
|
250
|
+
const formatHour = timeFormat('%I %p');
|
|
251
|
+
const formatDay = timeFormat('%a %d');
|
|
252
|
+
const formatWeek = timeFormat('%b %d');
|
|
253
|
+
const formatMonth = timeFormat('%B');
|
|
254
|
+
const formatYear = timeFormat('%Y');
|
|
255
|
+
const timeSecond = useUTC ? _d3time.utcSecond : _d3time.timeSecond;
|
|
256
|
+
const timeMinute = useUTC ? _d3time.utcMinute : _d3time.timeMinute;
|
|
257
|
+
const timeHour = useUTC ? _d3time.utcHour : _d3time.timeHour;
|
|
258
|
+
const timeDay = useUTC ? _d3time.utcDay : _d3time.timeDay;
|
|
259
|
+
const timeMonth = useUTC ? _d3time.utcMonth : _d3time.timeMonth;
|
|
260
|
+
const timeWeek = useUTC ? _d3time.utcWeek : _d3time.timeWeek;
|
|
261
|
+
const timeYear = useUTC ? _d3time.utcYear : _d3time.timeYear;
|
|
262
|
+
return (timeSecond(date) < date ? formatMillisecond : timeMinute(date) < date ? formatSecond : timeHour(date) < date ? formatMinute : timeDay(date) < date ? formatHour : timeMonth(date) < date ? timeWeek(date) < date ? formatDay : formatWeek : timeYear(date) < date ? formatMonth : formatYear)(date);
|
|
263
|
+
}
|
|
264
|
+
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
265
|
+
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, hideTickOverlap } = xAxisParams;
|
|
266
|
+
const xAxisScale = useUTC ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
|
|
267
|
+
xAxisScale.domain([
|
|
268
|
+
domainNRangeValues.dStartValue,
|
|
269
|
+
domainNRangeValues.dEndValue
|
|
270
|
+
]).range([
|
|
271
|
+
domainNRangeValues.rStartValue,
|
|
272
|
+
domainNRangeValues.rEndValue
|
|
273
|
+
]);
|
|
274
|
+
let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
275
|
+
const tickFormat = (domainValue, _index)=>{
|
|
276
|
+
if (customDateTimeFormatter) {
|
|
277
|
+
return customDateTimeFormatter(domainValue);
|
|
278
|
+
}
|
|
279
|
+
if (culture && options) {
|
|
280
|
+
return domainValue.toLocaleString(culture, options);
|
|
281
|
+
}
|
|
282
|
+
if (timeFormatLocale) {
|
|
283
|
+
const locale = (0, _d3timeformat.timeFormatLocale)(timeFormatLocale);
|
|
284
|
+
return multiFormat(domainValue, locale, useUTC);
|
|
285
|
+
}
|
|
286
|
+
if (culture === undefined && tickParams.tickFormat) {
|
|
287
|
+
if (useUTC) {
|
|
288
|
+
return (0, _d3timeformat.utcFormat)(tickParams.tickFormat)(domainValue);
|
|
289
|
+
} else {
|
|
290
|
+
return (0, _d3timeformat.timeFormat)(tickParams.tickFormat)(domainValue);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return multiFormat(domainValue, undefined, useUTC);
|
|
294
|
+
};
|
|
295
|
+
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
296
|
+
const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 40;
|
|
297
|
+
const [start, end] = xAxisScale.range();
|
|
298
|
+
tickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
|
|
299
|
+
}
|
|
300
|
+
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
301
|
+
tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
|
|
302
|
+
if (xAxisElement) {
|
|
303
|
+
(0, _d3selection.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
304
|
+
}
|
|
305
|
+
var _tickParams_tickValues;
|
|
306
|
+
const tickValues = ((_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
307
|
+
return {
|
|
308
|
+
xScale: xAxisScale,
|
|
309
|
+
tickValues
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
313
|
+
const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap } = xAxisParams;
|
|
314
|
+
const xAxisScale = (0, _d3scale.scaleBand)().domain(dataset).range([
|
|
315
|
+
domainNRangeValues.rStartValue,
|
|
316
|
+
domainNRangeValues.rEndValue
|
|
317
|
+
]).paddingInner(typeof xAxisInnerPadding !== 'undefined' ? xAxisInnerPadding : xAxisPadding).paddingOuter(typeof xAxisOuterPadding !== 'undefined' ? xAxisOuterPadding : xAxisPadding);
|
|
318
|
+
var _tickParams_tickValues;
|
|
319
|
+
let tickValues = (_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : dataset;
|
|
320
|
+
const tickFormat = (domainValue, _index)=>{
|
|
321
|
+
return convertToLocaleString(domainValue, culture);
|
|
322
|
+
};
|
|
323
|
+
if (hideTickOverlap) {
|
|
324
|
+
let nonOverlappingTickValues = [];
|
|
325
|
+
const tickSizes = tickValues.map((value, index)=>calculateLongestLabelWidth([
|
|
326
|
+
tickFormat(value, index)
|
|
327
|
+
], '.fui-cart__xAxis text'));
|
|
328
|
+
// for LTR
|
|
329
|
+
let start = 0;
|
|
330
|
+
let end = containerWidth;
|
|
331
|
+
let sign = 1;
|
|
332
|
+
const range = xAxisScale.range();
|
|
333
|
+
if (range[1] - range[0] < 0) {
|
|
334
|
+
// for RTL
|
|
335
|
+
start = containerWidth;
|
|
336
|
+
end = 0;
|
|
337
|
+
sign = -1;
|
|
338
|
+
}
|
|
339
|
+
for(let i = tickValues.length - 1; i >= 0; i--){
|
|
340
|
+
const tickPosition = xAxisScale(tickValues[i]);
|
|
341
|
+
if (sign * (tickPosition - sign * tickSizes[i] / 2 - start) >= 0 && sign * (tickPosition + sign * tickSizes[i] / 2 - end) <= 0) {
|
|
342
|
+
nonOverlappingTickValues.push(tickValues[i]);
|
|
343
|
+
end = tickPosition - sign * (tickSizes[i] / 2 + 10);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
nonOverlappingTickValues = nonOverlappingTickValues.reverse();
|
|
347
|
+
tickValues = nonOverlappingTickValues;
|
|
348
|
+
}
|
|
349
|
+
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).tickValues(tickValues).tickFormat(tickFormat);
|
|
350
|
+
if (xAxisParams.xAxisElement) {
|
|
351
|
+
(0, _d3selection.select)(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
xScale: xAxisScale,
|
|
355
|
+
tickValues: tickValues.map(xAxis.tickFormat())
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function useRtl() {
|
|
359
|
+
const { dir } = (0, _reactsharedcontexts.useFluent_unstable)(); // "dir" returns "ltr" or "rtl"
|
|
360
|
+
return dir === 'rtl';
|
|
361
|
+
}
|
|
362
|
+
function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset) {
|
|
363
|
+
const val = isIntegralDataset ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto >= 1 ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto;
|
|
364
|
+
const dataPointsArray = [
|
|
365
|
+
minVal,
|
|
366
|
+
minVal + val
|
|
367
|
+
];
|
|
368
|
+
while(dataPointsArray[dataPointsArray.length - 1] < maxVal){
|
|
369
|
+
dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] + val);
|
|
370
|
+
}
|
|
371
|
+
return dataPointsArray;
|
|
372
|
+
}
|
|
373
|
+
function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale = false) {
|
|
374
|
+
switch(chartType){
|
|
375
|
+
case 6:
|
|
376
|
+
return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
|
|
377
|
+
default:
|
|
378
|
+
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
|
|
382
|
+
const { yMinMaxValues = {
|
|
383
|
+
startValue: 0,
|
|
384
|
+
endValue: 0
|
|
385
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4 } = yAxisParams;
|
|
386
|
+
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
387
|
+
const tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
388
|
+
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
389
|
+
const finalYmin = yMinMaxValues.startValue < yMinValue ? 0 : yMinValue;
|
|
390
|
+
const yAxisScale = (0, _d3scale.scaleLinear)().domain([
|
|
391
|
+
finalYmin,
|
|
392
|
+
finalYmax
|
|
393
|
+
]).range([
|
|
394
|
+
containerHeight - margins.bottom,
|
|
395
|
+
margins.top
|
|
396
|
+
]);
|
|
397
|
+
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
398
|
+
const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
399
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, _d3format.format)('.2~s'));
|
|
400
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
401
|
+
return yAxisScale;
|
|
402
|
+
}
|
|
403
|
+
function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale = false) {
|
|
404
|
+
const { yMinMaxValues = {
|
|
405
|
+
startValue: 0,
|
|
406
|
+
endValue: 0
|
|
407
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight } = yAxisParams;
|
|
408
|
+
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
409
|
+
const tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
410
|
+
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
411
|
+
const finalYmin = yMinMaxValues.startValue < yMinValue ? 0 : yMinValue;
|
|
412
|
+
const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset);
|
|
413
|
+
const yAxisScale = (0, _d3scale.scaleLinear)().domain([
|
|
414
|
+
finalYmin,
|
|
415
|
+
domainValues[domainValues.length - 1]
|
|
416
|
+
]).range([
|
|
417
|
+
containerHeight - margins.bottom,
|
|
418
|
+
margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
|
|
419
|
+
]);
|
|
420
|
+
const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
421
|
+
const yAxis = axis.tickPadding(tickPadding).tickValues(domainValues).tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
422
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, _d3format.format)('.2~s'));
|
|
423
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
424
|
+
axisData.yAxisDomainValues = domainValues;
|
|
425
|
+
return yAxisScale;
|
|
426
|
+
}
|
|
427
|
+
const createStringYAxis = (yAxisParams, dataPoints, isRtl, chartType, barWidth, culture)=>{
|
|
428
|
+
switch(chartType){
|
|
429
|
+
case 6:
|
|
430
|
+
return createStringYAxisForHorizontalBarChartWithAxis(yAxisParams, dataPoints, isRtl, barWidth, culture);
|
|
431
|
+
default:
|
|
432
|
+
return createStringYAxisForOtherCharts(yAxisParams, dataPoints, isRtl);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints, isRtl, barWidth, culture)=>{
|
|
436
|
+
const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement } = yAxisParams;
|
|
437
|
+
const yAxisScale = (0, _d3scale.scaleBand)().domain(dataPoints).range([
|
|
438
|
+
containerHeight - margins.bottom - barWidth / 2,
|
|
439
|
+
margins.top + barWidth / 2
|
|
440
|
+
]);
|
|
441
|
+
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
442
|
+
const yAxis = axis.tickPadding(tickPadding).ticks(dataPoints);
|
|
443
|
+
if (yAxisTickFormat) {
|
|
444
|
+
yAxis.tickFormat(yAxisTickFormat);
|
|
445
|
+
}
|
|
446
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text') : '';
|
|
447
|
+
return yAxisScale;
|
|
448
|
+
};
|
|
449
|
+
const createStringYAxisForOtherCharts = (yAxisParams, dataPoints, isRtl)=>{
|
|
450
|
+
const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding = 0 } = yAxisParams;
|
|
451
|
+
const yAxisScale = (0, _d3scale.scaleBand)().domain(dataPoints).range([
|
|
452
|
+
containerHeight - margins.bottom,
|
|
453
|
+
margins.top
|
|
454
|
+
]).padding(yAxisPadding);
|
|
455
|
+
const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
|
|
456
|
+
const yAxis = axis.tickPadding(tickPadding).tickValues(dataPoints).tickSize(0);
|
|
457
|
+
if (yAxisTickFormat) {
|
|
458
|
+
yAxis.tickFormat(yAxisTickFormat);
|
|
459
|
+
}
|
|
460
|
+
yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text') : '';
|
|
461
|
+
return yAxisScale;
|
|
462
|
+
};
|
|
463
|
+
function calloutData(values) {
|
|
464
|
+
let combinedResult = [];
|
|
465
|
+
values.forEach((line)=>{
|
|
466
|
+
const elements = line.data.filter((point)=>!point.hideCallout).map((point)=>{
|
|
467
|
+
return {
|
|
468
|
+
...point,
|
|
469
|
+
legend: line.legend,
|
|
470
|
+
color: line.color,
|
|
471
|
+
index: line.index
|
|
472
|
+
};
|
|
473
|
+
});
|
|
474
|
+
combinedResult = combinedResult.concat(elements);
|
|
475
|
+
});
|
|
476
|
+
const xValToDataPoints = {};
|
|
477
|
+
combinedResult.forEach((ele)=>{
|
|
478
|
+
const xValue = ele.x instanceof Date ? ele.x.getTime() : ele.x;
|
|
479
|
+
if (xValue in xValToDataPoints) {
|
|
480
|
+
xValToDataPoints[xValue].push({
|
|
481
|
+
legend: ele.legend,
|
|
482
|
+
y: ele.y,
|
|
483
|
+
color: ele.color,
|
|
484
|
+
xAxisCalloutData: ele.xAxisCalloutData,
|
|
485
|
+
yAxisCalloutData: ele.yAxisCalloutData,
|
|
486
|
+
callOutAccessibilityData: ele.callOutAccessibilityData,
|
|
487
|
+
index: ele.index
|
|
488
|
+
});
|
|
489
|
+
} else {
|
|
490
|
+
xValToDataPoints[xValue] = [
|
|
491
|
+
{
|
|
492
|
+
legend: ele.legend,
|
|
493
|
+
y: ele.y,
|
|
494
|
+
color: ele.color,
|
|
495
|
+
xAxisCalloutData: ele.xAxisCalloutData,
|
|
496
|
+
yAxisCalloutData: ele.yAxisCalloutData,
|
|
497
|
+
callOutAccessibilityData: ele.callOutAccessibilityData,
|
|
498
|
+
index: ele.index
|
|
499
|
+
}
|
|
500
|
+
];
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
const result = Object.keys(xValToDataPoints).map((xValue)=>{
|
|
504
|
+
return {
|
|
505
|
+
x: Number(xValue),
|
|
506
|
+
values: xValToDataPoints[xValue]
|
|
507
|
+
};
|
|
508
|
+
});
|
|
509
|
+
return result;
|
|
510
|
+
}
|
|
511
|
+
function getUnique(arr, comp) {
|
|
512
|
+
const unique = arr // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
513
|
+
.map((e)=>e[comp]) // store the keys of the unique objects
|
|
514
|
+
.map((e, i, final)=>final.indexOf(e) === i && i) // eliminate the dead keys & store unique objects
|
|
515
|
+
.filter((e)=>arr[e]).map((e)=>arr[e]);
|
|
516
|
+
return unique;
|
|
517
|
+
}
|
|
518
|
+
function silceOrAppendToArray(array, value) {
|
|
519
|
+
const pos = array.indexOf(value);
|
|
520
|
+
if (pos === -1) {
|
|
521
|
+
return [
|
|
522
|
+
...array,
|
|
523
|
+
value
|
|
524
|
+
];
|
|
525
|
+
} else {
|
|
526
|
+
return array.slice(0, pos).concat(array.slice(pos + 1));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function createWrapOfXLabels(wrapLabelProps) {
|
|
530
|
+
const { node, xAxis, noOfCharsToTruncate, showXAxisLablesTooltip } = wrapLabelProps;
|
|
531
|
+
if (node === null) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const axisNode = (0, _d3selection.select)(node).call((g)=>xAxis);
|
|
535
|
+
let removeVal = 0;
|
|
536
|
+
const width = 10;
|
|
537
|
+
const arr = [];
|
|
538
|
+
axisNode.selectAll('.tick text').each(function() {
|
|
539
|
+
const text = (0, _d3selection.select)(this);
|
|
540
|
+
const totalWord = text.text();
|
|
541
|
+
const truncatedWord = `${text.text().slice(0, noOfCharsToTruncate)}...`;
|
|
542
|
+
const totalWordLength = text.text().length;
|
|
543
|
+
const words = text.text().split(/\s+/).reverse();
|
|
544
|
+
arr.push(words.length);
|
|
545
|
+
let word = '';
|
|
546
|
+
let line = [];
|
|
547
|
+
let lineNumber = 0;
|
|
548
|
+
const lineHeight = 1.1; // ems
|
|
549
|
+
const y = text.attr('y');
|
|
550
|
+
const dy = parseFloat(text.attr('dy'));
|
|
551
|
+
let tspan = text.text(null).append('tspan').attr('x', 0).attr('y', y).attr('id', 'BaseSpan').attr('dy', dy + 'em').attr('data-', totalWord);
|
|
552
|
+
if (showXAxisLablesTooltip && totalWordLength > noOfCharsToTruncate) {
|
|
553
|
+
tspan = text.append('tspan').attr('id', 'showDots').attr('x', 0).attr('y', y).attr('dy', ++lineNumber * lineHeight + dy + 'em').text(truncatedWord);
|
|
554
|
+
} else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
|
|
555
|
+
tspan = text.append('tspan').attr('id', 'LessLength').attr('x', 0).attr('y', y).attr('dy', ++lineNumber * lineHeight + dy + 'em').text(totalWord);
|
|
556
|
+
} else {
|
|
557
|
+
while(word = words.pop()){
|
|
558
|
+
line.push(word);
|
|
559
|
+
tspan.text(line.join(' '));
|
|
560
|
+
if (tspan.node().getComputedTextLength() > width && line.length > 1) {
|
|
561
|
+
line.pop();
|
|
562
|
+
tspan.text(line.join(' '));
|
|
563
|
+
line = [
|
|
564
|
+
word
|
|
565
|
+
];
|
|
566
|
+
tspan = text.append('tspan').attr('id', 'WordBreakId').attr('x', 0).attr('y', y).attr('dy', ++lineNumber * lineHeight + dy + 'em').text(word);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
const maxDigit = Math.max(...arr);
|
|
570
|
+
let maxHeight = 12; // intial value to render corretly first time
|
|
571
|
+
axisNode.selectAll('text').each(()=>{
|
|
572
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
573
|
+
const outerHTMLElement = document.getElementById('WordBreakId');
|
|
574
|
+
const BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
|
|
575
|
+
const boxHeight = BoxCordinates && BoxCordinates.height;
|
|
576
|
+
if (boxHeight > maxHeight) {
|
|
577
|
+
maxHeight = boxHeight;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
// If we take directly maxDigit * maxheight, then it will show more height between x axis tick values and bottom.
|
|
581
|
+
// To avoid this, reducing maxDigit value by removing some digit based on legth of word.
|
|
582
|
+
let removeDigit = 4;
|
|
583
|
+
if (maxDigit <= 2) {
|
|
584
|
+
removeDigit = 1;
|
|
585
|
+
} else if (maxDigit > 2 && maxDigit <= 6) {
|
|
586
|
+
removeDigit = 2;
|
|
587
|
+
} else if (maxDigit > 6 && maxDigit <= 9) {
|
|
588
|
+
removeDigit = 3;
|
|
589
|
+
}
|
|
590
|
+
removeVal = (maxDigit - removeDigit) * maxHeight;
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
return removeVal > 0 ? removeVal : 0;
|
|
594
|
+
}
|
|
595
|
+
function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, xValue, isRtl) {
|
|
596
|
+
if (node === null) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const axisNode = (0, _d3selection.select)(node).call(yAxis);
|
|
600
|
+
axisNode.selectAll('.tick text').each(function() {
|
|
601
|
+
const text = (0, _d3selection.select)(this);
|
|
602
|
+
const totalWord = text.text();
|
|
603
|
+
const truncatedWord = isRtl ? `...${text.text().slice(0, noOfCharsToTruncate)}` : `${text.text().slice(0, noOfCharsToTruncate)}...`;
|
|
604
|
+
const totalWordLength = text.text().length;
|
|
605
|
+
const padding = truncateLabel ? 1.5 : 1; // ems
|
|
606
|
+
const y = text.attr('y');
|
|
607
|
+
const x = text.attr('x');
|
|
608
|
+
const dy = parseFloat(text.attr('dy'));
|
|
609
|
+
const dx = 0;
|
|
610
|
+
text.text(null).append('tspan').attr('x', x).attr('y', y).attr('id', 'BaseSpan').attr('dy', dy + 'em').attr('data-', totalWord);
|
|
611
|
+
if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
|
|
612
|
+
text.append('tspan').attr('id', 'showDots').attr('x', isRtl ? 0 : x).attr('y', y).attr('dy', dy).attr('dx', padding + dx + 'em').text(truncatedWord);
|
|
613
|
+
} else {
|
|
614
|
+
text.attr('text-align', 'start').append('tspan').attr('id', 'LessLength').attr('x', isRtl ? 0 : x).attr('y', y).attr('dx', padding + dx + 'em').text(totalWord);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
const wrapContent = (content, id, maxWidth)=>{
|
|
619
|
+
const textElement = (0, _d3selection.select)(`#${id}`);
|
|
620
|
+
textElement.text(content);
|
|
621
|
+
if (!textElement.node()) {
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
let isOverflowing = false;
|
|
625
|
+
let textLength = textElement.node().getComputedTextLength();
|
|
626
|
+
while(textLength > maxWidth && content.length > 0){
|
|
627
|
+
content = content.slice(0, -1);
|
|
628
|
+
textElement.text(content + '...');
|
|
629
|
+
isOverflowing = true;
|
|
630
|
+
textLength = textElement.node().getComputedTextLength();
|
|
631
|
+
}
|
|
632
|
+
return isOverflowing;
|
|
633
|
+
};
|
|
634
|
+
const calculateLongestLabelWidth = (labels, query = 'none')=>{
|
|
635
|
+
let maxLabelWidth = 0;
|
|
636
|
+
const canvas = document.createElement('canvas');
|
|
637
|
+
const ctx = canvas.getContext('2d');
|
|
638
|
+
if (ctx) {
|
|
639
|
+
const axisText = document.querySelector(query);
|
|
640
|
+
if (axisText) {
|
|
641
|
+
const styles = window.getComputedStyle(axisText, null);
|
|
642
|
+
const fontWeight = styles.getPropertyValue('font-weight');
|
|
643
|
+
const fontSize = styles.getPropertyValue('font-size');
|
|
644
|
+
const fontFamily = styles.getPropertyValue('font-family');
|
|
645
|
+
ctx.font = `${fontWeight} ${fontSize} ${fontFamily}`;
|
|
646
|
+
} else {
|
|
647
|
+
ctx.font = '600 10px "Segoe UI"';
|
|
648
|
+
}
|
|
649
|
+
labels.forEach((label)=>{
|
|
650
|
+
maxLabelWidth = Math.max(ctx.measureText(label.toString()).width, maxLabelWidth);
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
return maxLabelWidth;
|
|
654
|
+
};
|
|
655
|
+
function tooltipOfXAxislabels(xAxistooltipProps) {
|
|
656
|
+
const { tooltipCls, xAxis, id } = xAxistooltipProps;
|
|
657
|
+
if (xAxis === null) {
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
const div = (0, _d3selection.select)('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
|
|
661
|
+
const aa = xAxis.selectAll('#BaseSpan')._groups[0];
|
|
662
|
+
const baseSpanLength = aa && Object.keys(aa).length;
|
|
663
|
+
const originalDataArray = [];
|
|
664
|
+
for(let i = 0; i < baseSpanLength; i++){
|
|
665
|
+
const originalData = aa[i].dataset && Object.values(aa[i].dataset)[0];
|
|
666
|
+
originalDataArray.push(originalData);
|
|
667
|
+
}
|
|
668
|
+
const tickObject = xAxis.selectAll('.tick')._groups[0];
|
|
669
|
+
const tickObjectLength = tickObject && Object.keys(tickObject).length;
|
|
670
|
+
for(let i = 0; i < tickObjectLength; i++){
|
|
671
|
+
const d1 = tickObject[i];
|
|
672
|
+
(0, _d3selection.select)(d1) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
673
|
+
.on('mouseover', (event, d)=>{
|
|
674
|
+
div.style('opacity', 0.9);
|
|
675
|
+
div.html(originalDataArray[i]).style('left', event.pageX + 'px').style('top', event.pageY - 28 + 'px');
|
|
676
|
+
}).on('mouseout', (d)=>{
|
|
677
|
+
div.style('opacity', 0);
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
function getXAxisType(points) {
|
|
682
|
+
let isXAxisDateType = false;
|
|
683
|
+
if (points && points.length > 0) {
|
|
684
|
+
points.forEach((chartData)=>{
|
|
685
|
+
if (chartData.data.length > 0) {
|
|
686
|
+
isXAxisDateType = chartData.data[0].x instanceof Date;
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
return isXAxisDateType;
|
|
692
|
+
}
|
|
693
|
+
function domainRangeOfNumericForAreaChart(points, margins, width, isRTL) {
|
|
694
|
+
const xMin = (0, _d3array.min)(points, (point)=>{
|
|
695
|
+
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
696
|
+
});
|
|
697
|
+
const xMax = (0, _d3array.max)(points, (point)=>{
|
|
698
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
699
|
+
return item.x;
|
|
700
|
+
});
|
|
701
|
+
});
|
|
702
|
+
const rStartValue = margins.left;
|
|
703
|
+
const rEndValue = width - margins.right;
|
|
704
|
+
return isRTL ? {
|
|
705
|
+
dStartValue: xMax,
|
|
706
|
+
dEndValue: xMin,
|
|
707
|
+
rStartValue,
|
|
708
|
+
rEndValue
|
|
709
|
+
} : {
|
|
710
|
+
dStartValue: xMin,
|
|
711
|
+
dEndValue: xMax,
|
|
712
|
+
rStartValue,
|
|
713
|
+
rEndValue
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
function domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, containerWidth, isRTL, shiftX) {
|
|
717
|
+
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
718
|
+
const rMin = isRTL ? margins.left : margins.left + shiftX;
|
|
719
|
+
const rMax = isRTL ? containerWidth - margins.right - shiftX : containerWidth - margins.right;
|
|
720
|
+
return isRTL ? {
|
|
721
|
+
dStartValue: xMax,
|
|
722
|
+
dEndValue: 0,
|
|
723
|
+
rStartValue: rMin,
|
|
724
|
+
rEndValue: rMax
|
|
725
|
+
} : {
|
|
726
|
+
dStartValue: 0,
|
|
727
|
+
dEndValue: xMax,
|
|
728
|
+
rStartValue: rMin,
|
|
729
|
+
rEndValue: rMax
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
function domainRangeOfXStringAxis(margins, width, isRTL) {
|
|
733
|
+
const rMin = margins.left;
|
|
734
|
+
const rMax = width - margins.right;
|
|
735
|
+
return isRTL ? {
|
|
736
|
+
dStartValue: 0,
|
|
737
|
+
dEndValue: 0,
|
|
738
|
+
rStartValue: rMax,
|
|
739
|
+
rEndValue: rMin
|
|
740
|
+
} : {
|
|
741
|
+
dStartValue: 0,
|
|
742
|
+
dEndValue: 0,
|
|
743
|
+
rStartValue: rMin,
|
|
744
|
+
rEndValue: rMax
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
function domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth) {
|
|
748
|
+
const xMin = (0, _d3array.min)(points, (point)=>point.x);
|
|
749
|
+
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
750
|
+
const rMax = margins.left;
|
|
751
|
+
const rMin = width - margins.right;
|
|
752
|
+
return isRTL ? {
|
|
753
|
+
dStartValue: xMax,
|
|
754
|
+
dEndValue: xMin,
|
|
755
|
+
rStartValue: rMax,
|
|
756
|
+
rEndValue: rMin
|
|
757
|
+
} : {
|
|
758
|
+
dStartValue: xMin,
|
|
759
|
+
dEndValue: xMax,
|
|
760
|
+
rStartValue: rMax,
|
|
761
|
+
rEndValue: rMin
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
|
|
765
|
+
let sDate;
|
|
766
|
+
let lDate;
|
|
767
|
+
if (chartType === 0 || chartType === 1) {
|
|
768
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
769
|
+
sDate = (0, _d3array.min)(points, (point)=>{
|
|
770
|
+
return (0, _d3array.min)(point.data, (item)=>{
|
|
771
|
+
return item.x;
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
775
|
+
lDate = (0, _d3array.max)(points, (point)=>{
|
|
776
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
777
|
+
return item.x;
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
// Need to draw graph with given small and large date
|
|
781
|
+
// (Which Involves customization of date axis tick values)
|
|
782
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
783
|
+
// So, Finding smallest and largest dates
|
|
784
|
+
sDate = (0, _d3array.min)([
|
|
785
|
+
...tickValues,
|
|
786
|
+
sDate
|
|
787
|
+
]);
|
|
788
|
+
lDate = (0, _d3array.max)([
|
|
789
|
+
...tickValues,
|
|
790
|
+
lDate
|
|
791
|
+
]);
|
|
792
|
+
} else {
|
|
793
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
794
|
+
sDate = (0, _d3array.min)(points, (point)=>point.x);
|
|
795
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
796
|
+
lDate = (0, _d3array.max)(points, (point)=>point.x);
|
|
797
|
+
}
|
|
798
|
+
const rStartValue = margins.left;
|
|
799
|
+
const rEndValue = width - margins.right;
|
|
800
|
+
return isRTL ? {
|
|
801
|
+
dStartValue: lDate,
|
|
802
|
+
dEndValue: sDate,
|
|
803
|
+
rStartValue,
|
|
804
|
+
rEndValue
|
|
805
|
+
} : {
|
|
806
|
+
dStartValue: sDate,
|
|
807
|
+
dEndValue: lDate,
|
|
808
|
+
rStartValue,
|
|
809
|
+
rEndValue
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
function domainRageOfVerticalNumeric(points, margins, containerWidth, isRTL, barWidth) {
|
|
813
|
+
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
814
|
+
const xMin = (0, _d3array.min)(points, (point)=>point.x);
|
|
815
|
+
const rMin = margins.left;
|
|
816
|
+
const rMax = containerWidth - margins.right;
|
|
817
|
+
return isRTL ? {
|
|
818
|
+
dStartValue: xMax,
|
|
819
|
+
dEndValue: xMin,
|
|
820
|
+
rStartValue: rMin,
|
|
821
|
+
rEndValue: rMax
|
|
822
|
+
} : {
|
|
823
|
+
dStartValue: xMin,
|
|
824
|
+
dEndValue: xMax,
|
|
825
|
+
rStartValue: rMin,
|
|
826
|
+
rEndValue: rMax
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
830
|
+
let domainNRangeValue;
|
|
831
|
+
if (xAxisType === 0) {
|
|
832
|
+
switch(chartType){
|
|
833
|
+
case 0:
|
|
834
|
+
case 1:
|
|
835
|
+
domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);
|
|
836
|
+
break;
|
|
837
|
+
case 3:
|
|
838
|
+
domainNRangeValue = domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth);
|
|
839
|
+
break;
|
|
840
|
+
case 2:
|
|
841
|
+
domainNRangeValue = domainRageOfVerticalNumeric(points, margins, width, isRTL, barWidth);
|
|
842
|
+
break;
|
|
843
|
+
case 6:
|
|
844
|
+
domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, width, isRTL, shiftX);
|
|
845
|
+
break;
|
|
846
|
+
default:
|
|
847
|
+
domainNRangeValue = {
|
|
848
|
+
dStartValue: 0,
|
|
849
|
+
dEndValue: 0,
|
|
850
|
+
rStartValue: 0,
|
|
851
|
+
rEndValue: 0
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
} else if (xAxisType === 1) {
|
|
855
|
+
switch(chartType){
|
|
856
|
+
case 0:
|
|
857
|
+
case 1:
|
|
858
|
+
case 2:
|
|
859
|
+
case 3:
|
|
860
|
+
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
861
|
+
break;
|
|
862
|
+
default:
|
|
863
|
+
domainNRangeValue = {
|
|
864
|
+
dStartValue: 0,
|
|
865
|
+
dEndValue: 0,
|
|
866
|
+
rStartValue: 0,
|
|
867
|
+
rEndValue: 0
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
} else {
|
|
871
|
+
// String Axis type
|
|
872
|
+
switch(chartType){
|
|
873
|
+
case 3:
|
|
874
|
+
case 4:
|
|
875
|
+
case 2:
|
|
876
|
+
case 5:
|
|
877
|
+
domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
|
|
878
|
+
break;
|
|
879
|
+
default:
|
|
880
|
+
domainNRangeValue = {
|
|
881
|
+
dStartValue: 0,
|
|
882
|
+
dEndValue: 0,
|
|
883
|
+
rStartValue: 0,
|
|
884
|
+
rEndValue: 0
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
return domainNRangeValue;
|
|
889
|
+
}
|
|
890
|
+
function findNumericMinMaxOfY(points) {
|
|
891
|
+
const yMax = (0, _d3array.max)(points, (point)=>{
|
|
892
|
+
return (0, _d3array.max)(point.data, (item)=>item.y);
|
|
893
|
+
});
|
|
894
|
+
const yMin = (0, _d3array.min)(points, (point)=>{
|
|
895
|
+
return (0, _d3array.min)(point.data, (item)=>item.y);
|
|
896
|
+
});
|
|
897
|
+
return {
|
|
898
|
+
startValue: yMin,
|
|
899
|
+
endValue: yMax
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
function findVSBCNumericMinMaxOfY(dataset) {
|
|
903
|
+
const yMax = (0, _d3array.max)(dataset, (point)=>point.y);
|
|
904
|
+
const yMin = (0, _d3array.min)(dataset, (point)=>point.y);
|
|
905
|
+
return {
|
|
906
|
+
startValue: yMin,
|
|
907
|
+
endValue: yMax
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function findVerticalNumericMinMaxOfY(points) {
|
|
911
|
+
const yMax = (0, _d3array.max)(points, (point)=>{
|
|
912
|
+
if (point.lineData !== undefined) {
|
|
913
|
+
if (point.y > point.lineData.y) {
|
|
914
|
+
return point.y;
|
|
915
|
+
} else {
|
|
916
|
+
return point.lineData.y;
|
|
917
|
+
}
|
|
918
|
+
} else {
|
|
919
|
+
return point.y;
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
const yMin = (0, _d3array.min)(points, (point)=>{
|
|
923
|
+
if (point.lineData !== undefined) {
|
|
924
|
+
if (point.y < point.lineData.y) {
|
|
925
|
+
return point.y;
|
|
926
|
+
} else {
|
|
927
|
+
return point.lineData.y;
|
|
928
|
+
}
|
|
929
|
+
} else {
|
|
930
|
+
return point.y;
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
return {
|
|
934
|
+
startValue: yMin,
|
|
935
|
+
endValue: yMax
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function findHBCWANumericMinMaxOfY(points, yAxisType) {
|
|
939
|
+
if (yAxisType !== undefined && yAxisType === 0) {
|
|
940
|
+
const yMax = (0, _d3array.max)(points, (point)=>point.y);
|
|
941
|
+
const yMin = (0, _d3array.min)(points, (point)=>point.y);
|
|
942
|
+
return {
|
|
943
|
+
startValue: yMin,
|
|
944
|
+
endValue: yMax
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
return {
|
|
948
|
+
startValue: 0,
|
|
949
|
+
endValue: 0
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
function getMinMaxOfYAxis(points, chartType, yAxisType = 0) {
|
|
953
|
+
let minMaxValues;
|
|
954
|
+
switch(chartType){
|
|
955
|
+
case 0:
|
|
956
|
+
case 1:
|
|
957
|
+
minMaxValues = findNumericMinMaxOfY(points);
|
|
958
|
+
break;
|
|
959
|
+
case 3:
|
|
960
|
+
minMaxValues = findVSBCNumericMinMaxOfY(points);
|
|
961
|
+
break;
|
|
962
|
+
case 2:
|
|
963
|
+
minMaxValues = findVerticalNumericMinMaxOfY(points);
|
|
964
|
+
break;
|
|
965
|
+
case 6:
|
|
966
|
+
minMaxValues = findHBCWANumericMinMaxOfY(points, yAxisType);
|
|
967
|
+
break;
|
|
968
|
+
default:
|
|
969
|
+
minMaxValues = {
|
|
970
|
+
startValue: 0,
|
|
971
|
+
endValue: 0
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
return minMaxValues;
|
|
975
|
+
}
|
|
976
|
+
const getTypeOfAxis = (p, isXAxis)=>{
|
|
977
|
+
if (isXAxis) {
|
|
978
|
+
switch(typeof p){
|
|
979
|
+
case 'string':
|
|
980
|
+
return 2;
|
|
981
|
+
case 'number':
|
|
982
|
+
return 0;
|
|
983
|
+
default:
|
|
984
|
+
return 1;
|
|
985
|
+
}
|
|
986
|
+
} else {
|
|
987
|
+
switch(typeof p){
|
|
988
|
+
case 'string':
|
|
989
|
+
return 2;
|
|
990
|
+
case 'number':
|
|
991
|
+
return 0;
|
|
992
|
+
default:
|
|
993
|
+
return 1;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
var Points;
|
|
998
|
+
(function(Points) {
|
|
999
|
+
Points[Points["circle"] = 0] = "circle";
|
|
1000
|
+
Points[Points["square"] = 1] = "square";
|
|
1001
|
+
Points[Points["triangle"] = 2] = "triangle";
|
|
1002
|
+
Points[Points["diamond"] = 3] = "diamond";
|
|
1003
|
+
Points[Points["pyramid"] = 4] = "pyramid";
|
|
1004
|
+
Points[Points["hexagon"] = 5] = "hexagon";
|
|
1005
|
+
Points[Points["pentagon"] = 6] = "pentagon";
|
|
1006
|
+
Points[Points["octagon"] = 7] = "octagon";
|
|
1007
|
+
})(Points || (Points = {}));
|
|
1008
|
+
var CustomPoints;
|
|
1009
|
+
(function(CustomPoints) {
|
|
1010
|
+
CustomPoints[CustomPoints["dottedLine"] = 0] = "dottedLine";
|
|
1011
|
+
})(CustomPoints || (CustomPoints = {}));
|
|
1012
|
+
const pointTypes = {
|
|
1013
|
+
[0]: {
|
|
1014
|
+
widthRatio: 1
|
|
1015
|
+
},
|
|
1016
|
+
[1]: {
|
|
1017
|
+
widthRatio: 1
|
|
1018
|
+
},
|
|
1019
|
+
[2]: {
|
|
1020
|
+
widthRatio: 1
|
|
1021
|
+
},
|
|
1022
|
+
[3]: {
|
|
1023
|
+
widthRatio: 1
|
|
1024
|
+
},
|
|
1025
|
+
[4]: {
|
|
1026
|
+
widthRatio: 1
|
|
1027
|
+
},
|
|
1028
|
+
[5]: {
|
|
1029
|
+
widthRatio: 2
|
|
1030
|
+
},
|
|
1031
|
+
[6]: {
|
|
1032
|
+
widthRatio: 1.168
|
|
1033
|
+
},
|
|
1034
|
+
[7]: {
|
|
1035
|
+
widthRatio: 2.414
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
const getAccessibleDataObject = (accessibleData, role = 'text', isDataFocusable = true)=>{
|
|
1039
|
+
accessibleData = accessibleData !== null && accessibleData !== void 0 ? accessibleData : {};
|
|
1040
|
+
return {
|
|
1041
|
+
role,
|
|
1042
|
+
'data-is-focusable': isDataFocusable,
|
|
1043
|
+
'aria-label': accessibleData.ariaLabel,
|
|
1044
|
+
'aria-labelledby': accessibleData.ariaLabelledBy,
|
|
1045
|
+
'aria-describedby': accessibleData.ariaDescribedBy
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
const convertToLocaleString = (data, culture)=>{
|
|
1049
|
+
if (data === undefined || data === null || Number.isNaN(data)) {
|
|
1050
|
+
return data;
|
|
1051
|
+
}
|
|
1052
|
+
culture = culture || undefined;
|
|
1053
|
+
if (typeof data === 'number') {
|
|
1054
|
+
return data.toLocaleString(culture);
|
|
1055
|
+
} else if (typeof data === 'string' && !isNaN(Number(data))) {
|
|
1056
|
+
const num = Number(data);
|
|
1057
|
+
return num.toLocaleString(culture);
|
|
1058
|
+
} else if (data instanceof Date) {
|
|
1059
|
+
return data.toLocaleDateString(culture);
|
|
1060
|
+
}
|
|
1061
|
+
return data;
|
|
1062
|
+
};
|
|
1063
|
+
function rotateXAxisLabels(rotateLabelProps) {
|
|
1064
|
+
const { node, xAxis } = rotateLabelProps;
|
|
1065
|
+
if (node === null || xAxis === null) {
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
let maxHeight = 0;
|
|
1069
|
+
const xAxisTranslations = [];
|
|
1070
|
+
(0, _d3selection.select)(node).call(xAxis).selectAll('.tick').each(function() {
|
|
1071
|
+
const translateValue = this.getAttribute('transform');
|
|
1072
|
+
if ((translateValue === null || translateValue === void 0 ? void 0 : translateValue.indexOf('rotate')) === -1) {
|
|
1073
|
+
const translatePair = translateValue.substring(translateValue.indexOf('(') + 1, translateValue.indexOf(')')).split(',');
|
|
1074
|
+
if (translatePair.length === 2) {
|
|
1075
|
+
xAxisTranslations.push(translatePair[0]);
|
|
1076
|
+
this.setAttribute('transform', `translate(${translatePair[0]},0)rotate(-45)`);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
const BoxCordinates = this.getBoundingClientRect();
|
|
1080
|
+
const boxHeight = BoxCordinates && BoxCordinates.height;
|
|
1081
|
+
if (boxHeight > maxHeight) {
|
|
1082
|
+
maxHeight = boxHeight;
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
let idx = 0;
|
|
1086
|
+
(0, _d3selection.select)(node).call(xAxis).selectAll('.tick').each(function() {
|
|
1087
|
+
if (xAxisTranslations.length > idx) {
|
|
1088
|
+
this.setAttribute('transform', `translate(${xAxisTranslations[idx]},${maxHeight / 2})rotate(-45)`); // Translate y by max height/2
|
|
1089
|
+
idx += 1;
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
return Math.floor(maxHeight / 1.414); // Compute maxHeight/tanInverse(45) to get the vertical height of labels.
|
|
1093
|
+
}
|
|
1094
|
+
function wrapTextInsideDonut(selectorClass, maxWidth) {
|
|
1095
|
+
let idx = 0;
|
|
1096
|
+
(0, _d3selection.selectAll)(`.${selectorClass}`).each(function() {
|
|
1097
|
+
const text = (0, _d3selection.select)(this);
|
|
1098
|
+
const words = text.text().split(/\s+/).reverse();
|
|
1099
|
+
let word = '';
|
|
1100
|
+
let line = [];
|
|
1101
|
+
let lineNumber = 0;
|
|
1102
|
+
const lineHeight = 1.1; // ems
|
|
1103
|
+
const y = text.attr('y');
|
|
1104
|
+
let tspan = text.text(null).append('tspan').attr('id', `WordBreakId-${idx}-${lineNumber}`).attr('x', 0).attr('y', y).attr('dy', lineNumber++ * lineHeight + 'em');
|
|
1105
|
+
while(word = words.pop()){
|
|
1106
|
+
line.push(word);
|
|
1107
|
+
tspan.text(line.join(' ') + ' ');
|
|
1108
|
+
if (tspan.node().getComputedTextLength() > maxWidth && line.length > 1) {
|
|
1109
|
+
line.pop();
|
|
1110
|
+
tspan.text(line.join(' ') + ' ');
|
|
1111
|
+
line = [
|
|
1112
|
+
word
|
|
1113
|
+
];
|
|
1114
|
+
tspan = text.append('tspan').attr('id', `WordBreakId-${idx}-${lineNumber}`).attr('x', 0).attr('y', y).attr('dy', lineNumber++ * lineHeight + 'em').text(word);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
idx += 1;
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
function formatValueWithSIPrefix(value) {
|
|
1121
|
+
let specifier;
|
|
1122
|
+
if (value < 1000) {
|
|
1123
|
+
specifier = '.2~'; // upto 2 decimal places without insignificant trailing zeros
|
|
1124
|
+
} else {
|
|
1125
|
+
specifier = '.1'; // upto 1 decimal place
|
|
1126
|
+
}
|
|
1127
|
+
return (0, _d3format.formatPrefix)(specifier, value)(value);
|
|
1128
|
+
}
|
|
1129
|
+
const DEFAULT_BAR_WIDTH = 16;
|
|
1130
|
+
const MIN_BAR_WIDTH = 1;
|
|
1131
|
+
const getBarWidth = (barWidthProp, maxBarWidthProp, adjustedValue = DEFAULT_BAR_WIDTH)=>{
|
|
1132
|
+
let barWidth;
|
|
1133
|
+
if (typeof barWidthProp === 'number') {
|
|
1134
|
+
barWidth = barWidthProp;
|
|
1135
|
+
} else if (barWidthProp === 'default' || typeof barWidthProp === 'undefined') {
|
|
1136
|
+
barWidth = Math.min(adjustedValue, DEFAULT_BAR_WIDTH);
|
|
1137
|
+
} else {
|
|
1138
|
+
barWidth = adjustedValue;
|
|
1139
|
+
}
|
|
1140
|
+
if (typeof maxBarWidthProp === 'number') {
|
|
1141
|
+
barWidth = Math.min(barWidth, maxBarWidthProp);
|
|
1142
|
+
}
|
|
1143
|
+
barWidth = Math.max(barWidth, MIN_BAR_WIDTH);
|
|
1144
|
+
return barWidth;
|
|
1145
|
+
};
|
|
1146
|
+
const getScalePadding = (prop, shorthandProp, defaultValue = 0)=>{
|
|
1147
|
+
let padding = typeof prop === 'number' ? prop : typeof shorthandProp === 'number' ? shorthandProp : defaultValue;
|
|
1148
|
+
padding = Math.max(0, Math.min(padding, 1));
|
|
1149
|
+
return padding;
|
|
1150
|
+
};
|
|
1151
|
+
const isScalePaddingDefined = (prop, shorthandProp)=>{
|
|
1152
|
+
return typeof prop === 'number' || typeof shorthandProp === 'number';
|
|
1153
|
+
};
|
|
1154
|
+
function findIndex(array, cb, fromIndex = 0) {
|
|
1155
|
+
let index = -1;
|
|
1156
|
+
for(let i = fromIndex; array && i < array.length; i++){
|
|
1157
|
+
if (cb(array[i], i)) {
|
|
1158
|
+
index = i;
|
|
1159
|
+
break;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return index;
|
|
1163
|
+
}
|
|
1164
|
+
function find(array, cb) {
|
|
1165
|
+
let index = findIndex(array, cb);
|
|
1166
|
+
if (index < 0) {
|
|
1167
|
+
return undefined;
|
|
1168
|
+
}
|
|
1169
|
+
return array[index];
|
|
1170
|
+
}
|
|
1171
|
+
const HighContrastSelector = '@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)';
|
|
1172
|
+
const HighContrastSelectorWhite = '@media screen and (-ms-high-contrast: black-on-white), screen and (forced-colors: active) and (prefers-color-scheme: light)';
|
|
1173
|
+
const HighContrastSelectorBlack = '@media screen and (-ms-high-contrast: white-on-black), screen and (forced-colors: active) and (prefers-color-scheme: dark)';
|
|
1174
|
+
const formatDate = (date, useUTC)=>{
|
|
1175
|
+
const timeFormat = useUTC ? _d3timeformat.utcFormat : _d3timeformat.timeFormat;
|
|
1176
|
+
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1177
|
+
};
|
|
1178
|
+
const cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
|
|
1179
|
+
function resolveCSSVariables(chartContainer, styleRules) {
|
|
1180
|
+
const containerStyles = getComputedStyle(chartContainer);
|
|
1181
|
+
return styleRules.replace(cssVarRegExp, (match, group1)=>{
|
|
1182
|
+
return containerStyles.getPropertyValue(group1);
|
|
1183
|
+
});
|
|
1184
|
+
}
|