@fluentui/react-charting 5.25.4 → 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 +107 -1
- package/CHANGELOG.md +30 -2
- package/bundle-size/PolarChart.fixture.js +7 -0
- package/dist/react-charting.d.ts +424 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +93 -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 +20 -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 +390 -267
- 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/DonutChart/Pie/Pie.js +4 -2
- package/lib/components/DonutChart/Pie/Pie.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 +6 -18
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +55 -5
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +0 -1
- package/lib/components/LineChart/LineChart.base.js +2 -26
- 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 +10 -3
- 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 +14 -32
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +12 -80
- 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 +19 -31
- 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 +107 -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 +32 -8
- package/lib/utilities/utilities.js +232 -111
- 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 +20 -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 +392 -269
- 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/DonutChart/Pie/Pie.js +4 -2
- package/lib-amd/components/DonutChart/Pie/Pie.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 +4 -16
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -2
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +0 -1
- package/lib-amd/components/LineChart/LineChart.base.js +1 -25
- 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 +10 -4
- 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 +13 -31
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +12 -79
- 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 +19 -30
- 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 +107 -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 +32 -8
- package/lib-amd/utilities/utilities.js +239 -114
- 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 +20 -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 +392 -269
- 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/DonutChart/Pie/Pie.js +4 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.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 +4 -16
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +0 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +1 -25
- 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 +10 -3
- 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 +13 -31
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +11 -79
- 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 +18 -30
- 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 +107 -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 +32 -8
- package/lib-commonjs/utilities/utilities.js +239 -114
- 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 +22 -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/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +11 -0
- package/src/components/PolarChart/PolarChart.types.ts +232 -0
- package/src/components/SankeyChart/SankeyChart.types.ts +22 -0
- package/src/components/ScatterChart/ScatterChart.types.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-export-utils.js","sourceRoot":"../src/","sources":["utilities/image-export-utils.ts"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C;IACd,IAAI,GAAG,CAAC;IACR,IAAI,IAAI,CAAC;IACT,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;QACtB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;gBAC9B,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACvC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACnC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { copyStyle, createMeasurementSpan } from './index';\nimport { IImageExportOptions } from '../types/index';\nimport { ILegend, ILegendContainer } from '../Legends';\nimport {\n LEGEND_CONTAINER_MARGIN_TOP,\n LEGEND_CONTAINER_MARGIN_START,\n LEGEND_PADDING,\n LEGEND_HEIGHT,\n LEGEND_SHAPE_BORDER,\n LEGEND_SHAPE_SIZE,\n LEGEND_SHAPE_MARGIN_END,\n INACTIVE_LEGEND_TEXT_OPACITY,\n} from '../components/Legends/Legends.styles';\n\nexport type GridChart = {\n container: HTMLElement | null | undefined;\n row?: number;\n col?: number;\n};\n\ntype SvgImage = {\n dataUrl: string;\n width: number;\n height: number;\n};\n\nexport async function exportChartsAsImage(\n charts: GridChart[],\n legendsToSvg?: ILegendContainer['toSVG'],\n isRTL: boolean = false,\n opts: IImageExportOptions = {},\n): Promise<string> {\n if (charts.length === 0 && !legendsToSvg) {\n throw new Error('No charts or legends to export');\n }\n\n const chartImages = await Promise.all(\n charts.map(chart => {\n return new Promise<SvgImage>(resolve => {\n const svg = cloneStyledSVG(chart.container, isRTL);\n const svgDataUrl = svgToBase64(svg.node);\n resolve({ dataUrl: svgDataUrl, width: svg.width, height: svg.height });\n });\n }),\n );\n\n const grid: SvgImage[][] = []; // Sparse 2D array\n charts.forEach((chart, i) => {\n const row = chart.row || 0;\n const col = chart.col || 0;\n if (!grid[row]) {\n grid[row] = [];\n }\n grid[row][col] = chartImages[i];\n });\n\n if (legendsToSvg) {\n let totalWidth = 0;\n grid.forEach(row => {\n let rowWidth = 0;\n row.forEach(item => {\n rowWidth += item.width;\n });\n totalWidth = Math.max(totalWidth, rowWidth);\n });\n\n const svg = legendsToSvg(totalWidth, isRTL);\n if (svg.node) {\n const svgDataUrl = svgToBase64(svg.node);\n grid.push([{ dataUrl: svgDataUrl, width: svg.width, height: svg.height }]);\n }\n }\n\n return svgToPng(grid, opts);\n}\n\nconst SVG_STYLE_PROPERTIES = [\n 'display',\n 'fill',\n 'fill-opacity',\n 'opacity',\n 'stroke',\n 'stroke-width',\n 'transform',\n 'border-collapse',\n];\nconst SVG_TEXT_STYLE_PROPERTIES = [\n 'font-family',\n 'font-size',\n 'font-weight',\n 'text-anchor',\n 'background-color',\n 'color',\n 'padding',\n 'text-align',\n 'border',\n];\nconst ANNOTATION_HTML_STYLE_PROPERTIES = [\n 'align-items',\n 'background',\n 'background-color',\n 'border',\n 'border-radius',\n 'box-shadow',\n 'box-sizing',\n 'color',\n 'column-gap',\n 'display',\n 'flex',\n 'flex-direction',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'gap',\n 'height',\n 'justify-content',\n 'letter-spacing',\n 'line-height',\n 'margin',\n 'max-height',\n 'max-width',\n 'min-height',\n 'min-width',\n 'opacity',\n 'overflow',\n 'padding',\n 'pointer-events',\n 'position',\n 'row-gap',\n 'text-align',\n 'text-decoration',\n 'text-transform',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'visibility',\n 'white-space',\n 'width',\n 'z-index',\n];\nconst ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];\n\nfunction cloneStyledSVG(chartContainer: HTMLElement | null | undefined, isRTL: boolean) {\n if (!chartContainer) {\n throw new Error('Chart container is not defined');\n }\n\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n let clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n let svgElements = svg.getElementsByTagName('*');\n let clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n const TEXT_ELEMENTS = ['text'];\n const TABLE_ELEMENTS = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];\n\n for (let i = 0; i < svgElements.length; i++) {\n const tag = svgElements[i].tagName.toLowerCase();\n\n if (TEXT_ELEMENTS.includes(tag) || TABLE_ELEMENTS.includes(tag)) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgElements = null as any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvgElements = null as any;\n\n const originalForeignObjects = svg.querySelectorAll('foreignObject');\n const clonedForeignObjects = clonedSvg.node()!.querySelectorAll('foreignObject');\n\n originalForeignObjects.forEach((originalFo, index) => {\n const clonedFo = clonedForeignObjects[index];\n if (!clonedFo) {\n return;\n }\n\n const originalRoot = originalFo.firstElementChild as HTMLElement | null;\n const clonedRoot = clonedFo.firstElementChild as HTMLElement | null;\n\n if (originalRoot && clonedRoot) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalRoot, clonedRoot);\n }\n\n const originalHtmlElements = originalFo.querySelectorAll<HTMLElement>('*');\n const clonedHtmlElements = clonedFo.querySelectorAll<HTMLElement>('*');\n\n originalHtmlElements.forEach((originalEl, elementIndex) => {\n const clonedEl = clonedHtmlElements[elementIndex];\n if (clonedEl) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalEl, clonedEl);\n }\n });\n });\n\n const annotationSvg = chartContainer.querySelector<SVGSVGElement>('[data-chart-annotation-svg=\"true\"]');\n let annotationClone: SVGSVGElement | null = null;\n\n if (annotationSvg) {\n annotationClone = annotationSvg.cloneNode(true) as SVGSVGElement;\n copyStyle(SVG_STYLE_PROPERTIES, annotationSvg, annotationClone);\n\n const annotationElements = annotationSvg.getElementsByTagName('*');\n const clonedAnnotationElements = annotationClone.getElementsByTagName('*');\n\n for (let i = 0; i < annotationElements.length; i++) {\n const original = annotationElements[i];\n const cloned = clonedAnnotationElements[i];\n const tag = original.tagName.toLowerCase();\n const isSvgElement = original instanceof SVGElement;\n const isTextElement = tag === 'text';\n const isHtmlElement = original instanceof HTMLElement;\n\n if (isSvgElement) {\n if (isTextElement) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], original, cloned);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, original, cloned);\n }\n }\n\n if (isHtmlElement) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, original, cloned);\n }\n\n if (tag === 'foreignobject') {\n copyStyle(ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES, original, cloned);\n }\n }\n }\n\n const { width, height } = svg.getBoundingClientRect();\n\n clonedSvg\n .attr('width', width)\n .attr('height', height)\n .attr('viewBox', `0 0 ${width} ${height}`)\n .attr('direction', isRTL ? 'rtl' : 'ltr');\n\n if (annotationClone) {\n clonedSvg.selectAll('[data-chart-annotation-layer=\"true\"]').remove();\n d3Select(annotationClone).attr('x', 0).attr('y', 0).attr('width', width).attr('height', height);\n clonedSvg.append(() => annotationClone as SVGSVGElement);\n }\n\n const result = {\n node: clonedSvg.node(),\n width,\n height,\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvg = null as any;\n\n return result;\n}\n\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n};\n\nexport function cloneLegendsToSVG(\n legends: ILegend[],\n svgWidth: number,\n config: {\n selectedLegends: Record<string, boolean>;\n centerLegends: boolean;\n textClassName: string;\n isRTL: boolean;\n },\n legendContainer?: HTMLElement | null,\n): { node: SVGSVGElement | null; width: number; height: number } {\n if (legends.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const { selectedLegends, centerLegends, textClassName, isRTL } = config;\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n let legendY = LEGEND_CONTAINER_MARGIN_TOP;\n let legendLine: { elem: Selection<SVGGElement, unknown, null, undefined>; width: number }[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n const noLegendsSelected = Object.keys(selectedLegends).length === 0;\n\n for (let i = 0; i < legends.length; i++) {\n const textOffset = LEGEND_PADDING + LEGEND_SHAPE_SIZE + LEGEND_SHAPE_MARGIN_END;\n const legendText = createMeasurementSpan(legends[i].title, textClassName, legendContainer);\n const legendWidth = textOffset + legendText.getBoundingClientRect().width + LEGEND_PADDING;\n const legendItem = legendGroup.append('g');\n\n legendLine.push({ elem: legendItem, width: legendWidth });\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [{ elem: legendItem, width: legendWidth }];\n legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n legendY += LEGEND_HEIGHT;\n }\n\n const isLegendActive = selectedLegends[legends[i].title] || noLegendsSelected;\n\n legendItem\n .append('rect')\n .attr('x', legendX + (isRTL ? legendWidth - LEGEND_PADDING - LEGEND_SHAPE_SIZE : LEGEND_PADDING))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('width', LEGEND_SHAPE_SIZE)\n .attr('height', LEGEND_SHAPE_SIZE)\n .style('fill', isLegendActive ? legends[i].color : 'transparent')\n .style('stroke-width', LEGEND_SHAPE_BORDER)\n .style('stroke', legends[i].color);\n\n legendItem\n .append('text')\n .attr('x', legendX + (isRTL ? legendWidth - textOffset : textOffset))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('dominant-baseline', 'hanging')\n .style('opacity', isLegendActive ? 1 : INACTIVE_LEGEND_TEXT_OPACITY)\n .text(legends[i].title)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText, selection.node()!));\n\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += LEGEND_HEIGHT;\n\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const lineOffsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n let remLineWidth = legendLineWidths[idx];\n let itemOffsetX = 0;\n ln.forEach(item => {\n const newOffsetX = lineOffsetX + (isRTL ? remLineWidth - item.width - itemOffsetX : 0);\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n } else if (isRTL) {\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n legendLines.forEach(ln => {\n let remLineWidth = w1 - LEGEND_CONTAINER_MARGIN_START;\n let itemOffsetX = LEGEND_CONTAINER_MARGIN_START;\n ln.forEach(item => {\n const newOffsetX = remLineWidth - item.width - itemOffsetX;\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n }\n\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n const h1 = legendY;\n const svg = d3Create<SVGSVGElement>('svg').attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n svg.append(() => legendGroup.node()!);\n\n return {\n node: svg.node(),\n width: w1,\n height: h1,\n };\n}\n\ntype PositionedImage = SvgImage & {\n x: number;\n y: number;\n};\n\nasync function svgToPng(grid: SvgImage[][], opts: IImageExportOptions = {}): Promise<string> {\n let totalWidth = 0;\n let totalHeight = 0;\n\n const positionedImages: PositionedImage[] = grid\n .map(row => {\n let rowWidth = 0;\n let rowHeight = 0;\n\n const items = row.map(item => {\n const positioned = { ...item, x: rowWidth, y: totalHeight };\n rowWidth += item.width;\n rowHeight = Math.max(rowHeight, item.height);\n return positioned;\n });\n\n totalWidth = Math.max(totalWidth, rowWidth);\n totalHeight += rowHeight;\n\n return items;\n })\n .flat();\n\n const scale = opts.scale || 1;\n const w0 = opts.width || totalWidth;\n const h0 = opts.height || totalHeight;\n const scaleX = (scale * w0) / totalWidth;\n const scaleY = (scale * h0) / totalHeight;\n totalWidth = scaleX * totalWidth;\n totalHeight = scaleY * totalHeight;\n\n const canvas = document.createElement('canvas');\n canvas.width = totalWidth;\n canvas.height = totalHeight;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Canvas context is null');\n }\n\n ctx.fillStyle = opts.background || 'transparent';\n ctx.fillRect(0, 0, totalWidth, totalHeight);\n\n await Promise.all(\n positionedImages.map(\n item =>\n new Promise<void>((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n ctx.drawImage(img, scaleX * item.x, scaleY * item.y, scaleX * item.width, scaleY * item.height);\n resolve();\n };\n img.onerror = reject;\n img.src = item.dataUrl;\n }),\n ),\n );\n\n return canvas.toDataURL('image/png');\n}\n\nfunction svgToBase64(svgNode: SVGSVGElement | null) {\n if (!svgNode) {\n throw new Error('SVG node is null');\n }\n\n const svgData = new XMLSerializer().serializeToString(svgNode);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n return svgDataUrl;\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"image-export-utils.js","sourceRoot":"../src/","sources":["utilities/image-export-utils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,IAAI,QAAQ,EAAa,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGxD,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,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;gBAC9B,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACvC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACnC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { copyStyle, measureTextWithDOM } from './index';\nimport { IImageExportOptions } from '../types/index';\nimport { ILegend, ILegendContainer } from '../Legends';\nimport {\n LEGEND_CONTAINER_MARGIN_TOP,\n LEGEND_CONTAINER_MARGIN_START,\n LEGEND_PADDING,\n LEGEND_HEIGHT,\n LEGEND_SHAPE_BORDER,\n LEGEND_SHAPE_SIZE,\n LEGEND_SHAPE_MARGIN_END,\n INACTIVE_LEGEND_TEXT_OPACITY,\n} from '../components/Legends/Legends.styles';\n\nexport type GridChart = {\n container: HTMLElement | null | undefined;\n row?: number;\n col?: number;\n};\n\ntype SvgImage = {\n dataUrl: string;\n width: number;\n height: number;\n};\n\nexport async function exportChartsAsImage(\n charts: GridChart[],\n legendsToSvg?: ILegendContainer['toSVG'],\n isRTL: boolean = false,\n opts: IImageExportOptions = {},\n): Promise<string> {\n if (charts.length === 0 && !legendsToSvg) {\n throw new Error('No charts or legends to export');\n }\n\n const chartImages = await Promise.all(\n charts.map(chart => {\n return new Promise<SvgImage>(resolve => {\n const svg = cloneStyledSVG(chart.container, isRTL);\n const svgDataUrl = svgToBase64(svg.node);\n resolve({ dataUrl: svgDataUrl, width: svg.width, height: svg.height });\n });\n }),\n );\n\n const grid: SvgImage[][] = []; // Sparse 2D array\n charts.forEach((chart, i) => {\n const row = chart.row || 0;\n const col = chart.col || 0;\n if (!grid[row]) {\n grid[row] = [];\n }\n grid[row][col] = chartImages[i];\n });\n\n if (legendsToSvg) {\n let totalWidth = 0;\n grid.forEach(row => {\n let rowWidth = 0;\n row.forEach(item => {\n rowWidth += item.width;\n });\n totalWidth = Math.max(totalWidth, rowWidth);\n });\n\n const svg = legendsToSvg(totalWidth, isRTL);\n if (svg.node) {\n const svgDataUrl = svgToBase64(svg.node);\n grid.push([{ dataUrl: svgDataUrl, width: svg.width, height: svg.height }]);\n }\n }\n\n return svgToPng(grid, opts);\n}\n\nconst SVG_STYLE_PROPERTIES = [\n 'display',\n 'fill',\n 'fill-opacity',\n 'opacity',\n 'stroke',\n 'stroke-width',\n 'transform',\n 'border-collapse',\n];\nconst SVG_TEXT_STYLE_PROPERTIES = [\n 'font-family',\n 'font-size',\n 'font-weight',\n 'text-anchor',\n 'background-color',\n 'color',\n 'padding',\n 'text-align',\n 'border',\n];\nconst ANNOTATION_HTML_STYLE_PROPERTIES = [\n 'align-items',\n 'background',\n 'background-color',\n 'border',\n 'border-radius',\n 'box-shadow',\n 'box-sizing',\n 'color',\n 'column-gap',\n 'display',\n 'flex',\n 'flex-direction',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'gap',\n 'height',\n 'justify-content',\n 'letter-spacing',\n 'line-height',\n 'margin',\n 'max-height',\n 'max-width',\n 'min-height',\n 'min-width',\n 'opacity',\n 'overflow',\n 'padding',\n 'pointer-events',\n 'position',\n 'row-gap',\n 'text-align',\n 'text-decoration',\n 'text-transform',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'visibility',\n 'white-space',\n 'width',\n 'z-index',\n];\nconst ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];\n\nfunction cloneStyledSVG(chartContainer: HTMLElement | null | undefined, isRTL: boolean) {\n if (!chartContainer) {\n throw new Error('Chart container is not defined');\n }\n\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n let clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n let svgElements = svg.getElementsByTagName('*');\n let clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n const TEXT_ELEMENTS = ['text'];\n const TABLE_ELEMENTS = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];\n\n for (let i = 0; i < svgElements.length; i++) {\n const tag = svgElements[i].tagName.toLowerCase();\n\n if (TEXT_ELEMENTS.includes(tag) || TABLE_ELEMENTS.includes(tag)) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgElements = null as any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvgElements = null as any;\n\n const originalForeignObjects = svg.querySelectorAll('foreignObject');\n const clonedForeignObjects = clonedSvg.node()!.querySelectorAll('foreignObject');\n\n originalForeignObjects.forEach((originalFo, index) => {\n const clonedFo = clonedForeignObjects[index];\n if (!clonedFo) {\n return;\n }\n\n const originalRoot = originalFo.firstElementChild as HTMLElement | null;\n const clonedRoot = clonedFo.firstElementChild as HTMLElement | null;\n\n if (originalRoot && clonedRoot) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalRoot, clonedRoot);\n }\n\n const originalHtmlElements = originalFo.querySelectorAll<HTMLElement>('*');\n const clonedHtmlElements = clonedFo.querySelectorAll<HTMLElement>('*');\n\n originalHtmlElements.forEach((originalEl, elementIndex) => {\n const clonedEl = clonedHtmlElements[elementIndex];\n if (clonedEl) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalEl, clonedEl);\n }\n });\n });\n\n const annotationSvg = chartContainer.querySelector<SVGSVGElement>('[data-chart-annotation-svg=\"true\"]');\n let annotationClone: SVGSVGElement | null = null;\n\n if (annotationSvg) {\n annotationClone = annotationSvg.cloneNode(true) as SVGSVGElement;\n copyStyle(SVG_STYLE_PROPERTIES, annotationSvg, annotationClone);\n\n const annotationElements = annotationSvg.getElementsByTagName('*');\n const clonedAnnotationElements = annotationClone.getElementsByTagName('*');\n\n for (let i = 0; i < annotationElements.length; i++) {\n const original = annotationElements[i];\n const cloned = clonedAnnotationElements[i];\n const tag = original.tagName.toLowerCase();\n const isSvgElement = original instanceof SVGElement;\n const isTextElement = tag === 'text';\n const isHtmlElement = original instanceof HTMLElement;\n\n if (isSvgElement) {\n if (isTextElement) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], original, cloned);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, original, cloned);\n }\n }\n\n if (isHtmlElement) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, original, cloned);\n }\n\n if (tag === 'foreignobject') {\n copyStyle(ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES, original, cloned);\n }\n }\n }\n\n const { width, height } = svg.getBoundingClientRect();\n\n clonedSvg\n .attr('width', width)\n .attr('height', height)\n .attr('viewBox', `0 0 ${width} ${height}`)\n .attr('direction', isRTL ? 'rtl' : 'ltr');\n\n if (annotationClone) {\n clonedSvg.selectAll('[data-chart-annotation-layer=\"true\"]').remove();\n d3Select(annotationClone).attr('x', 0).attr('y', 0).attr('width', width).attr('height', height);\n clonedSvg.append(() => annotationClone as SVGSVGElement);\n }\n\n const result = {\n node: clonedSvg.node(),\n width,\n height,\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvg = null as any;\n\n return result;\n}\n\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n};\n\nexport function cloneLegendsToSVG(\n legends: ILegend[],\n svgWidth: number,\n config: {\n selectedLegends: Record<string, boolean>;\n centerLegends: boolean;\n textClassName: string;\n isRTL: boolean;\n },\n legendContainer?: HTMLElement | null,\n): { node: SVGSVGElement | null; width: number; height: number } {\n if (legends.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const { selectedLegends, centerLegends, textClassName, isRTL } = config;\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n let legendY = LEGEND_CONTAINER_MARGIN_TOP;\n let legendLine: { elem: Selection<SVGGElement, unknown, null, undefined>; width: number }[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n const noLegendsSelected = Object.keys(selectedLegends).length === 0;\n\n for (let i = 0; i < legends.length; i++) {\n const textOffset = LEGEND_PADDING + LEGEND_SHAPE_SIZE + LEGEND_SHAPE_MARGIN_END;\n const legendText = measureTextWithDOM(legends[i].title, `.${textClassName}`, legendContainer);\n const legendWidth = textOffset + legendText.width + LEGEND_PADDING;\n const legendItem = legendGroup.append('g');\n\n legendLine.push({ elem: legendItem, width: legendWidth });\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [{ elem: legendItem, width: legendWidth }];\n legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n legendY += LEGEND_HEIGHT;\n }\n\n const isLegendActive = selectedLegends[legends[i].title] || noLegendsSelected;\n\n legendItem\n .append('rect')\n .attr('x', legendX + (isRTL ? legendWidth - LEGEND_PADDING - LEGEND_SHAPE_SIZE : LEGEND_PADDING))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('width', LEGEND_SHAPE_SIZE)\n .attr('height', LEGEND_SHAPE_SIZE)\n .style('fill', isLegendActive ? legends[i].color : 'transparent')\n .style('stroke-width', LEGEND_SHAPE_BORDER)\n .style('stroke', legends[i].color);\n\n legendItem\n .append('text')\n .attr('x', legendX + (isRTL ? legendWidth - textOffset : textOffset))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('dominant-baseline', 'hanging')\n .style('opacity', isLegendActive ? 1 : INACTIVE_LEGEND_TEXT_OPACITY)\n .text(legends[i].title)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText.node, selection.node()!));\n\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += LEGEND_HEIGHT;\n\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const lineOffsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n let remLineWidth = legendLineWidths[idx];\n let itemOffsetX = 0;\n ln.forEach(item => {\n const newOffsetX = lineOffsetX + (isRTL ? remLineWidth - item.width - itemOffsetX : 0);\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n } else if (isRTL) {\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n legendLines.forEach(ln => {\n let remLineWidth = w1 - LEGEND_CONTAINER_MARGIN_START;\n let itemOffsetX = LEGEND_CONTAINER_MARGIN_START;\n ln.forEach(item => {\n const newOffsetX = remLineWidth - item.width - itemOffsetX;\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n }\n\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n const h1 = legendY;\n const svg = d3Create<SVGSVGElement>('svg').attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n svg.append(() => legendGroup.node()!);\n\n return {\n node: svg.node(),\n width: w1,\n height: h1,\n };\n}\n\ntype PositionedImage = SvgImage & {\n x: number;\n y: number;\n};\n\nasync function svgToPng(grid: SvgImage[][], opts: IImageExportOptions = {}): Promise<string> {\n let totalWidth = 0;\n let totalHeight = 0;\n\n const positionedImages: PositionedImage[] = grid\n .map(row => {\n let rowWidth = 0;\n let rowHeight = 0;\n\n const items = row.map(item => {\n const positioned = { ...item, x: rowWidth, y: totalHeight };\n rowWidth += item.width;\n rowHeight = Math.max(rowHeight, item.height);\n return positioned;\n });\n\n totalWidth = Math.max(totalWidth, rowWidth);\n totalHeight += rowHeight;\n\n return items;\n })\n .flat();\n\n const scale = opts.scale || 1;\n const w0 = opts.width || totalWidth;\n const h0 = opts.height || totalHeight;\n const scaleX = (scale * w0) / totalWidth;\n const scaleY = (scale * h0) / totalHeight;\n totalWidth = scaleX * totalWidth;\n totalHeight = scaleY * totalHeight;\n\n const canvas = document.createElement('canvas');\n canvas.width = totalWidth;\n canvas.height = totalHeight;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Canvas context is null');\n }\n\n ctx.fillStyle = opts.background || 'transparent';\n ctx.fillRect(0, 0, totalWidth, totalHeight);\n\n await Promise.all(\n positionedImages.map(\n item =>\n new Promise<void>((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n ctx.drawImage(img, scaleX * item.x, scaleY * item.y, scaleX * item.width, scaleY * item.height);\n resolve();\n };\n img.onerror = reject;\n img.src = item.dataUrl;\n }),\n ),\n );\n\n return canvas.toDataURL('image/png');\n}\n\nfunction svgToBase64(svgNode: SVGSVGElement | null) {\n if (!svgNode) {\n throw new Error('SVG node is null');\n }\n\n const svgData = new XMLSerializer().serializeToString(svgNode);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n return svgDataUrl;\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n"]}
|
package/lib/utilities/index.d.ts
CHANGED
package/lib/utilities/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC","sourcesContent":["export * from './ChartHoverCard/index';\nexport * from './Common.styles';\nexport * from './utilities';\nexport * from './colors';\nexport * from './gradients';\nexport * from './vbc-utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC","sourcesContent":["export * from './ChartHoverCard/index';\nexport * from './ChartTitle';\nexport * from './Common.styles';\nexport * from './utilities';\nexport * from './colors';\nexport * from './gradients';\nexport * from './vbc-utils';\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Axis as D3Axis } from 'd3-axis';
|
|
2
2
|
import { ScaleBand, ScaleLinear, ScaleContinuousNumeric as IScaleContinuousNumeric, ScaleTime as IScaleTime } from 'd3-scale';
|
|
3
|
+
import { Selection as ISelection } from 'd3-selection';
|
|
3
4
|
import { TimeLocaleDefinition as d3TimeLocaleDefinition } from 'd3-time-format';
|
|
4
5
|
import { IAccessibilityProps, IEventsAnnotationProps, ILineChartPoints, IDataPoint, IVerticalStackedBarDataPoint, IVerticalBarChartDataPoint, IHorizontalBarChartWithAxisDataPoint, ILineChartLineOptions, AxisCategoryOrder, IYValueHover } from '../index';
|
|
5
6
|
import { ITheme } from '@fluentui/react';
|
|
@@ -8,6 +9,7 @@ import { AxisProps, AxisScaleType, IGanttChartDataPoint, IScatterChartPoints } f
|
|
|
8
9
|
export declare const MIN_DOMAIN_MARGIN = 8;
|
|
9
10
|
export declare const MIN_DONUT_RADIUS = 1;
|
|
10
11
|
export declare const DEFAULT_DATE_STRING = "2000-01-01";
|
|
12
|
+
export declare const CARTESIAN_XAXIS_CLASSNAME = "fui-cart__xAxis";
|
|
11
13
|
export type NumericAxis = D3Axis<number | {
|
|
12
14
|
valueOf(): number;
|
|
13
15
|
}>;
|
|
@@ -38,7 +40,8 @@ export interface IWrapLabelProps {
|
|
|
38
40
|
xAxis: NumericAxis | StringAxis;
|
|
39
41
|
noOfCharsToTruncate: number;
|
|
40
42
|
showXAxisLablesTooltip: boolean;
|
|
41
|
-
width?: number;
|
|
43
|
+
width?: number | number[];
|
|
44
|
+
container?: HTMLElement | null;
|
|
42
45
|
}
|
|
43
46
|
export interface IRotateLabelProps {
|
|
44
47
|
node: SVGSVGElement | null;
|
|
@@ -91,6 +94,8 @@ export interface IXAxisParams extends AxisProps {
|
|
|
91
94
|
containerWidth: number;
|
|
92
95
|
hideTickOverlap?: boolean;
|
|
93
96
|
calcMaxLabelWidth: (x: (string | number)[]) => number;
|
|
97
|
+
xMaxValue?: number;
|
|
98
|
+
xMinValue?: number;
|
|
94
99
|
}
|
|
95
100
|
export interface ITickParams {
|
|
96
101
|
tickValues?: Date[] | number[] | string[];
|
|
@@ -129,7 +134,8 @@ export declare function defaultYAxisTickFormatter(value: number): string;
|
|
|
129
134
|
*/
|
|
130
135
|
export declare function createNumericXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, chartType: ChartTypes, culture?: string, scaleType?: AxisScaleType): {
|
|
131
136
|
xScale: IScaleContinuousNumeric<number, number>;
|
|
132
|
-
tickValues:
|
|
137
|
+
tickValues: number[];
|
|
138
|
+
tickLabels: string[];
|
|
133
139
|
};
|
|
134
140
|
export declare function getDateFormatLevel(date: Date, useUTC?: boolean): number;
|
|
135
141
|
/**
|
|
@@ -140,7 +146,8 @@ export declare function getDateFormatLevel(date: Date, useUTC?: boolean): number
|
|
|
140
146
|
*/
|
|
141
147
|
export declare function createDateXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, culture?: string, options?: Intl.DateTimeFormatOptions, timeFormatLocale?: d3TimeLocaleDefinition, customDateTimeFormatter?: (dateTime: Date) => string, useUTC?: boolean, chartType?: ChartTypes): {
|
|
142
148
|
xScale: IScaleTime<number, number>;
|
|
143
|
-
tickValues:
|
|
149
|
+
tickValues: Date[];
|
|
150
|
+
tickLabels: string[];
|
|
144
151
|
};
|
|
145
152
|
/**
|
|
146
153
|
* Create String X axis
|
|
@@ -154,6 +161,7 @@ export declare function createDateXAxis(xAxisParams: IXAxisParams, tickParams: I
|
|
|
154
161
|
export declare function createStringXAxis(xAxisParams: IXAxisParams, tickParams: ITickParams, dataset: string[], culture?: string): {
|
|
155
162
|
xScale: ScaleBand<string>;
|
|
156
163
|
tickValues: string[];
|
|
164
|
+
tickLabels: string[];
|
|
157
165
|
};
|
|
158
166
|
/**
|
|
159
167
|
* This method used for creating data points for the y axis.
|
|
@@ -263,7 +271,12 @@ export declare const calculateLongestLabelWidth: (labels: (string | number)[], q
|
|
|
263
271
|
* when prop 'showXAxisLablesTooltip' enables to the respected chart.
|
|
264
272
|
* On hover of the truncated word(at x axis labels tick), a tooltip will be appeared.
|
|
265
273
|
*/
|
|
266
|
-
export declare function tooltipOfAxislabels(axistooltipProps:
|
|
274
|
+
export declare function tooltipOfAxislabels(axistooltipProps: {
|
|
275
|
+
tooltipCls: string;
|
|
276
|
+
axis: ISelection<SVGSVGElement, unknown, null, undefined> | null;
|
|
277
|
+
id: string;
|
|
278
|
+
container?: HTMLElement | null;
|
|
279
|
+
}): void | null;
|
|
267
280
|
/**
|
|
268
281
|
* Find the axis type of line chart and area chart from given data
|
|
269
282
|
* @param points
|
|
@@ -279,7 +292,7 @@ export declare function getXAxisType(points: ILineChartPoints[]): boolean;
|
|
|
279
292
|
* @param {boolean} isRTL
|
|
280
293
|
* @returns {IDomainNRange}
|
|
281
294
|
*/
|
|
282
|
-
export declare function domainRangeOfNumericForAreaLineScatterCharts(points: ILineChartPoints[] | IScatterChartPoints[], margins: IMargins, width: number, isRTL: boolean, scaleType?: AxisScaleType, hasMarkersMode?: boolean): IDomainNRange;
|
|
295
|
+
export declare function domainRangeOfNumericForAreaLineScatterCharts(points: ILineChartPoints[] | IScatterChartPoints[], margins: IMargins, width: number, isRTL: boolean, scaleType?: AxisScaleType, hasMarkersMode?: boolean, xMinVal?: number, xMaxVal?: number): IDomainNRange;
|
|
283
296
|
/**
|
|
284
297
|
* Groups HorizontalBarChart With Axis data based on YValue
|
|
285
298
|
* Used for stacked case
|
|
@@ -457,9 +470,17 @@ export declare const getScalePadding: (prop: number | undefined, shorthandProp?:
|
|
|
457
470
|
export declare const isScalePaddingDefined: (prop: number | undefined, shorthandProp?: number) => boolean;
|
|
458
471
|
export declare function getSecureProps(props?: Record<string, any>): Record<string, any>;
|
|
459
472
|
export declare function areArraysEqual(arr1?: string[], arr2?: string[]): boolean;
|
|
460
|
-
export declare function resolveCSSVariables(
|
|
473
|
+
export declare function resolveCSSVariables(container: HTMLElement, styleRules: string): string;
|
|
461
474
|
export declare function copyStyle(properties: string[] | Record<string, string>, fromEl: Element, toEl: Element): void;
|
|
462
|
-
export declare const
|
|
475
|
+
export declare const measureTextWithDOM: (text: string | number, cssSelector: string, container?: HTMLElement | null) => {
|
|
476
|
+
node: HTMLElement;
|
|
477
|
+
width: number;
|
|
478
|
+
height: number;
|
|
479
|
+
};
|
|
480
|
+
export declare const getTextSize: (text: string | number, cssSelector: string, container?: HTMLElement | null) => {
|
|
481
|
+
width: number;
|
|
482
|
+
height: number;
|
|
483
|
+
};
|
|
463
484
|
export declare function getCurveFactory(curve: ILineChartLineOptions['curve'], defaultFactory?: CurveFactory): CurveFactory;
|
|
464
485
|
export declare const truncateString: (str: string, maxLength: number, ellipsis?: string) => string;
|
|
465
486
|
/**
|
|
@@ -480,7 +501,7 @@ export declare function isScatterPolarSeries(points: (ILineChartPoints | IScatte
|
|
|
480
501
|
* @returns true if any point has lineOptions.mode as 'text'
|
|
481
502
|
*/
|
|
482
503
|
export declare function isTextMode(points: (ILineChartPoints | IScatterChartPoints)[]): boolean;
|
|
483
|
-
export declare const getDomainPaddingForMarkers: (minVal: number, maxVal: number, scaleType?: AxisScaleType) => {
|
|
504
|
+
export declare const getDomainPaddingForMarkers: (minVal: number, maxVal: number, scaleType?: AxisScaleType, userMinVal?: number, userMaxVal?: number) => {
|
|
484
505
|
start: number;
|
|
485
506
|
end: number;
|
|
486
507
|
};
|
|
@@ -503,7 +524,10 @@ export declare const getRangeForScatterMarkerSize: ({ data, xScale, yScalePrimar
|
|
|
503
524
|
}) => number;
|
|
504
525
|
export declare const generateLinearTicks: (tick0: number, tickStep: number, scaleDomain: number[]) => number[];
|
|
505
526
|
export declare const generateMonthlyTicks: (tick0: Date, tickStepInMonths: number, scaleDomain: Date[], useUTC?: boolean) => Date[];
|
|
527
|
+
export declare const generateNumericTicks: (scaleType: AxisScaleType | undefined, tickStep: string | number | undefined, tick0: number | Date | undefined, scaleDomain: number[]) => number[] | undefined;
|
|
528
|
+
export declare const generateDateTicks: (tickStep: string | number | undefined, tick0: number | Date | undefined, scaleDomain: Date[], useUTC?: boolean) => Date[] | undefined;
|
|
506
529
|
export declare const findCalloutPoints: (calloutPointsByX: Record<string, IYValueHover[]>, x: string | number | Date | null) => {
|
|
507
530
|
x: string | number | Date;
|
|
508
531
|
values: IYValueHover[];
|
|
509
532
|
} | undefined;
|
|
533
|
+
export declare const autoLayoutXAxisLabels: (tickValues: number[] | Date[] | string[], tickLabels: string[], scale: IScaleContinuousNumeric<number, number> | IScaleTime<number, number> | ScaleBand<string>, axisNode: SVGSVGElement | null, containerWidth: number, container?: HTMLElement | null) => number;
|