@lobehub/charts 5.7.0 → 5.7.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/es/AccuracyBarChart/index.d.mts +62 -0
- package/es/AccuracyBarChart/index.mjs +326 -0
- package/es/AccuracyBarChart/index.mjs.map +1 -0
- package/es/AccuracyBarChart/styles.d.mts +14 -0
- package/es/AccuracyBarChart/styles.mjs +71 -0
- package/es/AccuracyBarChart/styles.mjs.map +1 -0
- package/es/AreaChart/index.d.mts +13 -0
- package/es/AreaChart/index.mjs +308 -0
- package/es/AreaChart/index.mjs.map +1 -0
- package/es/AreaChart/styles.d.mts +9 -0
- package/es/AreaChart/styles.mjs +28 -0
- package/es/AreaChart/styles.mjs.map +1 -0
- package/es/BarChart/index.d.mts +11 -0
- package/es/BarChart/index.mjs +290 -0
- package/es/BarChart/index.mjs.map +1 -0
- package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
- package/es/BarChart/renderShape.mjs +28 -0
- package/es/BarChart/renderShape.mjs.map +1 -0
- package/es/BarChart/styles.d.mts +9 -0
- package/es/BarChart/styles.mjs +28 -0
- package/es/BarChart/styles.mjs.map +1 -0
- package/es/BarList/index.d.mts +32 -0
- package/es/BarList/index.mjs +128 -0
- package/es/BarList/index.mjs.map +1 -0
- package/es/BarList/styles.d.mts +13 -0
- package/es/BarList/styles.mjs +63 -0
- package/es/BarList/styles.mjs.map +1 -0
- package/es/BenchmarkColumnChart/index.d.mts +144 -0
- package/es/BenchmarkColumnChart/index.mjs +514 -0
- package/es/BenchmarkColumnChart/index.mjs.map +1 -0
- package/es/BenchmarkColumnChart/styles.d.mts +19 -0
- package/es/BenchmarkColumnChart/styles.mjs +129 -0
- package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
- package/es/BenchmarkRankingChart/index.d.mts +91 -0
- package/es/BenchmarkRankingChart/index.mjs +347 -0
- package/es/BenchmarkRankingChart/index.mjs.map +1 -0
- package/es/BenchmarkRankingChart/styles.d.mts +36 -0
- package/es/BenchmarkRankingChart/styles.mjs +265 -0
- package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
- package/es/BenchmarkScatterChart/index.d.mts +148 -0
- package/es/BenchmarkScatterChart/index.mjs +668 -0
- package/es/BenchmarkScatterChart/index.mjs.map +1 -0
- package/es/BenchmarkScatterChart/styles.d.mts +28 -0
- package/es/BenchmarkScatterChart/styles.mjs +193 -0
- package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
- package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
- package/es/BenchmarkScatterChart/utils.mjs +214 -0
- package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
- package/es/ComposedChart/index.d.mts +6 -0
- package/es/ComposedChart/index.mjs +254 -0
- package/es/ComposedChart/index.mjs.map +1 -0
- package/es/ComposedChart/styles.d.mts +9 -0
- package/es/ComposedChart/styles.mjs +28 -0
- package/es/ComposedChart/styles.mjs.map +1 -0
- package/es/ComposedChart/types.d.mts +71 -0
- package/es/ComposedChart/types.mjs +0 -0
- package/es/DataBars/CategoryBar.d.mts +17 -0
- package/es/DataBars/CategoryBar.mjs +146 -0
- package/es/DataBars/CategoryBar.mjs.map +1 -0
- package/es/DataBars/DeltaBar.d.mts +16 -0
- package/es/DataBars/DeltaBar.mjs +102 -0
- package/es/DataBars/DeltaBar.mjs.map +1 -0
- package/es/DataBars/MarkerBar.d.mts +19 -0
- package/es/DataBars/MarkerBar.mjs +74 -0
- package/es/DataBars/MarkerBar.mjs.map +1 -0
- package/es/DataBars/ProgressBar.d.mts +15 -0
- package/es/DataBars/ProgressBar.mjs +53 -0
- package/es/DataBars/ProgressBar.mjs.map +1 -0
- package/es/DataBars/index.d.mts +5 -0
- package/es/DataBars/index.mjs +5 -0
- package/es/DataBars/styles.d.mts +10 -0
- package/es/DataBars/styles.mjs +31 -0
- package/es/DataBars/styles.mjs.map +1 -0
- package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
- package/es/DonutChart/DonutChartTooltip.mjs +25 -0
- package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
- package/es/DonutChart/index.d.mts +33 -0
- package/es/DonutChart/index.mjs +160 -0
- package/es/DonutChart/index.mjs.map +1 -0
- package/es/DonutChart/inputParser.d.mts +5 -0
- package/es/DonutChart/inputParser.mjs +8 -0
- package/es/DonutChart/inputParser.mjs.map +1 -0
- package/es/DonutChart/renderInactiveShape.d.mts +4 -0
- package/es/DonutChart/renderInactiveShape.mjs +22 -0
- package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
- package/es/DonutChart/styles.d.mts +9 -0
- package/es/DonutChart/styles.mjs +28 -0
- package/es/DonutChart/styles.mjs.map +1 -0
- package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
- package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
- package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
- package/es/FunnelChart/index.d.mts +21 -0
- package/es/FunnelChart/index.mjs +421 -0
- package/es/FunnelChart/index.mjs.map +1 -0
- package/es/FunnelChart/styles.d.mts +9 -0
- package/es/FunnelChart/styles.mjs +28 -0
- package/es/FunnelChart/styles.mjs.map +1 -0
- package/es/FunnelChart/types.d.mts +31 -0
- package/es/FunnelChart/types.mjs +0 -0
- package/es/Heatmaps/Calendar.d.mts +21 -0
- package/es/Heatmaps/Calendar.mjs +108 -0
- package/es/Heatmaps/Calendar.mjs.map +1 -0
- package/es/Heatmaps/ChartLabels.d.mts +17 -0
- package/es/Heatmaps/ChartLabels.mjs +84 -0
- package/es/Heatmaps/ChartLabels.mjs.map +1 -0
- package/es/Heatmaps/Footer.d.mts +24 -0
- package/es/Heatmaps/Footer.mjs +81 -0
- package/es/Heatmaps/Footer.mjs.map +1 -0
- package/es/Heatmaps/index.d.mts +31 -0
- package/es/Heatmaps/index.mjs +188 -0
- package/es/Heatmaps/index.mjs.map +1 -0
- package/es/Heatmaps/styles.d.mts +10 -0
- package/es/Heatmaps/styles.mjs +47 -0
- package/es/Heatmaps/styles.mjs.map +1 -0
- package/es/Legend/LegendItem.d.mts +12 -0
- package/es/Legend/LegendItem.mjs +65 -0
- package/es/Legend/LegendItem.mjs.map +1 -0
- package/es/Legend/ScrollButton.d.mts +11 -0
- package/es/Legend/ScrollButton.mjs +50 -0
- package/es/Legend/ScrollButton.mjs.map +1 -0
- package/es/Legend/index.d.mts +16 -0
- package/es/Legend/index.mjs +152 -0
- package/es/Legend/index.mjs.map +1 -0
- package/es/LineChart/index.d.mts +11 -0
- package/es/LineChart/index.mjs +271 -0
- package/es/LineChart/index.mjs.map +1 -0
- package/es/LineChart/styles.d.mts +9 -0
- package/es/LineChart/styles.mjs +28 -0
- package/es/LineChart/styles.mjs.map +1 -0
- package/es/RadarChart/index.d.mts +27 -0
- package/es/RadarChart/index.mjs +157 -0
- package/es/RadarChart/index.mjs.map +1 -0
- package/es/RadarChart/styles.d.mts +8 -0
- package/es/RadarChart/styles.mjs +23 -0
- package/es/RadarChart/styles.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs +52 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs +36 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
- package/es/ScatterChart/index.d.mts +58 -0
- package/es/ScatterChart/index.mjs +241 -0
- package/es/ScatterChart/index.mjs.map +1 -0
- package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
- package/es/ScatterChart/renderShape.mjs +18 -0
- package/es/ScatterChart/renderShape.mjs.map +1 -0
- package/es/ScatterChart/styles.d.mts +9 -0
- package/es/ScatterChart/styles.mjs +28 -0
- package/es/ScatterChart/styles.mjs.map +1 -0
- package/es/SparkChart/SparkAreaChart.d.mts +14 -0
- package/es/SparkChart/SparkAreaChart.mjs +109 -0
- package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
- package/es/SparkChart/SparkBarChart.d.mts +11 -0
- package/es/SparkChart/SparkBarChart.mjs +69 -0
- package/es/SparkChart/SparkBarChart.mjs.map +1 -0
- package/es/SparkChart/SparkLineChart.d.mts +12 -0
- package/es/SparkChart/SparkLineChart.mjs +73 -0
- package/es/SparkChart/SparkLineChart.mjs.map +1 -0
- package/es/SparkChart/index.d.mts +4 -0
- package/es/SparkChart/index.mjs +4 -0
- package/es/Tracker/TrackerBlock.d.mts +11 -0
- package/es/Tracker/TrackerBlock.mjs +52 -0
- package/es/Tracker/TrackerBlock.mjs.map +1 -0
- package/es/Tracker/index.d.mts +21 -0
- package/es/Tracker/index.mjs +69 -0
- package/es/Tracker/index.mjs.map +1 -0
- package/es/Tracker/styles.d.mts +8 -0
- package/es/Tracker/styles.mjs +24 -0
- package/es/Tracker/styles.mjs.map +1 -0
- package/es/common/BaseAnimationTimingProps.d.mts +10 -0
- package/es/common/BaseAnimationTimingProps.mjs +0 -0
- package/es/common/BaseChartProps.d.mts +61 -0
- package/es/common/BaseChartProps.mjs +0 -0
- package/es/common/BaseSparkChartProps.d.mts +17 -0
- package/es/common/BaseSparkChartProps.mjs +0 -0
- package/es/common/ChartLegend.d.mts +8 -0
- package/es/common/ChartLegend.mjs +32 -0
- package/es/common/ChartLegend.mjs.map +1 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs +27 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
- package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
- package/es/common/ChartTooltip/ChartTooltipRow.mjs +51 -0
- package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
- package/es/common/ChartTooltip/index.d.mts +18 -0
- package/es/common/ChartTooltip/index.mjs +50 -0
- package/es/common/ChartTooltip/index.mjs.map +1 -0
- package/es/common/CustomTooltipProps.d.mts +15 -0
- package/es/common/CustomTooltipProps.mjs +0 -0
- package/es/common/CustomYAxisTick.d.mts +18 -0
- package/es/common/CustomYAxisTick.mjs +24 -0
- package/es/common/CustomYAxisTick.mjs.map +1 -0
- package/es/common/NoData.d.mts +13 -0
- package/es/common/NoData.mjs +25 -0
- package/es/common/NoData.mjs.map +1 -0
- package/es/common/benchmark/index.d.mts +3 -0
- package/es/common/benchmark/{index.js → index.mjs} +1 -1
- package/es/common/benchmark/types.d.mts +125 -0
- package/es/common/benchmark/types.mjs +0 -0
- package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
- package/es/common/benchmark/utils.mjs +115 -0
- package/es/common/benchmark/utils.mjs.map +1 -0
- package/es/common/{utils.d.ts → utils.d.mts} +3 -0
- package/es/common/utils.mjs +36 -0
- package/es/common/utils.mjs.map +1 -0
- package/es/hooks/useOnWindowResize.d.mts +6 -0
- package/es/hooks/useOnWindowResize.mjs +18 -0
- package/es/hooks/useOnWindowResize.mjs.map +1 -0
- package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
- package/es/hooks/usePrefersReducedMotion.mjs +24 -0
- package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
- package/es/hooks/useThemeColorRange.d.mts +4 -0
- package/es/hooks/useThemeColorRange.mjs +28 -0
- package/es/hooks/useThemeColorRange.mjs.map +1 -0
- package/es/index.d.mts +34 -0
- package/es/index.mjs +28 -0
- package/es/types/{charts.d.ts → charts.d.mts} +26 -26
- package/es/types/charts.mjs +12 -0
- package/es/types/charts.mjs.map +1 -0
- package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
- package/es/utils/calendar.mjs +154 -0
- package/es/utils/calendar.mjs.map +1 -0
- package/es/utils/getMaxLabelLength.d.mts +13 -0
- package/es/utils/getMaxLabelLength.mjs +48 -0
- package/es/utils/getMaxLabelLength.mjs.map +1 -0
- package/es/utils/{index.d.ts → index.d.mts} +4 -1
- package/es/utils/index.mjs +19 -0
- package/es/utils/index.mjs.map +1 -0
- package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
- package/es/utils/theme.mjs +33 -0
- package/es/utils/theme.mjs.map +1 -0
- package/package.json +22 -4
- package/es/AccuracyBarChart/index.d.ts +0 -60
- package/es/AccuracyBarChart/index.js +0 -454
- package/es/AccuracyBarChart/index.mdx +0 -52
- package/es/AccuracyBarChart/styles.d.ts +0 -11
- package/es/AccuracyBarChart/styles.js +0 -18
- package/es/AreaChart/index.d.ts +0 -11
- package/es/AreaChart/index.js +0 -430
- package/es/AreaChart/index.mdx +0 -49
- package/es/AreaChart/styles.d.ts +0 -6
- package/es/AreaChart/styles.js +0 -13
- package/es/BarChart/index.d.ts +0 -9
- package/es/BarChart/index.js +0 -392
- package/es/BarChart/index.mdx +0 -73
- package/es/BarChart/renderShape.js +0 -34
- package/es/BarChart/styles.d.ts +0 -6
- package/es/BarChart/styles.js +0 -13
- package/es/BarList/index.d.ts +0 -29
- package/es/BarList/index.js +0 -174
- package/es/BarList/index.mdx +0 -34
- package/es/BarList/styles.d.ts +0 -10
- package/es/BarList/styles.js +0 -18
- package/es/BenchmarkColumnChart/index.d.ts +0 -140
- package/es/BenchmarkColumnChart/index.js +0 -686
- package/es/BenchmarkColumnChart/index.mdx +0 -66
- package/es/BenchmarkColumnChart/styles.d.ts +0 -16
- package/es/BenchmarkColumnChart/styles.js +0 -23
- package/es/BenchmarkRankingChart/index.d.ts +0 -87
- package/es/BenchmarkRankingChart/index.js +0 -455
- package/es/BenchmarkRankingChart/index.mdx +0 -59
- package/es/BenchmarkRankingChart/styles.d.ts +0 -33
- package/es/BenchmarkRankingChart/styles.js +0 -41
- package/es/BenchmarkScatterChart/index.d.ts +0 -145
- package/es/BenchmarkScatterChart/index.js +0 -857
- package/es/BenchmarkScatterChart/index.mdx +0 -61
- package/es/BenchmarkScatterChart/styles.d.ts +0 -25
- package/es/BenchmarkScatterChart/styles.js +0 -33
- package/es/BenchmarkScatterChart/utils.js +0 -353
- package/es/ComposedChart/index.d.ts +0 -5
- package/es/ComposedChart/index.js +0 -335
- package/es/ComposedChart/index.mdx +0 -43
- package/es/ComposedChart/styles.d.ts +0 -6
- package/es/ComposedChart/styles.js +0 -13
- package/es/ComposedChart/types.d.ts +0 -68
- package/es/ComposedChart/types.js +0 -1
- package/es/DataBars/CategoryBar.d.ts +0 -15
- package/es/DataBars/CategoryBar.js +0 -201
- package/es/DataBars/DeltaBar.d.ts +0 -13
- package/es/DataBars/DeltaBar.js +0 -117
- package/es/DataBars/MarkerBar.d.ts +0 -16
- package/es/DataBars/MarkerBar.js +0 -94
- package/es/DataBars/ProgressBar.d.ts +0 -12
- package/es/DataBars/ProgressBar.js +0 -71
- package/es/DataBars/index.d.ts +0 -4
- package/es/DataBars/index.js +0 -4
- package/es/DataBars/index.mdx +0 -36
- package/es/DataBars/styles.d.ts +0 -7
- package/es/DataBars/styles.js +0 -14
- package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
- package/es/DonutChart/DonutChartTooltip.js +0 -26
- package/es/DonutChart/index.d.ts +0 -31
- package/es/DonutChart/index.js +0 -232
- package/es/DonutChart/index.mdx +0 -48
- package/es/DonutChart/inputParser.d.ts +0 -2
- package/es/DonutChart/inputParser.js +0 -9
- package/es/DonutChart/renderInactiveShape.d.ts +0 -2
- package/es/DonutChart/renderInactiveShape.js +0 -27
- package/es/DonutChart/styles.d.ts +0 -6
- package/es/DonutChart/styles.js +0 -13
- package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
- package/es/FunnelChart/ArrowRightIcon.js +0 -22
- package/es/FunnelChart/index.d.ts +0 -19
- package/es/FunnelChart/index.js +0 -499
- package/es/FunnelChart/index.mdx +0 -21
- package/es/FunnelChart/styles.d.ts +0 -6
- package/es/FunnelChart/styles.js +0 -13
- package/es/FunnelChart/types.d.ts +0 -28
- package/es/FunnelChart/types.js +0 -1
- package/es/Heatmaps/Calendar.d.ts +0 -18
- package/es/Heatmaps/Calendar.js +0 -155
- package/es/Heatmaps/ChartLabels.d.ts +0 -15
- package/es/Heatmaps/ChartLabels.js +0 -106
- package/es/Heatmaps/Footer.d.ts +0 -22
- package/es/Heatmaps/Footer.js +0 -105
- package/es/Heatmaps/index.d.ts +0 -28
- package/es/Heatmaps/index.js +0 -227
- package/es/Heatmaps/index.mdx +0 -70
- package/es/Heatmaps/styles.d.ts +0 -7
- package/es/Heatmaps/styles.js +0 -14
- package/es/Legend/LegendItem.d.ts +0 -10
- package/es/Legend/LegendItem.js +0 -58
- package/es/Legend/ScrollButton.d.ts +0 -9
- package/es/Legend/ScrollButton.js +0 -63
- package/es/Legend/index.d.ts +0 -14
- package/es/Legend/index.js +0 -184
- package/es/Legend/index.mdx +0 -13
- package/es/LineChart/index.d.ts +0 -9
- package/es/LineChart/index.js +0 -388
- package/es/LineChart/index.mdx +0 -49
- package/es/LineChart/styles.d.ts +0 -6
- package/es/LineChart/styles.js +0 -13
- package/es/RadarChart/index.d.ts +0 -24
- package/es/RadarChart/index.js +0 -254
- package/es/RadarChart/index.mdx +0 -52
- package/es/RadarChart/styles.d.ts +0 -5
- package/es/RadarChart/styles.js +0 -12
- package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
- package/es/ScatterChart/ScatterChartTooltip.js +0 -76
- package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
- package/es/ScatterChart/ScatterChartTooltipRow.js +0 -40
- package/es/ScatterChart/index.d.ts +0 -56
- package/es/ScatterChart/index.js +0 -342
- package/es/ScatterChart/index.mdx +0 -49
- package/es/ScatterChart/renderShape.js +0 -18
- package/es/ScatterChart/styles.d.ts +0 -6
- package/es/ScatterChart/styles.js +0 -13
- package/es/SparkChart/SparkAreaChart.d.ts +0 -12
- package/es/SparkChart/SparkAreaChart.js +0 -148
- package/es/SparkChart/SparkBarChart.d.ts +0 -9
- package/es/SparkChart/SparkBarChart.js +0 -106
- package/es/SparkChart/SparkLineChart.d.ts +0 -10
- package/es/SparkChart/SparkLineChart.js +0 -110
- package/es/SparkChart/index.d.ts +0 -3
- package/es/SparkChart/index.js +0 -3
- package/es/SparkChart/index.mdx +0 -29
- package/es/Tracker/TrackerBlock.d.ts +0 -8
- package/es/Tracker/TrackerBlock.js +0 -64
- package/es/Tracker/index.d.ts +0 -18
- package/es/Tracker/index.js +0 -105
- package/es/Tracker/index.mdx +0 -41
- package/es/Tracker/styles.d.ts +0 -5
- package/es/Tracker/styles.js +0 -12
- package/es/common/BaseAnimationTimingProps.d.ts +0 -7
- package/es/common/BaseAnimationTimingProps.js +0 -1
- package/es/common/BaseChartProps.d.ts +0 -58
- package/es/common/BaseChartProps.js +0 -1
- package/es/common/BaseSparkChartProps.d.ts +0 -14
- package/es/common/BaseSparkChartProps.js +0 -1
- package/es/common/ChartLegend.d.ts +0 -5
- package/es/common/ChartLegend.js +0 -40
- package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
- package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -32
- package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
- package/es/common/ChartTooltip/ChartTooltipRow.js +0 -55
- package/es/common/ChartTooltip/index.d.ts +0 -15
- package/es/common/ChartTooltip/index.js +0 -66
- package/es/common/CustomTooltipProps.d.ts +0 -12
- package/es/common/CustomTooltipProps.js +0 -1
- package/es/common/CustomYAxisTick.d.ts +0 -15
- package/es/common/CustomYAxisTick.js +0 -27
- package/es/common/NoData.d.ts +0 -10
- package/es/common/NoData.js +0 -24
- package/es/common/benchmark/index.d.ts +0 -2
- package/es/common/benchmark/types.d.ts +0 -122
- package/es/common/benchmark/types.js +0 -1
- package/es/common/benchmark/utils.js +0 -159
- package/es/common/utils.js +0 -85
- package/es/hooks/useOnWindowResize.d.ts +0 -3
- package/es/hooks/useOnWindowResize.js +0 -15
- package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
- package/es/hooks/usePrefersReducedMotion.js +0 -28
- package/es/hooks/useThemeColorRange.d.ts +0 -1
- package/es/hooks/useThemeColorRange.js +0 -8
- package/es/index.d.ts +0 -24
- package/es/index.js +0 -22
- package/es/types/charts.js +0 -8
- package/es/types/global.d.ts +0 -9
- package/es/utils/calendar.js +0 -199
- package/es/utils/getMaxLabelLength.d.ts +0 -10
- package/es/utils/getMaxLabelLength.js +0 -110
- package/es/utils/index.js +0 -32
- package/es/utils/theme.js +0 -40
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useThemeColorRange } from "../hooks/useThemeColorRange.mjs";
|
|
3
|
+
import ChartTooltip from "../common/ChartTooltip/index.mjs";
|
|
4
|
+
import NoData from "../common/NoData.mjs";
|
|
5
|
+
import { constructCategoryColors } from "../common/utils.mjs";
|
|
6
|
+
import { getTextWidth } from "../utils/getMaxLabelLength.mjs";
|
|
7
|
+
import { defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, normalizeBenchmarkData } from "../common/benchmark/utils.mjs";
|
|
8
|
+
import { styles } from "./styles.mjs";
|
|
9
|
+
import { createScale, getParetoFrontier, placeLabels } from "./utils.mjs";
|
|
10
|
+
import { A } from "@lobehub/ui";
|
|
11
|
+
import { Segmented, Skeleton, Tooltip } from "@lobehub/ui/base-ui";
|
|
12
|
+
import { cssVar, cx, useTheme } from "antd-style";
|
|
13
|
+
import { forwardRef, useMemo, useRef, useState } from "react";
|
|
14
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { useSize } from "ahooks";
|
|
16
|
+
//#region src/BenchmarkScatterChart/index.tsx
|
|
17
|
+
const labelPriority = (point, frontierKeys) => (frontierKeys.has(point.key) ? 0 : 2) + (point.item.highlighted ? 0 : 1);
|
|
18
|
+
const MARGIN_TOP = 12;
|
|
19
|
+
const MARGIN_RIGHT = 16;
|
|
20
|
+
const TICK_GAP = 8;
|
|
21
|
+
const AXIS_TITLE_SIZE = 22;
|
|
22
|
+
const MONO_CHAR_RATIO = .62;
|
|
23
|
+
const renderShape = (shape, color, size, ring = false) => {
|
|
24
|
+
const half = size / 2;
|
|
25
|
+
let node;
|
|
26
|
+
switch (shape) {
|
|
27
|
+
case "square":
|
|
28
|
+
node = /* @__PURE__ */ jsx("rect", {
|
|
29
|
+
fill: color,
|
|
30
|
+
height: size * .84,
|
|
31
|
+
width: size * .84,
|
|
32
|
+
x: size * .08,
|
|
33
|
+
y: size * .08
|
|
34
|
+
});
|
|
35
|
+
break;
|
|
36
|
+
case "diamond":
|
|
37
|
+
node = /* @__PURE__ */ jsx("path", {
|
|
38
|
+
d: `M${half},0 L${size},${half} L${half},${size} L0,${half} Z`,
|
|
39
|
+
fill: color
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
case "triangle":
|
|
43
|
+
node = /* @__PURE__ */ jsx("path", {
|
|
44
|
+
d: `M${half},0 L${size},${size * .9} L0,${size * .9} Z`,
|
|
45
|
+
fill: color
|
|
46
|
+
});
|
|
47
|
+
break;
|
|
48
|
+
default: node = /* @__PURE__ */ jsx("circle", {
|
|
49
|
+
cx: half,
|
|
50
|
+
cy: half,
|
|
51
|
+
fill: color,
|
|
52
|
+
r: half
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
56
|
+
height: size,
|
|
57
|
+
style: {
|
|
58
|
+
display: "block",
|
|
59
|
+
overflow: "visible"
|
|
60
|
+
},
|
|
61
|
+
width: size,
|
|
62
|
+
children: ring ? /* @__PURE__ */ jsx("g", {
|
|
63
|
+
paintOrder: "stroke",
|
|
64
|
+
stroke: cssVar.colorBgContainer,
|
|
65
|
+
strokeWidth: 4,
|
|
66
|
+
children: node
|
|
67
|
+
}) : node
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const toLabelText = (name) => String(name ?? "").replaceAll("\n", " ");
|
|
71
|
+
const BenchmarkScatterChart = forwardRef((props, ref) => {
|
|
72
|
+
const theme = useTheme();
|
|
73
|
+
const themeColorRange = useThemeColorRange();
|
|
74
|
+
const { data = [], index, valueKey, providerKey, iconKey, colorKey, errorKey, renderIcon, valueFormatter = defaultBenchmarkValueFormatter, accuracyFormatter, errorFormatter = defaultBenchmarkErrorFormatter, showError = true, showErrorBars = true, showAnimation = false, onValueChange, className, style, loading, width = "100%", height = 420, noDataText, highlightColor, frontierColor, frontierWidth = 2, iconSize = 20, markerSize = 12, labelFontSize = 12, valueLabelFontSize = 11, metrics, metric, defaultMetric, onMetricChange, minX, maxX, minY, maxY, showDominatedArea = true, showFrontier = true, showGridLines = true, showLabels = true, showLegend = true, showTooltip = true, showValueLabel = true, showXAxis = true, showYAxis = true, xAxisLabel, xDirection = "lower", xFormatter = defaultBenchmarkValueFormatter, xKey = "x", xScale = "linear", yAxisLabel, ...rest } = props;
|
|
75
|
+
const plotRef = useRef(null);
|
|
76
|
+
const size = useSize(plotRef);
|
|
77
|
+
const [innerMetric, setInnerMetric] = useState(defaultMetric);
|
|
78
|
+
const [hoverKey, setHoverKey] = useState();
|
|
79
|
+
const [selectedKey, setSelectedKey] = useState();
|
|
80
|
+
const resolvedHighlightColor = highlightColor ?? theme.gold;
|
|
81
|
+
const resolvedFrontierColor = frontierColor ?? theme.orange;
|
|
82
|
+
const yFormatter = accuracyFormatter ?? valueFormatter;
|
|
83
|
+
const yName = yAxisLabel || (accuracyFormatter ? "Accuracy" : "Score");
|
|
84
|
+
const activeMetric = useMemo(() => {
|
|
85
|
+
if (metrics?.length) {
|
|
86
|
+
const key = metric ?? innerMetric;
|
|
87
|
+
const found = metrics.find((m) => m.key === key) ?? metrics[0];
|
|
88
|
+
return {
|
|
89
|
+
axisLabel: found.axisLabel ?? found.label,
|
|
90
|
+
direction: found.direction ?? "lower",
|
|
91
|
+
formatter: found.formatter ?? defaultBenchmarkValueFormatter,
|
|
92
|
+
key: found.key,
|
|
93
|
+
label: found.label,
|
|
94
|
+
max: found.max ?? maxX,
|
|
95
|
+
min: found.min ?? minX,
|
|
96
|
+
scale: found.scale ?? "linear"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
axisLabel: xAxisLabel,
|
|
101
|
+
direction: xDirection,
|
|
102
|
+
formatter: xFormatter,
|
|
103
|
+
key: xKey,
|
|
104
|
+
label: xAxisLabel || "X",
|
|
105
|
+
max: maxX,
|
|
106
|
+
min: minX,
|
|
107
|
+
scale: xScale
|
|
108
|
+
};
|
|
109
|
+
}, [
|
|
110
|
+
innerMetric,
|
|
111
|
+
maxX,
|
|
112
|
+
metric,
|
|
113
|
+
metrics,
|
|
114
|
+
minX,
|
|
115
|
+
xAxisLabel,
|
|
116
|
+
xDirection,
|
|
117
|
+
xFormatter,
|
|
118
|
+
xKey,
|
|
119
|
+
xScale
|
|
120
|
+
]);
|
|
121
|
+
const items = useMemo(() => normalizeBenchmarkData({
|
|
122
|
+
colorKey,
|
|
123
|
+
data,
|
|
124
|
+
errorKey,
|
|
125
|
+
iconKey,
|
|
126
|
+
index,
|
|
127
|
+
providerKey,
|
|
128
|
+
renderIcon,
|
|
129
|
+
sortOrder: "descending",
|
|
130
|
+
valueKey
|
|
131
|
+
}), [
|
|
132
|
+
colorKey,
|
|
133
|
+
data,
|
|
134
|
+
errorKey,
|
|
135
|
+
iconKey,
|
|
136
|
+
index,
|
|
137
|
+
providerKey,
|
|
138
|
+
renderIcon,
|
|
139
|
+
valueKey
|
|
140
|
+
]);
|
|
141
|
+
const categoryColors = useMemo(() => constructCategoryColors(items.map((item) => String(item.key)), themeColorRange), [items, themeColorRange]);
|
|
142
|
+
const points = useMemo(() => items.map((item) => ({
|
|
143
|
+
color: item.color ?? categoryColors.get(String(item.key)) ?? cssVar.colorPrimary,
|
|
144
|
+
item,
|
|
145
|
+
key: item.key,
|
|
146
|
+
x: Number(item.original[activeMetric.key]),
|
|
147
|
+
y: item.value
|
|
148
|
+
})).filter((p) => Number.isFinite(p.x) && Number.isFinite(p.y) && (activeMetric.scale !== "log" || p.x > 0)), [
|
|
149
|
+
activeMetric.key,
|
|
150
|
+
activeMetric.scale,
|
|
151
|
+
categoryColors,
|
|
152
|
+
items
|
|
153
|
+
]);
|
|
154
|
+
const frontier = useMemo(() => showFrontier ? getParetoFrontier(points, activeMetric.direction) : [], [
|
|
155
|
+
activeMetric.direction,
|
|
156
|
+
points,
|
|
157
|
+
showFrontier
|
|
158
|
+
]);
|
|
159
|
+
const frontierKeys = useMemo(() => new Set(frontier.map((p) => p.key)), [frontier]);
|
|
160
|
+
const enableErrorBars = showError && showErrorBars;
|
|
161
|
+
const yValues = useMemo(() => points.flatMap((p) => enableErrorBars && p.item.error ? [p.y - p.item.error, p.y + p.item.error] : [p.y]), [enableErrorBars, points]);
|
|
162
|
+
const labelSizes = useMemo(() => {
|
|
163
|
+
const map = /* @__PURE__ */ new Map();
|
|
164
|
+
if (!showLabels) return map;
|
|
165
|
+
const nameScale = labelFontSize / 12 * 1.1;
|
|
166
|
+
for (const p of points) {
|
|
167
|
+
const nameWidth = getTextWidth(toLabelText(p.item.name)) * nameScale;
|
|
168
|
+
const valueWidth = showValueLabel ? `${yFormatter(p.y)} · ${activeMetric.formatter(p.x)}`.length * valueLabelFontSize * MONO_CHAR_RATIO : 0;
|
|
169
|
+
map.set(p.key, {
|
|
170
|
+
height: Math.ceil(labelFontSize * 1.3 + (showValueLabel ? valueLabelFontSize * 1.3 : 0)),
|
|
171
|
+
width: Math.ceil(Math.max(nameWidth, valueWidth)) + 2
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return map;
|
|
175
|
+
}, [
|
|
176
|
+
activeMetric,
|
|
177
|
+
labelFontSize,
|
|
178
|
+
points,
|
|
179
|
+
showLabels,
|
|
180
|
+
showValueLabel,
|
|
181
|
+
valueLabelFontSize,
|
|
182
|
+
yFormatter
|
|
183
|
+
]);
|
|
184
|
+
const plotWidth = size?.width || (typeof width === "number" ? width : 0);
|
|
185
|
+
const plotHeight = typeof height === "number" ? height : 420;
|
|
186
|
+
const layout = useMemo(() => {
|
|
187
|
+
if (!plotWidth || !points.length) return null;
|
|
188
|
+
const probeY = createScale({
|
|
189
|
+
max: maxY,
|
|
190
|
+
min: minY,
|
|
191
|
+
range: [0, 1],
|
|
192
|
+
values: yValues
|
|
193
|
+
});
|
|
194
|
+
const yTickWidth = showYAxis ? Math.max(...probeY.ticks.map((t) => yFormatter(t).length * 12 * MONO_CHAR_RATIO), 0) : 0;
|
|
195
|
+
const left = (showYAxis ? yTickWidth + TICK_GAP + 4 : 4) + (yAxisLabel ? AXIS_TITLE_SIZE : 0);
|
|
196
|
+
const bottom = (showXAxis ? 26 : 4) + (activeMetric.axisLabel ? AXIS_TITLE_SIZE : 0);
|
|
197
|
+
const innerRight = plotWidth - MARGIN_RIGHT;
|
|
198
|
+
const innerBottom = plotHeight - bottom;
|
|
199
|
+
const xScaleObj = createScale({
|
|
200
|
+
max: activeMetric.max,
|
|
201
|
+
min: activeMetric.min,
|
|
202
|
+
range: [left, innerRight],
|
|
203
|
+
type: activeMetric.scale,
|
|
204
|
+
values: points.map((p) => p.x)
|
|
205
|
+
});
|
|
206
|
+
const yScaleObj = createScale({
|
|
207
|
+
max: maxY,
|
|
208
|
+
min: minY,
|
|
209
|
+
range: [innerBottom, MARGIN_TOP],
|
|
210
|
+
values: yValues
|
|
211
|
+
});
|
|
212
|
+
const positions = /* @__PURE__ */ new Map();
|
|
213
|
+
for (const p of points) positions.set(p.key, {
|
|
214
|
+
px: xScaleObj.map(p.x),
|
|
215
|
+
py: yScaleObj.map(p.y),
|
|
216
|
+
radius: (p.item.icon ? iconSize : markerSize) / 2
|
|
217
|
+
});
|
|
218
|
+
const frontierPath = frontier.map((p, i) => {
|
|
219
|
+
const pos = positions.get(p.key);
|
|
220
|
+
return `${i === 0 ? "M" : "L"}${pos.px.toFixed(2)},${pos.py.toFixed(2)}`;
|
|
221
|
+
}).join(" ");
|
|
222
|
+
let labels = /* @__PURE__ */ new Map();
|
|
223
|
+
if (showLabels) {
|
|
224
|
+
const lineBoxes = [];
|
|
225
|
+
for (let i = 1; i < frontier.length; i++) {
|
|
226
|
+
const a = positions.get(frontier[i - 1].key);
|
|
227
|
+
const b = positions.get(frontier[i].key);
|
|
228
|
+
const steps = Math.max(1, Math.ceil(Math.hypot(b.px - a.px, b.py - a.py) / 10));
|
|
229
|
+
for (let s = 0; s <= steps; s++) {
|
|
230
|
+
const t = s / steps;
|
|
231
|
+
lineBoxes.push({
|
|
232
|
+
height: 6,
|
|
233
|
+
width: 6,
|
|
234
|
+
x: a.px + (b.px - a.px) * t - 3,
|
|
235
|
+
y: a.py + (b.py - a.py) * t - 3
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const candidates = [...points].sort((a, b) => labelPriority(a, frontierKeys) - labelPriority(b, frontierKeys) || b.y - a.y).map((p) => {
|
|
240
|
+
const pos = positions.get(p.key);
|
|
241
|
+
return {
|
|
242
|
+
...labelSizes.get(p.key) ?? {
|
|
243
|
+
height: 16,
|
|
244
|
+
width: 40
|
|
245
|
+
},
|
|
246
|
+
key: p.key,
|
|
247
|
+
...pos
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
labels = placeLabels(candidates, {
|
|
251
|
+
height: innerBottom,
|
|
252
|
+
width: plotWidth - left + MARGIN_RIGHT,
|
|
253
|
+
x: left,
|
|
254
|
+
y: 0
|
|
255
|
+
}, { lines: lineBoxes });
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
bottom,
|
|
259
|
+
frontierPath,
|
|
260
|
+
innerBottom,
|
|
261
|
+
innerRight,
|
|
262
|
+
labels,
|
|
263
|
+
left,
|
|
264
|
+
positions,
|
|
265
|
+
xScale: xScaleObj,
|
|
266
|
+
yScale: yScaleObj
|
|
267
|
+
};
|
|
268
|
+
}, [
|
|
269
|
+
activeMetric,
|
|
270
|
+
frontier,
|
|
271
|
+
frontierKeys,
|
|
272
|
+
iconSize,
|
|
273
|
+
labelSizes,
|
|
274
|
+
markerSize,
|
|
275
|
+
maxY,
|
|
276
|
+
minY,
|
|
277
|
+
plotHeight,
|
|
278
|
+
plotWidth,
|
|
279
|
+
points,
|
|
280
|
+
showLabels,
|
|
281
|
+
showXAxis,
|
|
282
|
+
showYAxis,
|
|
283
|
+
yAxisLabel,
|
|
284
|
+
yFormatter,
|
|
285
|
+
yValues
|
|
286
|
+
]);
|
|
287
|
+
if (loading || !data) return /* @__PURE__ */ jsx(Skeleton, {
|
|
288
|
+
height: plotHeight,
|
|
289
|
+
width
|
|
290
|
+
});
|
|
291
|
+
const focusKey = hoverKey ?? selectedKey;
|
|
292
|
+
const focusPoint = focusKey === void 0 ? void 0 : points.find((point) => point.key === focusKey);
|
|
293
|
+
const dominatedKeys = /* @__PURE__ */ new Set();
|
|
294
|
+
if (showDominatedArea && focusPoint) for (const point of points) {
|
|
295
|
+
if (point.key === focusPoint.key || point.y > focusPoint.y) continue;
|
|
296
|
+
if (activeMetric.direction === "lower" ? point.x >= focusPoint.x : point.x <= focusPoint.x) dominatedKeys.add(point.key);
|
|
297
|
+
}
|
|
298
|
+
const getEmphasis = (key) => {
|
|
299
|
+
if (focusKey === void 0 || key === focusKey) return "normal";
|
|
300
|
+
if (!showDominatedArea) return "dimmed";
|
|
301
|
+
return dominatedKeys.has(key) ? "dominated" : "normal";
|
|
302
|
+
};
|
|
303
|
+
const isDimmed = (key) => getEmphasis(key) !== "normal";
|
|
304
|
+
const animatedCls = showAnimation ? void 0 : styles.noTransition;
|
|
305
|
+
const handleClick = (item) => {
|
|
306
|
+
if (!onValueChange) return;
|
|
307
|
+
if (selectedKey === item.key) {
|
|
308
|
+
setSelectedKey(void 0);
|
|
309
|
+
onValueChange(null);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
setSelectedKey(item.key);
|
|
313
|
+
const payload = {
|
|
314
|
+
...item.original,
|
|
315
|
+
eventType: "point",
|
|
316
|
+
rank: item.rank,
|
|
317
|
+
value: item.value
|
|
318
|
+
};
|
|
319
|
+
onValueChange(payload);
|
|
320
|
+
};
|
|
321
|
+
const handleMetricChange = (key) => {
|
|
322
|
+
if (metric === void 0) setInnerMetric(key);
|
|
323
|
+
onMetricChange?.(key);
|
|
324
|
+
};
|
|
325
|
+
const renderTooltip = (point, child) => {
|
|
326
|
+
if (!showTooltip) return child;
|
|
327
|
+
const { item } = point;
|
|
328
|
+
const rows = [];
|
|
329
|
+
if (metrics?.length) for (const m of metrics) {
|
|
330
|
+
const value = Number(item.original[m.key]);
|
|
331
|
+
if (!Number.isFinite(value)) continue;
|
|
332
|
+
rows.push({
|
|
333
|
+
format: m.formatter ?? defaultBenchmarkValueFormatter,
|
|
334
|
+
name: m.label,
|
|
335
|
+
value
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
else rows.push({
|
|
339
|
+
format: activeMetric.formatter,
|
|
340
|
+
name: activeMetric.label,
|
|
341
|
+
value: point.x
|
|
342
|
+
});
|
|
343
|
+
rows.reverse();
|
|
344
|
+
rows.push({
|
|
345
|
+
format: (v) => showError && item.error !== void 0 ? `${yFormatter(v)} ± ${errorFormatter(item.error)}` : yFormatter(v),
|
|
346
|
+
name: yName,
|
|
347
|
+
value: point.y
|
|
348
|
+
});
|
|
349
|
+
const formatters = new Map(rows.map((row) => [row.name, row.format]));
|
|
350
|
+
const modelName = toLabelText(item.name);
|
|
351
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
352
|
+
arrow: false,
|
|
353
|
+
mouseEnterDelay: .05,
|
|
354
|
+
mouseLeaveDelay: 0,
|
|
355
|
+
styles: {
|
|
356
|
+
container: {
|
|
357
|
+
background: "transparent",
|
|
358
|
+
boxShadow: "none",
|
|
359
|
+
maxWidth: "none",
|
|
360
|
+
padding: 0,
|
|
361
|
+
pointerEvents: "none",
|
|
362
|
+
width: "max-content"
|
|
363
|
+
},
|
|
364
|
+
content: {
|
|
365
|
+
color: cssVar.colorText,
|
|
366
|
+
fontSize: cssVar.fontSize,
|
|
367
|
+
lineHeight: cssVar.lineHeight,
|
|
368
|
+
maxWidth: "none",
|
|
369
|
+
overflow: "visible",
|
|
370
|
+
padding: 0
|
|
371
|
+
},
|
|
372
|
+
root: {
|
|
373
|
+
maxWidth: "none",
|
|
374
|
+
pointerEvents: "none"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
title: /* @__PURE__ */ jsx(ChartTooltip, {
|
|
378
|
+
active: true,
|
|
379
|
+
categoryColors: new Map(rows.map((row) => [row.name, point.color])),
|
|
380
|
+
label: item.provider ? `${modelName} · ${String(item.provider)}` : modelName,
|
|
381
|
+
payload: rows.map((row) => ({
|
|
382
|
+
dataKey: row.name,
|
|
383
|
+
name: row.name,
|
|
384
|
+
value: row.value
|
|
385
|
+
})),
|
|
386
|
+
valueFormatter: (value, name) => (formatters.get(name ?? "") ?? String)(Number(value))
|
|
387
|
+
}),
|
|
388
|
+
children: child
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
const renderMarker = (point, markerSizePx, ring = false) => point.item.icon ? /* @__PURE__ */ jsx("span", {
|
|
392
|
+
className: ring ? styles.markerIconRing : void 0,
|
|
393
|
+
style: {
|
|
394
|
+
alignItems: "center",
|
|
395
|
+
display: "flex",
|
|
396
|
+
flexShrink: 0,
|
|
397
|
+
height: iconSize,
|
|
398
|
+
justifyContent: "center",
|
|
399
|
+
transform: markerSizePx === iconSize ? void 0 : `scale(${markerSizePx / iconSize})`,
|
|
400
|
+
width: iconSize
|
|
401
|
+
},
|
|
402
|
+
children: point.item.icon
|
|
403
|
+
}) : renderShape(point.item.original.shape, point.color, markerSizePx, ring);
|
|
404
|
+
const hasMetricSwitch = (metrics?.length ?? 0) > 1;
|
|
405
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
406
|
+
className: cx(styles.container, className),
|
|
407
|
+
ref,
|
|
408
|
+
style: {
|
|
409
|
+
"--benchmark-label-font-size": `${labelFontSize}px`,
|
|
410
|
+
"--benchmark-value-label-font-size": `${valueLabelFontSize}px`,
|
|
411
|
+
"width": width,
|
|
412
|
+
...style
|
|
413
|
+
},
|
|
414
|
+
...rest,
|
|
415
|
+
children: [showLegend && points.length > 0 || hasMetricSwitch ? /* @__PURE__ */ jsxs("div", {
|
|
416
|
+
className: styles.header,
|
|
417
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
418
|
+
className: styles.legend,
|
|
419
|
+
children: showLegend ? points.map((point) => /* @__PURE__ */ jsxs("span", {
|
|
420
|
+
className: styles.legendItem,
|
|
421
|
+
onClick: () => handleClick(point.item),
|
|
422
|
+
onMouseEnter: () => setHoverKey(point.key),
|
|
423
|
+
onMouseLeave: () => setHoverKey(void 0),
|
|
424
|
+
style: {
|
|
425
|
+
color: point.item.highlighted ? resolvedHighlightColor : void 0,
|
|
426
|
+
cursor: onValueChange ? "pointer" : void 0,
|
|
427
|
+
opacity: isDimmed(point.key) ? .4 : 1
|
|
428
|
+
},
|
|
429
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
430
|
+
className: styles.legendMarker,
|
|
431
|
+
children: renderMarker(point, 12)
|
|
432
|
+
}), toLabelText(point.item.name)]
|
|
433
|
+
}, `legend-${point.key}`)) : null
|
|
434
|
+
}), hasMetricSwitch ? /* @__PURE__ */ jsx(Segmented, {
|
|
435
|
+
onChange: (value) => handleMetricChange(String(value)),
|
|
436
|
+
options: metrics.map((m) => ({
|
|
437
|
+
label: m.label,
|
|
438
|
+
value: m.key
|
|
439
|
+
})),
|
|
440
|
+
size: "small",
|
|
441
|
+
value: activeMetric.key
|
|
442
|
+
}) : null]
|
|
443
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
444
|
+
className: styles.plot,
|
|
445
|
+
ref: plotRef,
|
|
446
|
+
style: { height: plotHeight },
|
|
447
|
+
children: [!points.length ? /* @__PURE__ */ jsx(NoData, { noDataText }) : null, layout ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("svg", {
|
|
448
|
+
height: plotHeight,
|
|
449
|
+
role: "img",
|
|
450
|
+
style: {
|
|
451
|
+
display: "block",
|
|
452
|
+
overflow: "visible"
|
|
453
|
+
},
|
|
454
|
+
width: plotWidth,
|
|
455
|
+
children: [
|
|
456
|
+
showGridLines ? /* @__PURE__ */ jsxs("g", { children: [layout.yScale.ticks.map((tick) => {
|
|
457
|
+
const y = layout.yScale.map(tick);
|
|
458
|
+
return /* @__PURE__ */ jsx("line", {
|
|
459
|
+
className: styles.gridLine,
|
|
460
|
+
x1: layout.left,
|
|
461
|
+
x2: layout.innerRight,
|
|
462
|
+
y1: y,
|
|
463
|
+
y2: y
|
|
464
|
+
}, `gy-${tick}`);
|
|
465
|
+
}), layout.xScale.ticks.map((tick) => {
|
|
466
|
+
const x = layout.xScale.map(tick);
|
|
467
|
+
return /* @__PURE__ */ jsx("line", {
|
|
468
|
+
className: styles.gridLine,
|
|
469
|
+
x1: x,
|
|
470
|
+
x2: x,
|
|
471
|
+
y1: MARGIN_TOP,
|
|
472
|
+
y2: layout.innerBottom
|
|
473
|
+
}, `gx-${tick}`);
|
|
474
|
+
})] }) : null,
|
|
475
|
+
showYAxis ? /* @__PURE__ */ jsx("g", { children: layout.yScale.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
|
|
476
|
+
className: styles.tickLabel,
|
|
477
|
+
dominantBaseline: "middle",
|
|
478
|
+
textAnchor: "end",
|
|
479
|
+
x: layout.left - TICK_GAP,
|
|
480
|
+
y: layout.yScale.map(tick),
|
|
481
|
+
children: yFormatter(tick)
|
|
482
|
+
}, `ty-${tick}`)) }) : null,
|
|
483
|
+
showXAxis ? /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
484
|
+
className: styles.axisLine,
|
|
485
|
+
x1: layout.left,
|
|
486
|
+
x2: layout.innerRight,
|
|
487
|
+
y1: layout.innerBottom,
|
|
488
|
+
y2: layout.innerBottom
|
|
489
|
+
}), layout.xScale.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
|
|
490
|
+
className: styles.tickLabel,
|
|
491
|
+
dominantBaseline: "hanging",
|
|
492
|
+
textAnchor: "middle",
|
|
493
|
+
x: layout.xScale.map(tick),
|
|
494
|
+
y: layout.innerBottom + TICK_GAP,
|
|
495
|
+
children: activeMetric.formatter(tick)
|
|
496
|
+
}, `tx-${tick}`))] }) : null,
|
|
497
|
+
yAxisLabel ? /* @__PURE__ */ jsx("text", {
|
|
498
|
+
className: styles.axisLabel,
|
|
499
|
+
dominantBaseline: "hanging",
|
|
500
|
+
textAnchor: "middle",
|
|
501
|
+
transform: `rotate(-90, 0, ${(MARGIN_TOP + layout.innerBottom) / 2})`,
|
|
502
|
+
x: 0,
|
|
503
|
+
y: (MARGIN_TOP + layout.innerBottom) / 2,
|
|
504
|
+
children: yAxisLabel
|
|
505
|
+
}) : null,
|
|
506
|
+
activeMetric.axisLabel ? /* @__PURE__ */ jsx("text", {
|
|
507
|
+
className: styles.axisLabel,
|
|
508
|
+
dominantBaseline: "auto",
|
|
509
|
+
textAnchor: "middle",
|
|
510
|
+
x: (layout.left + layout.innerRight) / 2,
|
|
511
|
+
y: plotHeight - 4,
|
|
512
|
+
children: activeMetric.axisLabel
|
|
513
|
+
}) : null,
|
|
514
|
+
showDominatedArea && focusPoint ? (() => {
|
|
515
|
+
const pos = layout.positions.get(focusPoint.key);
|
|
516
|
+
const toRight = activeMetric.direction === "lower";
|
|
517
|
+
const x0 = toRight ? pos.px : layout.left;
|
|
518
|
+
const x1 = toRight ? layout.innerRight : pos.px;
|
|
519
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
520
|
+
className: styles.dominatedArea,
|
|
521
|
+
"data-testid": "benchmark-scatter-dominated-area",
|
|
522
|
+
children: [
|
|
523
|
+
/* @__PURE__ */ jsx("rect", {
|
|
524
|
+
fill: resolvedFrontierColor,
|
|
525
|
+
fillOpacity: .08,
|
|
526
|
+
height: Math.max(0, layout.innerBottom - pos.py),
|
|
527
|
+
width: Math.max(0, x1 - x0),
|
|
528
|
+
x: x0,
|
|
529
|
+
y: pos.py
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ jsx("line", {
|
|
532
|
+
className: styles.dominatedGuide,
|
|
533
|
+
x1: x0,
|
|
534
|
+
x2: x1,
|
|
535
|
+
y1: pos.py,
|
|
536
|
+
y2: pos.py
|
|
537
|
+
}),
|
|
538
|
+
/* @__PURE__ */ jsx("line", {
|
|
539
|
+
className: styles.dominatedGuide,
|
|
540
|
+
x1: pos.px,
|
|
541
|
+
x2: pos.px,
|
|
542
|
+
y1: pos.py,
|
|
543
|
+
y2: layout.innerBottom
|
|
544
|
+
})
|
|
545
|
+
]
|
|
546
|
+
});
|
|
547
|
+
})() : null,
|
|
548
|
+
enableErrorBars ? points.map((point) => {
|
|
549
|
+
const { error } = point.item;
|
|
550
|
+
if (!error) return null;
|
|
551
|
+
const pos = layout.positions.get(point.key);
|
|
552
|
+
const top = layout.yScale.map(point.y + error);
|
|
553
|
+
const bottom = layout.yScale.map(point.y - error);
|
|
554
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
555
|
+
className: styles.errorBar,
|
|
556
|
+
"data-testid": "benchmark-scatter-error-bar",
|
|
557
|
+
opacity: isDimmed(point.key) ? .25 : .7,
|
|
558
|
+
stroke: point.color,
|
|
559
|
+
children: [
|
|
560
|
+
/* @__PURE__ */ jsx("line", {
|
|
561
|
+
x1: pos.px,
|
|
562
|
+
x2: pos.px,
|
|
563
|
+
y1: top,
|
|
564
|
+
y2: bottom
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ jsx("line", {
|
|
567
|
+
x1: pos.px - 4,
|
|
568
|
+
x2: pos.px + 4,
|
|
569
|
+
y1: top,
|
|
570
|
+
y2: top
|
|
571
|
+
}),
|
|
572
|
+
/* @__PURE__ */ jsx("line", {
|
|
573
|
+
x1: pos.px - 4,
|
|
574
|
+
x2: pos.px + 4,
|
|
575
|
+
y1: bottom,
|
|
576
|
+
y2: bottom
|
|
577
|
+
})
|
|
578
|
+
]
|
|
579
|
+
}, `err-${point.key}`);
|
|
580
|
+
}) : null,
|
|
581
|
+
layout.frontierPath ? /* @__PURE__ */ jsx("path", {
|
|
582
|
+
className: styles.frontier,
|
|
583
|
+
d: layout.frontierPath,
|
|
584
|
+
"data-testid": "benchmark-scatter-frontier",
|
|
585
|
+
opacity: !showDominatedArea && focusKey !== void 0 && !frontierKeys.has(focusKey) ? .35 : 1,
|
|
586
|
+
stroke: resolvedFrontierColor,
|
|
587
|
+
strokeWidth: frontierWidth,
|
|
588
|
+
style: showAnimation ? { transition: `d 0.4s, opacity 0.2s` } : void 0
|
|
589
|
+
}) : null
|
|
590
|
+
]
|
|
591
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
592
|
+
className: styles.overlay,
|
|
593
|
+
children: [points.map((point) => {
|
|
594
|
+
const pos = layout.positions.get(point.key);
|
|
595
|
+
const markerPx = point.item.icon ? iconSize : markerSize;
|
|
596
|
+
return /* @__PURE__ */ jsx("div", { children: renderTooltip(point, /* @__PURE__ */ jsx("div", {
|
|
597
|
+
"aria-label": `${toLabelText(point.item.name)}: ${yFormatter(point.y)}, ${activeMetric.formatter(point.x)}`,
|
|
598
|
+
className: cx(styles.marker, animatedCls),
|
|
599
|
+
onClick: () => handleClick(point.item),
|
|
600
|
+
onMouseEnter: () => setHoverKey(point.key),
|
|
601
|
+
onMouseLeave: () => setHoverKey(void 0),
|
|
602
|
+
role: "button",
|
|
603
|
+
style: {
|
|
604
|
+
cursor: onValueChange ? "pointer" : "default",
|
|
605
|
+
filter: getEmphasis(point.key) === "dominated" ? "grayscale(1)" : void 0,
|
|
606
|
+
height: markerPx,
|
|
607
|
+
left: pos.px,
|
|
608
|
+
opacity: {
|
|
609
|
+
dimmed: .25,
|
|
610
|
+
dominated: .5,
|
|
611
|
+
normal: 1
|
|
612
|
+
}[getEmphasis(point.key)],
|
|
613
|
+
top: pos.py,
|
|
614
|
+
width: markerPx
|
|
615
|
+
},
|
|
616
|
+
children: renderMarker(point, markerPx, true)
|
|
617
|
+
})) }, `marker-${point.key}`);
|
|
618
|
+
}), showLabels ? points.map((point) => {
|
|
619
|
+
const label = layout.labels.get(point.key);
|
|
620
|
+
if (!label) return null;
|
|
621
|
+
const emphasis = getEmphasis(point.key);
|
|
622
|
+
const textColor = emphasis === "dominated" ? cssVar.colorTextQuaternary : point.item.highlighted ? resolvedHighlightColor : void 0;
|
|
623
|
+
const isKeyLabel = emphasis !== "dominated" && (frontierKeys.has(point.key) || point.item.highlighted || point.key === focusKey);
|
|
624
|
+
const align = label.placement.endsWith("left") ? "right" : label.placement === "top" || label.placement === "bottom" ? "center" : "left";
|
|
625
|
+
const name = toLabelText(point.item.name);
|
|
626
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
627
|
+
className: cx(styles.label, animatedCls),
|
|
628
|
+
onClick: () => handleClick(point.item),
|
|
629
|
+
onMouseEnter: () => setHoverKey(point.key),
|
|
630
|
+
onMouseLeave: () => setHoverKey(void 0),
|
|
631
|
+
style: {
|
|
632
|
+
cursor: onValueChange ? "pointer" : "default",
|
|
633
|
+
height: label.height,
|
|
634
|
+
left: label.x,
|
|
635
|
+
opacity: emphasis === "dimmed" ? .25 : 1,
|
|
636
|
+
textAlign: align,
|
|
637
|
+
top: label.y,
|
|
638
|
+
width: label.width
|
|
639
|
+
},
|
|
640
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
641
|
+
className: cx(styles.labelName, isKeyLabel && styles.labelNameEmphasis),
|
|
642
|
+
style: textColor ? { color: textColor } : void 0,
|
|
643
|
+
children: point.item.href ? /* @__PURE__ */ jsx(A, {
|
|
644
|
+
className: styles.labelNameLink,
|
|
645
|
+
href: point.item.href,
|
|
646
|
+
onClick: (event) => event.stopPropagation(),
|
|
647
|
+
target: point.item.target,
|
|
648
|
+
children: name
|
|
649
|
+
}) : name
|
|
650
|
+
}), showValueLabel ? /* @__PURE__ */ jsxs("div", {
|
|
651
|
+
className: styles.labelValue,
|
|
652
|
+
children: [
|
|
653
|
+
yFormatter(point.y),
|
|
654
|
+
" · ",
|
|
655
|
+
activeMetric.formatter(point.x)
|
|
656
|
+
]
|
|
657
|
+
}) : null]
|
|
658
|
+
}, `label-${point.key}`);
|
|
659
|
+
}) : null]
|
|
660
|
+
})] }) : null]
|
|
661
|
+
})]
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
BenchmarkScatterChart.displayName = "BenchmarkScatterChart";
|
|
665
|
+
//#endregion
|
|
666
|
+
export { BenchmarkScatterChart as default };
|
|
667
|
+
|
|
668
|
+
//# sourceMappingURL=index.mjs.map
|