@fluentui/react-charts 0.0.0-nightly-20250423-1342.1 → 0.0.0-nightly-20250423-1415.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -16
- package/dist/index.d.ts +3337 -0
- package/lib/AreaChart.js +1 -0
- package/lib/AreaChart.js.map +1 -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/GaugeChart.js +1 -0
- package/lib/GaugeChart.js.map +1 -0
- package/lib/GroupedVerticalBarChart.js +1 -0
- package/lib/GroupedVerticalBarChart.js.map +1 -0
- package/lib/HeatMapChart.js +1 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/HorizontalBarChart.js +1 -0
- package/lib/HorizontalBarChart.js.map +1 -0
- package/lib/HorizontalBarChartWithAxis.js +1 -0
- package/lib/HorizontalBarChartWithAxis.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/SankeyChart.js +1 -0
- package/lib/SankeyChart.js.map +1 -0
- package/lib/ScatterChart.js +1 -0
- package/lib/ScatterChart.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/VerticalStackedBarChart.js +1 -0
- package/lib/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +775 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.types.js +4 -0
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib/components/AreaChart/index.js +3 -0
- package/lib/components/AreaChart/index.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +64 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +478 -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 +197 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +811 -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/GaugeChart/GaugeChart.js +592 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib/components/GaugeChart/index.js +3 -0
- package/lib/components/GaugeChart/index.js.map +1 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +174 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +501 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/index.js +3 -0
- package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +90 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib/components/HeatMapChart/index.js +3 -0
- package/lib/components/HeatMapChart/index.js.map +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +303 -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 +1034 -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/SankeyChart/SankeyChart.js +1022 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib/components/SankeyChart/index.js +3 -0
- package/lib/components/SankeyChart/index.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.js +465 -0
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib/components/ScatterChart/index.js +3 -0
- package/lib/components/ScatterChart/index.js.map +1 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +65 -0
- package/lib/components/ScatterChart/useScatterChartStyles.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 +926 -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/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/index.js +3 -0
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/types/DataPoint.js +1 -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 -0
- package/lib/types/index.js.map +1 -0
- 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 +183 -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 +269 -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/string.js +32 -0
- package/lib/utilities/string.js.map +1 -0
- package/lib/utilities/test-data.js +329 -0
- package/lib/utilities/test-data.js.map +1 -0
- package/lib/utilities/utilities.js +1405 -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/AreaChart.js +6 -0
- package/lib-commonjs/AreaChart.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/GaugeChart.js +6 -0
- package/lib-commonjs/GaugeChart.js.map +1 -0
- package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
- package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/HeatMapChart.js +6 -0
- package/lib-commonjs/HeatMapChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChart.js +6 -0
- package/lib-commonjs/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.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/SankeyChart.js +6 -0
- package/lib-commonjs/SankeyChart.js.map +1 -0
- package/lib-commonjs/ScatterChart.js +6 -0
- package/lib-commonjs/ScatterChart.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/VerticalStackedBarChart.js +6 -0
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib-commonjs/components/AreaChart/index.js +8 -0
- package/lib-commonjs/components/AreaChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +484 -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 +205 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +859 -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/GaugeChart/GaugeChart.js +621 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/index.js +8 -0
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +252 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +507 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +139 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/index.js +8 -0
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.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 +1040 -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/SankeyChart/SankeyChart.js +1038 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/index.js +8 -0
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +471 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/index.js +8 -0
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +96 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.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 +928 -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/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +25 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js +4 -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 +193 -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 +293 -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/string.js +29 -0
- package/lib-commonjs/utilities/string.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +383 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +1371 -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 +13 -13
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useVerticalBarChartStyles } from './useVerticalBarChartStyles.styles';
|
|
3
|
+
import { max as d3Max, min as d3Min } from 'd3-array';
|
|
4
|
+
import { line as d3Line } from 'd3-shape';
|
|
5
|
+
import { select as d3Select } from 'd3-selection';
|
|
6
|
+
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc } from 'd3-scale';
|
|
7
|
+
import { useId } from '@fluentui/react-utilities';
|
|
8
|
+
import { tokens } from '@fluentui/react-theme';
|
|
9
|
+
import { CartesianChart, Legends, ChartPopover } from '../../index';
|
|
10
|
+
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, useRtl, areArraysEqual, calculateLongestLabelWidth } from '../../utilities/index';
|
|
11
|
+
var CircleVisbility;
|
|
12
|
+
(function(CircleVisbility) {
|
|
13
|
+
CircleVisbility["show"] = "visibility";
|
|
14
|
+
CircleVisbility["hide"] = "hidden";
|
|
15
|
+
})(CircleVisbility || (CircleVisbility = {}));
|
|
16
|
+
const MIN_DOMAIN_MARGIN = 8;
|
|
17
|
+
// Create a VerticalBarChart variant which uses these default styles and this styled subcomponent.
|
|
18
|
+
/**
|
|
19
|
+
* VerticalBarchart component
|
|
20
|
+
* {@docCategory VerticalBarChart}
|
|
21
|
+
*/ export const VerticalBarChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
22
|
+
var _props_legendProps;
|
|
23
|
+
let _points = [];
|
|
24
|
+
let _barWidth = 0;
|
|
25
|
+
let _colors;
|
|
26
|
+
const _refArray = [];
|
|
27
|
+
let margins;
|
|
28
|
+
const _useRtl = useRtl();
|
|
29
|
+
let _bars;
|
|
30
|
+
let _xAxisLabels;
|
|
31
|
+
let _yMax;
|
|
32
|
+
let _yMin;
|
|
33
|
+
let _isHavingLine = _checkForLine();
|
|
34
|
+
const _tooltipId = useId('VCTooltipID_');
|
|
35
|
+
const _xAxisType = props.data && props.data.length > 0 ? getTypeOfAxis(props.data[0].x, true) : XAxisTypes.StringAxis;
|
|
36
|
+
let _calloutAnchorPoint;
|
|
37
|
+
let _domainMargin;
|
|
38
|
+
const _emptyChartId = useId('_VBC_empty');
|
|
39
|
+
const _vbcLineId = useId('_VBC_line_');
|
|
40
|
+
const _vbcPointId = useId('_VBC_point_');
|
|
41
|
+
const _vbcBarId = useId('_VBC_bar_');
|
|
42
|
+
let _xAxisInnerPadding = 0;
|
|
43
|
+
let _xAxisOuterPadding = 0;
|
|
44
|
+
const cartesianChartRef = React.useRef(null);
|
|
45
|
+
const [color, setColor] = React.useState('');
|
|
46
|
+
const [dataForHoverCard, setDataForHoverCard] = React.useState(0);
|
|
47
|
+
const [activeLegend, setActiveLegend] = React.useState(undefined);
|
|
48
|
+
const [xCalloutValue, setXCalloutValue] = React.useState('');
|
|
49
|
+
const [yCalloutValue, setYCalloutValue] = React.useState('');
|
|
50
|
+
const [activeXdataPoint, setActiveXDatapoint] = React.useState(null);
|
|
51
|
+
const [hoveredYValues, setYValueHover] = React.useState();
|
|
52
|
+
const [hoverXValue, setHoverXValue] = React.useState('');
|
|
53
|
+
const [calloutLegend, setCalloutLegend] = React.useState('');
|
|
54
|
+
const [callOutAccessibilityData, setCalloutAccessibilityData] = React.useState();
|
|
55
|
+
const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState();
|
|
56
|
+
const [clickPosition, setClickPosition] = React.useState({
|
|
57
|
+
x: 0,
|
|
58
|
+
y: 0
|
|
59
|
+
});
|
|
60
|
+
const [isPopoverOpen, setPopoverOpen] = React.useState(false);
|
|
61
|
+
const [selectedLegends, setSelectedLegends] = React.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
|
|
62
|
+
const prevPropsRef = React.useRef(null);
|
|
63
|
+
React.useImperativeHandle(props.componentRef, ()=>{
|
|
64
|
+
var _cartesianChartRef_current;
|
|
65
|
+
var _cartesianChartRef_current_chartContainer;
|
|
66
|
+
return {
|
|
67
|
+
chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
React.useEffect(()=>{
|
|
71
|
+
if (prevPropsRef.current) {
|
|
72
|
+
var _prevProps_legendProps, _props_legendProps;
|
|
73
|
+
const prevProps = prevPropsRef.current;
|
|
74
|
+
if (!areArraysEqual((_prevProps_legendProps = prevProps.legendProps) === null || _prevProps_legendProps === void 0 ? void 0 : _prevProps_legendProps.selectedLegends, (_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends)) {
|
|
75
|
+
var _props_legendProps1;
|
|
76
|
+
setSelectedLegends(((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.selectedLegends) || []);
|
|
77
|
+
}
|
|
78
|
+
if (prevProps.height !== props.height || prevProps.width !== props.width) {
|
|
79
|
+
_adjustProps();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
prevPropsRef.current = props;
|
|
83
|
+
}, [
|
|
84
|
+
props,
|
|
85
|
+
prevPropsRef,
|
|
86
|
+
_adjustProps
|
|
87
|
+
]);
|
|
88
|
+
function _createLine(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
+
xScale, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
yScale, containerHeight = 0, containerWidth = 0, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
+
yScaleSecondary) {
|
|
92
|
+
var _props_lineOptions;
|
|
93
|
+
const isStringAxis = _xAxisType === XAxisTypes.StringAxis;
|
|
94
|
+
const colorScale = _createColors();
|
|
95
|
+
const { data, lineLegendColor = tokens.colorPaletteYellowBackground1, lineLegendText } = props;
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
const lineData = [];
|
|
98
|
+
const line = [];
|
|
99
|
+
data && data.forEach((item, index)=>{
|
|
100
|
+
if (item.lineData && item.lineData.y) {
|
|
101
|
+
var _item_lineData_useSecondaryYScale;
|
|
102
|
+
lineData.push({
|
|
103
|
+
x: item.x,
|
|
104
|
+
y: item.lineData.y,
|
|
105
|
+
useSecondaryYScale: (_item_lineData_useSecondaryYScale = item.lineData.useSecondaryYScale) !== null && _item_lineData_useSecondaryYScale !== void 0 ? _item_lineData_useSecondaryYScale : false,
|
|
106
|
+
point: item,
|
|
107
|
+
index
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const linePath = d3Line()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
112
|
+
.x((d)=>isStringAxis ? xScale(d.x) + 0.5 * xScale.bandwidth() : xScale(d.x))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
.y((d)=>d.useSecondaryYScale && yScaleSecondary ? yScaleSecondary(d.y) : yScale(d.y));
|
|
114
|
+
const shouldHighlight = _legendHighlighted(lineLegendText) || _noLegendHighlighted() ? true : false;
|
|
115
|
+
const lineBorderWidth = ((_props_lineOptions = props.lineOptions) === null || _props_lineOptions === void 0 ? void 0 : _props_lineOptions.lineBorderWidth) ? Number.parseFloat(props.lineOptions.lineBorderWidth.toString()) : 0;
|
|
116
|
+
if (lineBorderWidth > 0) {
|
|
117
|
+
line.push(/*#__PURE__*/ React.createElement("path", {
|
|
118
|
+
key: _vbcLineId,
|
|
119
|
+
id: _vbcLineId,
|
|
120
|
+
opacity: shouldHighlight ? 1 : 0.1,
|
|
121
|
+
d: linePath(lineData),
|
|
122
|
+
fill: "transparent",
|
|
123
|
+
strokeLinecap: "square",
|
|
124
|
+
strokeWidth: 3 + lineBorderWidth * 2,
|
|
125
|
+
stroke: tokens.colorNeutralBackground1
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
line.push(/*#__PURE__*/ React.createElement("path", {
|
|
129
|
+
key: _vbcLineId,
|
|
130
|
+
id: _vbcLineId,
|
|
131
|
+
opacity: shouldHighlight ? 1 : 0.1,
|
|
132
|
+
d: linePath(lineData),
|
|
133
|
+
fill: "transparent",
|
|
134
|
+
strokeLinecap: "square",
|
|
135
|
+
strokeWidth: 3,
|
|
136
|
+
stroke: lineLegendColor
|
|
137
|
+
}));
|
|
138
|
+
const dots = lineData.map((item, index)=>{
|
|
139
|
+
var _item_point_lineData;
|
|
140
|
+
// Create an object to store line point ref so that the object can be passed by reference to the focus handler
|
|
141
|
+
const circleRef = {
|
|
142
|
+
refElement: null
|
|
143
|
+
};
|
|
144
|
+
return /*#__PURE__*/ React.createElement("circle", {
|
|
145
|
+
key: index,
|
|
146
|
+
id: `${_vbcPointId}-${index}`,
|
|
147
|
+
cx: isStringAxis ? xScale(item.x) + 0.5 * xScale.bandwidth() : xScale(item.x),
|
|
148
|
+
cy: item.useSecondaryYScale && yScaleSecondary ? yScaleSecondary(item.y) : yScale(item.y),
|
|
149
|
+
onMouseOver: (event)=>_legendHighlighted(lineLegendText) ? _lineHover(item.point, event) : _onBarHover(item.point, colorScale(item.y), event),
|
|
150
|
+
onMouseOut: _onBarLeave,
|
|
151
|
+
r: _getCircleVisibilityAndRadius(item.x, lineLegendText).radius,
|
|
152
|
+
stroke: lineLegendColor,
|
|
153
|
+
fill: tokens.colorNeutralBackground1,
|
|
154
|
+
strokeWidth: 3,
|
|
155
|
+
visibility: _getCircleVisibilityAndRadius(item.x, lineLegendText).visibility,
|
|
156
|
+
onClick: (_item_point_lineData = item.point.lineData) === null || _item_point_lineData === void 0 ? void 0 : _item_point_lineData.onClick,
|
|
157
|
+
// When no legend is highlighted: Line points are automatically displayed along with the bars
|
|
158
|
+
// at the same x-axis point in the stack callout. So to prevent an increase in focusable elements
|
|
159
|
+
// and avoid conveying duplicate info, make these line points non-focusable.
|
|
160
|
+
"data-is-focusable": _legendHighlighted(lineLegendText),
|
|
161
|
+
ref: (e)=>circleRef.refElement = e,
|
|
162
|
+
onFocus: _lineFocus.bind(item.point, circleRef),
|
|
163
|
+
onBlur: _handleChartMouseLeave
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, line, dots);
|
|
167
|
+
}
|
|
168
|
+
function _getCircleVisibilityAndRadius(xAxisPoint, legend) {
|
|
169
|
+
if (!_noLegendHighlighted()) {
|
|
170
|
+
if (xAxisPoint === activeXdataPoint && _legendHighlighted(legend)) {
|
|
171
|
+
return {
|
|
172
|
+
visibility: "visibility",
|
|
173
|
+
radius: 8
|
|
174
|
+
};
|
|
175
|
+
} else if (_legendHighlighted(legend)) {
|
|
176
|
+
// Don't hide the circle to keep it focusable. For more information,
|
|
177
|
+
// see https://fuzzbomb.github.io/accessibility-demos/visually-hidden-focus-test.html
|
|
178
|
+
return {
|
|
179
|
+
visibility: "visibility",
|
|
180
|
+
radius: 0.3
|
|
181
|
+
};
|
|
182
|
+
} else {
|
|
183
|
+
return {
|
|
184
|
+
visibility: "hidden",
|
|
185
|
+
radius: 0
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
return {
|
|
190
|
+
visibility: activeXdataPoint === xAxisPoint ? "visibility" : "hidden",
|
|
191
|
+
radius: 8
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function _checkForLine() {
|
|
196
|
+
const { data } = props;
|
|
197
|
+
return data.some((item)=>{
|
|
198
|
+
var _item_lineData;
|
|
199
|
+
return (item === null || item === void 0 ? void 0 : (_item_lineData = item.lineData) === null || _item_lineData === void 0 ? void 0 : _item_lineData.y) !== undefined;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function _adjustProps() {
|
|
203
|
+
_points = props.data || [];
|
|
204
|
+
_barWidth = getBarWidth(props.barWidth, props.maxBarWidth);
|
|
205
|
+
const defaultColors = [
|
|
206
|
+
tokens.colorPaletteBlueForeground2,
|
|
207
|
+
tokens.colorPaletteCornflowerForeground2,
|
|
208
|
+
tokens.colorPaletteDarkGreenForeground2,
|
|
209
|
+
tokens.colorPaletteNavyForeground2,
|
|
210
|
+
tokens.colorPaletteDarkOrangeForeground2
|
|
211
|
+
];
|
|
212
|
+
_colors = props.colors || defaultColors;
|
|
213
|
+
_isHavingLine = _checkForLine();
|
|
214
|
+
_xAxisInnerPadding = getScalePadding(props.xAxisInnerPadding, props.xAxisPadding, 2 / 3);
|
|
215
|
+
_xAxisOuterPadding = getScalePadding(props.xAxisOuterPadding, props.xAxisPadding, 0);
|
|
216
|
+
}
|
|
217
|
+
function _getMargins(_margins) {
|
|
218
|
+
margins = _margins;
|
|
219
|
+
}
|
|
220
|
+
function _renderContentForBothLineAndBars(point) {
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
222
|
+
const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
|
|
223
|
+
const content = YValueHover.map((item, index)=>{
|
|
224
|
+
var _props_culture;
|
|
225
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ChartPopover, {
|
|
226
|
+
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
227
|
+
clickPosition: clickPosition,
|
|
228
|
+
isPopoverOpen: isPopoverOpen,
|
|
229
|
+
legend: item.legend,
|
|
230
|
+
...index === 0 && {
|
|
231
|
+
XValue: `${hoverXValue || item.data}`
|
|
232
|
+
},
|
|
233
|
+
YValue: item.data || item.y,
|
|
234
|
+
color: item.color,
|
|
235
|
+
isCalloutForStack: false
|
|
236
|
+
}));
|
|
237
|
+
});
|
|
238
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, content);
|
|
239
|
+
}
|
|
240
|
+
function _renderContentForOnlyBars(_props) {
|
|
241
|
+
var _props_culture;
|
|
242
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ChartPopover, {
|
|
243
|
+
XValue: _props.xAxisCalloutData || _props.x,
|
|
244
|
+
xCalloutValue: xCalloutValue,
|
|
245
|
+
yCalloutValue: yCalloutValue,
|
|
246
|
+
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
247
|
+
clickPosition: clickPosition,
|
|
248
|
+
isPopoverOpen: isPopoverOpen,
|
|
249
|
+
legend: _props.legend,
|
|
250
|
+
YValue: _props.yAxisCalloutData || _props.y,
|
|
251
|
+
color: !props.useSingleColor && _props.color ? _props.color : _createColors()(_props.y),
|
|
252
|
+
isCalloutForStack: false
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
256
|
+
function _renderCallout(props) {
|
|
257
|
+
return props ? _isHavingLine ? _renderContentForBothLineAndBars(props) : _renderContentForOnlyBars(props) : null;
|
|
258
|
+
}
|
|
259
|
+
function _getCustomizedCallout() {
|
|
260
|
+
return props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout) : null;
|
|
261
|
+
}
|
|
262
|
+
function _getGraphData(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
263
|
+
xScale, yScale, containerHeight, containerWidth, xElement) {
|
|
264
|
+
return _bars = _xAxisType === XAxisTypes.NumericAxis ? _createNumericBars(containerHeight, containerWidth, xElement) : _xAxisType === XAxisTypes.DateAxis ? _createDateBars(containerHeight, containerWidth, xElement) : _createStringBars(containerHeight, containerWidth, xElement);
|
|
265
|
+
}
|
|
266
|
+
function _createColors() {
|
|
267
|
+
const increment = _colors.length <= 1 ? 1 : 1 / (_colors.length - 1);
|
|
268
|
+
const { useSingleColor = false } = props;
|
|
269
|
+
if (useSingleColor) {
|
|
270
|
+
return (_p)=>{
|
|
271
|
+
const { colors } = props;
|
|
272
|
+
return colors && colors.length > 0 ? colors[0] : tokens.colorPaletteBlueBackground2;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const domainValues = [];
|
|
276
|
+
for(let i = 0; i < _colors.length; i++){
|
|
277
|
+
domainValues.push(increment * i * _yMax);
|
|
278
|
+
}
|
|
279
|
+
const colorScale = d3ScaleLinear().domain(domainValues).range(_colors);
|
|
280
|
+
return colorScale;
|
|
281
|
+
}
|
|
282
|
+
function _refCallback(element, legendTitle) {
|
|
283
|
+
_refArray.push({
|
|
284
|
+
index: legendTitle,
|
|
285
|
+
refElement: element
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function _getCalloutContentForLineAndBar(point) {
|
|
289
|
+
var _selectedPoint__lineData;
|
|
290
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
291
|
+
const YValueHover = [];
|
|
292
|
+
const { useSingleColor = false } = props;
|
|
293
|
+
const { data, lineLegendText, lineLegendColor = tokens.colorPaletteYellowBackground1 } = props;
|
|
294
|
+
const selectedPoint = data.filter((xDataPoint)=>xDataPoint.x === point.x);
|
|
295
|
+
// Check if the line legend is highlighted or no legend is highlighted
|
|
296
|
+
if (_isHavingLine && ((_selectedPoint__lineData = selectedPoint[0].lineData) === null || _selectedPoint__lineData === void 0 ? void 0 : _selectedPoint__lineData.y) !== undefined && (_legendHighlighted(lineLegendText) || _noLegendHighlighted())) {
|
|
297
|
+
var _selectedPoint__lineData1, _selectedPoint__lineData2, _selectedPoint__lineData3;
|
|
298
|
+
// Add callout data for the line
|
|
299
|
+
YValueHover.push({
|
|
300
|
+
legend: lineLegendText,
|
|
301
|
+
color: lineLegendColor,
|
|
302
|
+
y: (_selectedPoint__lineData1 = selectedPoint[0].lineData) === null || _selectedPoint__lineData1 === void 0 ? void 0 : _selectedPoint__lineData1.y,
|
|
303
|
+
data: (_selectedPoint__lineData2 = selectedPoint[0].lineData) === null || _selectedPoint__lineData2 === void 0 ? void 0 : _selectedPoint__lineData2.yAxisCalloutData,
|
|
304
|
+
yAxisCalloutData: (_selectedPoint__lineData3 = selectedPoint[0].lineData) === null || _selectedPoint__lineData3 === void 0 ? void 0 : _selectedPoint__lineData3.yAxisCalloutData
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
// Check if the bar legend is highlighted or no legend is highlighted
|
|
308
|
+
if (selectedPoint[0].legend && (selectedLegends.includes(selectedPoint[0].legend) || _noLegendHighlighted())) {
|
|
309
|
+
// Add callout data for the bar
|
|
310
|
+
YValueHover.push({
|
|
311
|
+
legend: selectedPoint[0].legend,
|
|
312
|
+
y: selectedPoint[0].y,
|
|
313
|
+
color: !useSingleColor ? selectedPoint[0].color ? selectedPoint[0].color : _createColors()(selectedPoint[0].y) : _createColors()(1),
|
|
314
|
+
data: selectedPoint[0].yAxisCalloutData,
|
|
315
|
+
yAxisCalloutData: selectedPoint[0].yAxisCalloutData
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
319
|
+
const hoverXValue = point.x instanceof Date ? point.x.toLocaleString() : point.x.toString();
|
|
320
|
+
return {
|
|
321
|
+
YValueHover,
|
|
322
|
+
hoverXValue: point.xAxisCalloutData || hoverXValue
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function _onBarHover(point, // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
326
|
+
color, mouseEvent) {
|
|
327
|
+
mouseEvent.persist();
|
|
328
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
329
|
+
const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
|
|
330
|
+
if (_calloutAnchorPoint !== point) {
|
|
331
|
+
_calloutAnchorPoint = point;
|
|
332
|
+
/** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
|
|
333
|
+
setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(point.legend));
|
|
334
|
+
setDataForHoverCard(point.y);
|
|
335
|
+
setCalloutLegend(point.legend);
|
|
336
|
+
setColor(point.color || color);
|
|
337
|
+
// To display callout value, if no callout value given, taking given point.x value as a string.
|
|
338
|
+
setXCalloutValue(point.xAxisCalloutData || (point.x instanceof Date ? point.x.toLocaleDateString() : point.x.toString()));
|
|
339
|
+
setDataPointCalloutProps(point);
|
|
340
|
+
// Hovering over a bar should highlight corresponding line points only when no legend is selected
|
|
341
|
+
setActiveXDatapoint(_noLegendHighlighted() ? point.x : null);
|
|
342
|
+
setYValueHover(YValueHover);
|
|
343
|
+
setHoverXValue(hoverXValue);
|
|
344
|
+
setCalloutAccessibilityData(point.callOutAccessibilityData);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function _onBarLeave() {
|
|
348
|
+
/**/ }
|
|
349
|
+
function _handleChartMouseLeave() {
|
|
350
|
+
_calloutAnchorPoint = null;
|
|
351
|
+
setPopoverOpen(false);
|
|
352
|
+
setActiveXDatapoint(null);
|
|
353
|
+
setYValueHover([]);
|
|
354
|
+
setHoverXValue('');
|
|
355
|
+
}
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
357
|
+
function _onBarFocus(point, refArrayIndexNumber, color) {
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
359
|
+
const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
|
|
360
|
+
_refArray.forEach((obj, index)=>{
|
|
361
|
+
if (obj.index === point.legend && refArrayIndexNumber === index) {
|
|
362
|
+
/** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(point.legend));
|
|
363
|
+
setDataForHoverCard(point.y);
|
|
364
|
+
setCalloutLegend(point.legend);
|
|
365
|
+
setColor(point.color || color);
|
|
366
|
+
// To display callout value, if no callout value given, taking given point.x value as a string.
|
|
367
|
+
setXCalloutValue(point.xAxisCalloutData || (point.x instanceof Date ? point.x.toLocaleDateString() : point.x.toString()));
|
|
368
|
+
setYCalloutValue(point.yAxisCalloutData);
|
|
369
|
+
setDataPointCalloutProps(point);
|
|
370
|
+
// Hovering over a bar should highlight corresponding line points only when no legend is selected
|
|
371
|
+
setActiveXDatapoint(point.x);
|
|
372
|
+
setYValueHover(YValueHover);
|
|
373
|
+
setHoverXValue(hoverXValue);
|
|
374
|
+
setCalloutAccessibilityData(point.callOutAccessibilityData);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function _lineHover(point, mouseEvent) {
|
|
379
|
+
mouseEvent.persist();
|
|
380
|
+
_lineHoverFocus(point, mouseEvent);
|
|
381
|
+
}
|
|
382
|
+
function _lineFocus(point, ref) {
|
|
383
|
+
if (ref.refElement) {
|
|
384
|
+
_lineHoverFocus(point, ref.refElement);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function _lineHoverFocus(point, _refSelected) {
|
|
388
|
+
const { lineLegendText = '', lineLegendColor = tokens.colorPaletteYellowBackground1 } = props;
|
|
389
|
+
setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(lineLegendText));
|
|
390
|
+
setCalloutLegend(lineLegendText);
|
|
391
|
+
setDataForHoverCard(point.lineData.y);
|
|
392
|
+
setColor(lineLegendColor);
|
|
393
|
+
setXCalloutValue(point.xAxisCalloutData || (point.x instanceof Date ? point.x.toLocaleDateString() : point.x.toString()));
|
|
394
|
+
setYCalloutValue(point.lineData.yAxisCalloutData);
|
|
395
|
+
setDataPointCalloutProps(point);
|
|
396
|
+
setActiveXDatapoint(point.x);
|
|
397
|
+
}
|
|
398
|
+
function _getScales(containerHeight, containerWidth) {
|
|
399
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
400
|
+
let xBarScale;
|
|
401
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
402
|
+
const yBarScale = d3ScaleLinear().domain([
|
|
403
|
+
_yMin,
|
|
404
|
+
_yMax
|
|
405
|
+
]).range([
|
|
406
|
+
0,
|
|
407
|
+
containerHeight - margins.bottom - margins.top
|
|
408
|
+
]);
|
|
409
|
+
if (_xAxisType === XAxisTypes.NumericAxis) {
|
|
410
|
+
const xMax = d3Max(_points, (point)=>point.x);
|
|
411
|
+
const xMin = d3Min(_points, (point)=>point.x);
|
|
412
|
+
xBarScale = d3ScaleLinear().domain(_useRtl ? [
|
|
413
|
+
xMax,
|
|
414
|
+
xMin
|
|
415
|
+
] : [
|
|
416
|
+
xMin,
|
|
417
|
+
xMax
|
|
418
|
+
]).nice().range([
|
|
419
|
+
margins.left + _domainMargin,
|
|
420
|
+
containerWidth - margins.right - _domainMargin
|
|
421
|
+
]);
|
|
422
|
+
} else if (_xAxisType === XAxisTypes.DateAxis) {
|
|
423
|
+
const sDate = d3Min(_points, (point)=>point.x);
|
|
424
|
+
const lDate = d3Max(_points, (point)=>point.x);
|
|
425
|
+
xBarScale = d3ScaleUtc().domain([
|
|
426
|
+
sDate,
|
|
427
|
+
lDate
|
|
428
|
+
]).range(_useRtl ? [
|
|
429
|
+
containerWidth - margins.right - _domainMargin,
|
|
430
|
+
margins.left + _domainMargin
|
|
431
|
+
] : [
|
|
432
|
+
margins.left + _domainMargin,
|
|
433
|
+
containerWidth - margins.right - _domainMargin
|
|
434
|
+
]);
|
|
435
|
+
} else {
|
|
436
|
+
xBarScale = d3ScaleBand().domain(_xAxisLabels).range(_useRtl ? [
|
|
437
|
+
containerWidth - margins.right - _domainMargin,
|
|
438
|
+
margins.left + _domainMargin
|
|
439
|
+
] : [
|
|
440
|
+
margins.left + _domainMargin,
|
|
441
|
+
containerWidth - margins.right - _domainMargin
|
|
442
|
+
]).paddingInner(_xAxisInnerPadding).paddingOuter(_xAxisOuterPadding);
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
xBarScale,
|
|
446
|
+
yBarScale
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
const classes = useVerticalBarChartStyles(props);
|
|
450
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
451
|
+
function _calculateMinBarHeight(yMin, yMax, yReferencePoint, yBarScale) {
|
|
452
|
+
const maxHeightFromBaseline = yMax < 0 ? Math.abs(yMin - yReferencePoint) : Math.max(Math.abs(yMax - yReferencePoint), Math.abs(yMin - yReferencePoint));
|
|
453
|
+
return Math.ceil(yBarScale(maxHeightFromBaseline) / 100.0);
|
|
454
|
+
}
|
|
455
|
+
function _createNumericBars(containerHeight, containerWidth, xElement) {
|
|
456
|
+
const { useSingleColor = false } = props;
|
|
457
|
+
const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
|
|
458
|
+
const colorScale = _createColors();
|
|
459
|
+
const yReferencePoint = _yMax < 0 ? _yMax : 0;
|
|
460
|
+
const bars = _points.map((point, index)=>{
|
|
461
|
+
const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
|
|
462
|
+
let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
|
|
463
|
+
const isHeightNegative = barHeight < 0;
|
|
464
|
+
barHeight = Math.abs(barHeight);
|
|
465
|
+
// Calculate threshold for minimum visible bar height
|
|
466
|
+
const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
|
|
467
|
+
let adjustedBarHeight = barHeight;
|
|
468
|
+
if (barHeight === 0) {
|
|
469
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
470
|
+
key: point.x
|
|
471
|
+
}, " ");
|
|
472
|
+
} else if (barHeight <= minBarHeight) {
|
|
473
|
+
adjustedBarHeight = minBarHeight;
|
|
474
|
+
}
|
|
475
|
+
const xPoint = xBarScale(point.x) - _barWidth / 2;
|
|
476
|
+
const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
|
|
477
|
+
const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
|
|
478
|
+
return /*#__PURE__*/ React.createElement("g", {
|
|
479
|
+
key: `${point.x}_${index}`
|
|
480
|
+
}, /*#__PURE__*/ React.createElement("rect", {
|
|
481
|
+
id: `${_vbcBarId}-${index}`,
|
|
482
|
+
x: xPoint,
|
|
483
|
+
y: !isHeightNegative ? yPoint : baselineHeight,
|
|
484
|
+
width: _barWidth,
|
|
485
|
+
"data-is-focusable": !props.hideTooltip && shouldHighlight,
|
|
486
|
+
height: adjustedBarHeight,
|
|
487
|
+
ref: (e)=>{
|
|
488
|
+
_refCallback(e, point.legend);
|
|
489
|
+
},
|
|
490
|
+
onClick: point.onClick,
|
|
491
|
+
onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
|
|
492
|
+
"aria-label": _getAriaLabel(point),
|
|
493
|
+
role: "img",
|
|
494
|
+
onMouseLeave: _onBarLeave,
|
|
495
|
+
onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
|
|
496
|
+
onBlur: _onBarLeave,
|
|
497
|
+
fill: point.color && !useSingleColor ? point.color : colorScale(point.y),
|
|
498
|
+
tabIndex: point.legend !== '' ? 0 : undefined,
|
|
499
|
+
opacity: shouldHighlight ? 1 : 0.1,
|
|
500
|
+
rx: props.roundCorners ? 3 : 0
|
|
501
|
+
}), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
|
|
502
|
+
});
|
|
503
|
+
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
504
|
+
if (!props.showXAxisLablesTooltip) {
|
|
505
|
+
try {
|
|
506
|
+
// eslint-disable-next-line no-restricted-globals
|
|
507
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
508
|
+
// eslint-disable-next-line no-empty
|
|
509
|
+
} catch (e) {}
|
|
510
|
+
}
|
|
511
|
+
// Used to display tooltip at x axis labels.
|
|
512
|
+
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
513
|
+
const xAxisElement = d3Select(xElement).call(xBarScale);
|
|
514
|
+
try {
|
|
515
|
+
// eslint-disable-next-line no-restricted-globals
|
|
516
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
517
|
+
// eslint-disable-next-line no-empty
|
|
518
|
+
} catch (e) {}
|
|
519
|
+
const tooltipProps = {
|
|
520
|
+
tooltipCls: classes.tooltip,
|
|
521
|
+
id: _tooltipId,
|
|
522
|
+
xAxis: xAxisElement
|
|
523
|
+
};
|
|
524
|
+
xAxisElement && tooltipOfXAxislabels(tooltipProps);
|
|
525
|
+
}
|
|
526
|
+
return bars;
|
|
527
|
+
}
|
|
528
|
+
function _createStringBars(containerHeight, containerWidth, xElement) {
|
|
529
|
+
const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
|
|
530
|
+
const colorScale = _createColors();
|
|
531
|
+
const yReferencePoint = _yMax < 0 ? _yMax : 0;
|
|
532
|
+
const bars = _points.map((point, index)=>{
|
|
533
|
+
const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
|
|
534
|
+
let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
|
|
535
|
+
const isHeightNegative = barHeight < 0;
|
|
536
|
+
barHeight = Math.abs(barHeight);
|
|
537
|
+
// Calculate threshold for minimum visible bar height
|
|
538
|
+
const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
|
|
539
|
+
let adjustedBarHeight = barHeight;
|
|
540
|
+
if (barHeight === 0) {
|
|
541
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
542
|
+
key: point.x
|
|
543
|
+
}, " ");
|
|
544
|
+
} else if (barHeight <= minBarHeight) {
|
|
545
|
+
adjustedBarHeight = minBarHeight;
|
|
546
|
+
}
|
|
547
|
+
const xPoint = xBarScale(point.x);
|
|
548
|
+
const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
|
|
549
|
+
const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
|
|
550
|
+
// Setting the bar width here is safe because there are no dependencies earlier in the code
|
|
551
|
+
// that rely on the width of bars in vertical bar charts with string x-axis.
|
|
552
|
+
_barWidth = getBarWidth(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
|
|
553
|
+
return /*#__PURE__*/ React.createElement("g", {
|
|
554
|
+
key: point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`,
|
|
555
|
+
transform: `translate(${0.5 * (xBarScale.bandwidth() - _barWidth)}, 0)`
|
|
556
|
+
}, /*#__PURE__*/ React.createElement("rect", {
|
|
557
|
+
id: `${_vbcBarId}-${index}`,
|
|
558
|
+
x: xPoint,
|
|
559
|
+
y: !isHeightNegative ? yPoint : baselineHeight,
|
|
560
|
+
width: _barWidth,
|
|
561
|
+
height: adjustedBarHeight,
|
|
562
|
+
"aria-label": _getAriaLabel(point),
|
|
563
|
+
role: "img",
|
|
564
|
+
ref: (e)=>{
|
|
565
|
+
_refCallback(e, point.legend);
|
|
566
|
+
},
|
|
567
|
+
onClick: point.onClick,
|
|
568
|
+
onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
|
|
569
|
+
onMouseLeave: _onBarLeave,
|
|
570
|
+
onBlur: _onBarLeave,
|
|
571
|
+
"data-is-focusable": !props.hideTooltip && shouldHighlight,
|
|
572
|
+
onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
|
|
573
|
+
fill: point.color ? point.color : colorScale(point.y),
|
|
574
|
+
tabIndex: point.legend !== '' ? 0 : undefined,
|
|
575
|
+
rx: props.roundCorners ? 3 : 0,
|
|
576
|
+
opacity: shouldHighlight ? 1 : 0.1
|
|
577
|
+
}), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
|
|
578
|
+
});
|
|
579
|
+
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
580
|
+
if (!props.showXAxisLablesTooltip) {
|
|
581
|
+
try {
|
|
582
|
+
// eslint-disable-next-line no-restricted-globals
|
|
583
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
584
|
+
// eslint-disable-next-line no-empty
|
|
585
|
+
} catch (e) {}
|
|
586
|
+
}
|
|
587
|
+
// Used to display tooltip at x axis labels.
|
|
588
|
+
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
589
|
+
const xAxisElement = d3Select(xElement).call(xBarScale);
|
|
590
|
+
try {
|
|
591
|
+
// eslint-disable-next-line no-restricted-globals
|
|
592
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
593
|
+
// eslint-disable-next-line no-empty
|
|
594
|
+
} catch (e) {}
|
|
595
|
+
const tooltipProps = {
|
|
596
|
+
tooltipCls: classes.tooltip,
|
|
597
|
+
id: _tooltipId,
|
|
598
|
+
xAxis: xAxisElement,
|
|
599
|
+
showTooltip: props.showXAxisLablesTooltip
|
|
600
|
+
};
|
|
601
|
+
xAxisElement && tooltipOfXAxislabels(tooltipProps);
|
|
602
|
+
}
|
|
603
|
+
return bars;
|
|
604
|
+
}
|
|
605
|
+
function _createDateBars(containerHeight, containerWidth, xElement) {
|
|
606
|
+
const { useSingleColor = false } = props;
|
|
607
|
+
const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
|
|
608
|
+
const colorScale = _createColors();
|
|
609
|
+
const yReferencePoint = _yMax < 0 ? _yMax : 0;
|
|
610
|
+
const bars = _points.map((point, index)=>{
|
|
611
|
+
const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
|
|
612
|
+
let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
|
|
613
|
+
const isHeightNegative = barHeight < 0;
|
|
614
|
+
barHeight = Math.abs(barHeight);
|
|
615
|
+
// Calculate threshold for minimum visible bar height
|
|
616
|
+
const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
|
|
617
|
+
let adjustedBarHeight = barHeight;
|
|
618
|
+
if (barHeight === 0) {
|
|
619
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
620
|
+
key: point.x
|
|
621
|
+
}, " ");
|
|
622
|
+
} else if (barHeight <= minBarHeight) {
|
|
623
|
+
adjustedBarHeight = minBarHeight;
|
|
624
|
+
}
|
|
625
|
+
const xPoint = xBarScale(point.x) - _barWidth / 2;
|
|
626
|
+
const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
|
|
627
|
+
const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
|
|
628
|
+
return /*#__PURE__*/ React.createElement("g", {
|
|
629
|
+
key: point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`
|
|
630
|
+
}, /*#__PURE__*/ React.createElement("rect", {
|
|
631
|
+
id: `${_vbcBarId}-${index}`,
|
|
632
|
+
x: xPoint,
|
|
633
|
+
className: classes.opacityChangeOnHover,
|
|
634
|
+
y: !isHeightNegative ? yPoint : baselineHeight,
|
|
635
|
+
width: _barWidth,
|
|
636
|
+
"data-is-focusable": !props.hideTooltip && shouldHighlight,
|
|
637
|
+
height: adjustedBarHeight,
|
|
638
|
+
ref: (e)=>{
|
|
639
|
+
_refCallback(e, point.legend);
|
|
640
|
+
},
|
|
641
|
+
onClick: point.onClick,
|
|
642
|
+
onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
|
|
643
|
+
"aria-label": _getAriaLabel(point),
|
|
644
|
+
role: "img",
|
|
645
|
+
onMouseLeave: _onBarLeave,
|
|
646
|
+
onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
|
|
647
|
+
onBlur: _onBarLeave,
|
|
648
|
+
fill: point.color && !useSingleColor ? point.color : colorScale(point.y),
|
|
649
|
+
tabIndex: point.legend !== '' ? 0 : undefined,
|
|
650
|
+
rx: props.roundCorners ? 3 : 0,
|
|
651
|
+
opacity: shouldHighlight ? 1 : 0.1
|
|
652
|
+
}), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
|
|
653
|
+
});
|
|
654
|
+
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
655
|
+
if (!props.showXAxisLablesTooltip) {
|
|
656
|
+
try {
|
|
657
|
+
// eslint-disable-next-line no-restricted-globals
|
|
658
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
659
|
+
// eslint-disable-next-line no-empty
|
|
660
|
+
} catch (e) {}
|
|
661
|
+
}
|
|
662
|
+
// Used to display tooltip at x axis labels.
|
|
663
|
+
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
664
|
+
const xAxisElement = d3Select(xElement).call(xBarScale);
|
|
665
|
+
try {
|
|
666
|
+
// eslint-disable-next-line no-restricted-globals
|
|
667
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
668
|
+
// eslint-disable-next-line no-empty
|
|
669
|
+
} catch (e) {}
|
|
670
|
+
const tooltipProps = {
|
|
671
|
+
tooltipCls: classes.tooltip,
|
|
672
|
+
id: _tooltipId,
|
|
673
|
+
xAxis: xAxisElement
|
|
674
|
+
};
|
|
675
|
+
xAxisElement && tooltipOfXAxislabels(tooltipProps);
|
|
676
|
+
}
|
|
677
|
+
return bars;
|
|
678
|
+
}
|
|
679
|
+
function _onLegendHover(legendTitle) {
|
|
680
|
+
setActiveLegend(legendTitle);
|
|
681
|
+
}
|
|
682
|
+
function _onLegendLeave() {
|
|
683
|
+
setActiveLegend(undefined);
|
|
684
|
+
}
|
|
685
|
+
function _getLegendData(data) {
|
|
686
|
+
const { useSingleColor } = props;
|
|
687
|
+
const { lineLegendText, lineLegendColor = tokens.colorPaletteYellowForeground1 } = props;
|
|
688
|
+
const actions = [];
|
|
689
|
+
const mapLegendToColor = {};
|
|
690
|
+
data.forEach((point, _index)=>{
|
|
691
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
692
|
+
const color = !useSingleColor ? point.color : _createColors()(1);
|
|
693
|
+
mapLegendToColor[point.legend] = color;
|
|
694
|
+
});
|
|
695
|
+
Object.entries(mapLegendToColor).forEach(([legendTitle, color])=>{
|
|
696
|
+
// mapping data to the format Legends component needs
|
|
697
|
+
const legend = {
|
|
698
|
+
title: legendTitle,
|
|
699
|
+
color,
|
|
700
|
+
hoverAction: ()=>{
|
|
701
|
+
_handleChartMouseLeave();
|
|
702
|
+
_onLegendHover(legendTitle);
|
|
703
|
+
},
|
|
704
|
+
onMouseOutAction: ()=>{
|
|
705
|
+
_onLegendLeave();
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
actions.push(legend);
|
|
709
|
+
});
|
|
710
|
+
if (_isHavingLine && lineLegendText && lineLegendColor) {
|
|
711
|
+
const lineLegend = {
|
|
712
|
+
title: lineLegendText,
|
|
713
|
+
color: lineLegendColor,
|
|
714
|
+
hoverAction: ()=>{
|
|
715
|
+
_handleChartMouseLeave();
|
|
716
|
+
_onLegendHover(lineLegendText);
|
|
717
|
+
},
|
|
718
|
+
onMouseOutAction: ()=>{
|
|
719
|
+
_onLegendLeave();
|
|
720
|
+
},
|
|
721
|
+
isLineLegendInBarChart: true
|
|
722
|
+
};
|
|
723
|
+
actions.unshift(lineLegend);
|
|
724
|
+
}
|
|
725
|
+
const legends = /*#__PURE__*/ React.createElement(Legends, {
|
|
726
|
+
legends: actions,
|
|
727
|
+
enabledWrapLines: props.enabledLegendsWrapLines,
|
|
728
|
+
overflowText: props.legendsOverflowText,
|
|
729
|
+
...props.legendProps,
|
|
730
|
+
selectedLegends: selectedLegends,
|
|
731
|
+
onChange: _onLegendSelectionChange
|
|
732
|
+
});
|
|
733
|
+
return legends;
|
|
734
|
+
}
|
|
735
|
+
function _onLegendSelectionChange(legendsSelected, event, currentLegend) {
|
|
736
|
+
var _props_legendProps, _props_legendProps1;
|
|
737
|
+
if ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.canSelectMultipleLegends) {
|
|
738
|
+
setSelectedLegends(legendsSelected);
|
|
739
|
+
} else {
|
|
740
|
+
setSelectedLegends(legendsSelected.slice(-1));
|
|
741
|
+
}
|
|
742
|
+
if ((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.onChange) {
|
|
743
|
+
props.legendProps.onChange(legendsSelected, event, currentLegend);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
function _getAxisData(yAxisData) {
|
|
747
|
+
if (yAxisData && yAxisData.yAxisDomainValues.length) {
|
|
748
|
+
const { yAxisDomainValues: domainValue } = yAxisData;
|
|
749
|
+
_yMax = Math.max(domainValue[domainValue.length - 1], props.yMaxValue || 0);
|
|
750
|
+
_yMin = Math.min(domainValue[0], props.yMinValue || 0);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* This function checks if the given legend is highlighted or not.
|
|
755
|
+
* A legend can be highlighted in 2 ways:
|
|
756
|
+
* 1. selection: if the user clicks on it
|
|
757
|
+
* 2. hovering: if there is no selected legend and the user hovers over it
|
|
758
|
+
*/ function _legendHighlighted(legendTitle) {
|
|
759
|
+
return _getHighlightedLegend().includes(legendTitle);
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* This function checks if none of the legends is selected or hovered.
|
|
763
|
+
*/ function _noLegendHighlighted() {
|
|
764
|
+
return _getHighlightedLegend().length === 0;
|
|
765
|
+
}
|
|
766
|
+
function _getHighlightedLegend() {
|
|
767
|
+
return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [
|
|
768
|
+
activeLegend
|
|
769
|
+
] : [];
|
|
770
|
+
}
|
|
771
|
+
function _getAriaLabel(point) {
|
|
772
|
+
var _point_lineData, _point_lineData1, _point_callOutAccessibilityData;
|
|
773
|
+
const xValue = point.xAxisCalloutData ? point.xAxisCalloutData : point.x instanceof Date ? point.x.toLocaleString() : point.x;
|
|
774
|
+
const legend = point.legend;
|
|
775
|
+
const yValue = point.yAxisCalloutData || point.y;
|
|
776
|
+
const lineLegend = props.lineLegendText || 'Line';
|
|
777
|
+
const lineYValue = ((_point_lineData = point.lineData) === null || _point_lineData === void 0 ? void 0 : _point_lineData.yAxisCalloutData) || ((_point_lineData1 = point.lineData) === null || _point_lineData1 === void 0 ? void 0 : _point_lineData1.y);
|
|
778
|
+
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ` + (legend ? `${legend}, ` : '') + `${yValue}.` + (typeof lineYValue !== 'undefined' ? ` ${lineLegend}, ${lineYValue}.` : '');
|
|
779
|
+
}
|
|
780
|
+
function _renderBarLabel(xPoint, yPoint, barValue, legend, isNegativeBar) {
|
|
781
|
+
if (props.hideLabels || _barWidth < 16 || !(_legendHighlighted(legend) || _noLegendHighlighted())) {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
return /*#__PURE__*/ React.createElement("text", {
|
|
785
|
+
x: xPoint + _barWidth / 2,
|
|
786
|
+
y: isNegativeBar ? yPoint + 12 : yPoint - 6,
|
|
787
|
+
textAnchor: "middle",
|
|
788
|
+
className: classes.barLabel,
|
|
789
|
+
"aria-hidden": true
|
|
790
|
+
}, formatValueWithSIPrefix(barValue));
|
|
791
|
+
}
|
|
792
|
+
function _getDomainMargins(containerWidth) {
|
|
793
|
+
_domainMargin = MIN_DOMAIN_MARGIN;
|
|
794
|
+
/** Total width available to render the bars */ const totalWidth = containerWidth - (margins.left + MIN_DOMAIN_MARGIN) - (margins.right + MIN_DOMAIN_MARGIN);
|
|
795
|
+
/** Rate at which the space between the bars changes wrt the bar width */ const barGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
|
|
796
|
+
if (_xAxisType === XAxisTypes.StringAxis) {
|
|
797
|
+
if (isScalePaddingDefined(props.xAxisOuterPadding, props.xAxisPadding)) {
|
|
798
|
+
// Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
|
|
799
|
+
// to adjust the space before the first bar and after the last bar.
|
|
800
|
+
_domainMargin = 0;
|
|
801
|
+
} else if (props.barWidth !== 'auto') {
|
|
802
|
+
// Update the bar width so that when CartesianChart rerenders,
|
|
803
|
+
// the following calculations don't use the previous bar width.
|
|
804
|
+
_barWidth = getBarWidth(props.barWidth, props.maxBarWidth);
|
|
805
|
+
/** Total width required to render the bars. Directly proportional to bar width */ const reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * _barWidth;
|
|
806
|
+
if (totalWidth >= reqWidth) {
|
|
807
|
+
// Center align the chart by setting equal left and right margins for domain
|
|
808
|
+
_domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
|
|
809
|
+
}
|
|
810
|
+
} else if (props.mode === 'plotly' && _xAxisLabels.length > 1) {
|
|
811
|
+
// Calculate the remaining width after rendering bars at their maximum allowable width
|
|
812
|
+
const bandwidth = totalWidth / (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate);
|
|
813
|
+
const barWidth = getBarWidth(props.barWidth, props.maxBarWidth, bandwidth);
|
|
814
|
+
let reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * barWidth;
|
|
815
|
+
const margin1 = (totalWidth - reqWidth) / 2;
|
|
816
|
+
// Calculate the remaining width after accounting for the space required to render x-axis labels
|
|
817
|
+
const step = calculateLongestLabelWidth(_xAxisLabels) + 20;
|
|
818
|
+
reqWidth = (_xAxisLabels.length - _xAxisInnerPadding) * step;
|
|
819
|
+
const margin2 = (totalWidth - reqWidth) / 2;
|
|
820
|
+
_domainMargin = MIN_DOMAIN_MARGIN + Math.max(0, Math.min(margin1, margin2));
|
|
821
|
+
}
|
|
822
|
+
} else {
|
|
823
|
+
var _props_data;
|
|
824
|
+
const uniqueX = {};
|
|
825
|
+
(_props_data = props.data) === null || _props_data === void 0 ? void 0 : _props_data.forEach((point)=>{
|
|
826
|
+
if (point.x instanceof Date) {
|
|
827
|
+
uniqueX[point.x.getTime()] = point.x;
|
|
828
|
+
} else {
|
|
829
|
+
uniqueX[point.x] = point.x;
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
const data = Object.values(uniqueX);
|
|
833
|
+
_barWidth = getBarWidth(props.barWidth, props.maxBarWidth, calculateAppropriateBarWidth(data, totalWidth));
|
|
834
|
+
_domainMargin = MIN_DOMAIN_MARGIN + _barWidth / 2;
|
|
835
|
+
}
|
|
836
|
+
return {
|
|
837
|
+
...margins,
|
|
838
|
+
left: margins.left + _domainMargin,
|
|
839
|
+
right: margins.right + _domainMargin
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
function _isChartEmpty() {
|
|
843
|
+
return _points.length === 0 || _points.every((point)=>point.y === 0) && !_isHavingLine;
|
|
844
|
+
}
|
|
845
|
+
function updatePosition(newX, newY) {
|
|
846
|
+
const threshold = 1; // Set a threshold for movement
|
|
847
|
+
const { x, y } = clickPosition;
|
|
848
|
+
// Calculate the distance moved
|
|
849
|
+
const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
|
|
850
|
+
// Update the position only if the distance moved is greater than the threshold
|
|
851
|
+
if (distance > threshold) {
|
|
852
|
+
setClickPosition({
|
|
853
|
+
x: newX,
|
|
854
|
+
y: newY
|
|
855
|
+
});
|
|
856
|
+
setPopoverOpen(true);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
_adjustProps();
|
|
860
|
+
_xAxisLabels = _points.map((point)=>point.x);
|
|
861
|
+
_yMax = Math.max(d3Max(_points, (point)=>point.y), props.yMaxValue || 0);
|
|
862
|
+
_yMin = Math.min(d3Min(_points, (point)=>point.y), props.yMinValue || 0);
|
|
863
|
+
const legendBars = _getLegendData(_points);
|
|
864
|
+
var _props_culture;
|
|
865
|
+
const calloutProps = {
|
|
866
|
+
..._isHavingLine && {
|
|
867
|
+
YValueHover: hoveredYValues,
|
|
868
|
+
hoverXValue: hoverXValue
|
|
869
|
+
},
|
|
870
|
+
color: color,
|
|
871
|
+
legend: calloutLegend,
|
|
872
|
+
XValue: xCalloutValue,
|
|
873
|
+
YValue: yCalloutValue ? yCalloutValue : dataForHoverCard,
|
|
874
|
+
...props.calloutProps,
|
|
875
|
+
...getAccessibleDataObject(callOutAccessibilityData),
|
|
876
|
+
clickPosition: clickPosition,
|
|
877
|
+
isPopoverOpen: isPopoverOpen,
|
|
878
|
+
isCalloutForStack: _isHavingLine && (_noLegendHighlighted() || _getHighlightedLegend().length > 1),
|
|
879
|
+
culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
|
|
880
|
+
isCartesian: true,
|
|
881
|
+
customCallout: {
|
|
882
|
+
customizedCallout: _getCustomizedCallout() != null ? _getCustomizedCallout() : undefined,
|
|
883
|
+
customCalloutProps: props.calloutPropsPerDataPoint ? props.calloutPropsPerDataPoint(dataPointCalloutProps) : undefined
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
const tickParams = {
|
|
887
|
+
tickValues: props.tickValues,
|
|
888
|
+
tickFormat: props.tickFormat
|
|
889
|
+
};
|
|
890
|
+
return !_isChartEmpty() ? /*#__PURE__*/ React.createElement(CartesianChart, {
|
|
891
|
+
...props,
|
|
892
|
+
points: _points,
|
|
893
|
+
chartType: ChartTypes.VerticalBarChart,
|
|
894
|
+
xAxisType: _xAxisType,
|
|
895
|
+
calloutProps: calloutProps,
|
|
896
|
+
tickParams: tickParams,
|
|
897
|
+
..._isHavingLine && _noLegendHighlighted() && {
|
|
898
|
+
isCalloutForStack: true
|
|
899
|
+
},
|
|
900
|
+
legendBars: legendBars,
|
|
901
|
+
datasetForXAxisDomain: _xAxisLabels,
|
|
902
|
+
barwidth: _barWidth,
|
|
903
|
+
getmargins: _getMargins,
|
|
904
|
+
getGraphData: _getGraphData,
|
|
905
|
+
getAxisData: _getAxisData,
|
|
906
|
+
onChartMouseLeave: _handleChartMouseLeave,
|
|
907
|
+
getDomainMargins: _getDomainMargins,
|
|
908
|
+
..._xAxisType === XAxisTypes.StringAxis && {
|
|
909
|
+
xAxisInnerPadding: _xAxisInnerPadding,
|
|
910
|
+
xAxisOuterPadding: _xAxisOuterPadding
|
|
911
|
+
},
|
|
912
|
+
componentRef: cartesianChartRef,
|
|
913
|
+
/* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
|
|
914
|
+
children: (props)=>{
|
|
915
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g", null, _bars), _isHavingLine && /*#__PURE__*/ React.createElement("g", null, _createLine(props.xScale, props.yScale, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
|
|
916
|
+
}
|
|
917
|
+
}) : /*#__PURE__*/ React.createElement("div", {
|
|
918
|
+
id: _emptyChartId,
|
|
919
|
+
role: 'alert',
|
|
920
|
+
style: {
|
|
921
|
+
opacity: '0'
|
|
922
|
+
},
|
|
923
|
+
"aria-label": 'Graph has no data to display'
|
|
924
|
+
});
|
|
925
|
+
});
|
|
926
|
+
VerticalBarChart.displayName = 'VerticalBarChart';
|