@fluentui/react-charts 9.3.5 → 9.3.7
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 +42 -2
- package/dist/index.d.ts +239 -55
- package/lib/AnnotationOnlyChart.js +1 -0
- package/lib/AnnotationOnlyChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +194 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/index.js +2 -0
- package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +31 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +23 -0
- package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +3 -16
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +11 -6
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +2 -10
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +59 -39
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +5 -5
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +617 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/index.js +2 -0
- package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +173 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +126 -0
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +159 -132
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +1 -2
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/index.js +2 -0
- package/lib/components/CommonComponents/index.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +32 -14
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +17 -2
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +2 -6
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +1 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +83 -40
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +4 -8
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +692 -94
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +23 -8
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +2 -2
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +3 -12
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +4 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +2 -2
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +2 -10
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +6 -19
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +3 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +2 -10
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +8 -20
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +11 -6
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +4 -17
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +25 -12
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +4 -4
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -23
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.js +97 -37
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.raw.js +10 -11
- package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +11 -20
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +15 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +3 -9
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +13 -10
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +24 -24
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +13 -8
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.js +11 -7
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +3 -15
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +13 -8
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +8 -18
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +11 -6
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/ChartAnnotation.js +1 -0
- package/lib/types/ChartAnnotation.js.map +1 -0
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/Common.styles.js +1 -2
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +1 -2
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/getWindow.js +0 -1
- package/lib/utilities/getWindow.js.map +1 -1
- package/lib/utilities/hooks.js +34 -0
- package/lib/utilities/hooks.js.map +1 -0
- package/lib/utilities/image-export-utils.js +221 -73
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +39 -37
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/AnnotationOnlyChart.js +6 -0
- package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +205 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +6 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.js +7 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +56 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +33 -0
- package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -15
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +14 -15
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +3 -10
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +74 -102
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +4 -4
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +628 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +4 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/index.js +7 -0
- package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +265 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +161 -0
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +159 -131
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/index.js +2 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +35 -22
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +17 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +0 -14
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +82 -39
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +678 -60
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +25 -16
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +2 -11
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +2 -2
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +2 -10
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +5 -18
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +3 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +2 -10
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +8 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +14 -15
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +3 -16
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +47 -34
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +3 -3
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -21
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +144 -86
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +9 -10
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +11 -20
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +18 -19
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +3 -9
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +16 -19
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +22 -22
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +16 -17
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -15
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +16 -17
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +7 -17
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +14 -15
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js +6 -0
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/types/index.js +1 -0
- package/lib-commonjs/types/index.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +1 -2
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +1 -2
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/getWindow.js +0 -1
- package/lib-commonjs/utilities/getWindow.js.map +1 -1
- package/lib-commonjs/utilities/hooks.js +45 -0
- package/lib-commonjs/utilities/hooks.js.map +1 -0
- package/lib-commonjs/utilities/image-export-utils.js +222 -74
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +37 -33
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +11 -11
|
@@ -5,13 +5,18 @@ import { select as d3Select } from 'd3-selection';
|
|
|
5
5
|
import { createNumericXAxis, createStringXAxis, createDateXAxis, XAxisTypes, YAxisType, createWrapOfXLabels, rotateXAxisLabels, calculateLongestLabelWidth, createYAxisLabels, ChartTypes, wrapContent, useRtl, truncateString, tooltipOfAxislabels, getSecureProps, DEFAULT_WRAP_WIDTH } from '../../utilities/index';
|
|
6
6
|
import { useId } from '@fluentui/react-utilities';
|
|
7
7
|
import { SVGTooltipText } from '../../utilities/SVGTooltipText';
|
|
8
|
+
import { ChartAnnotationLayer } from './Annotations/ChartAnnotationLayer';
|
|
8
9
|
import { ChartPopover } from './ChartPopover';
|
|
9
10
|
import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
11
|
+
const HORIZONTAL_MARGIN_FOR_YAXIS_TITLE = 24;
|
|
12
|
+
const VERTICAL_MARGIN_FOR_XAXIS_TITLE = 20;
|
|
13
|
+
const AXIS_TITLE_PADDING = 8;
|
|
14
|
+
const DEFAULT_MARGIN_WITH_TICKS = 40;
|
|
15
|
+
const DEFAULT_MARGIN_NO_TICKS = 20;
|
|
10
16
|
/**
|
|
11
17
|
* Cartesian Chart component
|
|
12
18
|
* {@docCategory CartesianChart}
|
|
13
19
|
*/ export const CartesianChart = /*#__PURE__*/ React.forwardRef(({ hideTickOverlap = true, ...props }, forwardedRef)=>{
|
|
14
|
-
var _props_margins, _props_margins1, _props_margins2, _props_margins3, _props_margins4, _props_margins5;
|
|
15
20
|
const chartContainer = React.useRef(null);
|
|
16
21
|
let legendContainer;
|
|
17
22
|
const minLegendContainerHeight = 40;
|
|
@@ -23,7 +28,6 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
23
28
|
let _reqID;
|
|
24
29
|
const _useRtl = useRtl();
|
|
25
30
|
let _tickValues;
|
|
26
|
-
const titleMargin = 8;
|
|
27
31
|
const _isFirstRender = React.useRef(true);
|
|
28
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
33
|
let _xScale;
|
|
@@ -39,61 +43,12 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
39
43
|
* These value need to be removed from actual svg height/graph height.
|
|
40
44
|
* Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.
|
|
41
45
|
*/ let _removalValueForTextTuncate = 0;
|
|
46
|
+
const _yAxisTickText = React.useRef([]);
|
|
42
47
|
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
43
48
|
const [containerHeight, setContainerHeight] = React.useState(0);
|
|
44
49
|
const [startFromX, setStartFromX] = React.useState(0);
|
|
45
50
|
const prevWidthRef = React.useRef(undefined);
|
|
46
51
|
const prevHeightRef = React.useRef(undefined);
|
|
47
|
-
const chartTypesWithStringYAxis = [
|
|
48
|
-
ChartTypes.HorizontalBarChartWithAxis,
|
|
49
|
-
ChartTypes.HeatMapChart,
|
|
50
|
-
ChartTypes.VerticalStackedBarChart,
|
|
51
|
-
ChartTypes.GanttChart,
|
|
52
|
-
ChartTypes.ScatterChart
|
|
53
|
-
];
|
|
54
|
-
var _props_margins_top, _props_margins_bottom, _props_margins_left, _props_margins_right, _props_margins_right1, _props_margins_left1;
|
|
55
|
-
/**
|
|
56
|
-
* In RTL mode, Only graph will be rendered left/right. We need to provide left and right margins manually.
|
|
57
|
-
* So that, in RTL, left margins becomes right margins and viceversa.
|
|
58
|
-
* As graph needs to be drawn perfecty, these values consider as default values.
|
|
59
|
-
* Same margins using for all other cartesian charts. Can be accessible through 'getMargins' call back method.
|
|
60
|
-
*/ // eslint-disable-next-line prefer-const
|
|
61
|
-
margins = {
|
|
62
|
-
top: (_props_margins_top = (_props_margins = props.margins) === null || _props_margins === void 0 ? void 0 : _props_margins.top) !== null && _props_margins_top !== void 0 ? _props_margins_top : 20,
|
|
63
|
-
bottom: (_props_margins_bottom = (_props_margins1 = props.margins) === null || _props_margins1 === void 0 ? void 0 : _props_margins1.bottom) !== null && _props_margins_bottom !== void 0 ? _props_margins_bottom : 35,
|
|
64
|
-
right: _useRtl ? (_props_margins_left = (_props_margins2 = props.margins) === null || _props_margins2 === void 0 ? void 0 : _props_margins2.left) !== null && _props_margins_left !== void 0 ? _props_margins_left : 40 : ((_props_margins_right = (_props_margins3 = props.margins) === null || _props_margins3 === void 0 ? void 0 : _props_margins3.right) !== null && _props_margins_right !== void 0 ? _props_margins_right : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20,
|
|
65
|
-
left: _useRtl ? ((_props_margins_right1 = (_props_margins4 = props.margins) === null || _props_margins4 === void 0 ? void 0 : _props_margins4.right) !== null && _props_margins_right1 !== void 0 ? _props_margins_right1 : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20 : (_props_margins_left1 = (_props_margins5 = props.margins) === null || _props_margins5 === void 0 ? void 0 : _props_margins5.left) !== null && _props_margins_left1 !== void 0 ? _props_margins_left1 : 40
|
|
66
|
-
};
|
|
67
|
-
const TITLE_MARGIN_HORIZONTAL = 24;
|
|
68
|
-
const TITLE_MARGIN_VERTICAL = 20;
|
|
69
|
-
if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
|
|
70
|
-
var _props_margins6;
|
|
71
|
-
var _props_margins_bottom1;
|
|
72
|
-
margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : margins.bottom + TITLE_MARGIN_VERTICAL;
|
|
73
|
-
}
|
|
74
|
-
if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
|
|
75
|
-
var _props_margins7, _props_margins8, _props_margins9, _props_margins10;
|
|
76
|
-
var _props_margins_right2, _props_margins_left2;
|
|
77
|
-
margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN_HORIZONTAL : margins.right + TITLE_MARGIN_HORIZONTAL : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : margins.left + TITLE_MARGIN_HORIZONTAL;
|
|
78
|
-
var _props_margins_left3, _props_margins_right3;
|
|
79
|
-
margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : margins.left + TITLE_MARGIN_HORIZONTAL : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN_HORIZONTAL : margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
80
|
-
}
|
|
81
|
-
if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
|
|
82
|
-
var _props_margins11;
|
|
83
|
-
var _props_margins_top1;
|
|
84
|
-
margins.top = (_props_margins_top1 = (_props_margins11 = props.margins) === null || _props_margins11 === void 0 ? void 0 : _props_margins11.top) !== null && _props_margins_top1 !== void 0 ? _props_margins_top1 : margins.top + TITLE_MARGIN_VERTICAL;
|
|
85
|
-
}
|
|
86
|
-
if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
|
|
87
|
-
if (_useRtl) {
|
|
88
|
-
var _props_margins12;
|
|
89
|
-
var _props_margins_right4;
|
|
90
|
-
margins.left = (_props_margins_right4 = (_props_margins12 = props.margins) === null || _props_margins12 === void 0 ? void 0 : _props_margins12.right) !== null && _props_margins_right4 !== void 0 ? _props_margins_right4 : margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
91
|
-
} else {
|
|
92
|
-
var _props_margins13;
|
|
93
|
-
var _props_margins_right5;
|
|
94
|
-
margins.right = (_props_margins_right5 = (_props_margins13 = props.margins) === null || _props_margins13 === void 0 ? void 0 : _props_margins13.right) !== null && _props_margins_right5 !== void 0 ? _props_margins_right5 : margins.right + TITLE_MARGIN_HORIZONTAL;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
52
|
const classes = useCartesianChartStyles(props);
|
|
98
53
|
const focusAttributes = useFocusableGroup();
|
|
99
54
|
const arrowAttributes = useArrowNavigationGroup({
|
|
@@ -102,7 +57,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
102
57
|
// ComponentdidMount and Componentwillunmount logic
|
|
103
58
|
React.useEffect(()=>{
|
|
104
59
|
_fitParentContainer();
|
|
105
|
-
if (
|
|
60
|
+
if (props.showYAxisLables) {
|
|
106
61
|
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
|
|
107
62
|
if (startFromX !== maxYAxisLabelLength) {
|
|
108
63
|
setStartFromX(maxYAxisLabelLength);
|
|
@@ -127,7 +82,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
127
82
|
// Update refs with current values
|
|
128
83
|
prevWidthRef.current = props.width;
|
|
129
84
|
prevHeightRef.current = props.height;
|
|
130
|
-
if (
|
|
85
|
+
if (props.showYAxisLables) {
|
|
131
86
|
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
|
|
132
87
|
if (startFromX !== maxYAxisLabelLength) {
|
|
133
88
|
setStartFromX(maxYAxisLabelLength);
|
|
@@ -165,33 +120,26 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
165
120
|
}
|
|
166
121
|
return str;
|
|
167
122
|
};
|
|
168
|
-
return calculateLongestLabelWidth(
|
|
123
|
+
return calculateLongestLabelWidth(_yAxisTickText.current.map((label)=>formatTickLabel(label)), `.${className} text`);
|
|
169
124
|
}
|
|
170
125
|
const { calloutProps, points, chartType, svgProps, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter } = props;
|
|
171
126
|
if (props.parentRef) {
|
|
172
127
|
_fitParentContainer();
|
|
173
128
|
}
|
|
174
|
-
|
|
175
|
-
...margins
|
|
176
|
-
};
|
|
177
|
-
// Note: This check is unnecessary since startFromX is only set for charts with string y-axis.
|
|
178
|
-
if (chartTypesWithStringYAxis.includes(props.chartType)) {
|
|
179
|
-
if (!_useRtl) {
|
|
180
|
-
margin.left += startFromX;
|
|
181
|
-
} else {
|
|
182
|
-
margin.right += startFromX;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
129
|
+
margins = _calcMargins();
|
|
185
130
|
// Callback for margins to the chart
|
|
186
|
-
props.getmargins && props.getmargins(
|
|
131
|
+
props.getmargins && props.getmargins(margins);
|
|
187
132
|
let callout = null;
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
|
+
let yScalePrimary;
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
136
|
+
let yScaleSecondary;
|
|
188
137
|
let children = null;
|
|
189
138
|
if (props.enableFirstRenderOptimization && chartContainer.current || !props.enableFirstRenderOptimization) {
|
|
190
139
|
_isFirstRender.current = false;
|
|
191
140
|
var _props_showRoundOffXTickValues;
|
|
192
141
|
const XAxisParams = {
|
|
193
|
-
domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues,
|
|
194
|
-
startFromX),
|
|
142
|
+
domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues),
|
|
195
143
|
// FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.
|
|
196
144
|
// Since the x-axis in HBWA is numeric, it typically doesn't require transformation.
|
|
197
145
|
// However, if transformation props are enabled, the updated _removalValueForTextTuncate
|
|
@@ -211,6 +159,8 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
211
159
|
containerWidth: containerWidth,
|
|
212
160
|
hideTickOverlap: props.rotateXAxisLables ? false : hideTickOverlap,
|
|
213
161
|
calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,
|
|
162
|
+
xMinValue: props.xMinValue,
|
|
163
|
+
xMaxValue: props.xMaxValue,
|
|
214
164
|
...props.xAxis
|
|
215
165
|
};
|
|
216
166
|
/**
|
|
@@ -261,15 +211,12 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
261
211
|
* 1. To create x and y axis
|
|
262
212
|
* 2. To draw the graph.
|
|
263
213
|
* For area/line chart using same scales. For other charts, creating their own scales to draw the graph.
|
|
264
|
-
*/
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
let yScaleSecondary;
|
|
268
|
-
const axisData = {
|
|
269
|
-
yAxisDomainValues: []
|
|
214
|
+
*/ const axisData = {
|
|
215
|
+
yAxisDomainValues: [],
|
|
216
|
+
yAxisTickText: []
|
|
270
217
|
};
|
|
271
218
|
if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {
|
|
272
|
-
yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth, props.chartType);
|
|
219
|
+
yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, axisData, props.barwidth, props.chartType);
|
|
273
220
|
} else {
|
|
274
221
|
// TODO: Since the scale domain values are now computed independently for both the primary and
|
|
275
222
|
// secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately
|
|
@@ -296,42 +243,41 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
296
243
|
}
|
|
297
244
|
yScalePrimary = props.createYAxis(YAxisParams, _useRtl, axisData, isIntegralDataset, chartType, false, props.roundedTicks, props.yScaleType, _useRtl);
|
|
298
245
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
246
|
+
_yAxisTickText.current = axisData.yAxisTickText;
|
|
247
|
+
props.getAxisData && props.getAxisData(axisData);
|
|
248
|
+
// Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
|
|
249
|
+
// of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
|
|
250
|
+
// in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)
|
|
251
|
+
if (!props.showYAxisLablesTooltip) {
|
|
252
|
+
try {
|
|
253
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
254
|
+
//eslint-disable-next-line no-empty
|
|
255
|
+
} catch (e) {}
|
|
256
|
+
}
|
|
257
|
+
// Used to display tooltip at y axis labels.
|
|
258
|
+
if (props.showYAxisLablesTooltip) {
|
|
259
|
+
// To create y axis tick values by if specified truncating the rest of the text
|
|
260
|
+
// and showing elipsis or showing the whole string,
|
|
261
|
+
yScalePrimary && // Note: This function should be invoked within the showYAxisLablesTooltip check,
|
|
262
|
+
// as its sole purpose is to truncate labels that exceed the noOfCharsToTruncate limit.
|
|
263
|
+
createYAxisLabels(yAxisElement.current, yScalePrimary, props.noOfCharsToTruncate || 4, props.showYAxisLablesTooltip || false, _useRtl);
|
|
264
|
+
const _yAxisElement = d3Select(yAxisElement.current).call(yScalePrimary);
|
|
265
|
+
try {
|
|
266
|
+
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
267
|
+
//eslint-disable-next-line no-empty
|
|
268
|
+
} catch (e) {}
|
|
269
|
+
const ytooltipProps = {
|
|
270
|
+
tooltipCls: classes.tooltip,
|
|
271
|
+
id: _tooltipId,
|
|
272
|
+
axis: _yAxisElement
|
|
273
|
+
};
|
|
274
|
+
_yAxisElement && tooltipOfAxislabels(ytooltipProps);
|
|
328
275
|
}
|
|
329
276
|
// Call back to the chart.
|
|
330
277
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
331
278
|
const _getData = (xScale, yScalePrimary, yScaleSecondary)=>{
|
|
332
279
|
props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight - _removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current, yScaleSecondary);
|
|
333
280
|
};
|
|
334
|
-
props.getAxisData && props.getAxisData(axisData);
|
|
335
281
|
// Callback function for chart, returns axis
|
|
336
282
|
_getData(xScale, yScalePrimary, yScaleSecondary);
|
|
337
283
|
children = props.children({
|
|
@@ -349,8 +295,30 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
349
295
|
width: containerWidth,
|
|
350
296
|
height: containerHeight
|
|
351
297
|
};
|
|
352
|
-
const
|
|
353
|
-
const
|
|
298
|
+
const plotWidth = Math.max(0, svgDimensions.width - margins.left - margins.right);
|
|
299
|
+
const plotHeight = Math.max(0, svgDimensions.height - margins.top - margins.bottom - _removalValueForTextTuncate);
|
|
300
|
+
const plotRect = {
|
|
301
|
+
x: margins.left,
|
|
302
|
+
y: margins.top,
|
|
303
|
+
width: plotWidth,
|
|
304
|
+
height: plotHeight
|
|
305
|
+
};
|
|
306
|
+
var _props_annotations;
|
|
307
|
+
const annotations = (_props_annotations = props.annotations) !== null && _props_annotations !== void 0 ? _props_annotations : [];
|
|
308
|
+
const hasAnnotations = annotations.length > 0;
|
|
309
|
+
const annotationContext = hasAnnotations ? {
|
|
310
|
+
plotRect,
|
|
311
|
+
svgRect: svgDimensions,
|
|
312
|
+
isRtl: _useRtl,
|
|
313
|
+
xScale: _xScale,
|
|
314
|
+
yScalePrimary,
|
|
315
|
+
yScaleSecondary
|
|
316
|
+
} : undefined;
|
|
317
|
+
const xAxisTitleMaxWidth = svgDimensions.width - margins.left - margins.right - AXIS_TITLE_PADDING * 2;
|
|
318
|
+
const yAxisTitleMaxHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - AXIS_TITLE_PADDING * 2;
|
|
319
|
+
const yAxisTitleCenterY = margins.top + AXIS_TITLE_PADDING + yAxisTitleMaxHeight / 2;
|
|
320
|
+
const yAxisTitleCenterX = _useRtl ? svgDimensions.width - AXIS_TITLE_PADDING : HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING;
|
|
321
|
+
const secondaryYAxisTitleCenterX = _useRtl ? HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING : svgDimensions.width - AXIS_TITLE_PADDING;
|
|
354
322
|
const commonSvgToolTipProps = {
|
|
355
323
|
wrapContent,
|
|
356
324
|
showBackground: true,
|
|
@@ -470,6 +438,64 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
470
438
|
_removalValueForTextTuncate = rotatedHeight + margins.bottom;
|
|
471
439
|
}
|
|
472
440
|
}
|
|
441
|
+
function _calcMargins() {
|
|
442
|
+
let _margins = _getDefaultMargins();
|
|
443
|
+
_margins = _applyTitleMargins(_margins);
|
|
444
|
+
_margins = _applyAnnotationMargins(_margins);
|
|
445
|
+
if (_useRtl) {
|
|
446
|
+
_margins = _swapRtlMargins(_margins);
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
..._margins,
|
|
450
|
+
...props.margins
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function _getDefaultMargins() {
|
|
454
|
+
return {
|
|
455
|
+
top: DEFAULT_MARGIN_NO_TICKS,
|
|
456
|
+
// Smaller than the default because it is based on the line height rather than
|
|
457
|
+
// the length of the tick labels.
|
|
458
|
+
bottom: DEFAULT_MARGIN_WITH_TICKS - 5,
|
|
459
|
+
// For the actual margin, add the tick size, tick padding, and some extra space to
|
|
460
|
+
// the width of the longest yaxis tick label (startFromX).
|
|
461
|
+
left: Math.max(DEFAULT_MARGIN_WITH_TICKS, startFromX + 20),
|
|
462
|
+
right: props.secondaryYScaleOptions ? DEFAULT_MARGIN_WITH_TICKS : DEFAULT_MARGIN_NO_TICKS
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function _applyTitleMargins(_margins) {
|
|
466
|
+
const updated = {
|
|
467
|
+
..._margins
|
|
468
|
+
};
|
|
469
|
+
if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
|
|
470
|
+
updated.bottom += VERTICAL_MARGIN_FOR_XAXIS_TITLE;
|
|
471
|
+
}
|
|
472
|
+
if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
|
|
473
|
+
updated.left += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;
|
|
474
|
+
}
|
|
475
|
+
if (props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '') {
|
|
476
|
+
updated.right += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;
|
|
477
|
+
}
|
|
478
|
+
return updated;
|
|
479
|
+
}
|
|
480
|
+
function _applyAnnotationMargins(_margins) {
|
|
481
|
+
const updated = {
|
|
482
|
+
..._margins
|
|
483
|
+
};
|
|
484
|
+
if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
|
|
485
|
+
updated.top += VERTICAL_MARGIN_FOR_XAXIS_TITLE;
|
|
486
|
+
}
|
|
487
|
+
if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
|
|
488
|
+
updated.right += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;
|
|
489
|
+
}
|
|
490
|
+
return updated;
|
|
491
|
+
}
|
|
492
|
+
function _swapRtlMargins(_margins) {
|
|
493
|
+
return {
|
|
494
|
+
..._margins,
|
|
495
|
+
left: _margins.right,
|
|
496
|
+
right: _margins.left
|
|
497
|
+
};
|
|
498
|
+
}
|
|
473
499
|
/**
|
|
474
500
|
* We have use the {@link defaultTabbableElement } to fix
|
|
475
501
|
* the Focus not landing on chart while tabbing, instead goes to legend.
|
|
@@ -521,75 +547,76 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
|
|
|
521
547
|
...commonSvgToolTipProps,
|
|
522
548
|
content: props.xAxisTitle,
|
|
523
549
|
textProps: {
|
|
524
|
-
x: margins.left +
|
|
525
|
-
y: svgDimensions.height -
|
|
550
|
+
x: margins.left + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,
|
|
551
|
+
y: svgDimensions.height - AXIS_TITLE_PADDING,
|
|
526
552
|
className: classes.axisTitle,
|
|
527
553
|
textAnchor: 'middle'
|
|
528
554
|
},
|
|
529
|
-
maxWidth:
|
|
555
|
+
maxWidth: xAxisTitleMaxWidth
|
|
530
556
|
}), props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
531
557
|
...commonSvgToolTipProps,
|
|
532
558
|
content: props.xAxisAnnotation,
|
|
533
559
|
textProps: {
|
|
534
|
-
x: margins.left +
|
|
535
|
-
y:
|
|
560
|
+
x: margins.left + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,
|
|
561
|
+
y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,
|
|
536
562
|
className: classes.axisAnnotation,
|
|
537
563
|
textAnchor: 'middle',
|
|
538
564
|
'aria-hidden': true
|
|
539
565
|
},
|
|
540
|
-
maxWidth:
|
|
566
|
+
maxWidth: xAxisTitleMaxWidth
|
|
541
567
|
}), /*#__PURE__*/ React.createElement("g", {
|
|
542
568
|
ref: (e)=>{
|
|
543
569
|
yAxisElement.current = e;
|
|
544
570
|
},
|
|
545
571
|
id: `yAxisGElement${idForGraph}`,
|
|
546
|
-
transform: `translate(${_useRtl ? svgDimensions.width - margins.right
|
|
572
|
+
transform: `translate(${_useRtl ? svgDimensions.width - margins.right : margins.left}, 0)`,
|
|
547
573
|
className: classes.yAxis
|
|
548
574
|
}), props.secondaryYScaleOptions && /*#__PURE__*/ React.createElement("g", null, /*#__PURE__*/ React.createElement("g", {
|
|
549
575
|
ref: (e)=>{
|
|
550
576
|
yAxisElementSecondary.current = e;
|
|
551
577
|
},
|
|
552
578
|
id: `yAxisGElementSecondary${idForGraph}`,
|
|
553
|
-
transform: `translate(${_useRtl ? margins.left
|
|
579
|
+
transform: `translate(${_useRtl ? margins.left : svgDimensions.width - margins.right}, 0)`,
|
|
554
580
|
className: classes.yAxis
|
|
555
581
|
}), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
556
582
|
...commonSvgToolTipProps,
|
|
557
583
|
content: props.secondaryYAxistitle,
|
|
558
584
|
textProps: {
|
|
559
|
-
x:
|
|
560
|
-
y:
|
|
585
|
+
x: secondaryYAxisTitleCenterX,
|
|
586
|
+
y: yAxisTitleCenterY,
|
|
561
587
|
textAnchor: 'middle',
|
|
562
|
-
transform: `
|
|
563
|
-
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
588
|
+
transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,
|
|
564
589
|
className: classes.axisTitle
|
|
565
590
|
},
|
|
566
|
-
maxWidth:
|
|
591
|
+
maxWidth: yAxisTitleMaxHeight
|
|
567
592
|
})), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
568
593
|
...commonSvgToolTipProps,
|
|
569
594
|
content: props.yAxisTitle,
|
|
570
595
|
textProps: {
|
|
571
|
-
x:
|
|
572
|
-
y:
|
|
596
|
+
x: yAxisTitleCenterX,
|
|
597
|
+
y: yAxisTitleCenterY,
|
|
573
598
|
textAnchor: 'middle',
|
|
574
|
-
transform: `
|
|
575
|
-
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
599
|
+
transform: `rotate(-90, ${yAxisTitleCenterX}, ${yAxisTitleCenterY})`,
|
|
576
600
|
className: classes.axisTitle
|
|
577
601
|
},
|
|
578
|
-
maxWidth:
|
|
602
|
+
maxWidth: yAxisTitleMaxHeight
|
|
579
603
|
}), props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && /*#__PURE__*/ React.createElement(SVGTooltipText, {
|
|
580
604
|
...commonSvgToolTipProps,
|
|
581
605
|
content: props.yAxisAnnotation,
|
|
582
606
|
textProps: {
|
|
583
|
-
x:
|
|
584
|
-
y:
|
|
607
|
+
x: secondaryYAxisTitleCenterX,
|
|
608
|
+
y: yAxisTitleCenterY,
|
|
585
609
|
textAnchor: 'middle',
|
|
586
|
-
transform: `
|
|
587
|
-
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
610
|
+
transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,
|
|
588
611
|
className: classes.axisAnnotation,
|
|
589
612
|
'aria-hidden': true
|
|
590
613
|
},
|
|
591
|
-
maxWidth:
|
|
592
|
-
}))
|
|
614
|
+
maxWidth: yAxisTitleMaxHeight
|
|
615
|
+
})), hasAnnotations && annotationContext && /*#__PURE__*/ React.createElement(ChartAnnotationLayer, {
|
|
616
|
+
annotations: annotations,
|
|
617
|
+
context: annotationContext,
|
|
618
|
+
className: classes.annotationLayer
|
|
619
|
+
})), !props.hideLegend && /*#__PURE__*/ React.createElement("div", {
|
|
593
620
|
ref: (e)=>{
|
|
594
621
|
legendContainer = e;
|
|
595
622
|
},
|