@fluentui/react-charts 0.0.0-nightly-20250423-1342.1 → 0.0.0-nightly-20250424-0405.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -16
- package/dist/index.d.ts +3305 -0
- package/lib/AreaChart.js +1 -0
- package/lib/AreaChart.js.map +1 -0
- package/lib/CartesianChart.js +1 -0
- package/lib/CartesianChart.js.map +1 -0
- package/lib/DeclarativeChart.js +1 -0
- package/lib/DeclarativeChart.js.map +1 -0
- package/lib/DonutChart.js +1 -0
- package/lib/DonutChart.js.map +1 -0
- package/lib/GaugeChart.js +1 -0
- package/lib/GaugeChart.js.map +1 -0
- package/lib/GroupedVerticalBarChart.js +1 -0
- package/lib/GroupedVerticalBarChart.js.map +1 -0
- package/lib/HeatMapChart.js +1 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/HorizontalBarChart.js +1 -0
- package/lib/HorizontalBarChart.js.map +1 -0
- package/lib/HorizontalBarChartWithAxis.js +1 -0
- package/lib/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/Legends.js +1 -0
- package/lib/Legends.js.map +1 -0
- package/lib/LineChart.js +1 -0
- package/lib/LineChart.js.map +1 -0
- package/lib/Popover.js +1 -0
- package/lib/Popover.js.map +1 -0
- package/lib/ResponsiveContainer.js +1 -0
- package/lib/ResponsiveContainer.js.map +1 -0
- package/lib/SankeyChart.js +1 -0
- package/lib/SankeyChart.js.map +1 -0
- package/lib/ScatterChart.js +1 -0
- package/lib/ScatterChart.js.map +1 -0
- package/lib/Sparkline.js +1 -0
- package/lib/Sparkline.js.map +1 -0
- package/lib/VerticalBarChart.js +1 -0
- package/lib/VerticalBarChart.js.map +1 -0
- package/lib/VerticalStackedBarChart.js +1 -0
- package/lib/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +775 -0
- package/lib/components/AreaChart/AreaChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.types.js +4 -0
- package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib/components/AreaChart/index.js +3 -0
- package/lib/components/AreaChart/index.js.map +1 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +55 -0
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +478 -0
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.js +187 -0
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib/components/CommonComponents/index.js +4 -0
- package/lib/components/CommonComponents/index.js.map +1 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +113 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +167 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +197 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +811 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/imageExporter.js +221 -0
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib/components/DeclarativeChart/index.js +1 -0
- package/lib/components/DeclarativeChart/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.js +110 -0
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib/components/DonutChart/Arc/index.js +2 -0
- package/lib/components/DonutChart/Arc/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +54 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.js +291 -0
- package/lib/components/DonutChart/DonutChart.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.types.js +1 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.js +72 -0
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/index.js +2 -0
- package/lib/components/DonutChart/Pie/index.js.map +1 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js +40 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/index.js +3 -0
- package/lib/components/DonutChart/index.js.map +1 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +58 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.js +592 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib/components/GaugeChart/index.js +3 -0
- package/lib/components/GaugeChart/index.js.map +1 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +178 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +501 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/index.js +3 -0
- package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +81 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib/components/HeatMapChart/index.js +3 -0
- package/lib/components/HeatMapChart/index.js.map +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +37 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +402 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +6 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib/components/HorizontalBarChart/index.js +3 -0
- package/lib/components/HorizontalBarChart/index.js.map +1 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +156 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
- package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +67 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +303 -0
- package/lib/components/Legends/Legends.js.map +1 -0
- package/lib/components/Legends/Legends.types.js +1 -0
- package/lib/components/Legends/Legends.types.js.map +1 -0
- package/lib/components/Legends/OverflowMenu.js +25 -0
- package/lib/components/Legends/OverflowMenu.js.map +1 -0
- package/lib/components/Legends/index.js +3 -0
- package/lib/components/Legends/index.js.map +1 -0
- package/lib/components/Legends/shape.js +35 -0
- package/lib/components/Legends/shape.js.map +1 -0
- package/lib/components/Legends/useLegendsStyles.styles.js +146 -0
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib/components/LineChart/LineChart.js +1034 -0
- package/lib/components/LineChart/LineChart.js.map +1 -0
- package/lib/components/LineChart/LineChart.types.js +3 -0
- package/lib/components/LineChart/LineChart.types.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +119 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +57 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js +40 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib/components/LineChart/index.js +4 -0
- package/lib/components/LineChart/index.js.map +1 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js +56 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +65 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib/components/ResponsiveContainer/index.js +1 -0
- package/lib/components/ResponsiveContainer/index.js.map +1 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +23 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.js +1023 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib/components/SankeyChart/index.js +3 -0
- package/lib/components/SankeyChart/index.js.map +1 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.js +465 -0
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib/components/ScatterChart/index.js +3 -0
- package/lib/components/ScatterChart/index.js.map +1 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +56 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.js +119 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.types.js +4 -0
- package/lib/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib/components/Sparkline/index.js +3 -0
- package/lib/components/Sparkline/index.js.map +1 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js +49 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js +926 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js +4 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib/components/VerticalBarChart/index.js +3 -0
- package/lib/components/VerticalBarChart/index.js.map +1 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +66 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/index.js +3 -0
- package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +65 -0
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/types/DataPoint.js +1 -0
- package/lib/types/DataPoint.js.map +1 -0
- package/lib/types/EventAnnotation.js +1 -0
- package/lib/types/EventAnnotation.js.map +1 -0
- package/lib/types/LegendDataItem.js +1 -0
- package/lib/types/LegendDataItem.js.map +1 -0
- package/lib/types/index.js +2 -0
- package/lib/types/index.js.map +1 -0
- package/lib/utilities/FocusableTooltipText.js +65 -0
- package/lib/utilities/FocusableTooltipText.js.map +1 -0
- package/lib/utilities/KeyCodes.js +8 -0
- package/lib/utilities/KeyCodes.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js +183 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -0
- package/lib/utilities/async-utils.js +380 -0
- package/lib/utilities/async-utils.js.map +1 -0
- package/lib/utilities/colors.js +269 -0
- package/lib/utilities/colors.js.map +1 -0
- package/lib/utilities/getWindow.js +25 -0
- package/lib/utilities/getWindow.js.map +1 -0
- package/lib/utilities/index.js +3 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib/utilities/locale-util.js +15 -0
- package/lib/utilities/locale-util.js.map +1 -0
- package/lib/utilities/overflow-utils.js +27 -0
- package/lib/utilities/overflow-utils.js.map +1 -0
- package/lib/utilities/string.js +32 -0
- package/lib/utilities/string.js.map +1 -0
- package/lib/utilities/test-data.js +329 -0
- package/lib/utilities/test-data.js.map +1 -0
- package/lib/utilities/utilities.js +1405 -0
- package/lib/utilities/utilities.js.map +1 -0
- package/lib/utilities/vbc-utils.js +27 -0
- package/lib/utilities/vbc-utils.js.map +1 -0
- package/lib-commonjs/AreaChart.js +6 -0
- package/lib-commonjs/AreaChart.js.map +1 -0
- package/lib-commonjs/CartesianChart.js +6 -0
- package/lib-commonjs/CartesianChart.js.map +1 -0
- package/lib-commonjs/DeclarativeChart.js +6 -0
- package/lib-commonjs/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/DonutChart.js +6 -0
- package/lib-commonjs/DonutChart.js.map +1 -0
- package/lib-commonjs/GaugeChart.js +6 -0
- package/lib-commonjs/GaugeChart.js.map +1 -0
- package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
- package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/HeatMapChart.js +6 -0
- package/lib-commonjs/HeatMapChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChart.js +6 -0
- package/lib-commonjs/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
- package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/Legends.js +6 -0
- package/lib-commonjs/Legends.js.map +1 -0
- package/lib-commonjs/LineChart.js +6 -0
- package/lib-commonjs/LineChart.js.map +1 -0
- package/lib-commonjs/Popover.js +6 -0
- package/lib-commonjs/Popover.js.map +1 -0
- package/lib-commonjs/ResponsiveContainer.js +6 -0
- package/lib-commonjs/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/SankeyChart.js +6 -0
- package/lib-commonjs/SankeyChart.js.map +1 -0
- package/lib-commonjs/ScatterChart.js +6 -0
- package/lib-commonjs/ScatterChart.js.map +1 -0
- package/lib-commonjs/Sparkline.js +6 -0
- package/lib-commonjs/Sparkline.js.map +1 -0
- package/lib-commonjs/VerticalBarChart.js +6 -0
- package/lib-commonjs/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/VerticalStackedBarChart.js +6 -0
- package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
- package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
- package/lib-commonjs/components/AreaChart/index.js +8 -0
- package/lib-commonjs/components/AreaChart/index.js.map +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +95 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +484 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +6 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +197 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +4 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/index.js +9 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +166 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +236 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +205 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +859 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +231 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/index.js +6 -0
- package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +117 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +83 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js +298 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js +6 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +79 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +54 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/index.js +8 -0
- package/lib-commonjs/components/DonutChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +82 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +621 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/index.js +8 -0
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +258 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +507 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +130 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/index.js +8 -0
- package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +59 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +408 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +17 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +237 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +107 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +313 -0
- package/lib-commonjs/components/Legends/Legends.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.types.js +6 -0
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js +36 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -0
- package/lib-commonjs/components/Legends/index.js +8 -0
- package/lib-commonjs/components/Legends/index.js.map +1 -0
- package/lib-commonjs/components/Legends/shape.js +46 -0
- package/lib-commonjs/components/Legends/shape.js.map +1 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +304 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.js +1040 -0
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js +6 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +129 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +68 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +51 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib-commonjs/components/LineChart/index.js +9 -0
- package/lib-commonjs/components/LineChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +87 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +76 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +47 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1039 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/index.js +8 -0
- package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +471 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/index.js +8 -0
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +87 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js +125 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js +7 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib-commonjs/components/Sparkline/index.js +8 -0
- package/lib-commonjs/components/Sparkline/index.js.map +1 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +77 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +928 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +110 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +113 -0
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +25 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js +4 -0
- package/lib-commonjs/types/DataPoint.js.map +1 -0
- package/lib-commonjs/types/EventAnnotation.js +6 -0
- package/lib-commonjs/types/EventAnnotation.js.map +1 -0
- package/lib-commonjs/types/LegendDataItem.js +4 -0
- package/lib-commonjs/types/LegendDataItem.js.map +1 -0
- package/lib-commonjs/types/index.js +7 -0
- package/lib-commonjs/types/index.js.map +1 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js +75 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/KeyCodes.js +18 -0
- package/lib-commonjs/utilities/KeyCodes.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js +193 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/async-utils.js +382 -0
- package/lib-commonjs/utilities/async-utils.js.map +1 -0
- package/lib-commonjs/utilities/colors.js +293 -0
- package/lib-commonjs/utilities/colors.js.map +1 -0
- package/lib-commonjs/utilities/getWindow.js +28 -0
- package/lib-commonjs/utilities/getWindow.js.map +1 -0
- package/lib-commonjs/utilities/index.js +8 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/lib-commonjs/utilities/locale-util.js +25 -0
- package/lib-commonjs/utilities/locale-util.js.map +1 -0
- package/lib-commonjs/utilities/overflow-utils.js +36 -0
- package/lib-commonjs/utilities/overflow-utils.js.map +1 -0
- package/lib-commonjs/utilities/string.js +29 -0
- package/lib-commonjs/utilities/string.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +383 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +1371 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -0
- package/lib-commonjs/utilities/vbc-utils.js +45 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -0
- package/package.json +13 -13
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
/* eslint-disable one-var */ /* eslint-disable vars-on-top */ /* eslint-disable no-var */ /* eslint-disable @typescript-eslint/no-explicit-any */ import * as React from 'react';
|
|
2
|
+
import { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3Max, range as d3Range } from 'd3-array';
|
|
3
|
+
import { scaleLinear as d3ScaleLinear } from 'd3-scale';
|
|
4
|
+
import { DataVizPalette, getColorFromToken, getNextColor } from '../../utilities/colors';
|
|
5
|
+
import { findNumericMinMaxOfY } from '../../utilities/utilities';
|
|
6
|
+
import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isLineData } from '@fluentui/chart-utilities';
|
|
7
|
+
import { timeParse } from 'd3-time-format';
|
|
8
|
+
import { curveCardinal as d3CurveCardinal } from 'd3-shape';
|
|
9
|
+
const dashOptions = {
|
|
10
|
+
dot: {
|
|
11
|
+
strokeDasharray: '1, 5',
|
|
12
|
+
strokeLinecap: 'round',
|
|
13
|
+
strokeWidth: '2',
|
|
14
|
+
lineBorderWidth: '4'
|
|
15
|
+
},
|
|
16
|
+
dash: {
|
|
17
|
+
strokeDasharray: '5, 5',
|
|
18
|
+
strokeLinecap: 'butt',
|
|
19
|
+
strokeWidth: '2',
|
|
20
|
+
lineBorderWidth: '4'
|
|
21
|
+
},
|
|
22
|
+
longdash: {
|
|
23
|
+
strokeDasharray: '10, 5',
|
|
24
|
+
strokeLinecap: 'butt',
|
|
25
|
+
strokeWidth: '2',
|
|
26
|
+
lineBorderWidth: '4'
|
|
27
|
+
},
|
|
28
|
+
dashdot: {
|
|
29
|
+
strokeDasharray: '5, 5, 1, 5',
|
|
30
|
+
strokeLinecap: 'butt',
|
|
31
|
+
strokeWidth: '2',
|
|
32
|
+
lineBorderWidth: '4'
|
|
33
|
+
},
|
|
34
|
+
longdashdot: {
|
|
35
|
+
strokeDasharray: '10, 5, 1, 5',
|
|
36
|
+
strokeLinecap: 'butt',
|
|
37
|
+
strokeWidth: '2',
|
|
38
|
+
lineBorderWidth: '4'
|
|
39
|
+
},
|
|
40
|
+
solid: {
|
|
41
|
+
strokeDasharray: '0',
|
|
42
|
+
strokeLinecap: 'butt',
|
|
43
|
+
strokeWidth: '2',
|
|
44
|
+
lineBorderWidth: '4'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const isMonth = (possiblyMonthValue)=>{
|
|
48
|
+
const parseFullMonth = timeParse('%B');
|
|
49
|
+
const parseShortMonth = timeParse('%b');
|
|
50
|
+
return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;
|
|
51
|
+
};
|
|
52
|
+
export const isMonthArray = (data)=>{
|
|
53
|
+
return isArrayOfType(data, isMonth);
|
|
54
|
+
};
|
|
55
|
+
const getLegend = (series, index)=>{
|
|
56
|
+
return series.name || `Series ${index + 1}`;
|
|
57
|
+
};
|
|
58
|
+
function getTitles(layout) {
|
|
59
|
+
var _layout_title, _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
|
|
60
|
+
var _layout_title_text, _layout_xaxis_title_text, _layout_yaxis_title_text;
|
|
61
|
+
const titles = {
|
|
62
|
+
chartTitle: typeof (layout === null || layout === void 0 ? void 0 : layout.title) === 'string' ? layout.title : (_layout_title_text = layout === null || layout === void 0 ? void 0 : (_layout_title = layout.title) === null || _layout_title === void 0 ? void 0 : _layout_title.text) !== null && _layout_title_text !== void 0 ? _layout_title_text : '',
|
|
63
|
+
xAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_xaxis = layout.xaxis) === null || _layout_xaxis === void 0 ? void 0 : _layout_xaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_xaxis1 = layout.xaxis) === null || _layout_xaxis1 === void 0 ? void 0 : _layout_xaxis1.title : (_layout_xaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_xaxis2 = layout.xaxis) === null || _layout_xaxis2 === void 0 ? void 0 : (_layout_xaxis_title = _layout_xaxis2.title) === null || _layout_xaxis_title === void 0 ? void 0 : _layout_xaxis_title.text) !== null && _layout_xaxis_title_text !== void 0 ? _layout_xaxis_title_text : '',
|
|
64
|
+
yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : ''
|
|
65
|
+
};
|
|
66
|
+
return titles;
|
|
67
|
+
}
|
|
68
|
+
export const correctYearMonth = (xValues)=>{
|
|
69
|
+
const presentYear = new Date().getFullYear();
|
|
70
|
+
if (xValues.length > 0 && Array.isArray(xValues[0])) {
|
|
71
|
+
throw new Error('updateXValues:: 2D array not supported');
|
|
72
|
+
}
|
|
73
|
+
const dates = xValues.map((possiblyMonthValue)=>{
|
|
74
|
+
const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;
|
|
75
|
+
return isDate(parsedDate) ? new Date(parsedDate) : null;
|
|
76
|
+
});
|
|
77
|
+
for(let i = dates.length - 1; i > 0; i--){
|
|
78
|
+
const currentMonth = dates[i].getMonth();
|
|
79
|
+
const previousMonth = dates[i - 1].getMonth();
|
|
80
|
+
const currentYear = dates[i].getFullYear();
|
|
81
|
+
const previousYear = dates[i - 1].getFullYear();
|
|
82
|
+
if (previousMonth >= currentMonth) {
|
|
83
|
+
dates[i - 1].setFullYear(dates[i].getFullYear() - 1);
|
|
84
|
+
} else if (previousYear > currentYear) {
|
|
85
|
+
dates[i - 1].setFullYear(currentYear);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
xValues = xValues.map((month, index)=>{
|
|
89
|
+
return `${month} 01, ${dates[index].getFullYear()}`;
|
|
90
|
+
});
|
|
91
|
+
return xValues;
|
|
92
|
+
};
|
|
93
|
+
export const getColor = (legendLabel, colorMap, isDarkTheme)=>{
|
|
94
|
+
if (!colorMap.current.has(legendLabel)) {
|
|
95
|
+
const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);
|
|
96
|
+
colorMap.current.set(legendLabel, nextColor);
|
|
97
|
+
return nextColor;
|
|
98
|
+
}
|
|
99
|
+
return colorMap.current.get(legendLabel);
|
|
100
|
+
};
|
|
101
|
+
const getSecondaryYAxisValues = (series, layout)=>{
|
|
102
|
+
const secondaryYAxisValues = {};
|
|
103
|
+
if (layout && layout.yaxis2 && series.yaxis === 'y2') {
|
|
104
|
+
var _layout_yaxis2_title;
|
|
105
|
+
secondaryYAxisValues.secondaryYAxistitle = typeof layout.yaxis2.title === 'string' ? layout.yaxis2.title : typeof ((_layout_yaxis2_title = layout.yaxis2.title) === null || _layout_yaxis2_title === void 0 ? void 0 : _layout_yaxis2_title.text) === 'string' ? layout.yaxis2.title.text : '';
|
|
106
|
+
if (layout.yaxis2.range) {
|
|
107
|
+
secondaryYAxisValues.secondaryYScaleOptions = {
|
|
108
|
+
yMinValue: layout.yaxis2.range[0],
|
|
109
|
+
yMaxValue: layout.yaxis2.range[1]
|
|
110
|
+
};
|
|
111
|
+
} else {
|
|
112
|
+
const yValues = series.y;
|
|
113
|
+
if (yValues) {
|
|
114
|
+
secondaryYAxisValues.secondaryYScaleOptions = {
|
|
115
|
+
yMinValue: Math.min(...yValues),
|
|
116
|
+
yMaxValue: Math.max(...yValues)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
secondaryYAxisValues.secondaryYAxistitle = secondaryYAxisValues.secondaryYAxistitle !== '' ? secondaryYAxisValues.secondaryYAxistitle : undefined;
|
|
122
|
+
secondaryYAxisValues.secondaryYScaleOptions = secondaryYAxisValues.secondaryYScaleOptions && Object.keys(secondaryYAxisValues.secondaryYScaleOptions).length !== 0 ? secondaryYAxisValues.secondaryYScaleOptions : undefined;
|
|
123
|
+
return secondaryYAxisValues;
|
|
124
|
+
};
|
|
125
|
+
export const transformPlotlyJsonToDonutProps = (input, colorMap, isDarkTheme)=>{
|
|
126
|
+
var _firstData_labels, _input_layout, _input_layout1, _input_layout2, _input_layout3;
|
|
127
|
+
const firstData = input.data[0];
|
|
128
|
+
const mapLegendToDataPoint = {};
|
|
129
|
+
(_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
|
|
130
|
+
var _firstData_values;
|
|
131
|
+
const color = getColor(label, colorMap, isDarkTheme);
|
|
132
|
+
//ToDo how to handle string data?
|
|
133
|
+
const value = typeof ((_firstData_values = firstData.values) === null || _firstData_values === void 0 ? void 0 : _firstData_values[index]) === 'number' ? firstData.values[index] : 1;
|
|
134
|
+
if (!mapLegendToDataPoint[label]) {
|
|
135
|
+
mapLegendToDataPoint[label] = {
|
|
136
|
+
legend: label,
|
|
137
|
+
data: value,
|
|
138
|
+
color
|
|
139
|
+
};
|
|
140
|
+
} else {
|
|
141
|
+
mapLegendToDataPoint[label].data += value;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
var _input_layout_width;
|
|
145
|
+
const width = (_input_layout_width = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
|
|
146
|
+
var _input_layout_height;
|
|
147
|
+
const height = (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 220;
|
|
148
|
+
const hideLabels = firstData.textinfo ? ![
|
|
149
|
+
'value',
|
|
150
|
+
'percent',
|
|
151
|
+
'label+percent'
|
|
152
|
+
].includes(firstData.textinfo) : false;
|
|
153
|
+
const donutMarginHorizontal = hideLabels ? 0 : 80;
|
|
154
|
+
const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
|
|
155
|
+
const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : 0;
|
|
156
|
+
const { chartTitle } = getTitles(input.layout);
|
|
157
|
+
return {
|
|
158
|
+
data: {
|
|
159
|
+
chartTitle,
|
|
160
|
+
chartData: Object.values(mapLegendToDataPoint)
|
|
161
|
+
},
|
|
162
|
+
hideLegend: ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false ? true : false,
|
|
163
|
+
width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
|
|
164
|
+
height,
|
|
165
|
+
innerRadius,
|
|
166
|
+
hideLabels,
|
|
167
|
+
showLabelsInPercent: firstData.textinfo ? [
|
|
168
|
+
'percent',
|
|
169
|
+
'label+percent'
|
|
170
|
+
].includes(firstData.textinfo) : true
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
export const transformPlotlyJsonToVSBCProps = (input, colorMap, isDarkTheme, fallbackVSBC)=>{
|
|
174
|
+
var _input_layout, _input_layout1;
|
|
175
|
+
const mapXToDataPoints = {};
|
|
176
|
+
let yMaxValue = 0;
|
|
177
|
+
let secondaryYAxisValues = {};
|
|
178
|
+
input.data.forEach((series, index1)=>{
|
|
179
|
+
var _series_x;
|
|
180
|
+
(_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
|
|
181
|
+
var _series_y;
|
|
182
|
+
if (!mapXToDataPoints[x]) {
|
|
183
|
+
mapXToDataPoints[x] = {
|
|
184
|
+
xAxisPoint: x,
|
|
185
|
+
chartData: [],
|
|
186
|
+
lineData: []
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const legend = getLegend(series, index1);
|
|
190
|
+
var _series_y_index2;
|
|
191
|
+
const yVal = (_series_y_index2 = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2]) !== null && _series_y_index2 !== void 0 ? _series_y_index2 : 0;
|
|
192
|
+
if (series.type === 'bar') {
|
|
193
|
+
const color = getColor(legend, colorMap, isDarkTheme);
|
|
194
|
+
mapXToDataPoints[x].chartData.push({
|
|
195
|
+
legend,
|
|
196
|
+
data: yVal,
|
|
197
|
+
color
|
|
198
|
+
});
|
|
199
|
+
} else if (series.type === 'scatter' || isLineData(series) || !!fallbackVSBC) {
|
|
200
|
+
const color = getColor(legend, colorMap, isDarkTheme);
|
|
201
|
+
const lineOptions = getLineOptions(series.line);
|
|
202
|
+
mapXToDataPoints[x].lineData.push({
|
|
203
|
+
legend,
|
|
204
|
+
y: yVal,
|
|
205
|
+
color,
|
|
206
|
+
...lineOptions ? {
|
|
207
|
+
lineOptions
|
|
208
|
+
} : {}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
yMaxValue = Math.max(yMaxValue, yVal);
|
|
212
|
+
});
|
|
213
|
+
secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);
|
|
214
|
+
});
|
|
215
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
216
|
+
var _input_layout_height;
|
|
217
|
+
return {
|
|
218
|
+
data: Object.values(mapXToDataPoints),
|
|
219
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
220
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
221
|
+
barWidth: 'auto',
|
|
222
|
+
yMaxValue,
|
|
223
|
+
chartTitle,
|
|
224
|
+
xAxisTitle,
|
|
225
|
+
yAxisTitle,
|
|
226
|
+
mode: 'plotly',
|
|
227
|
+
secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
|
|
228
|
+
secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
|
|
229
|
+
hideTickOverlap: true
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
export const transformPlotlyJsonToGVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
233
|
+
var _input_layout, _input_layout1;
|
|
234
|
+
const mapXToDataPoints = {};
|
|
235
|
+
let secondaryYAxisValues = {};
|
|
236
|
+
input.data.forEach((series, index1)=>{
|
|
237
|
+
var _series_x;
|
|
238
|
+
(_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
|
|
239
|
+
if (!mapXToDataPoints[x]) {
|
|
240
|
+
mapXToDataPoints[x] = {
|
|
241
|
+
name: x.toString(),
|
|
242
|
+
series: []
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
if (series.type === 'bar') {
|
|
246
|
+
var _series_y;
|
|
247
|
+
const legend = getLegend(series, index1);
|
|
248
|
+
const color = getColor(legend, colorMap, isDarkTheme);
|
|
249
|
+
var _series_y_index2;
|
|
250
|
+
mapXToDataPoints[x].series.push({
|
|
251
|
+
key: legend,
|
|
252
|
+
data: (_series_y_index2 = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2]) !== null && _series_y_index2 !== void 0 ? _series_y_index2 : 0,
|
|
253
|
+
xAxisCalloutData: x,
|
|
254
|
+
color,
|
|
255
|
+
legend
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);
|
|
260
|
+
});
|
|
261
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
262
|
+
var _input_layout_height;
|
|
263
|
+
return {
|
|
264
|
+
data: Object.values(mapXToDataPoints),
|
|
265
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
266
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
267
|
+
barWidth: 'auto',
|
|
268
|
+
chartTitle,
|
|
269
|
+
xAxisTitle,
|
|
270
|
+
yAxisTitle,
|
|
271
|
+
mode: 'plotly',
|
|
272
|
+
secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
|
|
273
|
+
secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
|
|
274
|
+
hideTickOverlap: true
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
export const transformPlotlyJsonToVBCProps = (input, colorMap, isDarkTheme)=>{
|
|
278
|
+
var _input_layout, _input_layout1;
|
|
279
|
+
const vbcData = [];
|
|
280
|
+
input.data.forEach((series, seriesIdx)=>{
|
|
281
|
+
var _series_xbins, _series_xbins1, _series_xbins2;
|
|
282
|
+
if (!series.x) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const isXString = isStringArray(series.x);
|
|
286
|
+
const xBins = createBins(series.x, (_series_xbins = series.xbins) === null || _series_xbins === void 0 ? void 0 : _series_xbins.start, (_series_xbins1 = series.xbins) === null || _series_xbins1 === void 0 ? void 0 : _series_xbins1.end, (_series_xbins2 = series.xbins) === null || _series_xbins2 === void 0 ? void 0 : _series_xbins2.size);
|
|
287
|
+
const yBins = xBins.map(()=>[]);
|
|
288
|
+
let total = 0;
|
|
289
|
+
series.x.forEach((xVal, index)=>{
|
|
290
|
+
const binIdx = findBinIndex(xBins, xVal, isXString);
|
|
291
|
+
if (binIdx !== -1) {
|
|
292
|
+
var _series_y;
|
|
293
|
+
var _series_y_index;
|
|
294
|
+
yBins[binIdx].push((_series_y_index = (_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index]) !== null && _series_y_index !== void 0 ? _series_y_index : 1);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const y = yBins.map((bin)=>{
|
|
298
|
+
const yVal = calculateHistFunc(series.histfunc, bin);
|
|
299
|
+
total += yVal;
|
|
300
|
+
return yVal;
|
|
301
|
+
});
|
|
302
|
+
xBins.forEach((bin, index)=>{
|
|
303
|
+
const legend = getLegend(series, seriesIdx);
|
|
304
|
+
const color = getColor(legend, colorMap, isDarkTheme);
|
|
305
|
+
const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
306
|
+
vbcData.push({
|
|
307
|
+
x: isXString ? bin.join(', ') : getBinCenter(bin),
|
|
308
|
+
y: yVal,
|
|
309
|
+
legend,
|
|
310
|
+
color,
|
|
311
|
+
...isXString ? {} : {
|
|
312
|
+
xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
318
|
+
var _input_layout_height;
|
|
319
|
+
return {
|
|
320
|
+
data: vbcData,
|
|
321
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
322
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
323
|
+
chartTitle,
|
|
324
|
+
xAxisTitle,
|
|
325
|
+
yAxisTitle,
|
|
326
|
+
mode: 'plotly',
|
|
327
|
+
hideTickOverlap: true
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
export const transformPlotlyJsonToScatterChartProps = (input, isAreaChart, colorMap, isDarkTheme)=>{
|
|
331
|
+
let secondaryYAxisValues = {};
|
|
332
|
+
let mode = 'tonexty';
|
|
333
|
+
const chartData = input.data.map((series, index)=>{
|
|
334
|
+
const xValues = series.x;
|
|
335
|
+
const isString = typeof xValues[0] === 'string';
|
|
336
|
+
const isXDate = isDateArray(xValues);
|
|
337
|
+
const isXNumber = isNumberArray(xValues);
|
|
338
|
+
const legend = getLegend(series, index);
|
|
339
|
+
const lineColor = getColor(legend, colorMap, isDarkTheme);
|
|
340
|
+
secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);
|
|
341
|
+
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
342
|
+
const lineOptions = getLineOptions(series.line);
|
|
343
|
+
return {
|
|
344
|
+
legend,
|
|
345
|
+
data: xValues.map((x, i)=>{
|
|
346
|
+
var _series_marker, _series_marker1;
|
|
347
|
+
return {
|
|
348
|
+
x: isString ? isXDate ? new Date(x) : isXNumber ? parseFloat(x) : x : x,
|
|
349
|
+
y: series.y[i],
|
|
350
|
+
...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
|
|
351
|
+
markerSize: series.marker.size[i]
|
|
352
|
+
} : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
|
|
353
|
+
markerSize: series.marker.size
|
|
354
|
+
} : {}
|
|
355
|
+
};
|
|
356
|
+
}),
|
|
357
|
+
color: lineColor,
|
|
358
|
+
...lineOptions ? {
|
|
359
|
+
lineOptions
|
|
360
|
+
} : {}
|
|
361
|
+
};
|
|
362
|
+
});
|
|
363
|
+
const yMinMaxValues = findNumericMinMaxOfY(chartData);
|
|
364
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
365
|
+
const chartProps = {
|
|
366
|
+
chartTitle,
|
|
367
|
+
lineChartData: chartData
|
|
368
|
+
};
|
|
369
|
+
if (isAreaChart) {
|
|
370
|
+
var _input_layout, _input_layout1;
|
|
371
|
+
var _input_layout_height;
|
|
372
|
+
return {
|
|
373
|
+
data: chartProps,
|
|
374
|
+
supportNegativeData: true,
|
|
375
|
+
xAxisTitle,
|
|
376
|
+
yAxisTitle,
|
|
377
|
+
secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
|
|
378
|
+
secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
|
|
379
|
+
mode,
|
|
380
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
381
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
382
|
+
hideTickOverlap: true
|
|
383
|
+
};
|
|
384
|
+
} else {
|
|
385
|
+
var _input_layout2, _input_layout3;
|
|
386
|
+
var _input_layout_height1;
|
|
387
|
+
return {
|
|
388
|
+
data: chartProps,
|
|
389
|
+
supportNegativeData: true,
|
|
390
|
+
xAxisTitle,
|
|
391
|
+
yAxisTitle,
|
|
392
|
+
secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,
|
|
393
|
+
secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,
|
|
394
|
+
roundedTicks: true,
|
|
395
|
+
yMinValue: yMinMaxValues.startValue,
|
|
396
|
+
yMaxValue: yMinMaxValues.endValue,
|
|
397
|
+
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
398
|
+
height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
|
|
399
|
+
hideTickOverlap: true,
|
|
400
|
+
enableReflow: false
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, colorMap, isDarkTheme)=>{
|
|
405
|
+
var _input_layout, _input_layout_margin, _input_layout1, _input_layout_margin1, _input_layout2, _input_layout_yaxis2, _input_layout3, _input_layout_yaxis21, _input_layout4, _input_layout_yaxis2_title, _input_layout_yaxis22, _input_layout5, _input_layout6;
|
|
406
|
+
const chartData = input.data.map((series, index)=>{
|
|
407
|
+
return series.y.map((yValue, i)=>{
|
|
408
|
+
const color = getColor(yValue, colorMap, isDarkTheme);
|
|
409
|
+
return {
|
|
410
|
+
x: series.x[i],
|
|
411
|
+
y: yValue,
|
|
412
|
+
legend: yValue,
|
|
413
|
+
color
|
|
414
|
+
};
|
|
415
|
+
});
|
|
416
|
+
}).flat()//reversing the order to invert the Y bars order as required by plotly.
|
|
417
|
+
.reverse();
|
|
418
|
+
var _input_layout_height;
|
|
419
|
+
const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
|
|
420
|
+
var _input_layout_margin_l;
|
|
421
|
+
const margin = (_input_layout_margin_l = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_margin = _input_layout1.margin) === null || _input_layout_margin === void 0 ? void 0 : _input_layout_margin.l) !== null && _input_layout_margin_l !== void 0 ? _input_layout_margin_l : 0;
|
|
422
|
+
var _input_layout_margin_pad;
|
|
423
|
+
const padding = (_input_layout_margin_pad = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_margin1 = _input_layout2.margin) === null || _input_layout_margin1 === void 0 ? void 0 : _input_layout_margin1.pad) !== null && _input_layout_margin_pad !== void 0 ? _input_layout_margin_pad : 0;
|
|
424
|
+
const availableHeight = chartHeight - margin - padding;
|
|
425
|
+
const numberOfBars = input.data[0].y.length;
|
|
426
|
+
const scalingFactor = 0.01;
|
|
427
|
+
const gapFactor = 1 / (1 + scalingFactor * numberOfBars);
|
|
428
|
+
const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));
|
|
429
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
430
|
+
return {
|
|
431
|
+
data: chartData,
|
|
432
|
+
chartTitle,
|
|
433
|
+
xAxisTitle,
|
|
434
|
+
yAxisTitle,
|
|
435
|
+
secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
|
|
436
|
+
barHeight,
|
|
437
|
+
showYAxisLables: true,
|
|
438
|
+
height: chartHeight,
|
|
439
|
+
width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
|
|
440
|
+
hideTickOverlap: true
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
export const transformPlotlyJsonToHeatmapProps = (input)=>{
|
|
444
|
+
var _input_layout, _input_layout1;
|
|
445
|
+
const firstData = input.data[0];
|
|
446
|
+
const heatmapDataPoints = [];
|
|
447
|
+
let zMin = Number.POSITIVE_INFINITY;
|
|
448
|
+
let zMax = Number.NEGATIVE_INFINITY;
|
|
449
|
+
if (firstData.type === 'histogram2d') {
|
|
450
|
+
var _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2, _firstData_x;
|
|
451
|
+
const isXString = isStringArray(firstData.x);
|
|
452
|
+
const isYString = isStringArray(firstData.y);
|
|
453
|
+
const xBins = createBins(firstData.x, (_firstData_xbins = firstData.xbins) === null || _firstData_xbins === void 0 ? void 0 : _firstData_xbins.start, (_firstData_xbins1 = firstData.xbins) === null || _firstData_xbins1 === void 0 ? void 0 : _firstData_xbins1.end, (_firstData_xbins2 = firstData.xbins) === null || _firstData_xbins2 === void 0 ? void 0 : _firstData_xbins2.size);
|
|
454
|
+
const yBins = createBins(firstData.y, (_firstData_ybins = firstData.ybins) === null || _firstData_ybins === void 0 ? void 0 : _firstData_ybins.start, (_firstData_ybins1 = firstData.ybins) === null || _firstData_ybins1 === void 0 ? void 0 : _firstData_ybins1.end, (_firstData_ybins2 = firstData.ybins) === null || _firstData_ybins2 === void 0 ? void 0 : _firstData_ybins2.size);
|
|
455
|
+
const zBins = yBins.map(()=>xBins.map(()=>[]));
|
|
456
|
+
let total = 0;
|
|
457
|
+
(_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
|
|
458
|
+
var _firstData_y;
|
|
459
|
+
const xBinIdx = findBinIndex(xBins, xVal, isXString);
|
|
460
|
+
const yBinIdx = findBinIndex(yBins, (_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index], isYString);
|
|
461
|
+
if (xBinIdx !== -1 && yBinIdx !== -1) {
|
|
462
|
+
var _firstData_z;
|
|
463
|
+
var _firstData_z_index;
|
|
464
|
+
zBins[yBinIdx][xBinIdx].push((_firstData_z_index = (_firstData_z = firstData.z) === null || _firstData_z === void 0 ? void 0 : _firstData_z[index]) !== null && _firstData_z_index !== void 0 ? _firstData_z_index : 1);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
const z = zBins.map((row)=>{
|
|
468
|
+
return row.map((bin)=>{
|
|
469
|
+
const zVal = calculateHistFunc(firstData.histfunc, bin);
|
|
470
|
+
total += zVal;
|
|
471
|
+
return zVal;
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
xBins.forEach((xBin, xIdx)=>{
|
|
475
|
+
yBins.forEach((yBin, yIdx)=>{
|
|
476
|
+
const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
|
|
477
|
+
heatmapDataPoints.push({
|
|
478
|
+
x: isXString ? xBin.join(', ') : getBinCenter(xBin),
|
|
479
|
+
y: isYString ? yBin.join(', ') : getBinCenter(yBin),
|
|
480
|
+
value: zVal,
|
|
481
|
+
rectText: zVal
|
|
482
|
+
});
|
|
483
|
+
if (typeof zVal === 'number') {
|
|
484
|
+
zMin = Math.min(zMin, zVal);
|
|
485
|
+
zMax = Math.max(zMax, zVal);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
} else {
|
|
490
|
+
var _firstData_x1;
|
|
491
|
+
(_firstData_x1 = firstData.x) === null || _firstData_x1 === void 0 ? void 0 : _firstData_x1.forEach((xVal, xIdx)=>{
|
|
492
|
+
var _firstData_y;
|
|
493
|
+
(_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y.forEach((yVal, yIdx)=>{
|
|
494
|
+
var _firstData_z_yIdx, _firstData_z, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
|
|
495
|
+
const zVal = (_firstData_z = firstData.z) === null || _firstData_z === void 0 ? void 0 : (_firstData_z_yIdx = _firstData_z[yIdx]) === null || _firstData_z_yIdx === void 0 ? void 0 : _firstData_z_yIdx[xIdx];
|
|
496
|
+
heatmapDataPoints.push({
|
|
497
|
+
x: ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_xaxis = _input_layout.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
|
|
498
|
+
y: ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_yaxis = _input_layout1.yaxis) === null || _input_layout_yaxis === void 0 ? void 0 : _input_layout_yaxis.type) === 'date' ? yVal : yVal,
|
|
499
|
+
value: zVal,
|
|
500
|
+
rectText: zVal
|
|
501
|
+
});
|
|
502
|
+
if (typeof zVal === 'number') {
|
|
503
|
+
zMin = Math.min(zMin, zVal);
|
|
504
|
+
zMax = Math.max(zMax, zVal);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
var _firstData_name;
|
|
510
|
+
const heatmapData = {
|
|
511
|
+
legend: (_firstData_name = firstData.name) !== null && _firstData_name !== void 0 ? _firstData_name : '',
|
|
512
|
+
data: heatmapDataPoints,
|
|
513
|
+
value: 0
|
|
514
|
+
};
|
|
515
|
+
// Initialize domain and range to default values
|
|
516
|
+
const defaultDomain = [
|
|
517
|
+
zMin,
|
|
518
|
+
(zMax + zMin) / 2,
|
|
519
|
+
zMax
|
|
520
|
+
];
|
|
521
|
+
const defaultRange = [
|
|
522
|
+
getColorFromToken(DataVizPalette.color1),
|
|
523
|
+
getColorFromToken(DataVizPalette.color2),
|
|
524
|
+
getColorFromToken(DataVizPalette.color3)
|
|
525
|
+
];
|
|
526
|
+
const domainValuesForColorScale = Array.isArray(firstData.colorscale) ? firstData.colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
|
|
527
|
+
const rangeValuesForColorScale = Array.isArray(firstData.colorscale) ? firstData.colorscale.map((arr)=>arr[1]) : defaultRange;
|
|
528
|
+
const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
|
|
529
|
+
var _input_layout_height;
|
|
530
|
+
return {
|
|
531
|
+
data: [
|
|
532
|
+
heatmapData
|
|
533
|
+
],
|
|
534
|
+
domainValuesForColorScale,
|
|
535
|
+
rangeValuesForColorScale,
|
|
536
|
+
hideLegend: true,
|
|
537
|
+
showYAxisLables: true,
|
|
538
|
+
chartTitle,
|
|
539
|
+
xAxisTitle,
|
|
540
|
+
yAxisTitle,
|
|
541
|
+
sortOrder: 'none',
|
|
542
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
543
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
544
|
+
hideTickOverlap: true
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
export const transformPlotlyJsonToSankeyProps = (input, colorMap, isDarkTheme)=>{
|
|
548
|
+
var _node_label, _input_layout, _input_layout1;
|
|
549
|
+
const { link, node } = input.data[0];
|
|
550
|
+
var _link_value;
|
|
551
|
+
const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>({
|
|
552
|
+
value: val,
|
|
553
|
+
source: link === null || link === void 0 ? void 0 : link.source[index],
|
|
554
|
+
target: link === null || link === void 0 ? void 0 : link.target[index]
|
|
555
|
+
}))// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
556
|
+
// Filter out negative nodes, unequal nodes and self-references (circular links)
|
|
557
|
+
.filter((x)=>x.source >= 0 && x.target >= 0 && x.source !== x.target);
|
|
558
|
+
const sankeyChartData = {
|
|
559
|
+
nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
|
|
560
|
+
const color = getColor(label, colorMap, isDarkTheme);
|
|
561
|
+
return {
|
|
562
|
+
nodeId: index,
|
|
563
|
+
name: label,
|
|
564
|
+
color
|
|
565
|
+
};
|
|
566
|
+
}),
|
|
567
|
+
links: validLinks.map((validLink, index)=>{
|
|
568
|
+
return {
|
|
569
|
+
...validLink
|
|
570
|
+
};
|
|
571
|
+
})
|
|
572
|
+
};
|
|
573
|
+
// const styles: SankeyChartProps['styles'] = {
|
|
574
|
+
// root: {
|
|
575
|
+
// ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
|
|
576
|
+
// },
|
|
577
|
+
// };
|
|
578
|
+
const { chartTitle } = getTitles(input.layout);
|
|
579
|
+
var _input_layout_height;
|
|
580
|
+
return {
|
|
581
|
+
data: {
|
|
582
|
+
chartTitle,
|
|
583
|
+
SankeyChartData: sankeyChartData
|
|
584
|
+
},
|
|
585
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
586
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468,
|
|
587
|
+
// TODO
|
|
588
|
+
// styles,
|
|
589
|
+
enableReflow: true
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
export const transformPlotlyJsonToGaugeProps = (input, colorMap, isDarkTheme)=>{
|
|
593
|
+
var _firstData_gauge_steps, _firstData_gauge, _firstData_gauge_axis_range, _firstData_gauge_axis, _firstData_gauge1, _firstData_gauge_axis_range1, _firstData_gauge_axis1, _firstData_gauge2, _firstData_delta, _firstData_gauge_axis_range2, _firstData_gauge_axis2, _firstData_gauge3, _firstData_gauge_axis_range3, _firstData_gauge_axis3, _firstData_gauge4, _firstData_gauge_axis_range4, _firstData_gauge_axis4, _firstData_gauge5, _firstData_gauge_axis_range5, _firstData_gauge_axis5, _firstData_gauge6, _firstData_gauge_steps1, _firstData_gauge7;
|
|
594
|
+
const firstData = input.data[0];
|
|
595
|
+
var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
|
|
596
|
+
const segments = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
|
|
597
|
+
var _step_range, _step_range1;
|
|
598
|
+
const legend = step.name || `Segment ${index + 1}`;
|
|
599
|
+
const color = getColor(legend, colorMap, isDarkTheme);
|
|
600
|
+
return {
|
|
601
|
+
legend,
|
|
602
|
+
size: ((_step_range = step.range) === null || _step_range === void 0 ? void 0 : _step_range[1]) - ((_step_range1 = step.range) === null || _step_range1 === void 0 ? void 0 : _step_range1[0]),
|
|
603
|
+
color
|
|
604
|
+
};
|
|
605
|
+
}) : [
|
|
606
|
+
{
|
|
607
|
+
legend: 'Current',
|
|
608
|
+
size: (_firstData_value = firstData.value) !== null && _firstData_value !== void 0 ? _firstData_value : 0 - ((_firstData_gauge_axis_range_ = (_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_axis = _firstData_gauge1.axis) === null || _firstData_gauge_axis === void 0 ? void 0 : (_firstData_gauge_axis_range = _firstData_gauge_axis.range) === null || _firstData_gauge_axis_range === void 0 ? void 0 : _firstData_gauge_axis_range[0]) !== null && _firstData_gauge_axis_range_ !== void 0 ? _firstData_gauge_axis_range_ : 0),
|
|
609
|
+
color: getColor('Current', colorMap, isDarkTheme)
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
legend: 'Target',
|
|
613
|
+
size: ((_firstData_gauge_axis_range_1 = (_firstData_gauge2 = firstData.gauge) === null || _firstData_gauge2 === void 0 ? void 0 : (_firstData_gauge_axis1 = _firstData_gauge2.axis) === null || _firstData_gauge_axis1 === void 0 ? void 0 : (_firstData_gauge_axis_range1 = _firstData_gauge_axis1.range) === null || _firstData_gauge_axis_range1 === void 0 ? void 0 : _firstData_gauge_axis_range1[1]) !== null && _firstData_gauge_axis_range_1 !== void 0 ? _firstData_gauge_axis_range_1 : 100) - ((_firstData_value1 = firstData.value) !== null && _firstData_value1 !== void 0 ? _firstData_value1 : 0),
|
|
614
|
+
color: DataVizPalette.disabled
|
|
615
|
+
}
|
|
616
|
+
];
|
|
617
|
+
let sublabel;
|
|
618
|
+
// let sublabelColor: string | undefined;
|
|
619
|
+
if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
|
|
620
|
+
const diff = firstData.value - firstData.delta.reference;
|
|
621
|
+
if (diff >= 0) {
|
|
622
|
+
sublabel = `\u25B2 ${diff}`;
|
|
623
|
+
// const color = getColorFromToken(DataVizPalette.success, isDarkTheme);
|
|
624
|
+
// sublabelColor = color;
|
|
625
|
+
} else {
|
|
626
|
+
sublabel = `\u25BC ${Math.abs(diff)}`;
|
|
627
|
+
// const color = getColorFromToken(DataVizPalette.error, isDarkTheme);
|
|
628
|
+
// sublabelColor = color;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
// const styles: GaugeChartProps['styles'] = {
|
|
632
|
+
// sublabel: {
|
|
633
|
+
// fill: sublabelColor,
|
|
634
|
+
// },
|
|
635
|
+
// };
|
|
636
|
+
const { chartTitle } = getTitles(input.layout);
|
|
637
|
+
var _firstData_value2;
|
|
638
|
+
return {
|
|
639
|
+
segments,
|
|
640
|
+
chartValue: (_firstData_value2 = firstData.value) !== null && _firstData_value2 !== void 0 ? _firstData_value2 : 0,
|
|
641
|
+
chartTitle,
|
|
642
|
+
sublabel,
|
|
643
|
+
// range values can be null
|
|
644
|
+
minValue: typeof ((_firstData_gauge3 = firstData.gauge) === null || _firstData_gauge3 === void 0 ? void 0 : (_firstData_gauge_axis2 = _firstData_gauge3.axis) === null || _firstData_gauge_axis2 === void 0 ? void 0 : (_firstData_gauge_axis_range2 = _firstData_gauge_axis2.range) === null || _firstData_gauge_axis_range2 === void 0 ? void 0 : _firstData_gauge_axis_range2[0]) === 'number' ? (_firstData_gauge4 = firstData.gauge) === null || _firstData_gauge4 === void 0 ? void 0 : (_firstData_gauge_axis3 = _firstData_gauge4.axis) === null || _firstData_gauge_axis3 === void 0 ? void 0 : (_firstData_gauge_axis_range3 = _firstData_gauge_axis3.range) === null || _firstData_gauge_axis_range3 === void 0 ? void 0 : _firstData_gauge_axis_range3[0] : undefined,
|
|
645
|
+
maxValue: typeof ((_firstData_gauge5 = firstData.gauge) === null || _firstData_gauge5 === void 0 ? void 0 : (_firstData_gauge_axis4 = _firstData_gauge5.axis) === null || _firstData_gauge_axis4 === void 0 ? void 0 : (_firstData_gauge_axis_range4 = _firstData_gauge_axis4.range) === null || _firstData_gauge_axis_range4 === void 0 ? void 0 : _firstData_gauge_axis_range4[1]) === 'number' ? (_firstData_gauge6 = firstData.gauge) === null || _firstData_gauge6 === void 0 ? void 0 : (_firstData_gauge_axis5 = _firstData_gauge6.axis) === null || _firstData_gauge_axis5 === void 0 ? void 0 : (_firstData_gauge_axis_range5 = _firstData_gauge_axis5.range) === null || _firstData_gauge_axis_range5 === void 0 ? void 0 : _firstData_gauge_axis_range5[1] : undefined,
|
|
646
|
+
chartValueFormat: ()=>{
|
|
647
|
+
var _firstData_value;
|
|
648
|
+
var _firstData_value_toString;
|
|
649
|
+
return (_firstData_value_toString = (_firstData_value = firstData.value) === null || _firstData_value === void 0 ? void 0 : _firstData_value.toString()) !== null && _firstData_value_toString !== void 0 ? _firstData_value_toString : '';
|
|
650
|
+
},
|
|
651
|
+
// FIXME
|
|
652
|
+
// width: input.layout?.width,
|
|
653
|
+
// height: input.layout?.height ?? 220,
|
|
654
|
+
// TODO
|
|
655
|
+
// styles,
|
|
656
|
+
variant: ((_firstData_gauge7 = firstData.gauge) === null || _firstData_gauge7 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge7.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment'
|
|
657
|
+
};
|
|
658
|
+
};
|
|
659
|
+
function isPlainObject(obj) {
|
|
660
|
+
return Object.prototype.toString.call(obj) === '[object Object]' && Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty');
|
|
661
|
+
}
|
|
662
|
+
var arrayAttributes = [];
|
|
663
|
+
var stack = [];
|
|
664
|
+
var isArrayStack = [];
|
|
665
|
+
var baseContainer, baseAttrName;
|
|
666
|
+
/**
|
|
667
|
+
* Interate iteratively through the trace object and find all the array attributes.
|
|
668
|
+
* 1 trace record = 1 series of data
|
|
669
|
+
* @param trace
|
|
670
|
+
*/ export function findArrayAttributes(trace) {
|
|
671
|
+
// Init basecontainer and baseAttrName
|
|
672
|
+
crawlIntoTrace(baseContainer, 0, '');
|
|
673
|
+
}
|
|
674
|
+
function crawlIntoTrace(container, i, astrPartial) {
|
|
675
|
+
var item = container[stack[i]];
|
|
676
|
+
var newAstrPartial = astrPartial + stack[i];
|
|
677
|
+
if (i === stack.length - 1) {
|
|
678
|
+
if (isArrayOrTypedArray(item)) {
|
|
679
|
+
arrayAttributes.push(baseAttrName + newAstrPartial);
|
|
680
|
+
}
|
|
681
|
+
} else {
|
|
682
|
+
if (isArrayStack[i]) {
|
|
683
|
+
if (Array.isArray(item)) {
|
|
684
|
+
for(var j = 0; j < item.length; j++){
|
|
685
|
+
if (isPlainObject(item[j])) {
|
|
686
|
+
crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
} else if (isPlainObject(item)) {
|
|
691
|
+
crawlIntoTrace(item, i + 1, newAstrPartial + '.');
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function getLineOptions(line) {
|
|
696
|
+
if (!line) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
let lineOptions = {};
|
|
700
|
+
if (line.dash) {
|
|
701
|
+
lineOptions = {
|
|
702
|
+
...lineOptions,
|
|
703
|
+
...dashOptions[line.dash]
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
switch(line.shape){
|
|
707
|
+
case 'spline':
|
|
708
|
+
const smoothing = typeof line.smoothing === 'number' ? line.smoothing : 1;
|
|
709
|
+
lineOptions.curve = d3CurveCardinal.tension(1 - smoothing / 1.3);
|
|
710
|
+
break;
|
|
711
|
+
case 'hv':
|
|
712
|
+
lineOptions.curve = 'stepAfter';
|
|
713
|
+
break;
|
|
714
|
+
case 'vh':
|
|
715
|
+
lineOptions.curve = 'stepBefore';
|
|
716
|
+
break;
|
|
717
|
+
case 'hvh':
|
|
718
|
+
lineOptions.curve = 'step';
|
|
719
|
+
break;
|
|
720
|
+
default:
|
|
721
|
+
lineOptions.curve = 'linear';
|
|
722
|
+
}
|
|
723
|
+
return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
|
|
724
|
+
}
|
|
725
|
+
const isStringArray = (arr)=>{
|
|
726
|
+
return isArrayOfType(arr, (value)=>typeof value === 'string');
|
|
727
|
+
};
|
|
728
|
+
// TODO: Use binary search to find the appropriate bin for numeric value.
|
|
729
|
+
const findBinIndex = (bins, value, isString)=>{
|
|
730
|
+
if (typeof value === 'undefined' || value === null) {
|
|
731
|
+
return -1;
|
|
732
|
+
}
|
|
733
|
+
return isString ? bins.findIndex((bin)=>bin.includes(value)) : bins.findIndex((bin)=>value >= bin.x0 && value < bin.x1);
|
|
734
|
+
};
|
|
735
|
+
const getBinSize = (bin)=>{
|
|
736
|
+
return bin.x1 - bin.x0;
|
|
737
|
+
};
|
|
738
|
+
const getBinCenter = (bin)=>{
|
|
739
|
+
return (bin.x1 + bin.x0) / 2;
|
|
740
|
+
};
|
|
741
|
+
// TODO: Add support for date axes
|
|
742
|
+
const createBins = (data, binStart, binEnd, binSize)=>{
|
|
743
|
+
if (!data || data.length === 0) {
|
|
744
|
+
return [];
|
|
745
|
+
}
|
|
746
|
+
if (isStringArray(data)) {
|
|
747
|
+
const categories = Array.from(new Set(data));
|
|
748
|
+
const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
|
|
749
|
+
const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;
|
|
750
|
+
const step = typeof binSize === 'number' ? binSize : 1;
|
|
751
|
+
return d3Range(start, stop, step).map((i)=>categories.slice(i, i + step));
|
|
752
|
+
}
|
|
753
|
+
const scale = d3ScaleLinear().domain(d3Extent(data)).nice();
|
|
754
|
+
let [minVal, maxVal] = scale.domain();
|
|
755
|
+
minVal = typeof binStart === 'number' ? binStart : minVal;
|
|
756
|
+
maxVal = typeof binEnd === 'number' ? binEnd : maxVal;
|
|
757
|
+
const binGenerator = d3Bin().domain([
|
|
758
|
+
minVal,
|
|
759
|
+
maxVal
|
|
760
|
+
]);
|
|
761
|
+
if (typeof binSize === 'number') {
|
|
762
|
+
var _binSize_toString_split_;
|
|
763
|
+
const thresholds = [];
|
|
764
|
+
let th = minVal;
|
|
765
|
+
var _binSize_toString_split__length;
|
|
766
|
+
const tolerance = 1 / Math.pow(10, (_binSize_toString_split__length = (_binSize_toString_split_ = binSize.toString().split('.')[1]) === null || _binSize_toString_split_ === void 0 ? void 0 : _binSize_toString_split_.length) !== null && _binSize_toString_split__length !== void 0 ? _binSize_toString_split__length : 0);
|
|
767
|
+
while(maxVal + binSize - th > tolerance){
|
|
768
|
+
thresholds.push(th);
|
|
769
|
+
th += binSize;
|
|
770
|
+
}
|
|
771
|
+
minVal = thresholds[0];
|
|
772
|
+
maxVal = thresholds[thresholds.length - 1];
|
|
773
|
+
binGenerator.domain([
|
|
774
|
+
minVal,
|
|
775
|
+
maxVal
|
|
776
|
+
]).thresholds(thresholds);
|
|
777
|
+
}
|
|
778
|
+
// NOTE: The last bin generated by d3Bin often has identical x0 and x1 values (both inclusive) and
|
|
779
|
+
// can be ignored if the highest value is already included in the previous bin.
|
|
780
|
+
return binGenerator(data);
|
|
781
|
+
};
|
|
782
|
+
const calculateHistFunc = (histfunc, bin)=>{
|
|
783
|
+
switch(histfunc){
|
|
784
|
+
case 'sum':
|
|
785
|
+
return d3Sum(bin);
|
|
786
|
+
case 'avg':
|
|
787
|
+
return bin.length === 0 ? 0 : d3Sum(bin) / bin.length;
|
|
788
|
+
case 'min':
|
|
789
|
+
var _d3Min;
|
|
790
|
+
return (_d3Min = d3Min(bin)) !== null && _d3Min !== void 0 ? _d3Min : 0;
|
|
791
|
+
case 'max':
|
|
792
|
+
var _d3Max;
|
|
793
|
+
return (_d3Max = d3Max(bin)) !== null && _d3Max !== void 0 ? _d3Max : 0;
|
|
794
|
+
default:
|
|
795
|
+
return bin.length;
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
const calculateHistNorm = (histnorm, value, total, dx, dy = 1)=>{
|
|
799
|
+
switch(histnorm){
|
|
800
|
+
case 'percent':
|
|
801
|
+
return total === 0 ? 0 : value / total * 100;
|
|
802
|
+
case 'probability':
|
|
803
|
+
return total === 0 ? 0 : value / total;
|
|
804
|
+
case 'density':
|
|
805
|
+
return dx * dy === 0 ? 0 : value / (dx * dy);
|
|
806
|
+
case 'probability density':
|
|
807
|
+
return total * dx * dy === 0 ? 0 : value / (total * dx * dy);
|
|
808
|
+
default:
|
|
809
|
+
return value;
|
|
810
|
+
}
|
|
811
|
+
};
|