@fluentui/react-charting 5.24.38 → 5.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +99 -1
- package/CHANGELOG.md +34 -2
- package/dist/react-charting.d.ts +129 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +76 -1
- package/lib/components/AreaChart/AreaChart.base.d.ts +2 -1
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.base.d.ts +2 -1
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +343 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.d.ts +2 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +19 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/index.d.ts +2 -0
- package/lib/components/CommonComponents/index.js +2 -0
- package/lib/components/CommonComponents/index.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.d.ts +2 -1
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.d.ts +2 -1
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.d.ts +3 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.base.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/Legends/Legends.base.d.ts +2 -1
- package/lib/components/Legends/Legends.base.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +2 -1
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/PieChart/Arc/Arc.d.ts +3 -2
- package/lib/components/PieChart/Arc/Arc.js.map +1 -1
- package/lib/components/PieChart/Pie/Pie.d.ts +3 -2
- package/lib/components/PieChart/Pie/Pie.js.map +1 -1
- package/lib/components/PieChart/PieChart.base.d.ts +2 -1
- package/lib/components/PieChart/PieChart.base.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.base.d.ts +3 -2
- package/lib/components/Sparkline/Sparkline.base.js.map +1 -1
- package/lib/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
- package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
- package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib/components/TreeChart/TreeChart.base.d.ts +2 -1
- package/lib/components/TreeChart/TreeChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IChartAnnotation.d.ts +99 -0
- package/lib/types/IChartAnnotation.js +2 -0
- package/lib/types/IChartAnnotation.js.map +1 -0
- package/lib/types/IDataPoint.d.ts +4 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/image-export-utils.js +55 -0
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.d.ts +2 -2
- package/lib/utilities/scatterpolar-utils.js.map +1 -1
- package/lib/utilities/utilities.d.ts +14 -14
- package/lib/utilities/utilities.js +72 -20
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +2 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.base.d.ts +2 -1
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +344 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +19 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/CommonComponents/index.d.ts +2 -0
- package/lib-amd/components/CommonComponents/index.js +3 -1
- package/lib-amd/components/CommonComponents/index.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/Arc/Arc.d.ts +2 -1
- package/lib-amd/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.d.ts +2 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/Pie/Pie.d.ts +3 -2
- package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-amd/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/Legends/Legends.base.d.ts +2 -1
- package/lib-amd/components/Legends/Legends.base.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +2 -1
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/PieChart/Arc/Arc.d.ts +3 -2
- package/lib-amd/components/PieChart/Arc/Arc.js.map +1 -1
- package/lib-amd/components/PieChart/Pie/Pie.d.ts +3 -2
- package/lib-amd/components/PieChart/Pie/Pie.js.map +1 -1
- package/lib-amd/components/PieChart/PieChart.base.d.ts +2 -1
- package/lib-amd/components/PieChart/PieChart.base.js.map +1 -1
- package/lib-amd/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/Sparkline/Sparkline.base.d.ts +3 -2
- package/lib-amd/components/Sparkline/Sparkline.base.js.map +1 -1
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
- package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib-amd/components/TreeChart/TreeChart.base.d.ts +2 -1
- package/lib-amd/components/TreeChart/TreeChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IChartAnnotation.d.ts +99 -0
- package/lib-amd/types/IChartAnnotation.js +5 -0
- package/lib-amd/types/IChartAnnotation.js.map +1 -0
- package/lib-amd/types/IDataPoint.d.ts +4 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/types/index.d.ts +1 -0
- package/lib-amd/types/index.js +2 -1
- package/lib-amd/types/index.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.js +55 -0
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/utilities/scatterpolar-utils.d.ts +2 -2
- package/lib-amd/utilities/scatterpolar-utils.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +14 -14
- package/lib-amd/utilities/utilities.js +72 -20
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-amd/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +2 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +2 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +346 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +19 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
- package/lib-commonjs/components/CommonComponents/index.js +2 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
- 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 +641 -76
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.d.ts +2 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +2 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.d.ts +3 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.base.d.ts +2 -1
- package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +2 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/PieChart/Arc/Arc.d.ts +3 -2
- package/lib-commonjs/components/PieChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/PieChart/Pie/Pie.d.ts +3 -2
- package/lib-commonjs/components/PieChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/PieChart/PieChart.base.d.ts +2 -1
- package/lib-commonjs/components/PieChart/PieChart.base.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.base.d.ts +3 -2
- package/lib-commonjs/components/Sparkline/Sparkline.base.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/TreeChart/TreeChart.base.d.ts +2 -1
- package/lib-commonjs/components/TreeChart/TreeChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
- package/lib-commonjs/types/IChartAnnotation.js +3 -0
- package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
- package/lib-commonjs/types/IDataPoint.d.ts +4 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/types/index.d.ts +1 -0
- package/lib-commonjs/types/index.js +1 -0
- package/lib-commonjs/types/index.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +55 -0
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.d.ts +2 -2
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +14 -14
- package/lib-commonjs/utilities/utilities.js +72 -20
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +9 -9
- package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
- package/src/components/CommonComponents/CartesianChart.types.ts +23 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ITheme } from '@fluentui/react/lib/Styling';
|
|
2
|
+
import { IChartAnnotation, ChartAnnotationArrowHead } from '../../../types/IChartAnnotation';
|
|
3
|
+
export interface IAnnotationPoint {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export interface IAnnotationPlotRect {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
export interface IChartAnnotationContext {
|
|
14
|
+
/** Rectangle describing the drawable area of the chart (without margins) */
|
|
15
|
+
plotRect: IAnnotationPlotRect;
|
|
16
|
+
/** Size of the owning SVG element */
|
|
17
|
+
svgRect: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
21
|
+
/** Indicates if layout should be mirrored */
|
|
22
|
+
isRtl?: boolean;
|
|
23
|
+
/** Primary x scale mapping data domain to pixels */
|
|
24
|
+
xScale?: (value: any) => number;
|
|
25
|
+
/** Primary y scale mapping data domain to pixels */
|
|
26
|
+
yScalePrimary?: (value: any) => number;
|
|
27
|
+
/** Secondary y scale when present */
|
|
28
|
+
yScaleSecondary?: (value: any) => number;
|
|
29
|
+
}
|
|
30
|
+
export interface IChartAnnotationLayerProps {
|
|
31
|
+
annotations?: IChartAnnotation[];
|
|
32
|
+
context: IChartAnnotationContext;
|
|
33
|
+
theme: ITheme;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IResolvedAnnotationPosition {
|
|
37
|
+
/** Final absolute position after applying layout and offsets */
|
|
38
|
+
point: IAnnotationPoint;
|
|
39
|
+
/** Raw anchor position before offsets (used for connectors) */
|
|
40
|
+
anchor: IAnnotationPoint;
|
|
41
|
+
}
|
|
42
|
+
export type ConnectorRenderData = {
|
|
43
|
+
key: string;
|
|
44
|
+
start: IAnnotationPoint;
|
|
45
|
+
end: IAnnotationPoint;
|
|
46
|
+
strokeColor: string;
|
|
47
|
+
strokeWidth: number;
|
|
48
|
+
dashArray?: string;
|
|
49
|
+
arrow: ChartAnnotationArrowHead;
|
|
50
|
+
markerSize: number;
|
|
51
|
+
markerStrokeWidth: number;
|
|
52
|
+
};
|
package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartAnnotationLayer.types.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ITheme } from '@fluentui/react/lib/Styling';\nimport { IChartAnnotation, ChartAnnotationArrowHead } from '../../../types/IChartAnnotation';\n\nexport interface IAnnotationPoint {\n x: number;\n y: number;\n}\n\nexport interface IAnnotationPlotRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface IChartAnnotationContext {\n /** Rectangle describing the drawable area of the chart (without margins) */\n plotRect: IAnnotationPlotRect;\n /** Size of the owning SVG element */\n svgRect: { width: number; height: number };\n /** Indicates if layout should be mirrored */\n isRtl?: boolean;\n /** Primary x scale mapping data domain to pixels */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xScale?: (value: any) => number;\n /** Primary y scale mapping data domain to pixels */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yScalePrimary?: (value: any) => number;\n /** Secondary y scale when present */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yScaleSecondary?: (value: any) => number;\n}\n\nexport interface IChartAnnotationLayerProps {\n annotations?: IChartAnnotation[];\n context: IChartAnnotationContext;\n theme: ITheme;\n className?: string;\n}\n\nexport interface IResolvedAnnotationPosition {\n /** Final absolute position after applying layout and offsets */\n point: IAnnotationPoint;\n /** Raw anchor position before offsets (used for connectors) */\n anchor: IAnnotationPoint;\n}\n\nexport type ConnectorRenderData = {\n key: string;\n start: IAnnotationPoint;\n end: IAnnotationPoint;\n strokeColor: string;\n strokeWidth: number;\n dashArray?: string;\n arrow: ChartAnnotationArrowHead;\n markerSize: number;\n markerStrokeWidth: number;\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IModifiedCartesianChartProps } from '../../index';
|
|
3
3
|
import { IChart } from '../../types/index';
|
|
4
|
+
import type { JSXElement } from '@fluentui/utilities';
|
|
4
5
|
export interface ICartesianChartState {
|
|
5
6
|
containerWidth: number;
|
|
6
7
|
containerHeight: number;
|
|
@@ -39,7 +40,7 @@ export declare class CartesianChartBase extends React.Component<IModifiedCartesi
|
|
|
39
40
|
componentWillUnmount(): void;
|
|
40
41
|
componentDidUpdate(prevProps: IModifiedCartesianChartProps): void;
|
|
41
42
|
calculateMaxYAxisLabelLength: (className: string) => number;
|
|
42
|
-
render():
|
|
43
|
+
render(): JSXElement;
|
|
43
44
|
/**
|
|
44
45
|
* Dedicated function to return the Callout JSX Element , which can further be used to only call this when
|
|
45
46
|
* only the calloutprops and charthover props changes.
|
|
@@ -11,6 +11,7 @@ var chart_utilities_1 = require("@fluentui/chart-utilities");
|
|
|
11
11
|
var index_1 = require("../../utilities/index");
|
|
12
12
|
var index_2 = require("../Legends/index");
|
|
13
13
|
var SVGTooltipText_1 = require("../../utilities/SVGTooltipText");
|
|
14
|
+
var ChartAnnotationLayer_1 = require("./Annotations/ChartAnnotationLayer");
|
|
14
15
|
var getClassNames = (0, Utilities_1.classNamesFunction)();
|
|
15
16
|
var ChartHoverCard = React.lazy(function () {
|
|
16
17
|
return Promise.resolve().then(function () { return require('../../utilities/ChartHoverCard/ChartHoverCard'); }).then(function (module) { return ({ default: module.ChartHoverCard }); });
|
|
@@ -305,8 +306,8 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
305
306
|
CartesianChartBase.prototype.render = function () {
|
|
306
307
|
var _a, _b, _c, _d;
|
|
307
308
|
var _this = this;
|
|
308
|
-
var _e, _f, _g, _h, _j, _k
|
|
309
|
-
var
|
|
309
|
+
var _e, _f, _g, _h, _j, _k;
|
|
310
|
+
var _l = this.props, calloutProps = _l.calloutProps, points = _l.points, chartType = _l.chartType, chartHoverProps = _l.chartHoverProps, svgFocusZoneProps = _l.svgFocusZoneProps, svgProps = _l.svgProps, culture = _l.culture, dateLocalizeOptions = _l.dateLocalizeOptions, timeFormatLocale = _l.timeFormatLocale, customDateTimeFormatter = _l.customDateTimeFormatter;
|
|
310
311
|
if (this.props.parentRef) {
|
|
311
312
|
this._fitParentContainer();
|
|
312
313
|
}
|
|
@@ -332,36 +333,24 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
332
333
|
});
|
|
333
334
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
334
335
|
var callout = null;
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
|
+
var yScalePrimary;
|
|
338
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
339
|
+
var yScaleSecondary;
|
|
335
340
|
var children = null;
|
|
336
341
|
if ((this.props.enableFirstRenderOptimization && this.chartContainer) ||
|
|
337
342
|
!this.props.enableFirstRenderOptimization) {
|
|
338
343
|
this._isFirstRender = false;
|
|
339
|
-
var XAxisParams = {
|
|
340
|
-
domainNRangeValues: this.props.getDomainNRangeValues(points, this.props.getDomainMargins ? this.props.getDomainMargins(this.state.containerWidth) : this.margins, this.state.containerWidth, chartType, this._isRtl, this.props.xAxisType, this.props.barwidth, this.props.tickValues,
|
|
344
|
+
var XAxisParams = tslib_1.__assign({ domainNRangeValues: this.props.getDomainNRangeValues(points, this.props.getDomainMargins ? this.props.getDomainMargins(this.state.containerWidth) : this.margins, this.state.containerWidth, chartType, this._isRtl, this.props.xAxisType, this.props.barwidth, this.props.tickValues,
|
|
341
345
|
// This is only used for Horizontal Bar Chart with Axis for y as string axis
|
|
342
|
-
this.state.startFromX),
|
|
346
|
+
this.state.startFromX),
|
|
343
347
|
// FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.
|
|
344
348
|
// Since the x-axis in HBWA is numeric, it typically doesn't require transformation.
|
|
345
349
|
// However, if transformation props are enabled, the updated _removalValueForTextTuncate
|
|
346
350
|
// will only be available in the next render, as it's set after the axis is created.
|
|
347
351
|
// Solution: Delay the creation of gridlines until after the transformation has been applied,
|
|
348
352
|
// or precompute the required height for transformed labels (_removalValueForTextTuncate).
|
|
349
|
-
containerHeight: this.state.containerHeight - this._removalValueForTextTuncate,
|
|
350
|
-
margins: this.margins,
|
|
351
|
-
xAxisElement: this.xAxisElement,
|
|
352
|
-
showRoundOffXTickValues: (_e = this.props.showRoundOffXTickValues) !== null && _e !== void 0 ? _e : true,
|
|
353
|
-
xAxisCount: this.props.xAxisTickCount,
|
|
354
|
-
xAxistickSize: this.props.xAxistickSize,
|
|
355
|
-
tickPadding: this.props.tickPadding || this.props.showXAxisLablesTooltip ? 5 : 10,
|
|
356
|
-
xAxisPadding: this.props.xAxisPadding,
|
|
357
|
-
xAxisInnerPadding: this.props.xAxisInnerPadding,
|
|
358
|
-
xAxisOuterPadding: this.props.xAxisOuterPadding,
|
|
359
|
-
containerWidth: this.state.containerWidth,
|
|
360
|
-
hideTickOverlap: this.props.hideTickOverlap,
|
|
361
|
-
calcMaxLabelWidth: this._calcMaxLabelWidthWithTransform,
|
|
362
|
-
tickStep: (_f = this.props.xAxis) === null || _f === void 0 ? void 0 : _f.tickStep,
|
|
363
|
-
tick0: (_g = this.props.xAxis) === null || _g === void 0 ? void 0 : _g.tick0,
|
|
364
|
-
};
|
|
353
|
+
containerHeight: this.state.containerHeight - this._removalValueForTextTuncate, margins: this.margins, xAxisElement: this.xAxisElement, showRoundOffXTickValues: (_e = this.props.showRoundOffXTickValues) !== null && _e !== void 0 ? _e : true, xAxisCount: this.props.xAxisTickCount, xAxistickSize: this.props.xAxistickSize, tickPadding: this.props.tickPadding || this.props.showXAxisLablesTooltip ? 5 : 10, xAxisPadding: this.props.xAxisPadding, xAxisInnerPadding: this.props.xAxisInnerPadding, xAxisOuterPadding: this.props.xAxisOuterPadding, containerWidth: this.state.containerWidth, hideTickOverlap: this.props.hideTickOverlap, calcMaxLabelWidth: this._calcMaxLabelWidthWithTransform }, this.props.xAxis);
|
|
365
354
|
/**
|
|
366
355
|
* These scales used for 2 purposes.
|
|
367
356
|
* 1. To create x and y axis
|
|
@@ -387,36 +376,17 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
387
376
|
this._xScale = xScale;
|
|
388
377
|
this._tickValues = tickValues;
|
|
389
378
|
this._transformXAxisLabels();
|
|
390
|
-
var YAxisParams = {
|
|
391
|
-
margins: this.props.getYDomainMargins ? this.props.getYDomainMargins(this.state.containerHeight) : this.margins,
|
|
392
|
-
containerWidth: this.state.containerWidth,
|
|
393
|
-
containerHeight: this.state.containerHeight - this._removalValueForTextTuncate,
|
|
394
|
-
yAxisElement: this.yAxisElement,
|
|
395
|
-
yAxisTickFormat: this.props.yAxisTickFormat,
|
|
396
|
-
yAxisTickCount: this.props.yAxisTickCount,
|
|
397
|
-
yMinValue: this.props.yMinValue || 0,
|
|
398
|
-
yMaxValue: this.props.yMaxValue || 0,
|
|
399
|
-
tickPadding: 10,
|
|
400
|
-
maxOfYVal: this.props.maxOfYVal,
|
|
401
|
-
yMinMaxValues: this.props.getMinMaxOfYAxis(points, this.props.yAxisType),
|
|
379
|
+
var YAxisParams = tslib_1.__assign({ margins: this.props.getYDomainMargins ? this.props.getYDomainMargins(this.state.containerHeight) : this.margins, containerWidth: this.state.containerWidth, containerHeight: this.state.containerHeight - this._removalValueForTextTuncate, yAxisElement: this.yAxisElement, yAxisTickFormat: this.props.yAxisTickFormat, yAxisTickCount: this.props.yAxisTickCount, yMinValue: this.props.yMinValue || 0, yMaxValue: this.props.yMaxValue || 0, tickPadding: 10, maxOfYVal: this.props.maxOfYVal, yMinMaxValues: this.props.getMinMaxOfYAxis(points, this.props.yAxisType),
|
|
402
380
|
// please note these padding default values must be consistent in here
|
|
403
381
|
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
404
382
|
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
405
|
-
yAxisPadding: this.props.yAxisPadding || 0,
|
|
406
|
-
tickValues: this.props.yAxisTickValues,
|
|
407
|
-
tickStep: (_h = this.props.yAxis) === null || _h === void 0 ? void 0 : _h.tickStep,
|
|
408
|
-
tick0: (_j = this.props.yAxis) === null || _j === void 0 ? void 0 : _j.tick0,
|
|
409
|
-
};
|
|
383
|
+
yAxisPadding: this.props.yAxisPadding || 0, tickValues: this.props.yAxisTickValues }, this.props.yAxis);
|
|
410
384
|
/**
|
|
411
385
|
* These scales used for 2 purposes.
|
|
412
386
|
* 1. To create x and y axis
|
|
413
387
|
* 2. To draw the graph.
|
|
414
388
|
* For area/line chart using same scales. For other charts, creating their own scales to draw the graph.
|
|
415
389
|
*/
|
|
416
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
417
|
-
var yScalePrimary = void 0;
|
|
418
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
419
|
-
var yScaleSecondary = void 0;
|
|
420
390
|
var axisData = { yAxisDomainValues: [] };
|
|
421
391
|
if (this.props.yAxisType && this.props.yAxisType === index_1.YAxisType.StringAxis) {
|
|
422
392
|
yScalePrimary = this.props.createStringYAxis(YAxisParams, this.props.stringDatasetForYAxisDomain, this._isRtl, this.props.barwidth, this.props.chartType);
|
|
@@ -427,7 +397,7 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
427
397
|
// rendering the secondary y-axis. Therefore, rather than checking the secondaryYScaleOptions
|
|
428
398
|
// prop to determine whether to create a secondary y-axis, it's more appropriate to check if any
|
|
429
399
|
// data points are assigned to use the secondary y-scale.
|
|
430
|
-
if ((
|
|
400
|
+
if ((_f = this.props) === null || _f === void 0 ? void 0 : _f.secondaryYScaleOptions) {
|
|
431
401
|
var YAxisParamsSecondary = {
|
|
432
402
|
margins: this.margins,
|
|
433
403
|
containerWidth: this.state.containerWidth,
|
|
@@ -435,8 +405,8 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
435
405
|
yAxisElement: this.yAxisElementSecondary,
|
|
436
406
|
yAxisTickFormat: this.props.yAxisTickFormat,
|
|
437
407
|
yAxisTickCount: this.props.yAxisTickCount,
|
|
438
|
-
yMinValue: ((
|
|
439
|
-
yMaxValue: (
|
|
408
|
+
yMinValue: ((_g = this.props.secondaryYScaleOptions) === null || _g === void 0 ? void 0 : _g.yMinValue) || 0,
|
|
409
|
+
yMaxValue: (_j = (_h = this.props.secondaryYScaleOptions) === null || _h === void 0 ? void 0 : _h.yMaxValue) !== null && _j !== void 0 ? _j : 100,
|
|
440
410
|
tickPadding: 10,
|
|
441
411
|
yMinMaxValues: this.props.getMinMaxOfYAxis(points, this.props.yAxisType, true),
|
|
442
412
|
yAxisPadding: this.props.yAxisPadding,
|
|
@@ -490,6 +460,27 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
490
460
|
width: this.state.containerWidth,
|
|
491
461
|
height: this.state.containerHeight,
|
|
492
462
|
};
|
|
463
|
+
var startFromX = this.state.startFromX || 0;
|
|
464
|
+
var plotWidth = Math.max(0, svgDimensions.width - this.margins.left - this.margins.right - startFromX);
|
|
465
|
+
var plotHeight = Math.max(0, svgDimensions.height - this.margins.top - this.margins.bottom - this._removalValueForTextTuncate);
|
|
466
|
+
var plotRect = {
|
|
467
|
+
x: this._isRtl ? this.margins.left : this.margins.left + startFromX,
|
|
468
|
+
y: this.margins.top,
|
|
469
|
+
width: plotWidth,
|
|
470
|
+
height: plotHeight,
|
|
471
|
+
};
|
|
472
|
+
var annotations = (_k = this.props.annotations) !== null && _k !== void 0 ? _k : [];
|
|
473
|
+
var hasAnnotations = annotations.length > 0;
|
|
474
|
+
var annotationContext = hasAnnotations
|
|
475
|
+
? {
|
|
476
|
+
plotRect: plotRect,
|
|
477
|
+
svgRect: svgDimensions,
|
|
478
|
+
isRtl: this._isRtl,
|
|
479
|
+
xScale: this._xScale,
|
|
480
|
+
yScalePrimary: yScalePrimary,
|
|
481
|
+
yScaleSecondary: yScaleSecondary,
|
|
482
|
+
}
|
|
483
|
+
: undefined;
|
|
493
484
|
var focusDirection;
|
|
494
485
|
if (this.props.focusZoneDirection === react_focus_1.FocusZoneDirection.vertical) {
|
|
495
486
|
focusDirection = this.props.focusZoneDirection;
|
|
@@ -602,7 +593,8 @@ var CartesianChartBase = /** @class */ (function (_super) {
|
|
|
602
593
|
: this.margins.right / 2 + this.titleMargin, ",\n ").concat(svgDimensions.height - this.margins.bottom - this.margins.top - this.titleMargin, ")rotate(-90)"),
|
|
603
594
|
className: this._classNames.axisAnnotation,
|
|
604
595
|
'aria-hidden': true,
|
|
605
|
-
}, maxWidth: yAxisTitleMaximumAllowedHeight }, commonSvgToolTipProps))))
|
|
596
|
+
}, maxWidth: yAxisTitleMaximumAllowedHeight }, commonSvgToolTipProps)))),
|
|
597
|
+
hasAnnotations && annotationContext && (React.createElement(ChartAnnotationLayer_1.ChartAnnotationLayer, { annotations: annotations, context: annotationContext, theme: this.props.theme, className: this._classNames.annotationLayer }))),
|
|
606
598
|
!this.props.hideLegend && (React.createElement("div", { ref: function (e) { return (_this.legendContainer = e); }, className: this._classNames.legendContainer }, this.props.legendBars)),
|
|
607
599
|
callout && React.createElement(React.Suspense, { fallback: React.createElement("div", null, "Loading...") }, callout)));
|
|
608
600
|
};
|