@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.
- package/es/AccuracyBarChart/index.js +3 -3
- package/es/AreaChart/index.js +3 -3
- package/es/BarChart/index.js +3 -3
- package/es/BarList/index.js +3 -3
- package/es/BenchmarkColumnChart/index.js +3 -3
- package/es/BenchmarkRankingChart/index.js +11 -4
- package/es/BenchmarkScatterChart/index.d.ts +145 -0
- package/es/BenchmarkScatterChart/index.js +857 -0
- package/es/BenchmarkScatterChart/index.mdx +61 -0
- package/es/BenchmarkScatterChart/styles.d.ts +25 -0
- package/es/BenchmarkScatterChart/styles.js +33 -0
- package/es/BenchmarkScatterChart/utils.d.ts +55 -0
- package/es/BenchmarkScatterChart/utils.js +353 -0
- package/es/ComposedChart/index.js +3 -3
- package/es/DataBars/CategoryBar.js +2 -1
- package/es/DataBars/DeltaBar.js +2 -1
- package/es/DataBars/MarkerBar.js +2 -1
- package/es/DataBars/ProgressBar.js +2 -1
- package/es/DonutChart/index.js +3 -3
- package/es/FunnelChart/index.js +3 -3
- package/es/Heatmaps/Calendar.js +1 -1
- package/es/Heatmaps/index.js +2 -1
- package/es/Legend/LegendItem.js +2 -2
- package/es/Legend/ScrollButton.js +1 -1
- package/es/LineChart/index.js +3 -3
- package/es/RadarChart/index.js +3 -3
- package/es/ScatterChart/ScatterChartTooltip.js +2 -2
- package/es/ScatterChart/ScatterChartTooltipRow.js +3 -3
- package/es/ScatterChart/index.js +3 -3
- package/es/SparkChart/SparkAreaChart.js +3 -3
- package/es/SparkChart/SparkBarChart.js +3 -3
- package/es/SparkChart/SparkLineChart.js +3 -3
- package/es/Tracker/TrackerBlock.js +2 -1
- package/es/Tracker/index.js +2 -1
- package/es/common/ChartTooltip/ChartTooltipRow.js +3 -3
- package/es/common/ChartTooltip/index.js +2 -2
- package/es/common/NoData.js +5 -22
- package/es/common/benchmark/index.d.ts +1 -1
- package/es/common/benchmark/types.d.ts +6 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: BenchmarkScatterChart
|
|
3
|
+
description: Quality-vs-cost scatter chart for benchmarks with a Pareto frontier, auto-placed labels, switchable X metrics and injectable brand icons.
|
|
4
|
+
category: Benchmark
|
|
5
|
+
order: 4
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import DemoIndex from './demos/index.tsx?demo';
|
|
9
|
+
import DemoShapes from './demos/shapes.tsx?demo';
|
|
10
|
+
|
|
11
|
+
<Demo of={DemoIndex} layout="bare" />
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Each record needs a Y value (`score` by default, override with `valueKey`) and an X value (`x` by default, override with `xKey`). Icons and brand colors are provided by the consumer, e.g. from `@lobehub/icons`.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { BenchmarkScatterChart } from '@lobehub/charts';
|
|
19
|
+
import { ClaudeCode, Codex } from '@lobehub/icons';
|
|
20
|
+
|
|
21
|
+
export default () => (
|
|
22
|
+
<BenchmarkScatterChart
|
|
23
|
+
accuracyFormatter={(v) => `${v.toFixed(1)}%`}
|
|
24
|
+
data={[
|
|
25
|
+
{ cost: 3.47, icon: <Codex.Avatar size={22} />, name: 'Codex', score: 66.7 },
|
|
26
|
+
{
|
|
27
|
+
color: ClaudeCode.colorPrimary,
|
|
28
|
+
cost: 18.34,
|
|
29
|
+
icon: <ClaudeCode.Avatar size={22} />,
|
|
30
|
+
name: 'Claude Code',
|
|
31
|
+
score: 63.3,
|
|
32
|
+
},
|
|
33
|
+
]}
|
|
34
|
+
xAxisLabel="Median cost per task"
|
|
35
|
+
xFormatter={(v) => `$${v}`}
|
|
36
|
+
xKey="cost"
|
|
37
|
+
xScale="log"
|
|
38
|
+
yAxisLabel="Pass rate"
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Switchable metrics
|
|
44
|
+
|
|
45
|
+
Pass `metrics` to render a switcher (e.g. Cost / Speed). Each metric defines its own record `key`, `scale`, `formatter`, `axisLabel` and `direction` (which side is better — drives the Pareto frontier). All metrics are listed in the tooltip. Use `metric` + `onMetricChange` for controlled mode, and `showAnimation` to animate points between metrics.
|
|
46
|
+
|
|
47
|
+
## Pareto frontier
|
|
48
|
+
|
|
49
|
+
With `showFrontier` (default on), points that are not dominated by any other point — no other entry is both better on X and higher on Y — are connected by a line. Set `xDirection="higher"` when larger X is better.
|
|
50
|
+
|
|
51
|
+
Hovering (or selecting) a point shades the region it dominates — worse on X and lower on Y — draws dashed guides along its edges, and grays out every point inside. Turn this off with `showDominatedArea={false}`; other points are then simply dimmed.
|
|
52
|
+
|
|
53
|
+
## Shape markers
|
|
54
|
+
|
|
55
|
+
When an item has no `icon`, a colored marker is drawn. Pick the shape per record with `shape`: `circle`, `square`, `diamond` or `triangle`.
|
|
56
|
+
|
|
57
|
+
<Demo of={DemoShapes} />
|
|
58
|
+
|
|
59
|
+
## API
|
|
60
|
+
|
|
61
|
+
<Api name="BenchmarkScatterChart" />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
axisLabel: string;
|
|
3
|
+
axisLine: string;
|
|
4
|
+
container: string;
|
|
5
|
+
dominatedArea: string;
|
|
6
|
+
dominatedGuide: string;
|
|
7
|
+
errorBar: string;
|
|
8
|
+
frontier: string;
|
|
9
|
+
gridLine: string;
|
|
10
|
+
header: string;
|
|
11
|
+
label: string;
|
|
12
|
+
labelName: string;
|
|
13
|
+
labelNameEmphasis: string;
|
|
14
|
+
labelNameLink: string;
|
|
15
|
+
labelValue: string;
|
|
16
|
+
legend: string;
|
|
17
|
+
legendItem: string;
|
|
18
|
+
legendMarker: string;
|
|
19
|
+
marker: string;
|
|
20
|
+
markerIconRing: string;
|
|
21
|
+
noTransition: string;
|
|
22
|
+
overlay: string;
|
|
23
|
+
plot: string;
|
|
24
|
+
tickLabel: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
var mono = "'Geist Mono', SFMono-Regular, Consolas, 'Liberation Mono', monospace";
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
cssVar = _ref.cssVar;
|
|
8
|
+
return {
|
|
9
|
+
axisLabel: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 12px;\n fill: ", ";\n "])), cssVar.colorTextTertiary),
|
|
10
|
+
axisLine: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])), cssVar.colorBorderSecondary),
|
|
11
|
+
container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n min-width: 0;\n "]))),
|
|
12
|
+
dominatedArea: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n animation: benchmark-scatter-fade-in 0.2s ", ";\n\n @keyframes benchmark-scatter-fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n "])), cssVar.motionEaseOut),
|
|
13
|
+
dominatedGuide: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-dasharray: 3 3;\n stroke-width: 1;\n "])), cssVar.colorTextQuaternary),
|
|
14
|
+
errorBar: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pointer-events: none;\n stroke-width: 1.5;\n "]))),
|
|
15
|
+
frontier: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n pointer-events: none;\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n "]))),
|
|
16
|
+
gridLine: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])), cssVar.colorFillTertiary),
|
|
17
|
+
header: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n gap: 16px;\n align-items: center;\n justify-content: space-between;\n\n margin-block-end: 12px;\n "]))),
|
|
18
|
+
label: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n pointer-events: auto;\n cursor: default;\n\n position: absolute;\n z-index: 2;\n\n display: flex;\n flex-direction: column;\n gap: 1px;\n justify-content: center;\n\n white-space: nowrap;\n\n transition:\n left 0.4s ", ",\n top 0.4s ", ",\n opacity 0.2s;\n "])), cssVar.motionEaseInOut, cssVar.motionEaseInOut),
|
|
19
|
+
labelName: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n overflow: hidden;\n\n font-size: var(--benchmark-label-font-size, 12px);\n font-weight: 500;\n line-height: 1.25;\n color: ", ";\n text-overflow: ellipsis;\n\n transition: color 0.2s;\n "])), cssVar.colorTextSecondary),
|
|
20
|
+
labelNameEmphasis: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n font-weight: 600;\n color: ", ";\n "])), cssVar.colorText),
|
|
21
|
+
labelNameLink: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n color: inherit !important;\n\n &:hover {\n color: ", " !important;\n }\n "])), cssVar.colorLinkHover),
|
|
22
|
+
labelValue: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n font-family: ", ";\n font-size: var(--benchmark-value-label-font-size, 11px);\n font-variant-numeric: tabular-nums;\n line-height: 1.25;\n color: ", ";\n "])), mono, cssVar.colorTextQuaternary),
|
|
23
|
+
legend: css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n flex-flow: row wrap;\n gap: 4px 12px;\n align-items: center;\n\n min-width: 0;\n\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n "])), cssVar.colorTextTertiary),
|
|
24
|
+
legendItem: css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n cursor: default;\n\n display: inline-flex;\n flex-shrink: 0;\n gap: 5px;\n align-items: center;\n\n transition:\n opacity 0.2s,\n color 0.2s;\n\n &:hover {\n color: ", ";\n }\n "])), cssVar.colorText),
|
|
25
|
+
legendMarker: css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n width: 12px;\n height: 12px;\n "]))),
|
|
26
|
+
marker: css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 3;\n transform: translate(-50%, -50%);\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n transition:\n left 0.4s ", ",\n top 0.4s ", ",\n opacity 0.2s,\n filter 0.2s,\n transform 0.2s;\n\n &:hover {\n transform: translate(-50%, -50%) scale(1.15);\n }\n "])), cssVar.motionEaseInOut, cssVar.motionEaseInOut),
|
|
27
|
+
markerIconRing: css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n border-radius: 50%;\n box-shadow: 0 0 0 2px ", ";\n "])), cssVar.colorBgContainer),
|
|
28
|
+
noTransition: css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n transition: none !important;\n "]))),
|
|
29
|
+
overlay: css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n inset: 0;\n\n > * {\n pointer-events: auto;\n }\n "]))),
|
|
30
|
+
plot: css(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n "]))),
|
|
31
|
+
tickLabel: css(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n font-family: ", ";\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n fill: ", ";\n "])), mono, cssVar.colorTextQuaternary)
|
|
32
|
+
};
|
|
33
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type ScaleType = 'linear' | 'log';
|
|
2
|
+
export interface Scale {
|
|
3
|
+
domain: [number, number];
|
|
4
|
+
map: (value: number) => number;
|
|
5
|
+
ticks: number[];
|
|
6
|
+
}
|
|
7
|
+
export declare const getLinearTicks: (min: number, max: number, count?: number) => number[];
|
|
8
|
+
export declare const getLogTicks: (min: number, max: number) => number[];
|
|
9
|
+
export declare const createScale: ({ values, type, range, min, max, padding, tickCount, }: {
|
|
10
|
+
max?: number | undefined;
|
|
11
|
+
min?: number | undefined;
|
|
12
|
+
padding?: number | undefined;
|
|
13
|
+
range: [number, number];
|
|
14
|
+
tickCount?: number | undefined;
|
|
15
|
+
type?: ScaleType | undefined;
|
|
16
|
+
values: number[];
|
|
17
|
+
}) => Scale;
|
|
18
|
+
/**
|
|
19
|
+
* Pareto frontier: points not dominated by any other point.
|
|
20
|
+
* `xDirection = 'lower'` treats smaller X as better (e.g. cost / latency).
|
|
21
|
+
* Returns keys ordered by ascending X.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getParetoFrontier: <T extends {
|
|
24
|
+
key: string | number;
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}>(points: T[], xDirection?: 'lower' | 'higher') => T[];
|
|
28
|
+
export type LabelPlacement = 'right' | 'left' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
29
|
+
export interface Box {
|
|
30
|
+
height: number;
|
|
31
|
+
width: number;
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}
|
|
35
|
+
export interface LabelCandidate {
|
|
36
|
+
height: number;
|
|
37
|
+
key: string | number;
|
|
38
|
+
px: number;
|
|
39
|
+
py: number;
|
|
40
|
+
radius: number;
|
|
41
|
+
width: number;
|
|
42
|
+
}
|
|
43
|
+
export interface PlacedLabel extends Box {
|
|
44
|
+
key: string | number;
|
|
45
|
+
placement: LabelPlacement;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Greedy label placement: candidates are processed in the given order,
|
|
49
|
+
* each picks the position with the least overlap against markers,
|
|
50
|
+
* already-placed labels and the outer bounds.
|
|
51
|
+
*/
|
|
52
|
+
export declare const placeLabels: (candidates: LabelCandidate[], bounds: Box, { gap, lines }?: {
|
|
53
|
+
gap?: number | undefined;
|
|
54
|
+
lines?: Box[] | undefined;
|
|
55
|
+
}) => Map<string | number, PlacedLabel>;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
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; }
|
|
14
|
+
var niceStep = function niceStep(range, count) {
|
|
15
|
+
if (range <= 0 || !Number.isFinite(range)) return 1;
|
|
16
|
+
var raw = range / count;
|
|
17
|
+
var magnitude = Math.pow(10, Math.floor(Math.log10(raw)));
|
|
18
|
+
var normalized = raw / magnitude;
|
|
19
|
+
var base = normalized <= 1 ? 1 : normalized <= 2 ? 2 : normalized <= 5 ? 5 : 10;
|
|
20
|
+
return base * magnitude;
|
|
21
|
+
};
|
|
22
|
+
export var getLinearTicks = function getLinearTicks(min, max) {
|
|
23
|
+
var count = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
|
|
24
|
+
var step = niceStep(max - min, count);
|
|
25
|
+
var ticks = [];
|
|
26
|
+
var start = Math.ceil(min / step) * step;
|
|
27
|
+
for (var _value = start; _value <= max + step / 1e6; _value += step) {
|
|
28
|
+
ticks.push(Number(_value.toPrecision(12)));
|
|
29
|
+
}
|
|
30
|
+
return ticks;
|
|
31
|
+
};
|
|
32
|
+
export var getLogTicks = function getLogTicks(min, max) {
|
|
33
|
+
var ticks = [];
|
|
34
|
+
var from = Math.floor(Math.log10(min));
|
|
35
|
+
var to = Math.ceil(Math.log10(max));
|
|
36
|
+
for (var exp = from; exp <= to; exp++) {
|
|
37
|
+
for (var _i = 0, _arr = [1, 2, 5]; _i < _arr.length; _i++) {
|
|
38
|
+
var base = _arr[_i];
|
|
39
|
+
var _value2 = Number((base * Math.pow(10, exp)).toPrecision(12));
|
|
40
|
+
if (_value2 >= min && _value2 <= max) ticks.push(_value2);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return ticks;
|
|
44
|
+
};
|
|
45
|
+
export var createScale = function createScale(_ref) {
|
|
46
|
+
var values = _ref.values,
|
|
47
|
+
_ref$type = _ref.type,
|
|
48
|
+
type = _ref$type === void 0 ? 'linear' : _ref$type,
|
|
49
|
+
range = _ref.range,
|
|
50
|
+
min = _ref.min,
|
|
51
|
+
max = _ref.max,
|
|
52
|
+
_ref$padding = _ref.padding,
|
|
53
|
+
padding = _ref$padding === void 0 ? 0.08 : _ref$padding,
|
|
54
|
+
_ref$tickCount = _ref.tickCount,
|
|
55
|
+
tickCount = _ref$tickCount === void 0 ? 5 : _ref$tickCount;
|
|
56
|
+
var isLog = type === 'log';
|
|
57
|
+
var valid = values.filter(function (v) {
|
|
58
|
+
return Number.isFinite(v) && (!isLog || v > 0);
|
|
59
|
+
});
|
|
60
|
+
var toSpace = function toSpace(v) {
|
|
61
|
+
return isLog ? Math.log10(v) : v;
|
|
62
|
+
};
|
|
63
|
+
var fromSpace = function fromSpace(v) {
|
|
64
|
+
return isLog ? Math.pow(10, v) : v;
|
|
65
|
+
};
|
|
66
|
+
var lo = valid.length ? Math.min.apply(Math, _toConsumableArray(valid.map(toSpace))) : 0;
|
|
67
|
+
var hi = valid.length ? Math.max.apply(Math, _toConsumableArray(valid.map(toSpace))) : 1;
|
|
68
|
+
if (lo === hi) {
|
|
69
|
+
var delta = lo === 0 ? 1 : Math.abs(lo) * 0.1;
|
|
70
|
+
lo -= delta;
|
|
71
|
+
hi += delta;
|
|
72
|
+
}
|
|
73
|
+
var pad = (hi - lo) * padding;
|
|
74
|
+
lo = typeof min === 'number' && (!isLog || min > 0) ? toSpace(min) : lo - pad;
|
|
75
|
+
hi = typeof max === 'number' && (!isLog || max > 0) ? toSpace(max) : hi + pad;
|
|
76
|
+
var domain = [fromSpace(lo), fromSpace(hi)];
|
|
77
|
+
var span = hi - lo || 1;
|
|
78
|
+
var map = function map(value) {
|
|
79
|
+
return range[0] + (toSpace(Math.max(value, isLog ? domain[0] : -Infinity)) - lo) / span * (range[1] - range[0]);
|
|
80
|
+
};
|
|
81
|
+
var ticks = isLog ? getLogTicks(domain[0], domain[1]) : getLinearTicks.apply(void 0, domain.concat([tickCount]));
|
|
82
|
+
if (isLog && ticks.length < 2) {
|
|
83
|
+
ticks = getLinearTicks(lo, hi, tickCount).map(function (v) {
|
|
84
|
+
return Number(fromSpace(v).toPrecision(3));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
domain: domain,
|
|
89
|
+
map: map,
|
|
90
|
+
ticks: ticks
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Pareto frontier: points not dominated by any other point.
|
|
96
|
+
* `xDirection = 'lower'` treats smaller X as better (e.g. cost / latency).
|
|
97
|
+
* Returns keys ordered by ascending X.
|
|
98
|
+
*/
|
|
99
|
+
export var getParetoFrontier = function getParetoFrontier(points) {
|
|
100
|
+
var xDirection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'lower';
|
|
101
|
+
var sign = xDirection === 'lower' ? 1 : -1;
|
|
102
|
+
var sorted = _toConsumableArray(points).filter(function (p) {
|
|
103
|
+
return Number.isFinite(p.x) && Number.isFinite(p.y);
|
|
104
|
+
}).sort(function (a, b) {
|
|
105
|
+
return sign * (a.x - b.x) || b.y - a.y;
|
|
106
|
+
});
|
|
107
|
+
var frontier = [];
|
|
108
|
+
var bestY = -Infinity;
|
|
109
|
+
var _iterator = _createForOfIteratorHelper(sorted),
|
|
110
|
+
_step;
|
|
111
|
+
try {
|
|
112
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
113
|
+
var point = _step.value;
|
|
114
|
+
if (point.y > bestY) {
|
|
115
|
+
frontier.push(point);
|
|
116
|
+
bestY = point.y;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} catch (err) {
|
|
120
|
+
_iterator.e(err);
|
|
121
|
+
} finally {
|
|
122
|
+
_iterator.f();
|
|
123
|
+
}
|
|
124
|
+
return frontier.sort(function (a, b) {
|
|
125
|
+
return a.x - b.x;
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
// Ordered by preference; `shift` nudges side labels vertically (in label heights)
|
|
129
|
+
var PLACEMENTS = [{
|
|
130
|
+
placement: 'right'
|
|
131
|
+
}, {
|
|
132
|
+
placement: 'left'
|
|
133
|
+
}, {
|
|
134
|
+
placement: 'right',
|
|
135
|
+
shift: -0.5
|
|
136
|
+
}, {
|
|
137
|
+
placement: 'right',
|
|
138
|
+
shift: 0.5
|
|
139
|
+
}, {
|
|
140
|
+
placement: 'left',
|
|
141
|
+
shift: -0.5
|
|
142
|
+
}, {
|
|
143
|
+
placement: 'left',
|
|
144
|
+
shift: 0.5
|
|
145
|
+
}, {
|
|
146
|
+
placement: 'top-right'
|
|
147
|
+
}, {
|
|
148
|
+
placement: 'bottom-right'
|
|
149
|
+
}, {
|
|
150
|
+
placement: 'top-left'
|
|
151
|
+
}, {
|
|
152
|
+
placement: 'bottom-left'
|
|
153
|
+
}, {
|
|
154
|
+
placement: 'top'
|
|
155
|
+
}, {
|
|
156
|
+
placement: 'bottom'
|
|
157
|
+
}];
|
|
158
|
+
var getLabelBox = function getLabelBox(_ref2, placement, gap) {
|
|
159
|
+
var px = _ref2.px,
|
|
160
|
+
py = _ref2.py,
|
|
161
|
+
radius = _ref2.radius,
|
|
162
|
+
width = _ref2.width,
|
|
163
|
+
height = _ref2.height;
|
|
164
|
+
var offset = radius + gap;
|
|
165
|
+
var diagonal = radius * 0.7 + gap;
|
|
166
|
+
switch (placement) {
|
|
167
|
+
case 'right':
|
|
168
|
+
{
|
|
169
|
+
return {
|
|
170
|
+
height: height,
|
|
171
|
+
width: width,
|
|
172
|
+
x: px + offset,
|
|
173
|
+
y: py - height / 2
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
case 'left':
|
|
177
|
+
{
|
|
178
|
+
return {
|
|
179
|
+
height: height,
|
|
180
|
+
width: width,
|
|
181
|
+
x: px - offset - width,
|
|
182
|
+
y: py - height / 2
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
case 'top':
|
|
186
|
+
{
|
|
187
|
+
return {
|
|
188
|
+
height: height,
|
|
189
|
+
width: width,
|
|
190
|
+
x: px - width / 2,
|
|
191
|
+
y: py - offset - height
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
case 'bottom':
|
|
195
|
+
{
|
|
196
|
+
return {
|
|
197
|
+
height: height,
|
|
198
|
+
width: width,
|
|
199
|
+
x: px - width / 2,
|
|
200
|
+
y: py + offset
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
case 'top-right':
|
|
204
|
+
{
|
|
205
|
+
return {
|
|
206
|
+
height: height,
|
|
207
|
+
width: width,
|
|
208
|
+
x: px + diagonal,
|
|
209
|
+
y: py - diagonal - height
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
case 'top-left':
|
|
213
|
+
{
|
|
214
|
+
return {
|
|
215
|
+
height: height,
|
|
216
|
+
width: width,
|
|
217
|
+
x: px - diagonal - width,
|
|
218
|
+
y: py - diagonal - height
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
case 'bottom-right':
|
|
222
|
+
{
|
|
223
|
+
return {
|
|
224
|
+
height: height,
|
|
225
|
+
width: width,
|
|
226
|
+
x: px + diagonal,
|
|
227
|
+
y: py + diagonal
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
case 'bottom-left':
|
|
231
|
+
{
|
|
232
|
+
return {
|
|
233
|
+
height: height,
|
|
234
|
+
width: width,
|
|
235
|
+
x: px - diagonal - width,
|
|
236
|
+
y: py + diagonal
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
var overlapArea = function overlapArea(a, b) {
|
|
242
|
+
var w = Math.min(a.x + a.width, b.x + b.width) - Math.max(a.x, b.x);
|
|
243
|
+
var h = Math.min(a.y + a.height, b.y + b.height) - Math.max(a.y, b.y);
|
|
244
|
+
return w > 0 && h > 0 ? w * h : 0;
|
|
245
|
+
};
|
|
246
|
+
var inflate = function inflate(box, by) {
|
|
247
|
+
return {
|
|
248
|
+
height: box.height + by * 2,
|
|
249
|
+
width: box.width + by * 2,
|
|
250
|
+
x: box.x - by,
|
|
251
|
+
y: box.y - by
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
var outOfBoundsArea = function outOfBoundsArea(box, bounds) {
|
|
255
|
+
var inside = overlapArea(box, bounds);
|
|
256
|
+
return box.width * box.height - inside;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Greedy label placement: candidates are processed in the given order,
|
|
261
|
+
* each picks the position with the least overlap against markers,
|
|
262
|
+
* already-placed labels and the outer bounds.
|
|
263
|
+
*/
|
|
264
|
+
export var placeLabels = function placeLabels(candidates, bounds) {
|
|
265
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
266
|
+
_ref3$gap = _ref3.gap,
|
|
267
|
+
gap = _ref3$gap === void 0 ? 8 : _ref3$gap,
|
|
268
|
+
_ref3$lines = _ref3.lines,
|
|
269
|
+
lines = _ref3$lines === void 0 ? [] : _ref3$lines;
|
|
270
|
+
var markers = candidates.map(function (c) {
|
|
271
|
+
return {
|
|
272
|
+
height: c.radius * 2,
|
|
273
|
+
key: c.key,
|
|
274
|
+
width: c.radius * 2,
|
|
275
|
+
x: c.px - c.radius,
|
|
276
|
+
y: c.py - c.radius
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
var placed = new Map();
|
|
280
|
+
var _iterator2 = _createForOfIteratorHelper(candidates),
|
|
281
|
+
_step2;
|
|
282
|
+
try {
|
|
283
|
+
var _loop = function _loop() {
|
|
284
|
+
var candidate = _step2.value;
|
|
285
|
+
var best;
|
|
286
|
+
var bestCost = Infinity;
|
|
287
|
+
PLACEMENTS.forEach(function (_ref4, order) {
|
|
288
|
+
var placement = _ref4.placement,
|
|
289
|
+
_ref4$shift = _ref4.shift,
|
|
290
|
+
shift = _ref4$shift === void 0 ? 0 : _ref4$shift;
|
|
291
|
+
var base = getLabelBox(candidate, placement, gap);
|
|
292
|
+
var box = _objectSpread(_objectSpread({}, base), {}, {
|
|
293
|
+
y: base.y + shift * candidate.height
|
|
294
|
+
});
|
|
295
|
+
var cost = order * 2;
|
|
296
|
+
cost += outOfBoundsArea(box, bounds) * 20;
|
|
297
|
+
var _iterator3 = _createForOfIteratorHelper(markers),
|
|
298
|
+
_step3;
|
|
299
|
+
try {
|
|
300
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
301
|
+
var marker = _step3.value;
|
|
302
|
+
if (marker.key === candidate.key) continue;
|
|
303
|
+
cost += overlapArea(inflate(box, 3), marker) * 10;
|
|
304
|
+
}
|
|
305
|
+
} catch (err) {
|
|
306
|
+
_iterator3.e(err);
|
|
307
|
+
} finally {
|
|
308
|
+
_iterator3.f();
|
|
309
|
+
}
|
|
310
|
+
var _iterator4 = _createForOfIteratorHelper(placed.values()),
|
|
311
|
+
_step4;
|
|
312
|
+
try {
|
|
313
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
314
|
+
var label = _step4.value;
|
|
315
|
+
cost += overlapArea(inflate(box, 2), label) * 8;
|
|
316
|
+
}
|
|
317
|
+
} catch (err) {
|
|
318
|
+
_iterator4.e(err);
|
|
319
|
+
} finally {
|
|
320
|
+
_iterator4.f();
|
|
321
|
+
}
|
|
322
|
+
var _iterator5 = _createForOfIteratorHelper(lines),
|
|
323
|
+
_step5;
|
|
324
|
+
try {
|
|
325
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
326
|
+
var line = _step5.value;
|
|
327
|
+
cost += overlapArea(box, line) * 1.5;
|
|
328
|
+
}
|
|
329
|
+
} catch (err) {
|
|
330
|
+
_iterator5.e(err);
|
|
331
|
+
} finally {
|
|
332
|
+
_iterator5.f();
|
|
333
|
+
}
|
|
334
|
+
if (cost < bestCost) {
|
|
335
|
+
bestCost = cost;
|
|
336
|
+
best = _objectSpread(_objectSpread({}, box), {}, {
|
|
337
|
+
key: candidate.key,
|
|
338
|
+
placement: placement
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
if (best) placed.set(candidate.key, best);
|
|
343
|
+
};
|
|
344
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
345
|
+
_loop();
|
|
346
|
+
}
|
|
347
|
+
} catch (err) {
|
|
348
|
+
_iterator2.e(err);
|
|
349
|
+
} finally {
|
|
350
|
+
_iterator2.f();
|
|
351
|
+
}
|
|
352
|
+
return placed;
|
|
353
|
+
};
|
|
@@ -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
|
|
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, Line, ComposedChart as ReChartsComposedChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
@@ -124,8 +125,7 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
124
125
|
valueFormatter: rightFormatter
|
|
125
126
|
});
|
|
126
127
|
}, [yAxisRight, data, index]);
|
|
127
|
-
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton
|
|
128
|
-
active: true,
|
|
128
|
+
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
|
|
129
129
|
height: height,
|
|
130
130
|
width: width
|
|
131
131
|
});
|
|
@@ -16,7 +16,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
16
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
18
|
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; }
|
|
19
|
-
import { Flexbox
|
|
19
|
+
import { Flexbox } from '@lobehub/ui';
|
|
20
|
+
import { Tooltip } from '@lobehub/ui/base-ui';
|
|
20
21
|
import { cssVar, cx } from 'antd-style';
|
|
21
22
|
import { forwardRef, memo, useMemo } from 'react';
|
|
22
23
|
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
package/es/DataBars/DeltaBar.js
CHANGED
|
@@ -9,7 +9,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
|
-
import { Flexbox
|
|
12
|
+
import { Flexbox } from '@lobehub/ui';
|
|
13
|
+
import { Tooltip } from '@lobehub/ui/base-ui';
|
|
13
14
|
import { cssVar, cx } from 'antd-style';
|
|
14
15
|
import { forwardRef } from 'react';
|
|
15
16
|
import { DeltaTypes } from "../types/charts";
|
package/es/DataBars/MarkerBar.js
CHANGED
|
@@ -9,7 +9,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
|
-
import { Flexbox
|
|
12
|
+
import { Flexbox } from '@lobehub/ui';
|
|
13
|
+
import { Tooltip } from '@lobehub/ui/base-ui';
|
|
13
14
|
import { cssVar, cx } from 'antd-style';
|
|
14
15
|
import { forwardRef } from 'react';
|
|
15
16
|
import { styles } from "./styles";
|
|
@@ -9,7 +9,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
|
-
import { Flexbox
|
|
12
|
+
import { Flexbox } from '@lobehub/ui';
|
|
13
|
+
import { Tooltip } from '@lobehub/ui/base-ui';
|
|
13
14
|
import { cssVar, cx } from 'antd-style';
|
|
14
15
|
import { forwardRef } from 'react';
|
|
15
16
|
import { styles } from "./styles";
|
package/es/DonutChart/index.js
CHANGED
|
@@ -18,7 +18,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
21
|
-
import { Flexbox
|
|
21
|
+
import { Flexbox } from '@lobehub/ui';
|
|
22
|
+
import { Skeleton } from '@lobehub/ui/base-ui';
|
|
22
23
|
import { css, cssVar, cx, useThemeMode } from 'antd-style';
|
|
23
24
|
import { forwardRef, useEffect, useState } from 'react';
|
|
24
25
|
import { Pie, PieChart as ReChartsDonutChart, ResponsiveContainer, Tooltip } from 'recharts';
|
|
@@ -96,8 +97,7 @@ var DonutChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
}, [activeIndex]);
|
|
99
|
-
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton
|
|
100
|
-
active: true,
|
|
100
|
+
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
|
|
101
101
|
height: height,
|
|
102
102
|
width: width
|
|
103
103
|
});
|
package/es/FunnelChart/index.js
CHANGED
|
@@ -22,7 +22,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
22
22
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
23
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
24
|
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; }
|
|
25
|
-
import { Flexbox
|
|
25
|
+
import { Flexbox } from '@lobehub/ui';
|
|
26
|
+
import { Skeleton } from '@lobehub/ui/base-ui';
|
|
26
27
|
import { useSize } from 'ahooks';
|
|
27
28
|
import { css, cssVar, cx } from 'antd-style';
|
|
28
29
|
import { Fragment, forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -253,8 +254,7 @@ var FunnelChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
253
254
|
y: closestBar.startY
|
|
254
255
|
});
|
|
255
256
|
};
|
|
256
|
-
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton
|
|
257
|
-
active: true,
|
|
257
|
+
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
|
|
258
258
|
height: height,
|
|
259
259
|
width: width
|
|
260
260
|
});
|
package/es/Heatmaps/Calendar.js
CHANGED
|
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
9
|
-
import { Tooltip } from '@lobehub/ui';
|
|
9
|
+
import { Tooltip } from '@lobehub/ui/base-ui';
|
|
10
10
|
import { keyframes } from 'antd-style';
|
|
11
11
|
import isEqual from 'fast-deep-equal';
|
|
12
12
|
import { memo, useMemo } from 'react';
|