@lobehub/charts 5.5.1 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/es/AccuracyBarChart/index.js +3 -3
  2. package/es/AreaChart/index.js +3 -3
  3. package/es/BarChart/index.js +3 -3
  4. package/es/BarList/index.js +3 -3
  5. package/es/BenchmarkColumnChart/index.js +3 -3
  6. package/es/BenchmarkRankingChart/index.js +11 -4
  7. package/es/BenchmarkScatterChart/index.d.ts +145 -0
  8. package/es/BenchmarkScatterChart/index.js +857 -0
  9. package/es/BenchmarkScatterChart/index.mdx +61 -0
  10. package/es/BenchmarkScatterChart/styles.d.ts +25 -0
  11. package/es/BenchmarkScatterChart/styles.js +33 -0
  12. package/es/BenchmarkScatterChart/utils.d.ts +55 -0
  13. package/es/BenchmarkScatterChart/utils.js +353 -0
  14. package/es/ComposedChart/index.js +3 -3
  15. package/es/DataBars/CategoryBar.js +2 -1
  16. package/es/DataBars/DeltaBar.js +2 -1
  17. package/es/DataBars/MarkerBar.js +2 -1
  18. package/es/DataBars/ProgressBar.js +2 -1
  19. package/es/DonutChart/index.js +3 -3
  20. package/es/FunnelChart/index.js +3 -3
  21. package/es/Heatmaps/Calendar.js +1 -1
  22. package/es/Heatmaps/index.js +2 -1
  23. package/es/Legend/LegendItem.js +2 -2
  24. package/es/Legend/ScrollButton.js +1 -1
  25. package/es/LineChart/index.js +3 -3
  26. package/es/RadarChart/index.js +3 -3
  27. package/es/ScatterChart/ScatterChartTooltip.js +2 -2
  28. package/es/ScatterChart/ScatterChartTooltipRow.js +3 -3
  29. package/es/ScatterChart/index.js +3 -3
  30. package/es/SparkChart/SparkAreaChart.js +3 -3
  31. package/es/SparkChart/SparkBarChart.js +3 -3
  32. package/es/SparkChart/SparkLineChart.js +3 -3
  33. package/es/Tracker/TrackerBlock.js +2 -1
  34. package/es/Tracker/index.js +2 -1
  35. package/es/common/ChartTooltip/ChartTooltipRow.js +3 -3
  36. package/es/common/ChartTooltip/index.js +2 -2
  37. package/es/common/NoData.js +5 -22
  38. package/es/common/benchmark/index.d.ts +1 -1
  39. package/es/common/benchmark/types.d.ts +6 -1
  40. package/es/index.d.ts +2 -1
  41. package/es/index.js +1 -0
  42. package/package.json +4 -4
@@ -17,7 +17,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
19
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
- import { Flexbox, Skeleton } from '@lobehub/ui';
20
+ import { Flexbox } from '@lobehub/ui';
21
+ import { Skeleton } from '@lobehub/ui/base-ui';
21
22
  import { css, cssVar, cx } from 'antd-style';
22
23
  import { forwardRef, useMemo, useState } from 'react';
23
24
  import { Bar, CartesianGrid, ErrorBar, Label, LabelList, Legend, BarChart as ReChartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
@@ -134,8 +135,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
134
135
  valueFormatter: xAxisLabelFormatter
135
136
  });
136
137
  }, [yAxisWidth, layout, data, xAxisLabelFormatter, index]);
137
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
138
- active: true,
138
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
139
139
  height: height,
140
140
  width: width
141
141
  });
@@ -17,7 +17,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
19
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
- import { Flexbox, Skeleton } from '@lobehub/ui';
20
+ import { Flexbox } from '@lobehub/ui';
21
+ import { Skeleton } from '@lobehub/ui/base-ui';
21
22
  import { css, cssVar, cx } from 'antd-style';
22
23
  import { Fragment, forwardRef, useMemo, useState } from 'react';
23
24
  import { Area, CartesianGrid, Dot, Label, Legend, Line, AreaChart as ReChartsAreaChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
@@ -121,8 +122,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
121
122
  valueFormatter: valueFormatter
122
123
  });
123
124
  }, [yAxisWidth, data, valueFormatter, index]);
124
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
125
- active: true,
125
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
126
126
  height: height,
127
127
  width: width
128
128
  });
