@fluentui/react-charting 5.25.1 → 5.25.3
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 +123 -1
- package/CHANGELOG.md +34 -2
- package/dist/react-charting.d.ts +48 -45
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +24 -11
- package/lib/AnnotationOnlyChart.d.ts +1 -0
- package/lib/AnnotationOnlyChart.js +2 -0
- package/lib/AnnotationOnlyChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.d.ts +3 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +158 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.d.ts +33 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +2 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/index.d.ts +2 -0
- package/lib/components/AnnotationOnlyChart/index.js +3 -0
- package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.base.js +2 -2
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.base.js +5 -3
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +18 -14
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/index.d.ts +2 -0
- package/lib/components/CommonComponents/Annotations/index.js +3 -0
- package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.d.ts +6 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +131 -157
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +11 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +85 -51
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +12 -4
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +176 -63
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +5 -3
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.base.js +15 -18
- package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.base.js +6 -6
- package/lib/components/GanttChart/GanttChart.base.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.types.d.ts +0 -11
- package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.js +5 -3
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +11 -6
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.js +3 -3
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.d.ts +0 -9
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +4 -4
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +0 -9
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/Legends/Legends.base.d.ts +1 -1
- package/lib/components/Legends/Legends.base.js +6 -2
- package/lib/components/Legends/Legends.base.js.map +1 -1
- package/lib/components/Legends/Legends.types.d.ts +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +3 -3
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.base.js +5 -3
- package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +41 -31
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +0 -4
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +6 -4
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +22 -10
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +0 -9
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.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/IChartAnnotation.d.ts +2 -0
- package/lib/types/IChartAnnotation.js.map +1 -1
- package/lib/utilities/image-export-utils.d.ts +7 -2
- package/lib/utilities/image-export-utils.js +176 -86
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.d.ts +5 -4
- package/lib/utilities/utilities.js +18 -17
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/AnnotationOnlyChart.d.ts +1 -0
- package/lib-amd/AnnotationOnlyChart.js +6 -0
- package/lib-amd/AnnotationOnlyChart.js.map +1 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.d.ts +3 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js +159 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.types.d.ts +33 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +5 -0
- package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib-amd/components/AnnotationOnlyChart/index.d.ts +2 -0
- package/lib-amd/components/AnnotationOnlyChart/index.js +7 -0
- package/lib-amd/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.base.js +4 -2
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +18 -14
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/index.d.ts +2 -0
- package/lib-amd/components/CommonComponents/Annotations/index.js +7 -0
- package/lib-amd/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +6 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +131 -157
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +11 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +80 -50
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +12 -4
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +178 -64
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +4 -2
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/FunnelChart/FunnelChart.base.js +13 -16
- package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-amd/components/GanttChart/GanttChart.base.js +5 -5
- package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -1
- package/lib-amd/components/GanttChart/GanttChart.types.d.ts +0 -11
- package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.js +4 -2
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +10 -6
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +2 -2
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.d.ts +0 -9
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +3 -3
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +0 -9
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-amd/components/Legends/Legends.base.d.ts +1 -1
- package/lib-amd/components/Legends/Legends.base.js +6 -2
- package/lib-amd/components/Legends/Legends.base.js.map +1 -1
- package/lib-amd/components/Legends/Legends.types.d.ts +1 -1
- package/lib-amd/components/Legends/Legends.types.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +2 -2
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-amd/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib-amd/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.base.js +4 -2
- package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +39 -29
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +0 -4
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +5 -3
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +20 -8
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +0 -9
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.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/IChartAnnotation.d.ts +2 -0
- package/lib-amd/types/IChartAnnotation.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.d.ts +7 -2
- package/lib-amd/utilities/image-export-utils.js +175 -85
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +5 -4
- package/lib-amd/utilities/utilities.js +18 -17
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/AnnotationOnlyChart.d.ts +1 -0
- package/lib-commonjs/AnnotationOnlyChart.js +5 -0
- package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.d.ts +3 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +162 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.d.ts +33 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +3 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.d.ts +2 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.js +6 -0
- package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.js +4 -2
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +18 -14
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/index.d.ts +2 -0
- package/lib-commonjs/components/CommonComponents/Annotations/index.js +6 -0
- package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +6 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +131 -157
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +11 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +83 -49
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +12 -4
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +178 -64
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +4 -2
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +13 -16
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.base.js +5 -5
- package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +0 -11
- package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +4 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +10 -5
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +2 -2
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.d.ts +0 -9
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +3 -3
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +0 -9
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.base.d.ts +1 -1
- package/lib-commonjs/components/Legends/Legends.base.js +6 -2
- package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.d.ts +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +2 -2
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +4 -2
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +39 -29
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +0 -4
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +5 -3
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +20 -8
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +0 -9
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.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/IChartAnnotation.d.ts +2 -0
- package/lib-commonjs/types/IChartAnnotation.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.d.ts +7 -2
- package/lib-commonjs/utilities/image-export-utils.js +175 -85
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +5 -4
- package/lib-commonjs/utilities/utilities.js +18 -17
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +5 -5
- package/src/components/AnnotationOnlyChart/AnnotationOnlyChart.types.ts +34 -0
- package/src/components/CommonComponents/CartesianChart.types.ts +12 -1
- package/src/components/GanttChart/GanttChart.types.ts +0 -13
- package/src/components/HeatMapChart/HeatMapChart.types.ts +0 -11
- package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +0 -11
- package/src/components/Legends/Legends.types.ts +1 -1
- package/src/components/ScatterChart/ScatterChart.types.ts +0 -5
- package/src/components/VerticalStackedBarChart/VerticalStackedBarChart.types.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/AnnotationOnlyChart/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationOnlyChart.js","sourceRoot":"../src/","sources":["AnnotationOnlyChart.ts"],"names":[],"mappings":";;;AAAA,iFAAuD","sourcesContent":["export * from './components/AnnotationOnlyChart/index';\n"]}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnnotationOnlyChart = void 0;
|
|
4
|
+
var React = require("react");
|
|
5
|
+
var react_1 = require("@fluentui/react");
|
|
6
|
+
var Styling_1 = require("@fluentui/react/lib/Styling");
|
|
7
|
+
var ChartAnnotationLayer_1 = require("../CommonComponents/Annotations/ChartAnnotationLayer");
|
|
8
|
+
var image_export_utils_1 = require("../../utilities/image-export-utils");
|
|
9
|
+
var DEFAULT_HEIGHT = 650;
|
|
10
|
+
var FALLBACK_WIDTH = 400;
|
|
11
|
+
var buildPadding = function (margin) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
if (!margin) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
var top = (_a = margin.t) !== null && _a !== void 0 ? _a : 0;
|
|
17
|
+
var right = (_b = margin.r) !== null && _b !== void 0 ? _b : 0;
|
|
18
|
+
var bottom = (_c = margin.b) !== null && _c !== void 0 ? _c : 0;
|
|
19
|
+
var left = (_d = margin.l) !== null && _d !== void 0 ? _d : 0;
|
|
20
|
+
if (top === 0 && right === 0 && bottom === 0 && left === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return "".concat(top, "px ").concat(right, "px ").concat(bottom, "px ").concat(left, "px");
|
|
24
|
+
};
|
|
25
|
+
var AnnotationOnlyChart = function (props) {
|
|
26
|
+
var annotations = props.annotations, chartTitle = props.chartTitle, description = props.description, width = props.width, height = props.height, paperBackgroundColor = props.paperBackgroundColor, plotBackgroundColor = props.plotBackgroundColor, fontColor = props.fontColor, fontFamily = props.fontFamily, margin = props.margin, componentRef = props.componentRef;
|
|
27
|
+
var theme = (0, react_1.useTheme)();
|
|
28
|
+
var containerRef = React.useRef(null);
|
|
29
|
+
var contentRef = React.useRef(null);
|
|
30
|
+
var _a = React.useState(width !== null && width !== void 0 ? width : 0), measuredWidth = _a[0], setMeasuredWidth = _a[1];
|
|
31
|
+
var _b = React.useState(height !== null && height !== void 0 ? height : DEFAULT_HEIGHT), contentHeight = _b[0], setContentHeight = _b[1];
|
|
32
|
+
React.useEffect(function () {
|
|
33
|
+
if (typeof width === 'number' && width > 0) {
|
|
34
|
+
setMeasuredWidth(width);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var node = containerRef.current;
|
|
38
|
+
if (!node || typeof ResizeObserver === 'undefined') {
|
|
39
|
+
var rect_1 = node === null || node === void 0 ? void 0 : node.getBoundingClientRect();
|
|
40
|
+
if (rect_1 && rect_1.width > 0) {
|
|
41
|
+
setMeasuredWidth(rect_1.width);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
setMeasuredWidth(function (prev) { return (prev > 0 ? prev : FALLBACK_WIDTH); });
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
var observer = new ResizeObserver(function (entries) {
|
|
49
|
+
var entry = entries[0];
|
|
50
|
+
if (!entry) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var newWidth = entry.contentRect.width;
|
|
54
|
+
if (newWidth > 0 && Math.abs(newWidth - measuredWidth) > 0.5) {
|
|
55
|
+
setMeasuredWidth(newWidth);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var rect = node.getBoundingClientRect();
|
|
59
|
+
if (rect.width > 0) {
|
|
60
|
+
setMeasuredWidth(rect.width);
|
|
61
|
+
}
|
|
62
|
+
observer.observe(node);
|
|
63
|
+
return function () { return observer.disconnect(); };
|
|
64
|
+
}, [width, measuredWidth]);
|
|
65
|
+
var resolvedWidth = Math.max(measuredWidth || FALLBACK_WIDTH, 1);
|
|
66
|
+
var resolvedHeight = Math.max(height !== null && height !== void 0 ? height : DEFAULT_HEIGHT, 1);
|
|
67
|
+
React.useEffect(function () {
|
|
68
|
+
var node = contentRef.current;
|
|
69
|
+
if (!node) {
|
|
70
|
+
setContentHeight(function (prev) { return (prev > 0 ? prev : resolvedHeight); });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
74
|
+
var rect_2 = node.getBoundingClientRect();
|
|
75
|
+
setContentHeight(function (prev) { return (rect_2.height > 0 ? rect_2.height : prev > 0 ? prev : resolvedHeight); });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
var observer = new ResizeObserver(function (entries) {
|
|
79
|
+
var entry = entries[0];
|
|
80
|
+
if (!entry) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
var newHeight = entry.contentRect.height;
|
|
84
|
+
if (newHeight > 0) {
|
|
85
|
+
setContentHeight(function (prev) { return (Math.abs(prev - newHeight) > 0.5 ? newHeight : prev); });
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var rect = node.getBoundingClientRect();
|
|
89
|
+
setContentHeight(function (prev) { return (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight); });
|
|
90
|
+
observer.observe(node);
|
|
91
|
+
return function () { return observer.disconnect(); };
|
|
92
|
+
}, [
|
|
93
|
+
resolvedHeight,
|
|
94
|
+
resolvedWidth,
|
|
95
|
+
annotations,
|
|
96
|
+
chartTitle,
|
|
97
|
+
description,
|
|
98
|
+
margin,
|
|
99
|
+
plotBackgroundColor,
|
|
100
|
+
paperBackgroundColor,
|
|
101
|
+
fontColor,
|
|
102
|
+
fontFamily,
|
|
103
|
+
theme,
|
|
104
|
+
]);
|
|
105
|
+
var svgHeight = Math.max(Math.ceil(contentHeight || 0), resolvedHeight);
|
|
106
|
+
var context = {
|
|
107
|
+
plotRect: { x: 0, y: 0, width: resolvedWidth, height: resolvedHeight },
|
|
108
|
+
svgRect: { width: resolvedWidth, height: resolvedHeight },
|
|
109
|
+
isRtl: theme === null || theme === void 0 ? void 0 : theme.rtl,
|
|
110
|
+
};
|
|
111
|
+
var padding = buildPadding(margin);
|
|
112
|
+
var rootClassName = React.useMemo(function () {
|
|
113
|
+
return (0, Styling_1.mergeStyles)({
|
|
114
|
+
position: 'relative',
|
|
115
|
+
width: width ? "".concat(width, "px") : '100%',
|
|
116
|
+
minHeight: resolvedHeight,
|
|
117
|
+
backgroundColor: paperBackgroundColor !== null && paperBackgroundColor !== void 0 ? paperBackgroundColor : theme.semanticColors.bodyBackground,
|
|
118
|
+
color: fontColor !== null && fontColor !== void 0 ? fontColor : theme.semanticColors.bodyText,
|
|
119
|
+
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : theme.fonts.medium.fontFamily,
|
|
120
|
+
padding: padding,
|
|
121
|
+
display: 'flex',
|
|
122
|
+
flexDirection: 'column',
|
|
123
|
+
rowGap: '8px',
|
|
124
|
+
});
|
|
125
|
+
}, [fontColor, fontFamily, paperBackgroundColor, padding, resolvedHeight, theme, width]);
|
|
126
|
+
var contentClassName = React.useMemo(function () {
|
|
127
|
+
var _a;
|
|
128
|
+
return (0, Styling_1.mergeStyles)({
|
|
129
|
+
position: 'relative',
|
|
130
|
+
flexGrow: 1,
|
|
131
|
+
backgroundColor: plotBackgroundColor !== null && plotBackgroundColor !== void 0 ? plotBackgroundColor : 'transparent',
|
|
132
|
+
borderRadius: (_a = theme.effects.roundedCorner2) !== null && _a !== void 0 ? _a : 4,
|
|
133
|
+
boxSizing: 'border-box',
|
|
134
|
+
});
|
|
135
|
+
}, [plotBackgroundColor, theme.effects.roundedCorner2]);
|
|
136
|
+
var titleClassName = React.useMemo(function () {
|
|
137
|
+
return (0, Styling_1.mergeStyles)({
|
|
138
|
+
textAlign: 'center',
|
|
139
|
+
});
|
|
140
|
+
}, []);
|
|
141
|
+
var resolvedAnnotations = annotations !== null && annotations !== void 0 ? annotations : [];
|
|
142
|
+
var hasAnnotations = resolvedAnnotations.length > 0;
|
|
143
|
+
var ariaLabel = hasAnnotations ? description !== null && description !== void 0 ? description : chartTitle : undefined;
|
|
144
|
+
React.useImperativeHandle(componentRef, function () {
|
|
145
|
+
var chartHandle = {
|
|
146
|
+
chartContainer: containerRef.current,
|
|
147
|
+
toImage: function (opts) {
|
|
148
|
+
return (0, image_export_utils_1.exportChartsAsImage)([{ container: containerRef.current }], undefined, (0, react_1.getRTL)(), opts);
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
return chartHandle;
|
|
152
|
+
}, []);
|
|
153
|
+
return (React.createElement("div", { ref: containerRef, "data-chart-annotation-container": "true" },
|
|
154
|
+
React.createElement("svg", { width: resolvedWidth, height: svgHeight, viewBox: "0 0 ".concat(resolvedWidth, " ").concat(svgHeight), style: { width: width ? "".concat(width, "px") : '100%', height: "".concat(svgHeight, "px"), display: 'block' }, role: ariaLabel ? 'img' : undefined, "aria-label": ariaLabel },
|
|
155
|
+
React.createElement("foreignObject", { x: 0, y: 0, width: resolvedWidth, height: svgHeight },
|
|
156
|
+
React.createElement("div", { ref: contentRef, className: rootClassName, "data-chart-annotation-only": "true", "aria-label": ariaLabel },
|
|
157
|
+
chartTitle && (React.createElement("span", { className: titleClassName, "aria-hidden": "true" }, chartTitle)),
|
|
158
|
+
React.createElement("div", { className: contentClassName, role: "presentation" }, hasAnnotations ? (React.createElement(ChartAnnotationLayer_1.ChartAnnotationLayer, { annotations: resolvedAnnotations, context: context, theme: theme })) : null))))));
|
|
159
|
+
};
|
|
160
|
+
exports.AnnotationOnlyChart = AnnotationOnlyChart;
|
|
161
|
+
exports.AnnotationOnlyChart.displayName = 'AnnotationOnlyChart';
|
|
162
|
+
//# sourceMappingURL=AnnotationOnlyChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationOn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AAC;IACrB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,CACL,6BAAK,GAAG,EAAE,YAAY,qCAAkC,MAAM;QAC5D,6BACE,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,cAAO,aAAa,cAAI,SAAS,CAAE,EAC5C,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,UAAG,KAAK,OAAI,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAG,SAAS,OAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAC3F,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,gBACvB,SAAS;YAErB,uCAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS;gBAChE,6BAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,gCAA6B,MAAM,gBAAa,SAAS;oBACpG,UAAU,IAAI,CACb,8BAAM,SAAS,EAAE,cAAc,iBAAc,MAAM,IAChD,UAAU,CACN,CACR;oBACD,6BAAK,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAC,cAAc,IAClD,cAAc,CAAC,CAAC,CAAC,CAChB,oBAAC,2CAAoB,IAAC,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAI,CAC3F,CAAC,CAAC,CAAC,IAAI,CACJ,CACF,CACQ,CACZ,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAtMW,QAAA,mBAAmB,uBAsM9B;AAEF,2BAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAC","sourcesContent":["import * as React from 'react';\nimport { getRTL, useTheme } from '@fluentui/react';\nimport { mergeStyles } from '@fluentui/react/lib/Styling';\nimport { ChartAnnotationLayer } from '../CommonComponents/Annotations/ChartAnnotationLayer';\nimport { exportChartsAsImage } from '../../utilities/image-export-utils';\nimport type { IAnnotationOnlyChartProps } from './AnnotationOnlyChart.types';\nimport type { IChart, IImageExportOptions } from '../../types/index';\nimport type { IChartAnnotationContext } from '../CommonComponents/Annotations/ChartAnnotationLayer.types';\n\nconst DEFAULT_HEIGHT = 650;\nconst FALLBACK_WIDTH = 400;\n\nconst buildPadding = (margin: IAnnotationOnlyChartProps['margin']): string | undefined => {\n if (!margin) {\n return undefined;\n }\n\n const top = margin.t ?? 0;\n const right = margin.r ?? 0;\n const bottom = margin.b ?? 0;\n const left = margin.l ?? 0;\n\n if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n return undefined;\n }\n\n return `${top}px ${right}px ${bottom}px ${left}px`;\n};\n\nexport const AnnotationOnlyChart: React.FC<IAnnotationOnlyChartProps> = props => {\n const {\n annotations,\n chartTitle,\n description,\n width,\n height,\n paperBackgroundColor,\n plotBackgroundColor,\n fontColor,\n fontFamily,\n margin,\n componentRef,\n } = props;\n\n const theme = useTheme();\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const contentRef = React.useRef<HTMLDivElement | null>(null);\n const [measuredWidth, setMeasuredWidth] = React.useState<number>(width ?? 0);\n const [contentHeight, setContentHeight] = React.useState<number>(height ?? DEFAULT_HEIGHT);\n\n React.useEffect(() => {\n if (typeof width === 'number' && width > 0) {\n setMeasuredWidth(width);\n return;\n }\n\n const node = containerRef.current;\n if (!node || typeof ResizeObserver === 'undefined') {\n const rect = node?.getBoundingClientRect();\n if (rect && rect.width > 0) {\n setMeasuredWidth(rect.width);\n } else {\n setMeasuredWidth(prev => (prev > 0 ? prev : FALLBACK_WIDTH));\n }\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n const newWidth = entry.contentRect.width;\n if (newWidth > 0 && Math.abs(newWidth - measuredWidth) > 0.5) {\n setMeasuredWidth(newWidth);\n }\n });\n\n const rect = node.getBoundingClientRect();\n if (rect.width > 0) {\n setMeasuredWidth(rect.width);\n }\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [width, measuredWidth]);\n\n const resolvedWidth = Math.max(measuredWidth || FALLBACK_WIDTH, 1);\n const resolvedHeight = Math.max(height ?? DEFAULT_HEIGHT, 1);\n\n React.useEffect(() => {\n const node = contentRef.current;\n if (!node) {\n setContentHeight(prev => (prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n if (typeof ResizeObserver === 'undefined') {\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n return;\n }\n\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setContentHeight(prev => (Math.abs(prev - newHeight) > 0.5 ? newHeight : prev));\n }\n });\n\n const rect = node.getBoundingClientRect();\n setContentHeight(prev => (rect.height > 0 ? rect.height : prev > 0 ? prev : resolvedHeight));\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [\n resolvedHeight,\n resolvedWidth,\n annotations,\n chartTitle,\n description,\n margin,\n plotBackgroundColor,\n paperBackgroundColor,\n fontColor,\n fontFamily,\n theme,\n ]);\n\n const svgHeight = Math.max(Math.ceil(contentHeight || 0), resolvedHeight);\n\n const context: IChartAnnotationContext = {\n plotRect: { x: 0, y: 0, width: resolvedWidth, height: resolvedHeight },\n svgRect: { width: resolvedWidth, height: resolvedHeight },\n isRtl: theme?.rtl,\n };\n\n const padding = buildPadding(margin);\n\n const rootClassName = React.useMemo(\n () =>\n mergeStyles({\n position: 'relative',\n width: width ? `${width}px` : '100%',\n minHeight: resolvedHeight,\n backgroundColor: paperBackgroundColor ?? theme.semanticColors.bodyBackground,\n color: fontColor ?? theme.semanticColors.bodyText,\n fontFamily: fontFamily ?? theme.fonts.medium.fontFamily,\n padding,\n display: 'flex',\n flexDirection: 'column',\n rowGap: '8px',\n }),\n [fontColor, fontFamily, paperBackgroundColor, padding, resolvedHeight, theme, width],\n );\n\n const contentClassName = React.useMemo(\n () =>\n mergeStyles({\n position: 'relative',\n flexGrow: 1,\n backgroundColor: plotBackgroundColor ?? 'transparent',\n borderRadius: theme.effects.roundedCorner2 ?? 4,\n boxSizing: 'border-box',\n }),\n [plotBackgroundColor, theme.effects.roundedCorner2],\n );\n\n const titleClassName = React.useMemo(\n () =>\n mergeStyles({\n textAlign: 'center',\n }),\n [],\n );\n\n const resolvedAnnotations = annotations ?? [];\n const hasAnnotations = resolvedAnnotations.length > 0;\n const ariaLabel = hasAnnotations ? description ?? chartTitle : undefined;\n\n React.useImperativeHandle(\n componentRef,\n () => {\n const chartHandle: IChart = {\n chartContainer: containerRef.current,\n toImage: (opts?: IImageExportOptions) => {\n return exportChartsAsImage([{ container: containerRef.current }], undefined, getRTL(), opts);\n },\n };\n\n return chartHandle;\n },\n [],\n );\n\n return (\n <div ref={containerRef} data-chart-annotation-container=\"true\">\n <svg\n width={resolvedWidth}\n height={svgHeight}\n viewBox={`0 0 ${resolvedWidth} ${svgHeight}`}\n style={{ width: width ? `${width}px` : '100%', height: `${svgHeight}px`, display: 'block' }}\n role={ariaLabel ? 'img' : undefined}\n aria-label={ariaLabel}\n >\n <foreignObject x={0} y={0} width={resolvedWidth} height={svgHeight}>\n <div ref={contentRef} className={rootClassName} data-chart-annotation-only=\"true\" aria-label={ariaLabel}>\n {chartTitle && (\n <span className={titleClassName} aria-hidden=\"true\">\n {chartTitle}\n </span>\n )}\n <div className={contentClassName} role=\"presentation\">\n {hasAnnotations ? (\n <ChartAnnotationLayer annotations={resolvedAnnotations} context={context} theme={theme} />\n ) : null}\n </div>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n};\n\nAnnotationOnlyChart.displayName = 'AnnotationOnlyChart';\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { IChartAnnotation } from '../../types/IChartAnnotation';
|
|
3
|
+
import type { IChart } from '../../types/index';
|
|
4
|
+
import type { Margin } from '@fluentui/chart-utilities';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the annotation-only chart renderer.
|
|
7
|
+
*/
|
|
8
|
+
export interface IAnnotationOnlyChartProps {
|
|
9
|
+
/**
|
|
10
|
+
* Collection of annotations to render.
|
|
11
|
+
*/
|
|
12
|
+
annotations: IChartAnnotation[];
|
|
13
|
+
/** Optional layout title extracted from the Plotly schema. */
|
|
14
|
+
chartTitle?: string;
|
|
15
|
+
/** Optional descriptive text for accessibility. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Desired width in pixels (if absent the chart will grow to fit the container). */
|
|
18
|
+
width?: number;
|
|
19
|
+
/** Desired height in pixels. */
|
|
20
|
+
height?: number;
|
|
21
|
+
/** Paper/background colour specified in the Plotly layout. */
|
|
22
|
+
paperBackgroundColor?: string;
|
|
23
|
+
/** Plot area background colour specified in the Plotly layout. */
|
|
24
|
+
plotBackgroundColor?: string;
|
|
25
|
+
/** Global layout font colour. */
|
|
26
|
+
fontColor?: string;
|
|
27
|
+
/** Global layout font family. */
|
|
28
|
+
fontFamily?: string;
|
|
29
|
+
/** Layout margin converted to padding for the outer wrapper. */
|
|
30
|
+
margin?: Partial<Margin>;
|
|
31
|
+
/** Component ref propagated by the DeclarativeChart surface. */
|
|
32
|
+
componentRef?: React.RefObject<IChart>;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationOnlyChart.types.js","sourceRoot":"../src/","sources":["components/AnnotationOnlyChart/AnnotationOnlyChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { IChartAnnotation } from '../../types/IChartAnnotation';\nimport type { IChart } from '../../types/index';\nimport type { Margin } from '@fluentui/chart-utilities';\n\n/**\n * Props for the annotation-only chart renderer.\n */\nexport interface IAnnotationOnlyChartProps {\n /**\n * Collection of annotations to render.\n */\n annotations: IChartAnnotation[];\n /** Optional layout title extracted from the Plotly schema. */\n chartTitle?: string;\n /** Optional descriptive text for accessibility. */\n description?: string;\n /** Desired width in pixels (if absent the chart will grow to fit the container). */\n width?: number;\n /** Desired height in pixels. */\n height?: number;\n /** Paper/background colour specified in the Plotly layout. */\n paperBackgroundColor?: string;\n /** Plot area background colour specified in the Plotly layout. */\n plotBackgroundColor?: string;\n /** Global layout font colour. */\n fontColor?: string;\n /** Global layout font family. */\n fontFamily?: string;\n /** Layout margin converted to padding for the outer wrapper. */\n margin?: Partial<Margin>;\n /** Component ref propagated by the DeclarativeChart surface. */\n componentRef?: React.RefObject<IChart>;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./AnnotationOnlyChart"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./AnnotationOnlyChart.types"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/AnnotationOnlyChart/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,sEAA4C","sourcesContent":["export * from './AnnotationOnlyChart';\nexport * from './AnnotationOnlyChart.types';\n"]}
|
|
@@ -34,7 +34,7 @@ var AreaChartBase = /** @class */ (function (_super) {
|
|
|
34
34
|
_this._hasMissingXValues = false;
|
|
35
35
|
_this.toImage = function (opts) {
|
|
36
36
|
var _a, _b;
|
|
37
|
-
return (0, image_export_utils_1.
|
|
37
|
+
return (0, image_export_utils_1.exportChartsAsImage)([{ container: (_a = _this._cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer }], _this.props.hideLegend ? undefined : (_b = _this._legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, (0, Utilities_1.getRTL)(), opts);
|
|
38
38
|
};
|
|
39
39
|
_this._getMinMaxOfYAxis = function (points, yAxisType, useSecondaryYScale) {
|
|
40
40
|
return (0, index_2.findNumericMinMaxOfY)(points, yAxisType, useSecondaryYScale);
|