@fluentui/react-charting 5.25.5 → 5.25.6
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 +60 -1
- package/CHANGELOG.md +17 -2
- package/bundle-size/PolarChart.fixture.js +7 -0
- package/dist/react-charting.d.ts +388 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +85 -1
- package/lib/PolarChart.d.ts +1 -0
- package/lib/PolarChart.js +2 -0
- package/lib/PolarChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.base.d.ts +0 -1
- package/lib/components/AreaChart/AreaChart.base.js +2 -31
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.base.js +12 -4
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.styles.js +3 -0
- package/lib/components/ChartTable/ChartTable.styles.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.d.ts +11 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.d.ts +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +82 -42
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +31 -27
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +16 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +24 -28
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +202 -217
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.d.ts +1 -0
- package/lib/components/DonutChart/DonutChart.base.js +16 -4
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.styles.js +3 -1
- package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +13 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.base.js +14 -8
- package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.styles.js +3 -0
- package/lib/components/FunnelChart/FunnelChart.styles.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.d.ts +13 -0
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.js +2 -2
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.styles.js +16 -22
- package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.d.ts +9 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +2 -18
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +0 -1
- package/lib/components/LineChart/LineChart.base.js +1 -25
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/PolarChart/PolarChart.base.d.ts +3 -0
- package/lib/components/PolarChart/PolarChart.base.js +426 -0
- package/lib/components/PolarChart/PolarChart.base.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.d.ts +7 -0
- package/lib/components/PolarChart/PolarChart.js +9 -0
- package/lib/components/PolarChart/PolarChart.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.styles.d.ts +2 -0
- package/lib/components/PolarChart/PolarChart.styles.js +39 -0
- package/lib/components/PolarChart/PolarChart.styles.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.types.d.ts +185 -0
- package/lib/components/PolarChart/PolarChart.types.js +2 -0
- package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.utils.d.ts +43 -0
- package/lib/components/PolarChart/PolarChart.utils.js +180 -0
- package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib/components/PolarChart/index.d.ts +2 -0
- package/lib/components/PolarChart/index.js +3 -0
- package/lib/components/PolarChart/index.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.base.js +9 -2
- package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.styles.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.d.ts +18 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +1 -28
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +1 -73
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -26
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +88 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/ChartTitle.d.ts +55 -0
- package/lib/utilities/ChartTitle.js +45 -0
- package/lib/utilities/ChartTitle.js.map +1 -0
- package/lib/utilities/Common.styles.d.ts +51 -0
- package/lib/utilities/Common.styles.js +70 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/image-export-utils.js +4 -4
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/index.d.ts +1 -0
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.d.ts +28 -6
- package/lib/utilities/utilities.js +210 -104
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/PolarChart.d.ts +1 -0
- package/lib-amd/PolarChart.js +6 -0
- package/lib-amd/PolarChart.js.map +1 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +0 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js +1 -29
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.base.js +12 -5
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.styles.js +3 -1
- package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.types.d.ts +11 -0
- package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +81 -41
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +30 -26
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +16 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -28
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -219
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.d.ts +1 -0
- package/lib-amd/components/DonutChart/DonutChart.base.js +15 -3
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -0
- package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +13 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/FunnelChart/FunnelChart.base.js +14 -9
- package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-amd/components/FunnelChart/FunnelChart.styles.js +3 -1
- package/lib-amd/components/FunnelChart/FunnelChart.styles.js.map +1 -1
- package/lib-amd/components/FunnelChart/FunnelChart.types.d.ts +13 -0
- package/lib-amd/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.js +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.styles.js +16 -23
- package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +9 -0
- package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +0 -16
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +0 -1
- package/lib-amd/components/LineChart/LineChart.base.js +0 -24
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/PolarChart/PolarChart.base.d.ts +3 -0
- package/lib-amd/components/PolarChart/PolarChart.base.js +421 -0
- package/lib-amd/components/PolarChart/PolarChart.base.js.map +1 -0
- package/lib-amd/components/PolarChart/PolarChart.d.ts +7 -0
- package/lib-amd/components/PolarChart/PolarChart.js +11 -0
- package/lib-amd/components/PolarChart/PolarChart.js.map +1 -0
- package/lib-amd/components/PolarChart/PolarChart.styles.d.ts +2 -0
- package/lib-amd/components/PolarChart/PolarChart.styles.js +43 -0
- package/lib-amd/components/PolarChart/PolarChart.styles.js.map +1 -0
- package/lib-amd/components/PolarChart/PolarChart.types.d.ts +185 -0
- package/lib-amd/components/PolarChart/PolarChart.types.js +5 -0
- package/lib-amd/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib-amd/components/PolarChart/PolarChart.utils.d.ts +43 -0
- package/lib-amd/components/PolarChart/PolarChart.utils.js +183 -0
- package/lib-amd/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib-amd/components/PolarChart/index.d.ts +2 -0
- package/lib-amd/components/PolarChart/index.js +7 -0
- package/lib-amd/components/PolarChart/index.js.map +1 -0
- package/lib-amd/components/SankeyChart/SankeyChart.base.js +9 -3
- package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.styles.js +3 -1
- package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.types.d.ts +18 -0
- package/lib-amd/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +0 -27
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +1 -72
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -25
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +2 -0
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +88 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/ChartTitle.d.ts +55 -0
- package/lib-amd/utilities/ChartTitle.js +46 -0
- package/lib-amd/utilities/ChartTitle.js.map +1 -0
- package/lib-amd/utilities/Common.styles.d.ts +51 -0
- package/lib-amd/utilities/Common.styles.js +74 -2
- package/lib-amd/utilities/Common.styles.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.js +3 -3
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/utilities/index.d.ts +1 -0
- package/lib-amd/utilities/index.js +2 -1
- package/lib-amd/utilities/index.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +28 -6
- package/lib-amd/utilities/utilities.js +217 -107
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/PolarChart.d.ts +1 -0
- package/lib-commonjs/PolarChart.js +5 -0
- package/lib-commonjs/PolarChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +0 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +0 -29
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.js +12 -4
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.styles.js +3 -0
- package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +11 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +81 -41
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +30 -26
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +16 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -27
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -219
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +15 -3
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -0
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +13 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +14 -8
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js +3 -0
- package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.d.ts +13 -0
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +16 -22
- package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +9 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +0 -16
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +0 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +0 -24
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/PolarChart/PolarChart.base.d.ts +3 -0
- package/lib-commonjs/components/PolarChart/PolarChart.base.js +429 -0
- package/lib-commonjs/components/PolarChart/PolarChart.base.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.d.ts +7 -0
- package/lib-commonjs/components/PolarChart/PolarChart.js +12 -0
- package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.styles.d.ts +2 -0
- package/lib-commonjs/components/PolarChart/PolarChart.styles.js +43 -0
- package/lib-commonjs/components/PolarChart/PolarChart.styles.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.d.ts +185 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js +3 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.d.ts +43 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js +188 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib-commonjs/components/PolarChart/index.d.ts +2 -0
- package/lib-commonjs/components/PolarChart/index.js +6 -0
- package/lib-commonjs/components/PolarChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +9 -2
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +3 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.d.ts +18 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +0 -27
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +0 -72
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +0 -25
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -0
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +88 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/ChartTitle.d.ts +55 -0
- package/lib-commonjs/utilities/ChartTitle.js +49 -0
- package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.d.ts +51 -0
- package/lib-commonjs/utilities/Common.styles.js +74 -2
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +3 -3
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/index.d.ts +1 -0
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +28 -6
- package/lib-commonjs/utilities/utilities.js +217 -107
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +4 -12
- package/project.json +0 -1
- package/src/components/ChartTable/ChartTable.types.ts +13 -0
- package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +5 -0
- package/src/components/CommonComponents/CartesianChart.types.ts +17 -1
- package/src/components/DonutChart/DonutChart.types.ts +16 -0
- package/src/components/FunnelChart/FunnelChart.types.ts +16 -0
- package/src/components/GaugeChart/GaugeChart.types.ts +11 -0
- package/src/components/PolarChart/PolarChart.types.ts +232 -0
- package/src/components/SankeyChart/SankeyChart.types.ts +22 -0
|
@@ -8,13 +8,15 @@ import { format as d3Format } from 'd3-format';
|
|
|
8
8
|
import { timeFormat as d3TimeFormat, timeFormatLocale as d3TimeFormatLocale, utcFormat as d3UtcFormat, } from 'd3-time-format';
|
|
9
9
|
import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3TimeHour, timeDay as d3TimeDay, timeMonth as d3TimeMonth, timeWeek as d3TimeWeek, timeYear as d3TimeYear, utcSecond as d3UtcSecond, utcMinute as d3UtcMinute, utcHour as d3UtcHour, utcDay as d3UtcDay, utcMonth as d3UtcMonth, utcWeek as d3UtcWeek, utcYear as d3UtcYear, } from 'd3-time';
|
|
10
10
|
import { formatPrefix as d3FormatPrefix } from 'd3-format';
|
|
11
|
-
import { calculatePrecision,
|
|
11
|
+
import { calculatePrecision, precisionRound } from '@fluentui/react';
|
|
12
12
|
import { curveLinear as d3CurveLinear, curveNatural as d3CurveNatural, curveStep as d3CurveStep, curveStepAfter as d3CurveStepAfter, curveStepBefore as d3CurveStepBefore, } from 'd3-shape';
|
|
13
13
|
import { formatDateToLocaleString, formatToLocaleString, getMultiLevelDateTimeFormatOptions, handleFloatingPointPrecisionError, isInvalidValue, isNumber, } from '@fluentui/chart-utilities';
|
|
14
14
|
import { getColorContrast } from './colors';
|
|
15
15
|
export var MIN_DOMAIN_MARGIN = 8;
|
|
16
16
|
export var MIN_DONUT_RADIUS = 1;
|
|
17
17
|
export var DEFAULT_DATE_STRING = '2000-01-01';
|
|
18
|
+
export var CARTESIAN_XAXIS_CLASSNAME = 'fui-cart__xAxis';
|
|
19
|
+
var CARTESIAN_XAXIS_TEXT_SELECTOR = ".".concat(CARTESIAN_XAXIS_CLASSNAME, " text");
|
|
18
20
|
export var ChartTypes;
|
|
19
21
|
(function (ChartTypes) {
|
|
20
22
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
@@ -92,7 +94,7 @@ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture,
|
|
|
92
94
|
var xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
93
95
|
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : formatToLocaleString(xAxisValue, culture);
|
|
94
96
|
};
|
|
95
|
-
if (hideTickOverlap
|
|
97
|
+
if (hideTickOverlap) {
|
|
96
98
|
var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(function (v, i) { return tickFormat(v, i); })) + 20;
|
|
97
99
|
var _d = xAxisScale.range(), start = _d[0], end = _d[1];
|
|
98
100
|
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
@@ -118,8 +120,8 @@ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture,
|
|
|
118
120
|
if (xAxisElement) {
|
|
119
121
|
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
120
122
|
}
|
|
121
|
-
var tickValues =
|
|
122
|
-
return { xScale: xAxisScale, tickValues: tickValues };
|
|
123
|
+
var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
|
|
124
|
+
return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
|
|
123
125
|
}
|
|
124
126
|
/**
|
|
125
127
|
* This function returns a multilevel formatter for a given date range.
|
|
@@ -224,7 +226,7 @@ function isPowerOf10(num) {
|
|
|
224
226
|
* @param {ITickParams} tickParams
|
|
225
227
|
*/
|
|
226
228
|
export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
227
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
|
|
229
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
|
|
228
230
|
var xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
|
|
229
231
|
xAxisScale
|
|
230
232
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
@@ -265,10 +267,11 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
265
267
|
}
|
|
266
268
|
return formatDateToLocaleString(domainValue, culture, useUTC, false, formatOptions);
|
|
267
269
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
if (hideTickOverlap) {
|
|
271
|
+
var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
|
|
272
|
+
var _c = xAxisScale.range(), start = _c[0], end = _c[1];
|
|
273
|
+
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
274
|
+
}
|
|
272
275
|
var xAxis = d3AxisBottom(xAxisScale)
|
|
273
276
|
.tickSize(xAxistickSize)
|
|
274
277
|
.tickPadding(tickPadding)
|
|
@@ -290,8 +293,8 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
290
293
|
if (xAxisElement) {
|
|
291
294
|
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
292
295
|
}
|
|
293
|
-
var tickValues =
|
|
294
|
-
return { xScale: xAxisScale, tickValues: tickValues };
|
|
296
|
+
var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
|
|
297
|
+
return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
|
|
295
298
|
}
|
|
296
299
|
/**
|
|
297
300
|
* Create String X axis
|
|
@@ -353,7 +356,7 @@ export function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
|
353
356
|
if (xAxisParams.xAxisElement) {
|
|
354
357
|
d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
355
358
|
}
|
|
356
|
-
return { xScale: xAxisScale, tickValues: tickValues };
|
|
359
|
+
return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
|
|
357
360
|
}
|
|
358
361
|
/**
|
|
359
362
|
* This method is used to calculate the rounded tick values for the y-axis
|
|
@@ -677,14 +680,15 @@ export var DEFAULT_WRAP_WIDTH = 10;
|
|
|
677
680
|
* @returns
|
|
678
681
|
*/
|
|
679
682
|
export function createWrapOfXLabels(wrapLabelProps) {
|
|
680
|
-
var
|
|
683
|
+
var _a, _b;
|
|
684
|
+
var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip, _c = wrapLabelProps.width, width = _c === void 0 ? DEFAULT_WRAP_WIDTH : _c, container = wrapLabelProps.container;
|
|
681
685
|
if (node === null) {
|
|
682
686
|
return;
|
|
683
687
|
}
|
|
684
688
|
var axisNode = d3Select(node).call(xAxis);
|
|
685
689
|
var removeVal = 0;
|
|
686
690
|
var maxLines = 1;
|
|
687
|
-
axisNode.selectAll('.tick text').each(function () {
|
|
691
|
+
axisNode.selectAll('.tick text').each(function (_, tickIndex) {
|
|
688
692
|
var text = d3Select(this);
|
|
689
693
|
var totalWord = text.text();
|
|
690
694
|
var truncatedWord = "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
|
|
@@ -698,41 +702,27 @@ export function createWrapOfXLabels(wrapLabelProps) {
|
|
|
698
702
|
var dy = parseFloat(text.attr('dy'));
|
|
699
703
|
var tspan = text
|
|
700
704
|
.text(null)
|
|
705
|
+
.attr('data-full', totalWord)
|
|
701
706
|
.append('tspan')
|
|
702
707
|
.attr('x', 0)
|
|
703
708
|
.attr('y', y)
|
|
704
|
-
.attr('
|
|
705
|
-
|
|
706
|
-
.
|
|
707
|
-
if (showXAxisLablesTooltip && totalWordLength > noOfCharsToTruncate) {
|
|
708
|
-
tspan = text
|
|
709
|
-
.append('tspan')
|
|
710
|
-
.attr('id', 'showDots')
|
|
711
|
-
.attr('x', 0)
|
|
712
|
-
.attr('y', y)
|
|
713
|
-
.attr('dy', dy + 'em')
|
|
714
|
-
.text(truncatedWord);
|
|
715
|
-
}
|
|
716
|
-
else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
|
|
717
|
-
tspan = text
|
|
718
|
-
.append('tspan')
|
|
719
|
-
.attr('id', 'LessLength')
|
|
720
|
-
.attr('x', 0)
|
|
721
|
-
.attr('y', y)
|
|
722
|
-
.attr('dy', dy + 'em')
|
|
723
|
-
.text(totalWord);
|
|
709
|
+
.attr('dy', dy + 'em');
|
|
710
|
+
if (showXAxisLablesTooltip) {
|
|
711
|
+
tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
|
|
724
712
|
}
|
|
725
713
|
else {
|
|
714
|
+
var maxWidth = Array.isArray(width) ? width[tickIndex] : width;
|
|
726
715
|
while ((word = words.pop())) {
|
|
727
716
|
line.push(word);
|
|
728
|
-
|
|
729
|
-
|
|
717
|
+
var label = line.join(' ');
|
|
718
|
+
tspan.text(label);
|
|
719
|
+
var labelWidth = getTextSize(label, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
|
|
720
|
+
if (labelWidth > maxWidth && line.length > 1) {
|
|
730
721
|
line.pop();
|
|
731
722
|
tspan.text(line.join(' '));
|
|
732
723
|
line = [word];
|
|
733
724
|
tspan = text
|
|
734
725
|
.append('tspan')
|
|
735
|
-
.attr('id', 'WordBreakId')
|
|
736
726
|
.attr('x', 0)
|
|
737
727
|
.attr('y', y)
|
|
738
728
|
.attr('dy', ++lineNumber * lineHeight + dy + 'em')
|
|
@@ -744,10 +734,7 @@ export function createWrapOfXLabels(wrapLabelProps) {
|
|
|
744
734
|
});
|
|
745
735
|
if (!showXAxisLablesTooltip) {
|
|
746
736
|
var maxHeight = 12; // intial value to render corretly first time
|
|
747
|
-
|
|
748
|
-
var outerHTMLElement = document.getElementById('WordBreakId');
|
|
749
|
-
var BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
|
|
750
|
-
var boxHeight = BoxCordinates && BoxCordinates.height;
|
|
737
|
+
var boxHeight = (_b = (_a = (container !== null && container !== void 0 ? container : document).querySelector(".".concat(CARTESIAN_XAXIS_CLASSNAME, " tspan"))) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) !== null && _b !== void 0 ? _b : 0;
|
|
751
738
|
if (boxHeight > maxHeight) {
|
|
752
739
|
maxHeight = boxHeight;
|
|
753
740
|
}
|
|
@@ -772,53 +759,35 @@ yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
|
|
|
772
759
|
? "...".concat(text.text().slice(0, noOfCharsToTruncate))
|
|
773
760
|
: "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
|
|
774
761
|
var totalWordLength = text.text().length;
|
|
775
|
-
var padding = 0; // ems
|
|
776
762
|
var y = text.attr('y');
|
|
777
763
|
var x = text.attr('x');
|
|
778
764
|
var dy = parseFloat(text.attr('dy'));
|
|
779
|
-
var
|
|
780
|
-
text
|
|
765
|
+
var tspan = text
|
|
781
766
|
.text(null)
|
|
767
|
+
.attr('data-full', totalWord)
|
|
782
768
|
.append('tspan')
|
|
783
769
|
.attr('x', x)
|
|
784
770
|
.attr('y', y)
|
|
785
|
-
.attr('
|
|
786
|
-
|
|
787
|
-
.
|
|
788
|
-
if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
|
|
789
|
-
text
|
|
790
|
-
.append('tspan')
|
|
791
|
-
.attr('id', 'showDots')
|
|
792
|
-
.attr('x', x)
|
|
793
|
-
.attr('y', y)
|
|
794
|
-
.attr('dy', dy + 'em')
|
|
795
|
-
.attr('dx', padding + dx + 'em')
|
|
796
|
-
.text(truncatedWord);
|
|
797
|
-
}
|
|
798
|
-
else {
|
|
799
|
-
text
|
|
800
|
-
.append('tspan')
|
|
801
|
-
.attr('id', 'LessLength')
|
|
802
|
-
.attr('x', x)
|
|
803
|
-
.attr('y', y)
|
|
804
|
-
.attr('dx', padding + dx + 'em')
|
|
805
|
-
.text(totalWord);
|
|
771
|
+
.attr('dy', dy + 'em');
|
|
772
|
+
if (truncateLabel) {
|
|
773
|
+
tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
|
|
806
774
|
}
|
|
807
775
|
});
|
|
808
776
|
}
|
|
809
777
|
export var wrapContent = function (content, id, maxWidth) {
|
|
810
778
|
var textElement = d3Select("#".concat(id));
|
|
811
779
|
textElement.text(content);
|
|
812
|
-
|
|
780
|
+
var node = textElement.node();
|
|
781
|
+
if (!node || typeof node.getComputedTextLength !== 'function') {
|
|
813
782
|
return false;
|
|
814
783
|
}
|
|
815
784
|
var isOverflowing = false;
|
|
816
|
-
var textLength =
|
|
785
|
+
var textLength = node.getComputedTextLength();
|
|
817
786
|
while (textLength > maxWidth && content.length > 0) {
|
|
818
787
|
content = content.slice(0, -1);
|
|
819
788
|
textElement.text(content + '...');
|
|
820
789
|
isOverflowing = true;
|
|
821
|
-
textLength =
|
|
790
|
+
textLength = node.getComputedTextLength();
|
|
822
791
|
}
|
|
823
792
|
return isOverflowing;
|
|
824
793
|
};
|
|
@@ -855,38 +824,41 @@ export var calculateLongestLabelWidth = function (labels, query) {
|
|
|
855
824
|
*/
|
|
856
825
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
857
826
|
export function tooltipOfAxislabels(axistooltipProps) {
|
|
858
|
-
var tooltipCls = axistooltipProps.tooltipCls, axis = axistooltipProps.axis, id = axistooltipProps.id;
|
|
827
|
+
var tooltipCls = axistooltipProps.tooltipCls, axis = axistooltipProps.axis, id = axistooltipProps.id, container = axistooltipProps.container;
|
|
859
828
|
if (axis === null) {
|
|
860
829
|
return null;
|
|
861
830
|
}
|
|
862
|
-
var div = d3Select(
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
var
|
|
874
|
-
|
|
831
|
+
var div = (container ? d3Select(container) : d3Select('body'))
|
|
832
|
+
.append('div')
|
|
833
|
+
.attr('id', id)
|
|
834
|
+
.attr('class', tooltipCls)
|
|
835
|
+
.style('opacity', 0);
|
|
836
|
+
axis.selectAll('.tick text').each(function () {
|
|
837
|
+
var tickSelection = d3Select(this);
|
|
838
|
+
var fullLabel = tickSelection.attr('data-full');
|
|
839
|
+
if (tickSelection.text() === fullLabel) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
var tickEl = this;
|
|
843
|
+
tickSelection
|
|
875
844
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
876
845
|
.on('mouseover', function (event, d) {
|
|
877
|
-
|
|
846
|
+
var _a;
|
|
847
|
+
var containerBounds = container === null || container === void 0 ? void 0 : container.getBoundingClientRect();
|
|
848
|
+
var tickBounds = tickEl.getBoundingClientRect();
|
|
849
|
+
var tooltipBottom = containerBounds ? containerBounds.bottom - (tickBounds.top - 4) : tickBounds.top - 4;
|
|
850
|
+
var tooltipLeft = (tickBounds.left + tickBounds.right) / 2 - ((_a = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.left) !== null && _a !== void 0 ? _a : 0);
|
|
878
851
|
div
|
|
879
|
-
.text(
|
|
880
|
-
.style('
|
|
881
|
-
.style('
|
|
852
|
+
.text(fullLabel)
|
|
853
|
+
.style('bottom', "".concat(tooltipBottom, "px"))
|
|
854
|
+
.style('left', "".concat(tooltipLeft, "px"))
|
|
855
|
+
.style('transform', 'translateX(-50%)')
|
|
856
|
+
.style('opacity', 0.9);
|
|
882
857
|
})
|
|
883
858
|
.on('mouseout', function (d) {
|
|
884
859
|
div.style('opacity', 0);
|
|
885
860
|
});
|
|
886
|
-
};
|
|
887
|
-
for (var i = 0; i < tickObjectLength; i++) {
|
|
888
|
-
_loop_1(i);
|
|
889
|
-
}
|
|
861
|
+
});
|
|
890
862
|
}
|
|
891
863
|
/**
|
|
892
864
|
* Find the axis type of line chart and area chart from given data
|
|
@@ -1373,8 +1345,8 @@ export function areArraysEqual(arr1, arr2) {
|
|
|
1373
1345
|
return true;
|
|
1374
1346
|
}
|
|
1375
1347
|
var cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
|
|
1376
|
-
export function resolveCSSVariables(
|
|
1377
|
-
var containerStyles = getComputedStyle(
|
|
1348
|
+
export function resolveCSSVariables(container, styleRules) {
|
|
1349
|
+
var containerStyles = getComputedStyle(container);
|
|
1378
1350
|
return styleRules.replace(cssVarRegExp, function (match, group1) {
|
|
1379
1351
|
return containerStyles.getPropertyValue(group1);
|
|
1380
1352
|
});
|
|
@@ -1403,24 +1375,50 @@ var MEASUREMENT_SPAN_STYLE = {
|
|
|
1403
1375
|
border: 'none',
|
|
1404
1376
|
whiteSpace: 'pre',
|
|
1405
1377
|
};
|
|
1406
|
-
var MEASUREMENT_SPAN_ID =
|
|
1407
|
-
|
|
1378
|
+
var MEASUREMENT_SPAN_ID = 'fui_measurement_span';
|
|
1379
|
+
var TEXT_STYLE_PROPERTIES = [
|
|
1380
|
+
'font-size',
|
|
1381
|
+
'font-family',
|
|
1382
|
+
'font-weight',
|
|
1383
|
+
'font-style',
|
|
1384
|
+
'letter-spacing',
|
|
1385
|
+
'text-transform',
|
|
1386
|
+
];
|
|
1387
|
+
export var measureTextWithDOM = function (text, cssSelector, container) {
|
|
1408
1388
|
var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
|
1409
1389
|
if (!measurementSpan) {
|
|
1410
1390
|
measurementSpan = document.createElement('span');
|
|
1411
1391
|
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
|
1412
1392
|
measurementSpan.setAttribute('aria-hidden', 'true');
|
|
1413
|
-
|
|
1414
|
-
parentElement.appendChild(measurementSpan);
|
|
1415
|
-
}
|
|
1416
|
-
else {
|
|
1417
|
-
document.body.appendChild(measurementSpan);
|
|
1418
|
-
}
|
|
1393
|
+
(container !== null && container !== void 0 ? container : document.body).appendChild(measurementSpan);
|
|
1419
1394
|
}
|
|
1420
|
-
measurementSpan.setAttribute('class', className);
|
|
1421
1395
|
Object.assign(measurementSpan.style, MEASUREMENT_SPAN_STYLE);
|
|
1396
|
+
var refEl = (container !== null && container !== void 0 ? container : document).querySelector(cssSelector);
|
|
1397
|
+
if (refEl) {
|
|
1398
|
+
copyStyle(TEXT_STYLE_PROPERTIES, refEl, measurementSpan);
|
|
1399
|
+
}
|
|
1422
1400
|
measurementSpan.textContent = "".concat(text);
|
|
1423
|
-
|
|
1401
|
+
var rect = measurementSpan.getBoundingClientRect();
|
|
1402
|
+
return { node: measurementSpan, width: rect.width, height: rect.height };
|
|
1403
|
+
};
|
|
1404
|
+
var CACHE_SIZE = 2000;
|
|
1405
|
+
var textSizeCache = new Map();
|
|
1406
|
+
export var getTextSize = function (text, cssSelector, container) {
|
|
1407
|
+
var cacheKey = "".concat(text, "|").concat(cssSelector);
|
|
1408
|
+
var cachedResult = textSizeCache.get(cacheKey);
|
|
1409
|
+
if (cachedResult) {
|
|
1410
|
+
return cachedResult;
|
|
1411
|
+
}
|
|
1412
|
+
var _a = measureTextWithDOM(text, cssSelector, container), width = _a.width, height = _a.height;
|
|
1413
|
+
// TODO: Improve cache eviction strategy if needed (e.g., LRU)
|
|
1414
|
+
if (textSizeCache.size >= CACHE_SIZE) {
|
|
1415
|
+
var firstKey = textSizeCache.keys().next().value;
|
|
1416
|
+
if (!isInvalidValue(firstKey)) {
|
|
1417
|
+
textSizeCache.delete(firstKey);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
textSizeCache.set(cacheKey, { width: width, height: height });
|
|
1421
|
+
return { width: width, height: height };
|
|
1424
1422
|
};
|
|
1425
1423
|
export function getCurveFactory(curve, defaultFactory) {
|
|
1426
1424
|
if (defaultFactory === void 0) { defaultFactory = d3CurveLinear; }
|
|
@@ -1664,7 +1662,7 @@ export var generateMonthlyTicks = function (tick0, tickStepInMonths, scaleDomain
|
|
|
1664
1662
|
}
|
|
1665
1663
|
return ticks;
|
|
1666
1664
|
};
|
|
1667
|
-
var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
|
|
1665
|
+
export var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
|
|
1668
1666
|
var refTick = typeof tick0 === 'number' ? tick0 : 0;
|
|
1669
1667
|
if (scaleType === 'log') {
|
|
1670
1668
|
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
@@ -1683,7 +1681,7 @@ var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
|
|
|
1683
1681
|
return generateLinearTicks(refTick, tickStep, scaleDomain);
|
|
1684
1682
|
}
|
|
1685
1683
|
};
|
|
1686
|
-
var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
|
|
1684
|
+
export var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
|
|
1687
1685
|
var refTick = tick0 instanceof Date ? tick0 : new Date(DEFAULT_DATE_STRING);
|
|
1688
1686
|
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1689
1687
|
return generateLinearTicks(+refTick, tickStep, scaleDomain.map(function (d) { return +d; })).map(function (t) { return new Date(t); });
|
|
@@ -1709,4 +1707,112 @@ export var findCalloutPoints = function (calloutPointsByX, x) {
|
|
|
1709
1707
|
values: calloutPointsByX[key],
|
|
1710
1708
|
};
|
|
1711
1709
|
};
|
|
1710
|
+
export var autoLayoutXAxisLabels = function (tickValues, tickLabels, scale, axisNode, containerWidth, container) {
|
|
1711
|
+
var _a;
|
|
1712
|
+
var requiresWrap = false;
|
|
1713
|
+
var requiresTruncate = false;
|
|
1714
|
+
var maxWidths = [];
|
|
1715
|
+
var _b = scale.range(), rangeStart = _b[0], rangeEnd = _b[1];
|
|
1716
|
+
var isRTL = rangeEnd - rangeStart < 0;
|
|
1717
|
+
var start = isRTL ? containerWidth : 0;
|
|
1718
|
+
var end = isRTL ? 0 : containerWidth;
|
|
1719
|
+
var getTickPosition = function (index) {
|
|
1720
|
+
var _a;
|
|
1721
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1722
|
+
return ((_a = scale(tickValues[index])) !== null && _a !== void 0 ? _a : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
|
|
1723
|
+
};
|
|
1724
|
+
var getLabelWidth = function (text) {
|
|
1725
|
+
return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
|
|
1726
|
+
};
|
|
1727
|
+
for (var i = 0; i < tickValues.length; i++) {
|
|
1728
|
+
var position = getTickPosition(i);
|
|
1729
|
+
var leftSpace = Math.abs(i > 0 ? (position - getTickPosition(i - 1)) / 2 : position - start);
|
|
1730
|
+
var rightSpace = Math.abs(i + 1 < tickValues.length ? (getTickPosition(i + 1) - position) / 2 : end - position);
|
|
1731
|
+
var maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
|
|
1732
|
+
var label = tickLabels[i];
|
|
1733
|
+
var labelWidth = getLabelWidth(label);
|
|
1734
|
+
maxWidths.push(maxAvailableWidth);
|
|
1735
|
+
if (labelWidth > maxAvailableWidth) {
|
|
1736
|
+
var longestWordWidth = Math.max.apply(Math, label.split(/\s+/).map(function (word) { return getLabelWidth(word); }));
|
|
1737
|
+
if (longestWordWidth <= maxAvailableWidth) {
|
|
1738
|
+
requiresWrap = true;
|
|
1739
|
+
}
|
|
1740
|
+
else {
|
|
1741
|
+
requiresTruncate = true;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
if (requiresTruncate) {
|
|
1746
|
+
return truncateAndStaggerXAxisLabels(tickValues, tickLabels, scale, axisNode, containerWidth, container);
|
|
1747
|
+
}
|
|
1748
|
+
if (requiresWrap) {
|
|
1749
|
+
return ((_a = createWrapOfXLabels({
|
|
1750
|
+
node: axisNode,
|
|
1751
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1752
|
+
xAxis: scale,
|
|
1753
|
+
noOfCharsToTruncate: 100,
|
|
1754
|
+
showXAxisLablesTooltip: false,
|
|
1755
|
+
width: maxWidths,
|
|
1756
|
+
container: container,
|
|
1757
|
+
})) !== null && _a !== void 0 ? _a : 0);
|
|
1758
|
+
}
|
|
1759
|
+
return 0;
|
|
1760
|
+
};
|
|
1761
|
+
var truncateAndStaggerXAxisLabels = function (tickValues, tickLabels, scale, axisNode, containerWidth, container) {
|
|
1762
|
+
if (!axisNode) {
|
|
1763
|
+
return 0;
|
|
1764
|
+
}
|
|
1765
|
+
var maxHeight = 12;
|
|
1766
|
+
var _a = scale.range(), rangeStart = _a[0], rangeEnd = _a[1];
|
|
1767
|
+
var isRTL = rangeEnd - rangeStart < 0;
|
|
1768
|
+
var start = isRTL ? containerWidth : 0;
|
|
1769
|
+
var end = isRTL ? 0 : containerWidth;
|
|
1770
|
+
var getTickPosition = function (index) {
|
|
1771
|
+
var _a;
|
|
1772
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1773
|
+
return ((_a = scale(tickValues[index])) !== null && _a !== void 0 ? _a : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
|
|
1774
|
+
};
|
|
1775
|
+
var getLabelSize = function (text) {
|
|
1776
|
+
return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container);
|
|
1777
|
+
};
|
|
1778
|
+
d3Select(axisNode)
|
|
1779
|
+
.selectAll('.tick text')
|
|
1780
|
+
.each(function (_, i) {
|
|
1781
|
+
var position = getTickPosition(i);
|
|
1782
|
+
var leftSpace = Math.abs(i > 0 ? position - getTickPosition(i - 1) : position - start);
|
|
1783
|
+
var rightSpace = Math.abs(i + 1 < tickValues.length ? getTickPosition(i + 1) - position : end - position);
|
|
1784
|
+
var maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
|
|
1785
|
+
var label = tickLabels[i];
|
|
1786
|
+
var textNode = d3Select(this).text(null).attr('data-full', label);
|
|
1787
|
+
var lineHeight = 1.1; // ems
|
|
1788
|
+
var y = textNode.attr('y');
|
|
1789
|
+
var dy = parseFloat(textNode.attr('dy'));
|
|
1790
|
+
textNode
|
|
1791
|
+
.append('tspan')
|
|
1792
|
+
.attr('x', 0)
|
|
1793
|
+
.attr('y', y)
|
|
1794
|
+
.attr('dy', (i % 2 === 1 ? lineHeight : 0) + dy + 'em')
|
|
1795
|
+
.text(truncateTextToFitWidth(label, maxAvailableWidth, function (s) { return getLabelSize(s).width; }));
|
|
1796
|
+
maxHeight = Math.max(maxHeight, getLabelSize(label).height);
|
|
1797
|
+
});
|
|
1798
|
+
return tickValues.length > 1 ? maxHeight : 0;
|
|
1799
|
+
};
|
|
1800
|
+
var truncateTextToFitWidth = function (text, maxWidth, measure) {
|
|
1801
|
+
if (measure(text) <= maxWidth) {
|
|
1802
|
+
return text;
|
|
1803
|
+
}
|
|
1804
|
+
var lo = 1;
|
|
1805
|
+
var hi = text.length;
|
|
1806
|
+
while (lo < hi) {
|
|
1807
|
+
var mid = Math.floor((lo + hi + 1) / 2);
|
|
1808
|
+
var candidate = text.slice(0, mid) + '...';
|
|
1809
|
+
if (measure(candidate) <= maxWidth) {
|
|
1810
|
+
lo = mid;
|
|
1811
|
+
}
|
|
1812
|
+
else {
|
|
1813
|
+
hi = mid - 1;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
return text.slice(0, lo) + '...';
|
|
1817
|
+
};
|
|
1712
1818
|
//# sourceMappingURL=utilities.js.map
|