@@ -17,7 +17,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
19
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
- import { Flexbox, Skeleton } from '@lobehub/ui';
20
+ import { Flexbox } from '@lobehub/ui';
21
+ import { Skeleton } from '@lobehub/ui/base-ui';
21
22
  import { css, cssVar, cx } from 'antd-style';
22
23
  import { forwardRef, useMemo, useState } from 'react';
23
24
  import { Bar, CartesianGrid, Label, Legend, BarChart as ReChartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
@@ -118,8 +119,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
118
119
  valueFormatter: valueFormatter
119
120
  });
120
121
  }, [yAxisWidth, layout, data, valueFormatter, index]);
121
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
122
- active: true,
122
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
123
123
  height: height,
124
124
  width: width
125
125
  });
@@ -15,7 +15,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
15
15
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
16
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
17
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
18
- import { A, Flexbox, Skeleton } from '@lobehub/ui';
18
+ import { A, Flexbox } from '@lobehub/ui';
19
+ import { Skeleton } from '@lobehub/ui/base-ui';
19
20
  import { cssVar, cx } from 'antd-style';
20
21
  import React, { forwardRef, useMemo } from 'react';
21
22
  import NoData from "../common/NoData";
@@ -62,8 +63,7 @@ var BarList = /*#__PURE__*/forwardRef(function (props, ref) {
62
63
  return item.value === 0 ? 0 : Math.max(item.value / maxValue * 100, 2);
63
64
  });
64
65
  }, [sortedData]);
65
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
66
- active: true,
66
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
67
67
  height: height,
68
68
  width: width
69
69
  });
@@ -16,7 +16,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
18
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
- import { Flexbox, Skeleton } from '@lobehub/ui';
19
+ import { Flexbox } from '@lobehub/ui';
20
+ import { Skeleton } from '@lobehub/ui/base-ui';
20
21
  import { cssVar, cx, useTheme } from 'antd-style';
21
22
  import { readableColor } from 'polished';
22
23
  import { forwardRef, useMemo, useState } from 'react';
@@ -276,8 +277,7 @@ var BenchmarkColumnChart = /*#__PURE__*/forwardRef(function (props, ref) {
276
277
  var showUnrankedAnnotation = firstUnrankedKey !== undefined && resolvedUnrankedLabel !== null;
277
278
  var showChartHeader = enableLine && (showBarLegend || showLineLegend || showUnrankedAnnotation);
278
279
  var chartTopPad = enableLine || enableError ? showChartHeader ? 84 : 44 : 12;
279
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
280
- active: true,
280
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
281
281
  height: height,
282
282
  width: width
283
283
  });
@@ -19,8 +19,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
19
19
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
20
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
21
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
- import { A, Flexbox, Skeleton } from '@lobehub/ui';
23
- import { Tooltip } from 'antd';
22
+ import { A, Flexbox } from '@lobehub/ui';
23
+ import { Skeleton, Tooltip } from '@lobehub/ui/base-ui';
24
24
  import { cssVar, cx, useTheme } from 'antd-style';
25
25
  import { forwardRef, useMemo, useState } from 'react';
26
26
  import ChartTooltip from "../common/ChartTooltip";
@@ -141,8 +141,7 @@ var BenchmarkRankingChart = /*#__PURE__*/forwardRef(function (props, ref) {
141
141
  var gridTicks = axisTicks.filter(function (tick) {
142
142
  return tick > 0 && tick < resolvedMaxValue;
143
143
  });
144
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
145
- active: true,
144
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
146
145
  height: height !== null && height !== void 0 ? height : 280,
147
146
  width: width
148
147
  });
