@fluentui/react-charts 9.2.3 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -10
- package/dist/index.d.ts +98 -5
- package/lib/components/AreaChart/AreaChart.js +8 -6
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +4 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +4 -15
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +95 -8
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +5 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +3 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +45 -42
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +14 -5
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +19 -14
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -33
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +5 -3
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +3 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +56 -16
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +19 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1096 -337
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/imageExporter.js +1 -0
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +8 -8
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +9 -2
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -1
- package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +61 -25
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +1 -0
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js +2 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js +1 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +23 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +9 -4
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +11 -5
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +2 -0
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +1 -0
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +1 -0
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +2 -2
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +2 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +1 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -9
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +6 -17
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +5 -21
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +2 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +1 -0
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +3 -3
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +8 -2
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +1 -0
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/Legends.js +1 -0
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js +1 -0
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/Legends/shape.js +1 -0
- package/lib/components/Legends/shape.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.js +2 -0
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.raw.js +1 -0
- package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +284 -281
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +1 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js +1 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +25 -10
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +5 -21
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +2 -0
- package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -1
- package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +1 -0
- package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +1 -1
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js +1 -0
- package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1 -0
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +14 -25
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +3 -12
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +121 -81
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +13 -7
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +5 -22
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.js +1 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/Sparkline/useSparklineStyles.styles.js +2 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
- package/lib/components/Sparkline/useSparklineStyles.styles.raw.js +1 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +17 -12
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +10 -6
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +6 -19
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +30 -25
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +9 -6
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +5 -19
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/types/DataPoint.js +3 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +47 -0
- package/lib/utilities/Common.styles.js.map +1 -0
- package/lib/utilities/Common.styles.raw.js +47 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -0
- package/lib/utilities/FocusableTooltipText.js +1 -0
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +1 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/image-export-utils.js +1 -0
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.js +52 -0
- package/lib/utilities/scatterpolar-utils.js.map +1 -0
- package/lib/utilities/utilities.js +314 -146
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +7 -5
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +1 -0
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -14
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +95 -8
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +4 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +3 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +45 -42
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +14 -5
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +16 -13
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +5 -32
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +4 -3
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +3 -2
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +60 -20
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +22 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1109 -338
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +1 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -8
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +11 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -1
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +61 -25
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +2 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +1 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +33 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +9 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +11 -5
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +1 -0
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +2 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -9
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +3 -19
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -20
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +3 -3
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +10 -2
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +1 -0
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js +1 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Legends/shape.js +1 -0
- package/lib-commonjs/components/Legends/shape.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +1 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +282 -279
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +31 -9
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -20
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +1 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +2 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +24 -33
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +118 -78
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +14 -7
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -20
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.js +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +1 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js +1 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +16 -11
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +6 -3
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +4 -17
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -24
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +6 -3
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -18
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +3 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +71 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js +2 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +1 -0
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.js +67 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +327 -137
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { axisRight as d3AxisRight, axisBottom as d3AxisBottom, axisLeft as d3AxisLeft } from 'd3-axis';
|
|
2
3
|
import { max as d3Max, min as d3Min, ticks as d3Ticks, nice as d3nice, sum as d3Sum, mean as d3Mean, median as d3Median } from 'd3-array';
|
|
3
|
-
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime } from 'd3-scale';
|
|
4
|
+
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime, scaleLog as d3ScaleLog } from 'd3-scale';
|
|
4
5
|
import { select as d3Select, selectAll as d3SelectAll } from 'd3-selection';
|
|
5
6
|
import { format as d3Format } from 'd3-format';
|
|
6
7
|
import { timeFormat as d3TimeFormat, timeFormatLocale as d3TimeFormatLocale, utcFormat as d3UtcFormat } from 'd3-time-format';
|
|
@@ -8,9 +9,10 @@ import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3T
|
|
|
8
9
|
import { curveLinear as d3CurveLinear, curveNatural as d3CurveNatural, curveStep as d3CurveStep, curveStepAfter as d3CurveStepAfter, curveStepBefore as d3CurveStepBefore } from 'd3-shape';
|
|
9
10
|
import { formatPrefix as d3FormatPrefix } from 'd3-format';
|
|
10
11
|
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
|
11
|
-
import { formatDateToLocaleString, formatToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';
|
|
12
|
+
import { formatDateToLocaleString, formatToLocaleString, getMultiLevelDateTimeFormatOptions, isInvalidValue, isNumber } from '@fluentui/chart-utilities';
|
|
12
13
|
export const MIN_DOMAIN_MARGIN = 8;
|
|
13
14
|
export const MIN_DONUT_RADIUS = 1;
|
|
15
|
+
export const DEFAULT_DATE_STRING = '2000-01-01';
|
|
14
16
|
export var ChartTypes = /*#__PURE__*/ function(ChartTypes) {
|
|
15
17
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
16
18
|
ChartTypes[ChartTypes["LineChart"] = 1] = "LineChart";
|
|
@@ -63,9 +65,9 @@ function yAxisTickFormatterInternal(value, limitWidth = false) {
|
|
|
63
65
|
* Create Numeric X axis
|
|
64
66
|
* @export
|
|
65
67
|
* @param {IXAxisParams} xAxisParams
|
|
66
|
-
*/ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
67
|
-
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
|
|
68
|
-
const xAxisScale =
|
|
68
|
+
*/ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType, _useRtl) {
|
|
69
|
+
const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0 } = xAxisParams;
|
|
70
|
+
const xAxisScale = createNumericScale(scaleType).domain([
|
|
69
71
|
domainNRangeValues.dStartValue,
|
|
70
72
|
domainNRangeValues.dEndValue
|
|
71
73
|
]).range([
|
|
@@ -74,33 +76,38 @@ function yAxisTickFormatterInternal(value, limitWidth = false) {
|
|
|
74
76
|
]);
|
|
75
77
|
showRoundOffXTickValues && xAxisScale.nice();
|
|
76
78
|
let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
77
|
-
const tickFormat = (domainValue, _index)=>{
|
|
79
|
+
const tickFormat = (domainValue, _index, defaultFormat)=>{
|
|
78
80
|
if (tickParams.tickFormat) {
|
|
79
81
|
return d3Format(tickParams.tickFormat)(domainValue);
|
|
80
82
|
}
|
|
81
83
|
const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
82
|
-
return formatToLocaleString(xAxisValue, culture);
|
|
84
|
+
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : formatToLocaleString(xAxisValue, culture);
|
|
83
85
|
};
|
|
84
86
|
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
85
|
-
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 20;
|
|
87
|
+
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map((v, i)=>tickFormat(v, i))) + 20;
|
|
86
88
|
const [start, end] = xAxisScale.range();
|
|
87
89
|
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
88
90
|
}
|
|
89
|
-
const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
91
|
+
const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat((v, i)=>tickFormat(v, i, xAxisScale.tickFormat(tickCount)));
|
|
90
92
|
if ([
|
|
91
93
|
6,
|
|
92
94
|
8
|
|
93
95
|
].includes(chartType)) {
|
|
94
96
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
95
97
|
}
|
|
98
|
+
let customTickValues;
|
|
96
99
|
if (tickParams.tickValues) {
|
|
97
|
-
|
|
100
|
+
customTickValues = tickParams.tickValues;
|
|
101
|
+
} else if (tickStep) {
|
|
102
|
+
customTickValues = generateNumericTicks(scaleType, tickStep, tick0, xAxisScale.domain());
|
|
103
|
+
}
|
|
104
|
+
if (customTickValues) {
|
|
105
|
+
xAxis.tickValues(customTickValues);
|
|
98
106
|
}
|
|
99
107
|
if (xAxisElement) {
|
|
100
|
-
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
108
|
+
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate');
|
|
101
109
|
}
|
|
102
|
-
|
|
103
|
-
const tickValues = ((_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
110
|
+
const tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
104
111
|
return {
|
|
105
112
|
xScale: xAxisScale,
|
|
106
113
|
tickValues
|
|
@@ -296,7 +303,7 @@ export function getDateFormatLevel(date, useUTC) {
|
|
|
296
303
|
* @param {IXAxisParams} xAxisParams
|
|
297
304
|
* @param {ITickParams} tickParams
|
|
298
305
|
*/ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
299
|
-
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth } = xAxisParams;
|
|
306
|
+
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth, tickStep, tick0 } = xAxisParams;
|
|
300
307
|
const isUtcSet = useUTC === true || useUTC === 'utc';
|
|
301
308
|
const xAxisScale = isUtcSet ? d3ScaleUtc() : d3ScaleTime();
|
|
302
309
|
xAxisScale.domain([
|
|
@@ -347,12 +354,19 @@ export function getDateFormatLevel(date, useUTC) {
|
|
|
347
354
|
].includes(chartType)) {
|
|
348
355
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
349
356
|
}
|
|
350
|
-
|
|
357
|
+
let customTickValues;
|
|
358
|
+
if (tickParams.tickValues) {
|
|
359
|
+
customTickValues = tickParams.tickValues;
|
|
360
|
+
} else if (tickStep) {
|
|
361
|
+
customTickValues = generateDateTicks(tickStep, tick0, xAxisScale.domain(), useUTC);
|
|
362
|
+
}
|
|
363
|
+
if (customTickValues) {
|
|
364
|
+
xAxis.tickValues(customTickValues);
|
|
365
|
+
}
|
|
351
366
|
if (xAxisElement) {
|
|
352
367
|
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
353
368
|
}
|
|
354
|
-
|
|
355
|
-
const tickValues = ((_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
369
|
+
const tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
356
370
|
return {
|
|
357
371
|
xScale: xAxisScale,
|
|
358
372
|
tickValues
|
|
@@ -366,7 +380,7 @@ export function getDateFormatLevel(date, useUTC) {
|
|
|
366
380
|
* @param {ITickParams} tickParams
|
|
367
381
|
* @param {string[]} dataset
|
|
368
382
|
* @returns
|
|
369
|
-
*/ export function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
383
|
+
*/ export function createStringXAxis(xAxisParams, tickParams, dataset, culture, _useRtl) {
|
|
370
384
|
const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
|
|
371
385
|
const xAxisScale = d3ScaleBand().domain(dataset).range([
|
|
372
386
|
domainNRangeValues.rStartValue,
|
|
@@ -405,7 +419,7 @@ export function getDateFormatLevel(date, useUTC) {
|
|
|
405
419
|
}
|
|
406
420
|
const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).tickValues(tickValues).tickFormat(tickFormat);
|
|
407
421
|
if (xAxisParams.xAxisElement) {
|
|
408
|
-
d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
422
|
+
d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate');
|
|
409
423
|
}
|
|
410
424
|
return {
|
|
411
425
|
xScale: xAxisScale,
|
|
@@ -484,7 +498,7 @@ export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
484
498
|
const { yMinMaxValues = {
|
|
485
499
|
startValue: 0,
|
|
486
500
|
endValue: 0
|
|
487
|
-
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4 } = yAxisParams;
|
|
501
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, tickValues, tickStep, tick0 } = yAxisParams;
|
|
488
502
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
489
503
|
const tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
490
504
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -499,14 +513,23 @@ export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
499
513
|
const axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
|
|
500
514
|
const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
501
515
|
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
|
|
516
|
+
let customTickValues;
|
|
517
|
+
if (tickValues) {
|
|
518
|
+
customTickValues = tickValues;
|
|
519
|
+
} else if (tickStep) {
|
|
520
|
+
customTickValues = generateNumericTicks(undefined, tickStep, tick0, yAxisScale.domain());
|
|
521
|
+
}
|
|
522
|
+
if (customTickValues) {
|
|
523
|
+
yAxis.tickValues(customTickValues);
|
|
524
|
+
}
|
|
502
525
|
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
503
526
|
return yAxisScale;
|
|
504
527
|
}
|
|
505
|
-
export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
|
|
528
|
+
export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false, scaleType, _useRtl) {
|
|
506
529
|
const { yMinMaxValues = {
|
|
507
530
|
startValue: 0,
|
|
508
531
|
endValue: 0
|
|
509
|
-
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight } = yAxisParams;
|
|
532
|
+
}, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight, tickValues, tickStep, tick0 } = yAxisParams;
|
|
510
533
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
511
534
|
const tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
512
535
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -519,18 +542,53 @@ export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
519
542
|
yMin = yMin - yPadding;
|
|
520
543
|
yMax = yMax + yPadding;
|
|
521
544
|
}
|
|
522
|
-
|
|
545
|
+
let scaleDomain = [
|
|
523
546
|
domainValues[0],
|
|
524
|
-
|
|
525
|
-
]
|
|
547
|
+
domainValues[domainValues.length - 1]
|
|
548
|
+
];
|
|
549
|
+
if (scaleType === 'log') {
|
|
550
|
+
let domainStart = yMinMaxValues.startValue;
|
|
551
|
+
let domainEnd = yMinMaxValues.endValue;
|
|
552
|
+
if (yMinValue > 0) {
|
|
553
|
+
domainStart = Math.min(domainStart, yMinValue);
|
|
554
|
+
}
|
|
555
|
+
if (yMaxValue > 0) {
|
|
556
|
+
domainEnd = Math.max(domainEnd, yMaxValue);
|
|
557
|
+
}
|
|
558
|
+
scaleDomain = [
|
|
559
|
+
domainStart,
|
|
560
|
+
domainEnd
|
|
561
|
+
];
|
|
562
|
+
}
|
|
563
|
+
const yAxisScale = createNumericScale(scaleType).domain(scaleDomain).range([
|
|
526
564
|
containerHeight - margins.bottom,
|
|
527
565
|
margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
|
|
528
566
|
]);
|
|
529
567
|
const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
|
|
530
|
-
const yAxis = axis.tickPadding(tickPadding).
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
568
|
+
const yAxis = axis.tickPadding(tickPadding).tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
569
|
+
let customTickValues;
|
|
570
|
+
if (tickValues) {
|
|
571
|
+
customTickValues = tickValues;
|
|
572
|
+
} else if (tickStep) {
|
|
573
|
+
customTickValues = generateNumericTicks(scaleType, tickStep, tick0, yAxisScale.domain());
|
|
574
|
+
}
|
|
575
|
+
if (customTickValues) {
|
|
576
|
+
yAxis.tickValues(customTickValues);
|
|
577
|
+
axisData.yAxisDomainValues = customTickValues;
|
|
578
|
+
} else {
|
|
579
|
+
if (scaleType === 'log') {
|
|
580
|
+
axisData.yAxisDomainValues = yAxisScale.ticks();
|
|
581
|
+
} else {
|
|
582
|
+
yAxis.tickValues(domainValues);
|
|
583
|
+
axisData.yAxisDomainValues = domainValues;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
const tickFormat = (domainValue, index, defaultFormat)=>{
|
|
587
|
+
const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
588
|
+
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
|
|
589
|
+
};
|
|
590
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((v, i)=>tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)));
|
|
591
|
+
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate').style('text-anchor', !useSecondaryYScale && (_useRtl ? 'start' : 'end')) : '';
|
|
534
592
|
return yAxisScale;
|
|
535
593
|
}
|
|
536
594
|
/**
|
|
@@ -806,7 +864,7 @@ export function tooltipOfAxislabels(axistooltipProps) {
|
|
|
806
864
|
return null;
|
|
807
865
|
}
|
|
808
866
|
const div = d3Select('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
|
|
809
|
-
const aa = axis.selectAll('
|
|
867
|
+
const aa = axis.selectAll('[id^="BaseSpan-"]')._groups[0];
|
|
810
868
|
const baseSpanLength = aa && Object.keys(aa).length;
|
|
811
869
|
const originalDataArray = [];
|
|
812
870
|
for(let i = 0; i < baseSpanLength; i++){
|
|
@@ -850,59 +908,24 @@ export function tooltipOfAxislabels(axistooltipProps) {
|
|
|
850
908
|
* @param {number} width
|
|
851
909
|
* @param {boolean} isRTL
|
|
852
910
|
* @returns {IDomainNRange}
|
|
853
|
-
*/ export function
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
});
|
|
862
|
-
const rStartValue = margins.left;
|
|
863
|
-
const rEndValue = width - margins.right;
|
|
864
|
-
return isRTL ? {
|
|
865
|
-
dStartValue: xMax,
|
|
866
|
-
dEndValue: xMin,
|
|
867
|
-
rStartValue,
|
|
868
|
-
rEndValue
|
|
869
|
-
} : {
|
|
870
|
-
dStartValue: xMin,
|
|
871
|
-
dEndValue: xMax,
|
|
872
|
-
rStartValue,
|
|
873
|
-
rEndValue
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Calculates Domain and range values for Numeric X axis for scatter chart.
|
|
878
|
-
* @export
|
|
879
|
-
* @param {LineChartPoints[]} points
|
|
880
|
-
* @param {IMargins} margins
|
|
881
|
-
* @param {number} width
|
|
882
|
-
* @param {boolean} isRTL
|
|
883
|
-
* @returns {IDomainNRange}
|
|
884
|
-
*/ export function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
885
|
-
let xMin = d3Min(points, (point)=>{
|
|
886
|
-
return d3Min(point.data, (item)=>item.x);
|
|
887
|
-
});
|
|
888
|
-
let xMax = d3Max(points, (point)=>{
|
|
889
|
-
return d3Max(point.data, (item)=>{
|
|
890
|
-
return item.x;
|
|
891
|
-
});
|
|
892
|
-
});
|
|
893
|
-
const xPadding = (xMax - xMin) * 0.1;
|
|
894
|
-
xMin = xMin - xPadding;
|
|
895
|
-
xMax = xMax + xPadding;
|
|
911
|
+
*/ export function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode) {
|
|
912
|
+
const isScatterPolar = isScatterPolarSeries(points);
|
|
913
|
+
let [xMin, xMax] = getScatterXDomainExtent(points, scaleType);
|
|
914
|
+
if (hasMarkersMode) {
|
|
915
|
+
const xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType);
|
|
916
|
+
xMin = xMin - xPadding.start;
|
|
917
|
+
xMax = xMax + xPadding.end;
|
|
918
|
+
}
|
|
896
919
|
const rStartValue = margins.left;
|
|
897
920
|
const rEndValue = width - margins.right;
|
|
898
921
|
return isRTL ? {
|
|
899
|
-
dStartValue: xMax,
|
|
900
|
-
dEndValue: xMin,
|
|
922
|
+
dStartValue: isScatterPolar ? 1 : xMax,
|
|
923
|
+
dEndValue: isScatterPolar ? -1 : xMin,
|
|
901
924
|
rStartValue,
|
|
902
925
|
rEndValue
|
|
903
926
|
} : {
|
|
904
|
-
dStartValue: xMin,
|
|
905
|
-
dEndValue: xMax,
|
|
927
|
+
dStartValue: isScatterPolar ? -1 : xMin,
|
|
928
|
+
dEndValue: isScatterPolar ? 1 : xMax,
|
|
906
929
|
rStartValue,
|
|
907
930
|
rEndValue
|
|
908
931
|
};
|
|
@@ -1030,22 +1053,15 @@ export function tooltipOfAxislabels(axistooltipProps) {
|
|
|
1030
1053
|
* @param {boolean} isRTL
|
|
1031
1054
|
* @param {Date[] | number[]} tickValues
|
|
1032
1055
|
* @returns {IDomainNRange}
|
|
1033
|
-
*/ export function
|
|
1056
|
+
*/ export function domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues = [], chartType, barWidth, hasMarkersMode) {
|
|
1034
1057
|
let sDate;
|
|
1035
1058
|
let lDate;
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
});
|
|
1043
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1044
|
-
lDate = d3Max(points, (point)=>{
|
|
1045
|
-
return d3Max(point.data, (item)=>{
|
|
1046
|
-
return item.x;
|
|
1047
|
-
});
|
|
1048
|
-
});
|
|
1059
|
+
if ([
|
|
1060
|
+
0,
|
|
1061
|
+
1,
|
|
1062
|
+
7
|
|
1063
|
+
].includes(chartType)) {
|
|
1064
|
+
[sDate, lDate] = getScatterXDomainExtent(points);
|
|
1049
1065
|
// Need to draw graph with given small and large date
|
|
1050
1066
|
// (Which Involves customization of date axis tick values)
|
|
1051
1067
|
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
@@ -1058,6 +1074,11 @@ export function tooltipOfAxislabels(axistooltipProps) {
|
|
|
1058
1074
|
...tickValues,
|
|
1059
1075
|
lDate
|
|
1060
1076
|
]);
|
|
1077
|
+
if (hasMarkersMode || chartType === 7) {
|
|
1078
|
+
const xPadding = getDomainPaddingForMarkers(sDate.getTime(), lDate.getTime());
|
|
1079
|
+
sDate = new Date(sDate.getTime() - xPadding.start);
|
|
1080
|
+
lDate = new Date(lDate.getTime() + xPadding.end);
|
|
1081
|
+
}
|
|
1061
1082
|
} else {
|
|
1062
1083
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1063
1084
|
sDate = d3Min(points, (point)=>point.x);
|
|
@@ -1078,59 +1099,6 @@ export function tooltipOfAxislabels(axistooltipProps) {
|
|
|
1078
1099
|
rEndValue
|
|
1079
1100
|
};
|
|
1080
1101
|
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Calculates Domain and range values for Date X axis for scatter chart.
|
|
1083
|
-
* @export
|
|
1084
|
-
* @param {LineChartPoints[]} points
|
|
1085
|
-
* @param {IMargins} margins
|
|
1086
|
-
* @param {number} width
|
|
1087
|
-
* @param {boolean} isRTL
|
|
1088
|
-
* @param {Date[] | number[]} tickValues
|
|
1089
|
-
* @returns {IDomainNRange}
|
|
1090
|
-
*/ export function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues = []) {
|
|
1091
|
-
let sDate;
|
|
1092
|
-
let lDate;
|
|
1093
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1094
|
-
sDate = d3Min(points, (point)=>{
|
|
1095
|
-
return d3Min(point.data, (item)=>{
|
|
1096
|
-
return item.x;
|
|
1097
|
-
});
|
|
1098
|
-
});
|
|
1099
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1100
|
-
lDate = d3Max(points, (point)=>{
|
|
1101
|
-
return d3Max(point.data, (item)=>{
|
|
1102
|
-
return item.x;
|
|
1103
|
-
});
|
|
1104
|
-
});
|
|
1105
|
-
const xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
1106
|
-
sDate = new Date(sDate.getTime() - xPadding);
|
|
1107
|
-
lDate = new Date(lDate.getTime() + xPadding);
|
|
1108
|
-
// Need to draw graph with given small and large date
|
|
1109
|
-
// (Which Involves customization of date axis tick values)
|
|
1110
|
-
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
1111
|
-
// So, Finding smallest and largest dates
|
|
1112
|
-
sDate = d3Min([
|
|
1113
|
-
...tickValues,
|
|
1114
|
-
sDate
|
|
1115
|
-
]);
|
|
1116
|
-
lDate = d3Max([
|
|
1117
|
-
...tickValues,
|
|
1118
|
-
lDate
|
|
1119
|
-
]);
|
|
1120
|
-
const rStartValue = margins.left;
|
|
1121
|
-
const rEndValue = width - margins.right;
|
|
1122
|
-
return isRTL ? {
|
|
1123
|
-
dStartValue: lDate,
|
|
1124
|
-
dEndValue: sDate,
|
|
1125
|
-
rStartValue,
|
|
1126
|
-
rEndValue
|
|
1127
|
-
} : {
|
|
1128
|
-
dStartValue: sDate,
|
|
1129
|
-
dEndValue: lDate,
|
|
1130
|
-
rStartValue,
|
|
1131
|
-
rEndValue
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
1102
|
/**
|
|
1135
1103
|
* Calculate domain and range values to the Vertical bar chart - For Numeric axis
|
|
1136
1104
|
* @export
|
|
@@ -1162,12 +1130,14 @@ export function tooltipOfAxislabels(axistooltipProps) {
|
|
|
1162
1130
|
* @export
|
|
1163
1131
|
* @param {LineChartPoints[]} points
|
|
1164
1132
|
* @returns {{ startValue: number; endValue: number }}
|
|
1165
|
-
*/ export function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
|
|
1133
|
+
*/ export function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale, scaleType) {
|
|
1166
1134
|
const values = [];
|
|
1167
1135
|
points.forEach((point)=>{
|
|
1168
1136
|
if (!useSecondaryYScale === !point.useSecondaryYScale) {
|
|
1169
1137
|
point.data.forEach((data)=>{
|
|
1170
|
-
|
|
1138
|
+
if (isValidDomainValue(data.y, scaleType)) {
|
|
1139
|
+
values.push(data.y);
|
|
1140
|
+
}
|
|
1171
1141
|
});
|
|
1172
1142
|
}
|
|
1173
1143
|
});
|
|
@@ -1593,3 +1563,201 @@ export const createMeasurementSpan = (text, className, parentElement)=>{
|
|
|
1593
1563
|
measurementSpan.textContent = `${text}`;
|
|
1594
1564
|
return measurementSpan;
|
|
1595
1565
|
};
|
|
1566
|
+
/**
|
|
1567
|
+
* Utility function to check if an array of points is scatterpolar
|
|
1568
|
+
* @param points - Array of chart points
|
|
1569
|
+
* @returns true if any point has lineOptions.mode as 'scatterpolar'
|
|
1570
|
+
*/ export function isScatterPolarSeries(points) {
|
|
1571
|
+
return points.some(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1572
|
+
(item)=>{
|
|
1573
|
+
var _item_lineOptions;
|
|
1574
|
+
return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'scatterpolar';
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Utility function to check if an array of points contains mode as 'text' only
|
|
1579
|
+
* @param points - Array of chart points
|
|
1580
|
+
* @returns true if any point has lineOptions.mode as 'text'
|
|
1581
|
+
*/ export function isTextMode(points) {
|
|
1582
|
+
return points.some(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1583
|
+
(item)=>{
|
|
1584
|
+
var _item_lineOptions;
|
|
1585
|
+
return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'text';
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
// TODO: Refactor to encapsulate the complete numeric scale creation logic here, including setting domain and range.
|
|
1589
|
+
const createNumericScale = (scaleType)=>{
|
|
1590
|
+
if (scaleType === 'log') {
|
|
1591
|
+
return d3ScaleLog();
|
|
1592
|
+
} else {
|
|
1593
|
+
return d3ScaleLinear();
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
export const getDomainPaddingForMarkers = (minVal, maxVal, scaleType)=>{
|
|
1597
|
+
if (scaleType === 'log') {
|
|
1598
|
+
return {
|
|
1599
|
+
start: minVal * 0.5,
|
|
1600
|
+
end: maxVal
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
const defaultPadding = (maxVal - minVal) * 0.1;
|
|
1604
|
+
return {
|
|
1605
|
+
start: defaultPadding,
|
|
1606
|
+
end: defaultPadding
|
|
1607
|
+
};
|
|
1608
|
+
};
|
|
1609
|
+
/**
|
|
1610
|
+
* Determines whether a value is valid for inclusion in the scale domain.
|
|
1611
|
+
* For log scales, ensures the value is strictly positive to prevent undefined scale behavior.
|
|
1612
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1613
|
+
export const isValidDomainValue = (value, scaleType)=>{
|
|
1614
|
+
return typeof value !== 'number' || scaleType !== 'log' || value > 0;
|
|
1615
|
+
};
|
|
1616
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1617
|
+
export const isPlottable = (x, y)=>{
|
|
1618
|
+
return !isInvalidValue(x) && !isInvalidValue(y);
|
|
1619
|
+
};
|
|
1620
|
+
export const getScatterXDomainExtent = (points, scaleType)=>{
|
|
1621
|
+
const isValidDataPointForScale = (item)=>isValidDomainValue(item.x, scaleType);
|
|
1622
|
+
const xMin = d3Min(points, (point)=>{
|
|
1623
|
+
return d3Min(point.data.filter(isValidDataPointForScale), (item)=>item.x);
|
|
1624
|
+
});
|
|
1625
|
+
const xMax = d3Max(points, (point)=>{
|
|
1626
|
+
return d3Max(point.data.filter(isValidDataPointForScale), (item)=>{
|
|
1627
|
+
return item.x;
|
|
1628
|
+
});
|
|
1629
|
+
});
|
|
1630
|
+
return [
|
|
1631
|
+
xMin,
|
|
1632
|
+
xMax
|
|
1633
|
+
];
|
|
1634
|
+
};
|
|
1635
|
+
export const getRangeForScatterMarkerSize = ({ data, xScale, yScalePrimary, yScaleSecondary, useSecondaryYScale, xScaleType, yScaleType: primaryYScaleType, secondaryYScaleType })=>{
|
|
1636
|
+
// Note: This function is executed after the scale is created, so the actual padding can be
|
|
1637
|
+
// obtained by calculating the difference between the respective minimums or maximums of the
|
|
1638
|
+
// scale domain and the data. However, doing so often causes the marker size to scale up
|
|
1639
|
+
// unnecessarily when the scale uses a wider domain than required (due to the use of D3's nice
|
|
1640
|
+
// function or our own tick value calculations).
|
|
1641
|
+
// A better approach could be to treat the marker size as a fixed pixel value and adjust the
|
|
1642
|
+
// scale domain with sufficient padding to accommodate the maximum marker size—instead of doing
|
|
1643
|
+
// it the other way around (i.e., adjusting the scale domain first with padding and then scaling
|
|
1644
|
+
// the markers to fit inside the plot area).
|
|
1645
|
+
const [xMin, xMax] = getScatterXDomainExtent(data, xScaleType);
|
|
1646
|
+
const xPadding = getDomainPaddingForMarkers(+xMin, +xMax, xScaleType);
|
|
1647
|
+
const scaleXMin = xMin instanceof Date ? new Date(+xMin - xPadding.start) : xMin - xPadding.start;
|
|
1648
|
+
const scaleXMax = xMax instanceof Date ? new Date(+xMax + xPadding.end) : xMax + xPadding.end;
|
|
1649
|
+
const extraXPixels = Math.min(Math.abs(xScale(xMin) - xScale(scaleXMin)), Math.abs(xScale(scaleXMax) - xScale(xMax)));
|
|
1650
|
+
const yScaleType = useSecondaryYScale ? secondaryYScaleType : primaryYScaleType;
|
|
1651
|
+
const { startValue: yMin, endValue: yMax } = findNumericMinMaxOfY(data, undefined, useSecondaryYScale, yScaleType);
|
|
1652
|
+
const yPadding = getDomainPaddingForMarkers(yMin, yMax, yScaleType);
|
|
1653
|
+
const scaleYMin = yMin - yPadding.start;
|
|
1654
|
+
const scaleYMax = yMax + yPadding.end;
|
|
1655
|
+
const yScale = useSecondaryYScale ? yScaleSecondary : yScalePrimary;
|
|
1656
|
+
const extraYPixels = Math.min(Math.abs(yScale(scaleYMin) - yScale(yMin)), Math.abs(yScale(yMax) - yScale(scaleYMax)));
|
|
1657
|
+
return Math.min(extraXPixels, extraYPixels);
|
|
1658
|
+
};
|
|
1659
|
+
export const generateLinearTicks = (tick0, tickStep, scaleDomain)=>{
|
|
1660
|
+
const domainMin = d3Min(scaleDomain);
|
|
1661
|
+
const domainMax = d3Max(scaleDomain);
|
|
1662
|
+
const precision = Math.max(calculatePrecision(tick0), calculatePrecision(tickStep));
|
|
1663
|
+
const start = Math.ceil(precisionRound((domainMin - tick0) / tickStep, precision));
|
|
1664
|
+
const end = Math.floor(precisionRound((domainMax - tick0) / tickStep, precision));
|
|
1665
|
+
const ticks = [];
|
|
1666
|
+
for(let i = start; i <= end; i++){
|
|
1667
|
+
ticks.push(precisionRound(tick0 + i * tickStep, precision));
|
|
1668
|
+
}
|
|
1669
|
+
return ticks;
|
|
1670
|
+
};
|
|
1671
|
+
export const generateMonthlyTicks = (tick0, tickStepInMonths, scaleDomain, useUTC)=>{
|
|
1672
|
+
const domainMin = +d3Min(scaleDomain);
|
|
1673
|
+
const domainMax = +d3Max(scaleDomain);
|
|
1674
|
+
const getMonth = (d)=>useUTC ? d.getUTCMonth() : d.getMonth();
|
|
1675
|
+
const setMonth = (d, month)=>useUTC ? new Date(d.setUTCMonth(month)) : new Date(d.setMonth(month));
|
|
1676
|
+
// Find the earliest tick <= domainMin
|
|
1677
|
+
let start = 0;
|
|
1678
|
+
for(let firstTick = new Date(+tick0); +firstTick > domainMin;){
|
|
1679
|
+
firstTick = setMonth(firstTick, getMonth(firstTick) - tickStepInMonths);
|
|
1680
|
+
start -= tickStepInMonths;
|
|
1681
|
+
}
|
|
1682
|
+
const baseMonth = getMonth(tick0);
|
|
1683
|
+
const ticks = [];
|
|
1684
|
+
// Generate ticks forward until domainMax
|
|
1685
|
+
for(let i = start;; i += tickStepInMonths){
|
|
1686
|
+
let tickDate = setMonth(new Date(+tick0), baseMonth + i);
|
|
1687
|
+
// Handle month rollover (e.g., Jan 31 + 1 month → Mar 3 instead of Feb)
|
|
1688
|
+
if (getMonth(tickDate) !== ((baseMonth + i) % 12 + 12) % 12) {
|
|
1689
|
+
tickDate = useUTC ? new Date(tickDate.setUTCDate(0)) : new Date(tickDate.setDate(0));
|
|
1690
|
+
}
|
|
1691
|
+
if (+tickDate > domainMax) {
|
|
1692
|
+
break;
|
|
1693
|
+
}
|
|
1694
|
+
if (+tickDate >= domainMin) {
|
|
1695
|
+
ticks.push(tickDate);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
return ticks;
|
|
1699
|
+
};
|
|
1700
|
+
const generateNumericTicks = (scaleType, tickStep, tick0, scaleDomain)=>{
|
|
1701
|
+
const refTick = typeof tick0 === 'number' ? tick0 : 0;
|
|
1702
|
+
if (scaleType === 'log') {
|
|
1703
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1704
|
+
return generateLinearTicks(refTick, tickStep, scaleDomain.map((d)=>Math.log10(d))).map((t)=>Math.pow(10, t));
|
|
1705
|
+
}
|
|
1706
|
+
if (typeof tickStep === 'string') {
|
|
1707
|
+
const prefix = tickStep[0];
|
|
1708
|
+
const num = isNumber(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
|
|
1709
|
+
if (prefix === 'L' && num > 0) {
|
|
1710
|
+
return generateLinearTicks(refTick, num, scaleDomain);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1716
|
+
return generateLinearTicks(refTick, tickStep, scaleDomain);
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
const generateDateTicks = (tickStep, tick0, scaleDomain, useUTC)=>{
|
|
1720
|
+
const refTick = tick0 instanceof Date ? tick0 : new Date(DEFAULT_DATE_STRING);
|
|
1721
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1722
|
+
return generateLinearTicks(+refTick, tickStep, scaleDomain.map((d)=>+d)).map((t)=>new Date(t));
|
|
1723
|
+
}
|
|
1724
|
+
if (typeof tickStep === 'string') {
|
|
1725
|
+
const prefix = tickStep[0];
|
|
1726
|
+
const num = isNumber(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
|
|
1727
|
+
if (prefix === 'M' && num > 0 && num === Math.round(num)) {
|
|
1728
|
+
return generateMonthlyTicks(refTick, num, scaleDomain, useUTC);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
/**
|
|
1733
|
+
* Calculates a number's precision based on the number of trailing
|
|
1734
|
+
* zeros if the number does not have a decimal indicated by a negative
|
|
1735
|
+
* precision. Otherwise, it calculates the number of digits after
|
|
1736
|
+
* the decimal point indicated by a positive precision.
|
|
1737
|
+
* @param value - the value to determine the precision of
|
|
1738
|
+
*/ export function calculatePrecision(value) {
|
|
1739
|
+
/**
|
|
1740
|
+
* Group 1:
|
|
1741
|
+
* [1-9]([0]+$) matches trailing zeros
|
|
1742
|
+
* Group 2:
|
|
1743
|
+
* \.([0-9]*) matches all digits after a decimal point.
|
|
1744
|
+
*/ const groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));
|
|
1745
|
+
if (!groups) {
|
|
1746
|
+
return 0;
|
|
1747
|
+
}
|
|
1748
|
+
if (groups[1]) {
|
|
1749
|
+
return -groups[1].length;
|
|
1750
|
+
}
|
|
1751
|
+
if (groups[2]) {
|
|
1752
|
+
return groups[2].length;
|
|
1753
|
+
}
|
|
1754
|
+
return 0;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Rounds a number to a certain level of precision. Accepts negative precision.
|
|
1758
|
+
* @param value - The value that is being rounded.
|
|
1759
|
+
* @param precision - The number of decimal places to round the number to
|
|
1760
|
+
*/ export function precisionRound(value, precision, base = 10) {
|
|
1761
|
+
const exp = Math.pow(base, precision);
|
|
1762
|
+
return Math.round(value * exp) / exp;
|
|
1763
|
+
}
|