@lobehub/charts 6.0.0-beta.1 → 6.0.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/README.md +83 -72
- package/es/AccuracyBarChart/index.d.mts +62 -0
- package/es/AccuracyBarChart/index.mjs +324 -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 +306 -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 +288 -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 +126 -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 +512 -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 +345 -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 +666 -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 +252 -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 +144 -0
- package/es/DataBars/CategoryBar.mjs.map +1 -0
- package/es/DataBars/DeltaBar.d.mts +16 -0
- package/es/DataBars/DeltaBar.mjs +100 -0
- package/es/DataBars/DeltaBar.mjs.map +1 -0
- package/es/DataBars/MarkerBar.d.mts +19 -0
- package/es/DataBars/MarkerBar.mjs +72 -0
- package/es/DataBars/MarkerBar.mjs.map +1 -0
- package/es/DataBars/ProgressBar.d.mts +15 -0
- package/es/DataBars/ProgressBar.mjs +51 -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 +158 -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 +419 -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 +107 -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 +186 -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 +63 -0
- package/es/Legend/LegendItem.mjs.map +1 -0
- package/es/Legend/ScrollButton.d.mts +11 -0
- package/es/Legend/ScrollButton.mjs +49 -0
- package/es/Legend/ScrollButton.mjs.map +1 -0
- package/es/Legend/index.d.mts +16 -0
- package/es/Legend/index.mjs +151 -0
- package/es/Legend/index.mjs.map +1 -0
- package/es/LineChart/index.d.mts +11 -0
- package/es/LineChart/index.mjs +269 -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 +155 -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 +50 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs +34 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
- package/es/ScatterChart/index.d.mts +58 -0
- package/es/ScatterChart/index.mjs +239 -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 +107 -0
- package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
- package/es/SparkChart/SparkBarChart.d.mts +11 -0
- package/es/SparkChart/SparkBarChart.mjs +67 -0
- package/es/SparkChart/SparkBarChart.mjs.map +1 -0
- package/es/SparkChart/SparkLineChart.d.mts +12 -0
- package/es/SparkChart/SparkLineChart.mjs +71 -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 +50 -0
- package/es/Tracker/TrackerBlock.mjs.map +1 -0
- package/es/Tracker/index.d.mts +21 -0
- package/es/Tracker/index.mjs +67 -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 +26 -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 +49 -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 +48 -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 +144 -5
- package/es/AccuracyBarChart/index.d.ts +0 -60
- package/es/AccuracyBarChart/index.js +0 -452
- 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 -428
- 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 -390
- 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 -172
- 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 -684
- 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 -453
- 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 -855
- 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 -333
- 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 -199
- package/es/DataBars/DeltaBar.d.ts +0 -13
- package/es/DataBars/DeltaBar.js +0 -115
- package/es/DataBars/MarkerBar.d.ts +0 -16
- package/es/DataBars/MarkerBar.js +0 -92
- package/es/DataBars/ProgressBar.d.ts +0 -12
- package/es/DataBars/ProgressBar.js +0 -69
- 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 -230
- 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 -497
- 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 -154
- 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 -225
- 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 -56
- package/es/Legend/ScrollButton.d.ts +0 -9
- package/es/Legend/ScrollButton.js +0 -62
- package/es/Legend/index.d.ts +0 -14
- package/es/Legend/index.js +0 -183
- package/es/Legend/index.mdx +0 -13
- package/es/LineChart/index.d.ts +0 -9
- package/es/LineChart/index.js +0 -386
- 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 -252
- 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 -74
- package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
- package/es/ScatterChart/ScatterChartTooltipRow.js +0 -38
- package/es/ScatterChart/index.d.ts +0 -56
- package/es/ScatterChart/index.js +0 -340
- 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 -146
- package/es/SparkChart/SparkBarChart.d.ts +0 -9
- package/es/SparkChart/SparkBarChart.js +0 -104
- package/es/SparkChart/SparkLineChart.d.ts +0 -10
- package/es/SparkChart/SparkLineChart.js +0 -108
- 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 -62
- package/es/Tracker/index.d.ts +0 -18
- package/es/Tracker/index.js +0 -103
- 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 -31
- package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
- package/es/common/ChartTooltip/ChartTooltipRow.js +0 -53
- package/es/common/ChartTooltip/index.d.ts +0 -15
- package/es/common/ChartTooltip/index.js +0 -64
- 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/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 @@
|
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":[],"sources":["../../src/BarList/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nconst prefixCls = 'ant';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n bar: css`\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n max-width: 100%;\n height: 100%;\n border-radius: ${cssVar.borderRadius};\n\n opacity: 0.25;\n\n transition: all 0.25s ${cssVar.motionEaseInOut};\n `,\n barContainer: css`\n position: relative;\n `,\n barHover: css`\n &:hover {\n .${prefixCls}-chart-bar-item {\n opacity: 0.4;\n }\n }\n `,\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextDescription};\n `,\n sourceALabel: css`\n font-size: 14px;\n line-height: 16px;\n color: ${cssVar.colorText} !important;\n\n &:hover {\n color: ${cssVar.colorLinkHover} !important;\n }\n `,\n sourceLabel: css`\n font-size: 14px;\n line-height: 16px;\n color: ${cssVar.colorText};\n `,\n strongLabel: css`\n font-size: 14px;\n font-weight: 500;\n line-height: 16px;\n color: ${cssVar.colorText};\n `,\n}));\n"],"mappings":";;AAEA,MAAM,YAAY;AAElB,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,KAAK,GAAG;;;;;;;;qBAQW,OAAO,aAAa;;;;4BAIb,OAAO,gBAAgB;;CAEjD,cAAc,GAAG;;;CAGjB,UAAU,GAAG;;SAEN,UAAU;;;;;CAKjB,UAAU,GAAG;;;;;CAKb,OAAO,GAAG;;;aAGC,OAAO,qBAAqB;;CAEvC,cAAc,GAAG;;;aAGN,OAAO,UAAU;;;eAGf,OAAO,eAAe;;;CAGnC,aAAa,GAAG;;;aAGL,OAAO,UAAU;;CAE5B,aAAa,GAAG;;;;aAIL,OAAO,UAAU;;AAE9B,EAAE"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { BenchmarkBaseProps, NormalizedBenchmarkItem } from "../common/benchmark/types.mjs";
|
|
2
|
+
import "../common/benchmark/index.mjs";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/BenchmarkColumnChart/index.d.ts
|
|
5
|
+
export interface BenchmarkColumnChartProps extends BenchmarkBaseProps {
|
|
6
|
+
animationDuration?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Auto-compute Y min
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
autoMinValue?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Gap between bar categories
|
|
14
|
+
* @default '10%'
|
|
15
|
+
*/
|
|
16
|
+
barCategoryGap?: string | number;
|
|
17
|
+
/**
|
|
18
|
+
* Display name for the bar series in legend / tooltip.
|
|
19
|
+
* Pass `false` or `''` to hide from the legend (tooltip still uses a fallback).
|
|
20
|
+
* @default 'Score'
|
|
21
|
+
*/
|
|
22
|
+
barName?: string | false;
|
|
23
|
+
/**
|
|
24
|
+
* Rounded top corners radius
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
barRadius?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Fallback colors when items omit per-item color
|
|
30
|
+
*/
|
|
31
|
+
colors?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Rotate X-axis labels
|
|
34
|
+
* @default -66
|
|
35
|
+
*/
|
|
36
|
+
labelAngle?: number;
|
|
37
|
+
/**
|
|
38
|
+
* X-axis label font size
|
|
39
|
+
* @default 11
|
|
40
|
+
*/
|
|
41
|
+
labelFontSize?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Height reserved for icons + X-axis labels (via XAxis height)
|
|
44
|
+
* @default auto from label length / angle
|
|
45
|
+
*/
|
|
46
|
+
labelHeight?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Color of the overlay line
|
|
49
|
+
* @default theme.gold
|
|
50
|
+
*/
|
|
51
|
+
lineColor?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Secondary line-series field
|
|
54
|
+
* @default 'line'
|
|
55
|
+
*/
|
|
56
|
+
lineKey?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Display name for the line series in legend / tooltip.
|
|
59
|
+
* Pass `false` or `''` to hide from the legend (tooltip still uses a fallback).
|
|
60
|
+
* @default 'Overall'
|
|
61
|
+
*/
|
|
62
|
+
lineName?: string | false;
|
|
63
|
+
/**
|
|
64
|
+
* Override Y domain max
|
|
65
|
+
*/
|
|
66
|
+
maxValue?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Override Y domain min
|
|
69
|
+
* @default 0
|
|
70
|
+
*/
|
|
71
|
+
minValue?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Minimum chart width; enables horizontal scroll when container is narrower
|
|
74
|
+
*/
|
|
75
|
+
minWidth?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Custom rank renderer. Default is `#${rank}`.
|
|
78
|
+
*/
|
|
79
|
+
renderRank?: (item: NormalizedBenchmarkItem) => ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Show AccuracyBar-style error bars
|
|
82
|
+
* @default true
|
|
83
|
+
*/
|
|
84
|
+
showErrorBars?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Show dashed horizontal grid lines
|
|
87
|
+
* @default true
|
|
88
|
+
*/
|
|
89
|
+
showGridLines?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Show legend when a line series is present
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
showLegend?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Show overlay line series when data includes line values
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
showLine?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Show numeric labels above line points
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
showLineLabel?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Show rank under each column (bottom of X-axis labels)
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
showRank?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Show tooltip
|
|
112
|
+
* @default true
|
|
113
|
+
*/
|
|
114
|
+
showTooltip?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Show numeric labels on bars
|
|
117
|
+
* @default true
|
|
118
|
+
*/
|
|
119
|
+
showValueLabel?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Show X axis line (category labels stay visible)
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
showXAxis?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Show Y axis line + value ticks
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
showYAxis?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Annotation shown near the unranked separator.
|
|
132
|
+
* Pass `false` or `''` to hide.
|
|
133
|
+
*/
|
|
134
|
+
unrankedLabel?: string | false;
|
|
135
|
+
/**
|
|
136
|
+
* Font size for numeric labels on bars
|
|
137
|
+
* @default 12
|
|
138
|
+
*/
|
|
139
|
+
valueLabelFontSize?: number;
|
|
140
|
+
}
|
|
141
|
+
declare const BenchmarkColumnChart: import("react").ForwardRefExoticComponent<BenchmarkColumnChartProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
142
|
+
//#endregion
|
|
143
|
+
export { BenchmarkColumnChart as default };
|
|
144
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,512 @@
|
|
|
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, deepEqual, getYAxisDomain } from "../common/utils.mjs";
|
|
6
|
+
import { getTextWidth } from "../utils/getMaxLabelLength.mjs";
|
|
7
|
+
import { defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, splitBenchmarkLabel } from "../common/benchmark/utils.mjs";
|
|
8
|
+
import { styles } from "./styles.mjs";
|
|
9
|
+
import { Flexbox, Skeleton, cssVar, cx, useTheme } from "@lobehub/ui";
|
|
10
|
+
import { forwardRef, useMemo, useState } from "react";
|
|
11
|
+
import { Bar, CartesianGrid, Cell, ComposedChart, ErrorBar, LabelList, Line, ReferenceLine, ResponsiveContainer, Tooltip as Tooltip$1, XAxis, YAxis } from "recharts";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { readableColor } from "polished";
|
|
14
|
+
//#region src/BenchmarkColumnChart/index.tsx
|
|
15
|
+
const RoundedTopBar = (props) => {
|
|
16
|
+
const { fill, x, y, width, height, radius = 0 } = props;
|
|
17
|
+
if (height <= 0) return null;
|
|
18
|
+
if (!radius) return /* @__PURE__ */ jsx("rect", {
|
|
19
|
+
fill,
|
|
20
|
+
height,
|
|
21
|
+
width,
|
|
22
|
+
x,
|
|
23
|
+
y
|
|
24
|
+
});
|
|
25
|
+
const r = Math.min(radius, width / 2, height);
|
|
26
|
+
const path = `
|
|
27
|
+
M${x},${y + height}
|
|
28
|
+
L${x},${y + r}
|
|
29
|
+
Q${x},${y} ${x + r},${y}
|
|
30
|
+
L${x + width - r},${y}
|
|
31
|
+
Q${x + width},${y} ${x + width},${y + r}
|
|
32
|
+
L${x + width},${y + height}
|
|
33
|
+
Z
|
|
34
|
+
`;
|
|
35
|
+
return /* @__PURE__ */ jsx("path", {
|
|
36
|
+
d: path,
|
|
37
|
+
fill
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const BenchmarkColumnChart = forwardRef((props, ref) => {
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
const themeColorRange = useThemeColorRange();
|
|
43
|
+
const { data = [], index, valueKey, providerKey, iconKey, colorKey, errorKey, lineKey, renderIcon, colors = themeColorRange, valueFormatter = defaultBenchmarkValueFormatter, accuracyFormatter, errorFormatter = defaultBenchmarkErrorFormatter, showError = true, showErrorBars = true, showAnimation = false, animationDuration = 900, onValueChange, sortOrder = "descending", className, style, loading, width = "100%", height = 320, noDataText, barCategoryGap = "10%", barRadius = 0, barName, lineName, lineColor, minWidth, maxValue, minValue = 0, autoMinValue = false, labelAngle = -66, labelFontSize = 11, showGridLines = true, showValueLabel = true, valueLabelFontSize = 12, showRank = false, renderRank, showLine = true, showLineLabel = true, showLegend = true, unrankedLabel, showXAxis = false, showYAxis = false, showTooltip = true, highlightColor, ...rest } = props;
|
|
44
|
+
const [activeBar, setActiveBar] = useState();
|
|
45
|
+
const displayFormatter = accuracyFormatter ?? valueFormatter;
|
|
46
|
+
const enableError = showError && showErrorBars;
|
|
47
|
+
const resolvedHighlightColor = highlightColor ?? theme.gold;
|
|
48
|
+
const legendBarName = barName === false || barName === "" ? null : barName ?? "Score";
|
|
49
|
+
const legendLineName = lineName === false || lineName === "" ? null : lineName ?? "Overall";
|
|
50
|
+
const tooltipBarName = legendBarName ?? "Score";
|
|
51
|
+
const tooltipLineName = legendLineName ?? "Overall";
|
|
52
|
+
const resolvedUnrankedLabel = unrankedLabel === false || unrankedLabel === "" ? null : unrankedLabel ?? null;
|
|
53
|
+
const items = useMemo(() => normalizeBenchmarkData({
|
|
54
|
+
colorKey,
|
|
55
|
+
data,
|
|
56
|
+
errorKey,
|
|
57
|
+
iconKey,
|
|
58
|
+
index,
|
|
59
|
+
lineKey,
|
|
60
|
+
providerKey,
|
|
61
|
+
renderIcon,
|
|
62
|
+
sortOrder,
|
|
63
|
+
valueKey
|
|
64
|
+
}), [
|
|
65
|
+
colorKey,
|
|
66
|
+
data,
|
|
67
|
+
errorKey,
|
|
68
|
+
iconKey,
|
|
69
|
+
index,
|
|
70
|
+
lineKey,
|
|
71
|
+
providerKey,
|
|
72
|
+
renderIcon,
|
|
73
|
+
sortOrder,
|
|
74
|
+
valueKey
|
|
75
|
+
]);
|
|
76
|
+
const chartData = useMemo(() => items.map((item) => ({
|
|
77
|
+
...item.original,
|
|
78
|
+
__color: item.color,
|
|
79
|
+
__error: item.error,
|
|
80
|
+
__icon: item.icon,
|
|
81
|
+
__key: item.key,
|
|
82
|
+
__line: item.unranked ? null : item.lineValue ?? null,
|
|
83
|
+
__lineSolo: item.unranked ? item.lineValue ?? null : null,
|
|
84
|
+
__name: item.name,
|
|
85
|
+
__provider: item.provider,
|
|
86
|
+
__rank: item.rank,
|
|
87
|
+
__unranked: item.unranked,
|
|
88
|
+
__value: item.value
|
|
89
|
+
})), [items]);
|
|
90
|
+
const enableLine = showLine && items.some((item) => item.lineValue !== void 0 && item.lineValue !== null);
|
|
91
|
+
const firstUnrankedKey = items.find((item) => item.unranked)?.key;
|
|
92
|
+
const resolvedLineColor = lineColor ?? theme.gold;
|
|
93
|
+
const itemMap = useMemo(() => {
|
|
94
|
+
const map = /* @__PURE__ */ new Map();
|
|
95
|
+
for (const item of items) map.set(item.key, item);
|
|
96
|
+
return map;
|
|
97
|
+
}, [items]);
|
|
98
|
+
const resolvedMaxValue = useMemo(() => getBenchmarkMaxValue(items, maxValue), [items, maxValue]);
|
|
99
|
+
const yAxisDomain = getYAxisDomain(autoMinValue, minValue, resolvedMaxValue || void 0);
|
|
100
|
+
const categoryColors = constructCategoryColors(items.map((item) => String(item.key)), colors);
|
|
101
|
+
const chartMinWidth = minWidth ?? Math.max(items.length * 52, 320);
|
|
102
|
+
const numericHeight = typeof height === "number" ? height : 360;
|
|
103
|
+
const RANK_GAP = 12;
|
|
104
|
+
const BOTTOM_PAD = 16;
|
|
105
|
+
const SIDE_PAD_MIN = 24;
|
|
106
|
+
const { resolvedLabelHeight, rankY, sidePad } = useMemo(() => {
|
|
107
|
+
const lineHeight = Math.ceil(labelFontSize * 1.25);
|
|
108
|
+
const widthScale = labelFontSize / 12;
|
|
109
|
+
const absAngle = Math.abs(labelAngle);
|
|
110
|
+
const radians = absAngle * Math.PI / 180;
|
|
111
|
+
let maxProjected = 0;
|
|
112
|
+
let maxOverhang = 0;
|
|
113
|
+
for (const item of items) {
|
|
114
|
+
const { lineCount, longestWidth } = getBenchmarkLabelMetrics(item.name);
|
|
115
|
+
const scaledWidth = longestWidth * widthScale;
|
|
116
|
+
const blockHeight = lineCount * lineHeight;
|
|
117
|
+
const projected = scaledWidth * Math.sin(radians) + blockHeight * Math.cos(radians) + (item.icon ? 36 : 12);
|
|
118
|
+
maxProjected = Math.max(maxProjected, projected);
|
|
119
|
+
if (absAngle < 20) maxOverhang = Math.max(maxOverhang, 8);
|
|
120
|
+
else maxOverhang = Math.max(maxOverhang, scaledWidth * Math.cos(radians) * .55);
|
|
121
|
+
}
|
|
122
|
+
const labelBlock = Math.ceil(maxProjected + 16);
|
|
123
|
+
const autoHeight = labelBlock + (showRank ? 34 : 0);
|
|
124
|
+
const maxLabelBudget = Math.max(120, Math.floor(numericHeight * .48));
|
|
125
|
+
const height = Math.min(maxLabelBudget, props.labelHeight ? Math.max(props.labelHeight, autoHeight) : autoHeight);
|
|
126
|
+
return {
|
|
127
|
+
rankY: showRank ? Math.min(height - 8, labelBlock + RANK_GAP + 12) : 0,
|
|
128
|
+
resolvedLabelHeight: height,
|
|
129
|
+
sidePad: Math.min(56, Math.max(SIDE_PAD_MIN, Math.ceil(maxOverhang) + 12))
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
items,
|
|
133
|
+
labelAngle,
|
|
134
|
+
labelFontSize,
|
|
135
|
+
numericHeight,
|
|
136
|
+
props.labelHeight,
|
|
137
|
+
showRank
|
|
138
|
+
]);
|
|
139
|
+
const leftPad = sidePad + (showYAxis ? 4 : 0);
|
|
140
|
+
const rightPad = Math.abs(labelAngle) >= 20 && labelAngle < 0 ? Math.max(SIDE_PAD_MIN, Math.round(sidePad * .4)) : sidePad;
|
|
141
|
+
const headerPadInline = leftPad + (showYAxis ? 40 : 0);
|
|
142
|
+
const showBarLegend = showLegend && legendBarName !== null;
|
|
143
|
+
const showLineLegend = showLegend && legendLineName !== null;
|
|
144
|
+
const showUnrankedAnnotation = firstUnrankedKey !== void 0 && resolvedUnrankedLabel !== null;
|
|
145
|
+
const showChartHeader = enableLine && (showBarLegend || showLineLegend || showUnrankedAnnotation);
|
|
146
|
+
const chartTopPad = enableLine || enableError ? showChartHeader ? 84 : 44 : 12;
|
|
147
|
+
if (loading || !data) return /* @__PURE__ */ jsx(Skeleton, {
|
|
148
|
+
height,
|
|
149
|
+
width
|
|
150
|
+
});
|
|
151
|
+
const hasOnValueChange = !!onValueChange;
|
|
152
|
+
const onBarClick = (entry, _idx, event) => {
|
|
153
|
+
event.stopPropagation();
|
|
154
|
+
if (!onValueChange) return;
|
|
155
|
+
const item = itemMap.get(entry.__key ?? entry.payload?.__key);
|
|
156
|
+
if (!item) return;
|
|
157
|
+
if (activeBar && deepEqual({
|
|
158
|
+
key: activeBar.key,
|
|
159
|
+
value: activeBar.value
|
|
160
|
+
}, {
|
|
161
|
+
key: item.key,
|
|
162
|
+
value: item.value
|
|
163
|
+
})) {
|
|
164
|
+
setActiveBar(void 0);
|
|
165
|
+
onValueChange(null);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
setActiveBar(item);
|
|
169
|
+
const payload = {
|
|
170
|
+
...item.original,
|
|
171
|
+
eventType: "bar",
|
|
172
|
+
rank: item.rank,
|
|
173
|
+
value: item.value
|
|
174
|
+
};
|
|
175
|
+
onValueChange(payload);
|
|
176
|
+
};
|
|
177
|
+
const renderTick = ({ x, y, payload }) => {
|
|
178
|
+
const item = itemMap.get(payload.value);
|
|
179
|
+
if (!item) return /* @__PURE__ */ jsx("g", {});
|
|
180
|
+
const labelY = item.icon ? 36 : 12;
|
|
181
|
+
const lines = splitBenchmarkLabel(item.name);
|
|
182
|
+
const lineHeight = Math.ceil(labelFontSize * 1.25);
|
|
183
|
+
const highlightFill = item.highlighted ? resolvedHighlightColor : void 0;
|
|
184
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
185
|
+
transform: `translate(${x},${y})`,
|
|
186
|
+
children: [
|
|
187
|
+
item.icon ? /* @__PURE__ */ jsx("foreignObject", {
|
|
188
|
+
height: 24,
|
|
189
|
+
overflow: "visible",
|
|
190
|
+
width: 28,
|
|
191
|
+
x: -14,
|
|
192
|
+
y: 4,
|
|
193
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
194
|
+
className: styles.iconWrap,
|
|
195
|
+
children: item.icon
|
|
196
|
+
})
|
|
197
|
+
}) : null,
|
|
198
|
+
/* @__PURE__ */ jsxs("text", {
|
|
199
|
+
className: styles.tickLabel,
|
|
200
|
+
fill: highlightFill,
|
|
201
|
+
fontSize: labelFontSize,
|
|
202
|
+
style: {
|
|
203
|
+
fontSize: labelFontSize,
|
|
204
|
+
...highlightFill ? { fill: highlightFill } : null
|
|
205
|
+
},
|
|
206
|
+
textAnchor: labelAngle < 0 ? "end" : labelAngle > 0 ? "start" : "middle",
|
|
207
|
+
transform: `rotate(${labelAngle}, 0, ${labelY})`,
|
|
208
|
+
x: 0,
|
|
209
|
+
y: labelY,
|
|
210
|
+
children: [/* @__PURE__ */ jsx("title", { children: String(item.name).replaceAll("\n", " ") }), lines.map((line, lineIndex) => /* @__PURE__ */ jsx("tspan", {
|
|
211
|
+
dy: lineIndex === 0 ? 4 : lineHeight,
|
|
212
|
+
x: 0,
|
|
213
|
+
children: line
|
|
214
|
+
}, `${item.key}-${lineIndex}`))]
|
|
215
|
+
}),
|
|
216
|
+
showRank ? renderRank ? /* @__PURE__ */ jsx("foreignObject", {
|
|
217
|
+
height: 20,
|
|
218
|
+
overflow: "visible",
|
|
219
|
+
width: 48,
|
|
220
|
+
x: -24,
|
|
221
|
+
y: rankY - 16,
|
|
222
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
223
|
+
className: styles.rank,
|
|
224
|
+
style: highlightFill ? { color: highlightFill } : void 0,
|
|
225
|
+
children: renderRank(item)
|
|
226
|
+
})
|
|
227
|
+
}) : /* @__PURE__ */ jsxs("text", {
|
|
228
|
+
className: styles.rank,
|
|
229
|
+
dominantBaseline: "auto",
|
|
230
|
+
fill: highlightFill,
|
|
231
|
+
fontSize: 14,
|
|
232
|
+
style: highlightFill ? { fill: highlightFill } : void 0,
|
|
233
|
+
textAnchor: "middle",
|
|
234
|
+
x: 0,
|
|
235
|
+
y: rankY,
|
|
236
|
+
children: ["#", item.rank]
|
|
237
|
+
}) : null
|
|
238
|
+
]
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
return /* @__PURE__ */ jsx(Flexbox, {
|
|
242
|
+
className: cx(styles.container, className),
|
|
243
|
+
height: numericHeight,
|
|
244
|
+
ref,
|
|
245
|
+
style: {
|
|
246
|
+
"--benchmark-header-pad-inline": `${headerPadInline}px`,
|
|
247
|
+
"--benchmark-label-font-size": `${labelFontSize}px`,
|
|
248
|
+
"--benchmark-value-label-font-size": `${valueLabelFontSize}px`,
|
|
249
|
+
"position": "relative",
|
|
250
|
+
...style
|
|
251
|
+
},
|
|
252
|
+
width,
|
|
253
|
+
...rest,
|
|
254
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
255
|
+
style: {
|
|
256
|
+
height: numericHeight,
|
|
257
|
+
minWidth: chartMinWidth,
|
|
258
|
+
position: "relative",
|
|
259
|
+
width: "100%"
|
|
260
|
+
},
|
|
261
|
+
children: [showChartHeader ? /* @__PURE__ */ jsxs("div", {
|
|
262
|
+
className: styles.chartHeader,
|
|
263
|
+
children: [showBarLegend || showLineLegend ? /* @__PURE__ */ jsxs("div", {
|
|
264
|
+
className: styles.legend,
|
|
265
|
+
children: [showBarLegend ? /* @__PURE__ */ jsxs("span", {
|
|
266
|
+
className: styles.legendItem,
|
|
267
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
268
|
+
className: styles.legendBars,
|
|
269
|
+
style: { background: cssVar.colorText }
|
|
270
|
+
}), legendBarName]
|
|
271
|
+
}) : null, showLineLegend ? /* @__PURE__ */ jsxs("span", {
|
|
272
|
+
className: styles.legendItem,
|
|
273
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
274
|
+
className: styles.legendLine,
|
|
275
|
+
style: { borderColor: resolvedLineColor }
|
|
276
|
+
}), legendLineName]
|
|
277
|
+
}) : null]
|
|
278
|
+
}) : /* @__PURE__ */ jsx("span", {}), showUnrankedAnnotation ? /* @__PURE__ */ jsx("div", {
|
|
279
|
+
className: styles.unrankedLabel,
|
|
280
|
+
children: resolvedUnrankedLabel
|
|
281
|
+
}) : null]
|
|
282
|
+
}) : null, /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
283
|
+
height: numericHeight,
|
|
284
|
+
width: "100%",
|
|
285
|
+
children: chartData.length ? /* @__PURE__ */ jsxs(ComposedChart, {
|
|
286
|
+
barCategoryGap,
|
|
287
|
+
data: chartData,
|
|
288
|
+
margin: {
|
|
289
|
+
bottom: BOTTOM_PAD,
|
|
290
|
+
left: leftPad,
|
|
291
|
+
right: rightPad,
|
|
292
|
+
top: chartTopPad
|
|
293
|
+
},
|
|
294
|
+
onClick: hasOnValueChange && activeBar ? () => {
|
|
295
|
+
setActiveBar(void 0);
|
|
296
|
+
onValueChange?.(null);
|
|
297
|
+
} : void 0,
|
|
298
|
+
children: [
|
|
299
|
+
showGridLines ? /* @__PURE__ */ jsx(CartesianGrid, {
|
|
300
|
+
className: styles.gridLines,
|
|
301
|
+
horizontal: true,
|
|
302
|
+
vertical: false
|
|
303
|
+
}) : null,
|
|
304
|
+
/* @__PURE__ */ jsx(XAxis, {
|
|
305
|
+
axisLine: showXAxis,
|
|
306
|
+
dataKey: "__key",
|
|
307
|
+
height: resolvedLabelHeight,
|
|
308
|
+
interval: 0,
|
|
309
|
+
stroke: showXAxis ? cssVar.colorBorder : void 0,
|
|
310
|
+
tick: renderTick,
|
|
311
|
+
tickLine: showXAxis
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx(YAxis, {
|
|
314
|
+
allowDecimals: true,
|
|
315
|
+
axisLine: showYAxis,
|
|
316
|
+
domain: yAxisDomain,
|
|
317
|
+
hide: !showYAxis,
|
|
318
|
+
stroke: showYAxis ? cssVar.colorBorder : void 0,
|
|
319
|
+
tick: {
|
|
320
|
+
fill: cssVar.colorTextDescription,
|
|
321
|
+
fontSize: 12
|
|
322
|
+
},
|
|
323
|
+
tickFormatter: displayFormatter,
|
|
324
|
+
tickLine: showYAxis,
|
|
325
|
+
width: showYAxis ? 40 : 0
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(Tooltip$1, {
|
|
328
|
+
content: showTooltip ? ({ active, payload }) => {
|
|
329
|
+
if (!active || !payload?.length) return null;
|
|
330
|
+
const entry = payload[0]?.payload;
|
|
331
|
+
const item = itemMap.get(entry?.__key);
|
|
332
|
+
if (!item) return null;
|
|
333
|
+
const modelName = String(item.name).replaceAll("\n", " ");
|
|
334
|
+
const title = item.provider ? String(item.provider) : accuracyFormatter ? "Accuracy" : "Score";
|
|
335
|
+
const swatch = item.color ?? categoryColors.get(String(item.key)) ?? cssVar.colorPrimary;
|
|
336
|
+
const tooltipPayload = [{
|
|
337
|
+
color: swatch,
|
|
338
|
+
dataKey: "__value",
|
|
339
|
+
name: tooltipBarName,
|
|
340
|
+
value: item.value
|
|
341
|
+
}];
|
|
342
|
+
if (enableLine && item.lineValue !== void 0) tooltipPayload.push({
|
|
343
|
+
color: resolvedLineColor,
|
|
344
|
+
dataKey: "__line",
|
|
345
|
+
name: tooltipLineName,
|
|
346
|
+
value: item.lineValue
|
|
347
|
+
});
|
|
348
|
+
return /* @__PURE__ */ jsx(ChartTooltip, {
|
|
349
|
+
active,
|
|
350
|
+
categoryColors: /* @__PURE__ */ new Map([[tooltipBarName, swatch], [tooltipLineName, resolvedLineColor]]),
|
|
351
|
+
label: item.unranked && resolvedUnrankedLabel ? `${title} · ${modelName}` : title,
|
|
352
|
+
payload: tooltipPayload,
|
|
353
|
+
valueFormatter: (val) => displayFormatter(Number(val))
|
|
354
|
+
});
|
|
355
|
+
} : void 0,
|
|
356
|
+
cursor: { fill: cssVar.colorFillTertiary },
|
|
357
|
+
isAnimationActive: false,
|
|
358
|
+
wrapperStyle: { outline: "none" }
|
|
359
|
+
}),
|
|
360
|
+
firstUnrankedKey !== void 0 ? /* @__PURE__ */ jsx(ReferenceLine, {
|
|
361
|
+
ifOverflow: "extendDomain",
|
|
362
|
+
position: "start",
|
|
363
|
+
stroke: cssVar.colorBorder,
|
|
364
|
+
strokeDasharray: "4 4",
|
|
365
|
+
x: firstUnrankedKey
|
|
366
|
+
}) : null,
|
|
367
|
+
/* @__PURE__ */ jsxs(Bar, {
|
|
368
|
+
animationDuration,
|
|
369
|
+
dataKey: "__value",
|
|
370
|
+
isAnimationActive: showAnimation,
|
|
371
|
+
name: tooltipBarName,
|
|
372
|
+
onClick: onBarClick,
|
|
373
|
+
shape: (shapeProps) => /* @__PURE__ */ jsx(RoundedTopBar, {
|
|
374
|
+
...shapeProps,
|
|
375
|
+
radius: barRadius
|
|
376
|
+
}),
|
|
377
|
+
style: { cursor: onValueChange ? "pointer" : void 0 },
|
|
378
|
+
children: [
|
|
379
|
+
chartData.map((entry) => {
|
|
380
|
+
const fill = entry.__color ?? categoryColors.get(String(entry.__key)) ?? cssVar.colorPrimary;
|
|
381
|
+
const dimmed = activeBar && activeBar.key !== entry.__key;
|
|
382
|
+
return /* @__PURE__ */ jsx(Cell, {
|
|
383
|
+
fill,
|
|
384
|
+
fillOpacity: dimmed ? .35 : 1
|
|
385
|
+
}, String(entry.__key));
|
|
386
|
+
}),
|
|
387
|
+
showValueLabel ? /* @__PURE__ */ jsx(LabelList, {
|
|
388
|
+
content: (labelProps) => {
|
|
389
|
+
const { x, y, width: barWidth, height: barHeight, value, index: barIndex } = labelProps;
|
|
390
|
+
const entry = chartData[barIndex];
|
|
391
|
+
if (x === void 0 || y === void 0 || barWidth === void 0 || barHeight === void 0) return null;
|
|
392
|
+
const text = displayFormatter(Number(value ?? 0));
|
|
393
|
+
const textWidth = getTextWidth(text) * (valueLabelFontSize / 12);
|
|
394
|
+
const labelInset = enableError ? 18 : 8;
|
|
395
|
+
if (Number(barWidth) < textWidth + 8 || Number(barHeight) < labelInset + valueLabelFontSize + 2) return null;
|
|
396
|
+
const fill = entry?.__color ?? categoryColors.get(String(entry?.__key)) ?? cssVar.colorPrimary;
|
|
397
|
+
let labelFill = cssVar.colorTextLightSolid;
|
|
398
|
+
try {
|
|
399
|
+
labelFill = readableColor(fill, "#000000", "#ffffff", false);
|
|
400
|
+
} catch {}
|
|
401
|
+
return /* @__PURE__ */ jsx("text", {
|
|
402
|
+
className: styles.valueLabel,
|
|
403
|
+
dominantBaseline: "hanging",
|
|
404
|
+
fill: labelFill,
|
|
405
|
+
fontSize: valueLabelFontSize,
|
|
406
|
+
style: { fontSize: valueLabelFontSize },
|
|
407
|
+
textAnchor: "middle",
|
|
408
|
+
x: Number(x) + Number(barWidth) / 2,
|
|
409
|
+
y: Number(y) + labelInset,
|
|
410
|
+
children: text
|
|
411
|
+
});
|
|
412
|
+
},
|
|
413
|
+
dataKey: "__value",
|
|
414
|
+
position: "insideTop"
|
|
415
|
+
}) : null,
|
|
416
|
+
enableError ? /* @__PURE__ */ jsx(ErrorBar, {
|
|
417
|
+
dataKey: "__error",
|
|
418
|
+
direction: "y",
|
|
419
|
+
stroke: "#ffffff",
|
|
420
|
+
strokeWidth: 1.5,
|
|
421
|
+
width: 4
|
|
422
|
+
}) : null
|
|
423
|
+
]
|
|
424
|
+
}),
|
|
425
|
+
enableLine ? /* @__PURE__ */ jsx(Line, {
|
|
426
|
+
activeDot: { r: 5 },
|
|
427
|
+
connectNulls: false,
|
|
428
|
+
dataKey: "__line",
|
|
429
|
+
dot: (dotProps) => {
|
|
430
|
+
const { cx, cy, payload, value } = dotProps;
|
|
431
|
+
if (value === void 0 || value === null || cx === void 0 || cy === void 0) return /* @__PURE__ */ jsx("g", {}, `dot-${payload?.__key ?? "x"}`);
|
|
432
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
433
|
+
cx,
|
|
434
|
+
cy,
|
|
435
|
+
fill: cssVar.colorBgContainer,
|
|
436
|
+
r: 4,
|
|
437
|
+
stroke: resolvedLineColor,
|
|
438
|
+
strokeWidth: 1.5
|
|
439
|
+
}, `dot-${payload.__key}`);
|
|
440
|
+
},
|
|
441
|
+
isAnimationActive: showAnimation,
|
|
442
|
+
name: tooltipLineName,
|
|
443
|
+
stroke: resolvedLineColor,
|
|
444
|
+
strokeWidth: 2,
|
|
445
|
+
type: "monotone",
|
|
446
|
+
children: showLineLabel ? /* @__PURE__ */ jsx(LabelList, {
|
|
447
|
+
content: (labelProps) => {
|
|
448
|
+
const { x, y, value } = labelProps;
|
|
449
|
+
if (value === void 0 || value === null || x === void 0 || y === void 0) return null;
|
|
450
|
+
return /* @__PURE__ */ jsx("text", {
|
|
451
|
+
className: styles.lineLabel,
|
|
452
|
+
fill: resolvedLineColor,
|
|
453
|
+
fontSize: valueLabelFontSize,
|
|
454
|
+
textAnchor: "middle",
|
|
455
|
+
x: Number(x),
|
|
456
|
+
y: Number(y) - 10,
|
|
457
|
+
children: displayFormatter(Number(value))
|
|
458
|
+
});
|
|
459
|
+
},
|
|
460
|
+
dataKey: "__line",
|
|
461
|
+
position: "top"
|
|
462
|
+
}) : null
|
|
463
|
+
}) : null,
|
|
464
|
+
enableLine ? /* @__PURE__ */ jsx(Line, {
|
|
465
|
+
connectNulls: false,
|
|
466
|
+
dataKey: "__lineSolo",
|
|
467
|
+
dot: (dotProps) => {
|
|
468
|
+
const { cx, cy, payload, value } = dotProps;
|
|
469
|
+
if (value === void 0 || value === null || cx === void 0 || cy === void 0) return /* @__PURE__ */ jsx("g", {}, `solo-${payload?.__key ?? "x"}`);
|
|
470
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
471
|
+
cx,
|
|
472
|
+
cy,
|
|
473
|
+
fill: cssVar.colorBgContainer,
|
|
474
|
+
r: 4,
|
|
475
|
+
stroke: resolvedLineColor,
|
|
476
|
+
strokeWidth: 1.5
|
|
477
|
+
}, `solo-${payload.__key}`);
|
|
478
|
+
},
|
|
479
|
+
isAnimationActive: false,
|
|
480
|
+
legendType: "none",
|
|
481
|
+
stroke: "transparent",
|
|
482
|
+
strokeWidth: 0,
|
|
483
|
+
type: "monotone",
|
|
484
|
+
children: showLineLabel ? /* @__PURE__ */ jsx(LabelList, {
|
|
485
|
+
content: (labelProps) => {
|
|
486
|
+
const { x, y, value } = labelProps;
|
|
487
|
+
if (value === void 0 || value === null || x === void 0 || y === void 0) return null;
|
|
488
|
+
return /* @__PURE__ */ jsx("text", {
|
|
489
|
+
className: styles.lineLabel,
|
|
490
|
+
fill: resolvedLineColor,
|
|
491
|
+
fontSize: valueLabelFontSize,
|
|
492
|
+
textAnchor: "middle",
|
|
493
|
+
x: Number(x),
|
|
494
|
+
y: Number(y) - 10,
|
|
495
|
+
children: displayFormatter(Number(value))
|
|
496
|
+
});
|
|
497
|
+
},
|
|
498
|
+
dataKey: "__lineSolo",
|
|
499
|
+
position: "top"
|
|
500
|
+
}) : null
|
|
501
|
+
}) : null
|
|
502
|
+
]
|
|
503
|
+
}) : /* @__PURE__ */ jsx(NoData, { noDataText })
|
|
504
|
+
})]
|
|
505
|
+
})
|
|
506
|
+
});
|
|
507
|
+
});
|
|
508
|
+
BenchmarkColumnChart.displayName = "BenchmarkColumnChart";
|
|
509
|
+
//#endregion
|
|
510
|
+
export { BenchmarkColumnChart as default };
|
|
511
|
+
|
|
512
|
+
//# sourceMappingURL=index.mjs.map
|