@@ -190,6 +189,14 @@ var BenchmarkRankingChart = /*#__PURE__*/forwardRef(function (props, ref) {
190
189
  padding: 0,
191
190
  width: 'max-content'
192
191
  },
192
+ content: {
193
+ color: cssVar.colorText,
194
+ fontSize: cssVar.fontSize,
195
+ lineHeight: cssVar.lineHeight,
196
+ maxWidth: 'none',
197
+ overflow: 'visible',
198
+ padding: 0
199
+ },
193
200
  root: {
194
201
  maxWidth: 'none'
195
202
  }
@@ -0,0 +1,145 @@
1
+ /// <reference types="react" />
2
+ import { type BenchmarkBaseProps } from "../common/benchmark";
3
+ import { type ScaleType } from './utils';
4
+ export interface BenchmarkScatterMetric {
5
+ /**
6
+ * Axis title; falls back to `label`
7
+ */
8
+ axisLabel?: string;
9
+ /**
10
+ * Which direction is better on this axis (drives the Pareto frontier)
11
+ * @default 'lower'
12
+ */
13
+ direction?: 'lower' | 'higher';
14
+ formatter?: (value: number) => string;
15
+ /**
16
+ * Record field holding this metric
17
+ */
18
+ key: string;
19
+ /**
20
+ * Label shown in the metric switcher and tooltip
21
+ */
22
+ label: string;
23
+ max?: number;
24
+ min?: number;
25
+ /**
26
+ * @default 'linear'
27
+ */
28
+ scale?: ScaleType;
29
+ }
30
+ export interface BenchmarkScatterChartProps extends Omit<BenchmarkBaseProps, 'sortOrder'> {
31
+ /**
32
+ * Initially selected metric key when `metrics` is provided (uncontrolled)
33
+ */
34
+ defaultMetric?: string;
35
+ /**
36
+ * Pareto frontier line color
37
+ * @default theme.orange
38
+ */
39
+ frontierColor?: string;
40
+ /**
41
+ * @default 2
42
+ */
43
+ frontierWidth?: number;
44
+ /**
45
+ * Size of consumer-provided icons; should match the size the icon renders at.
46
+ * Icons are scaled down from this size in the legend.
47
+ * @default 20
48
+ */
49
+ iconSize?: number;
50
+ /**
51
+ * Font size for the point name label
52
+ * @default 12
53
+ */
54
+ labelFontSize?: number;
55
+ /**
56
+ * Size of the fallback shape marker when an item has no icon
57
+ * @default 12
58
+ */
59
+ markerSize?: number;
60
+ maxX?: number;
61
+ maxY?: number;
62
+ /**
63
+ * Selected metric key (controlled)
64
+ */
65
+ metric?: string;
66
+ /**
67
+ * Switchable X metrics (e.g. Cost / Speed). Overrides `xKey`, `xScale`,
68
+ * `xFormatter`, `xAxisLabel` and `xDirection` for the active metric.
69
+ */
70
+ metrics?: BenchmarkScatterMetric[];
71
+ minX?: number;
72
+ minY?: number;
73
+ onMetricChange?: (metric: string) => void;
74
+ /**
75
+ * On hover, shade the region the point dominates (worse X and lower Y)
76
+ * and gray out the points inside it. When off, all other points are dimmed instead.
77
+ * @default true
78
+ */
79
+ showDominatedArea?: boolean;
80
+ /**
81
+ * Draw vertical error bars when records have `error`
82
+ * @default true
83
+ */
84
+ showErrorBars?: boolean;
85
+ /**
86
+ * Connect non-dominated points with a Pareto frontier line
87
+ * @default true
88
+ */
89
+ showFrontier?: boolean;
90
+ /**
91
+ * @default true
92
+ */
93
+ showGridLines?: boolean;
94
+ /**
95
+ * Show name labels next to points (placed automatically to avoid overlap)
96
+ * @default true
97
+ */
98
+ showLabels?: boolean;
99
+ /**
100
+ * @default true
101
+ */
102
+ showLegend?: boolean;
103
+ /**
104
+ * @default true
105
+ */
106
+ showTooltip?: boolean;
107
+ /**
108
+ * Show `y · x` values under each point label
109
+ * @default true
110
+ */
111
+ showValueLabel?: boolean;
112
+ /**
113
+ * @default true
114
+ */
115
+ showXAxis?: boolean;
116
+ /**
117
+ * @default true
118
+ */
119
+ showYAxis?: boolean;
120
+ /**
121
+ * Font size for the `y · x` value line
122
+ * @default 11
123
+ */
124
+ valueLabelFontSize?: number;
125
+ xAxisLabel?: string;
126
+ /**
127
+ * Which direction is better on X (drives the Pareto frontier)
128
+ * @default 'lower'
129
+ */
130
+ xDirection?: 'lower' | 'higher';
131
+ xFormatter?: (value: number) => string;
132
+ /**
133
+ * Record field used for the X axis
134
+ * @default 'x'
135
+ */
136
+ xKey?: string;
137
+ /**
138
+ * X axis scale
139
+ * @default 'linear'
140
+ */
141
+ xScale?: ScaleType;
142
+ yAxisLabel?: string;
143
+ }
144
+ declare const BenchmarkScatterChart: import("react").ForwardRefExoticComponent<BenchmarkScatterChartProps & import("react").RefAttributes<HTMLDivElement>>;
145
+ export default BenchmarkScatterChart;