@lobehub/charts 5.1.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AreaChart/index.js +3 -2
- package/es/BarChart/index.js +3 -2
- package/es/ComposedChart/index.d.ts +1 -1
- package/es/ComposedChart/index.js +37 -35
- package/es/ComposedChart/types.d.ts +6 -0
- package/es/LineChart/index.js +3 -2
- package/es/common/BaseChartProps.d.ts +5 -0
- package/es/common/CustomYAxisTick.d.ts +1 -0
- package/es/common/CustomYAxisTick.js +4 -2
- package/es/index.d.ts +1 -1
- package/package.json +1 -1
package/es/AreaChart/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
5
|
-
var _excluded = ["data", "categories", "index", "stack", "colors", "valueFormatter", "xAxisLabelFormatter", "startEndOnly", "showXAxis", "showYAxis", "yAxisAlign", "yAxisWidth", "intervalType", "showAnimation", "animationDuration", "showTooltip", "showLegend", "showGridLines", "showGradient", "autoMinValue", "curveType", "minValue", "maxValue", "connectNulls", "allowDecimals", "noDataText", "className", "onValueChange", "enableLegendSlider", "customTooltip", "rotateLabelX", "tickGap", "loading", "xAxisLabel", "yAxisLabel", "width", "height", "style", "customCategories"];
|
|
5
|
+
var _excluded = ["data", "categories", "index", "stack", "colors", "valueFormatter", "xAxisLabelFormatter", "startEndOnly", "showXAxis", "showYAxis", "yAxisAlign", "yAxisWidth", "intervalType", "showAnimation", "animationDuration", "showTooltip", "showLegend", "showGridLines", "showGradient", "autoMinValue", "curveType", "minValue", "maxValue", "connectNulls", "allowDecimals", "noDataText", "className", "onValueChange", "enableLegendSlider", "customTooltip", "rotateLabelX", "tickGap", "loading", "xAxisLabel", "yAxisLabel", "yAxisDomain", "width", "height", "style", "customCategories"];
|
|
6
6
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
@@ -92,6 +92,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
92
92
|
loading = props.loading,
|
|
93
93
|
xAxisLabel = props.xAxisLabel,
|
|
94
94
|
yAxisLabel = props.yAxisLabel,
|
|
95
|
+
yAxisDomainOverride = props.yAxisDomain,
|
|
95
96
|
_props$width = props.width,
|
|
96
97
|
width = _props$width === void 0 ? '100%' : _props$width,
|
|
97
98
|
_props$height = props.height,
|
|
@@ -128,7 +129,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
128
129
|
var CustomTooltip = customTooltip;
|
|
129
130
|
var paddingValue = !showXAxis && !showYAxis || startEndOnly && !showYAxis ? 0 : 20;
|
|
130
131
|
var categoryColors = constructCategoryColors(categories, colors);
|
|
131
|
-
var yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);
|
|
132
|
+
var yAxisDomain = yAxisDomainOverride !== null && yAxisDomainOverride !== void 0 ? yAxisDomainOverride : getYAxisDomain(autoMinValue, minValue, maxValue);
|
|
132
133
|
var hasOnValueChange = !!onValueChange;
|
|
133
134
|
var onDotClick = function onDotClick(itemData, event) {
|
|
134
135
|
event.stopPropagation();
|
package/es/BarChart/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
var _templateObject;
|
|
5
|
-
var _excluded = ["data", "categories", "customCategories", "index", "yAxisAlign", "colors", "valueFormatter", "xAxisLabelFormatter", "layout", "stack", "startEndOnly", "animationDuration", "showAnimation", "showXAxis", "showYAxis", "yAxisWidth", "intervalType", "showTooltip", "showLegend", "showGridLines", "autoMinValue", "minValue", "maxValue", "allowDecimals", "noDataText", "onValueChange", "enableLegendSlider", "customTooltip", "rotateLabelX", "barCategoryGap", "tickGap", "loading", "xAxisLabel", "yAxisLabel", "className", "width", "height", "style"];
|
|
5
|
+
var _excluded = ["data", "categories", "customCategories", "index", "yAxisAlign", "colors", "valueFormatter", "xAxisLabelFormatter", "layout", "stack", "startEndOnly", "animationDuration", "showAnimation", "showXAxis", "showYAxis", "yAxisWidth", "intervalType", "showTooltip", "showLegend", "showGridLines", "autoMinValue", "minValue", "maxValue", "allowDecimals", "noDataText", "onValueChange", "enableLegendSlider", "customTooltip", "rotateLabelX", "barCategoryGap", "tickGap", "loading", "xAxisLabel", "yAxisLabel", "yAxisDomain", "className", "width", "height", "style"];
|
|
6
6
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
@@ -89,6 +89,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
89
89
|
loading = props.loading,
|
|
90
90
|
xAxisLabel = props.xAxisLabel,
|
|
91
91
|
yAxisLabel = props.yAxisLabel,
|
|
92
|
+
yAxisDomainOverride = props.yAxisDomain,
|
|
92
93
|
className = props.className,
|
|
93
94
|
_props$width = props.width,
|
|
94
95
|
width = _props$width === void 0 ? '100%' : _props$width,
|
|
@@ -161,7 +162,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
161
162
|
}
|
|
162
163
|
setActiveBar(undefined);
|
|
163
164
|
};
|
|
164
|
-
var yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);
|
|
165
|
+
var yAxisDomain = yAxisDomainOverride !== null && yAxisDomainOverride !== void 0 ? yAxisDomainOverride : getYAxisDomain(autoMinValue, minValue, maxValue);
|
|
165
166
|
return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|
|
166
167
|
className: className,
|
|
167
168
|
height: height,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ComposedChartProps } from './types';
|
|
3
|
-
export type { ComposedChartProps, SeriesItem } from './types';
|
|
3
|
+
export type { ComposedChartProps, SeriesItem, YAxisConfig } from './types';
|
|
4
4
|
declare const ComposedChart: import("react").ForwardRefExoticComponent<ComposedChartProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default ComposedChart;
|
|
@@ -188,6 +188,7 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
188
188
|
allowDecimals: allowDecimals,
|
|
189
189
|
axisLine: false,
|
|
190
190
|
className: styles.label,
|
|
191
|
+
domain: yAxisLeft === null || yAxisLeft === void 0 ? void 0 : yAxisLeft.domain,
|
|
191
192
|
fill: "",
|
|
192
193
|
hide: !showYAxis,
|
|
193
194
|
orientation: "left",
|
|
@@ -197,7 +198,6 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
197
198
|
return /*#__PURE__*/_jsx(CustomYAxisTick, _objectSpread(_objectSpread({}, tickProps), {}, {
|
|
198
199
|
align: "left",
|
|
199
200
|
formatter: (_yAxisLeft$valueForma2 = yAxisLeft === null || yAxisLeft === void 0 ? void 0 : yAxisLeft.valueFormatter) !== null && _yAxisLeft$valueForma2 !== void 0 ? _yAxisLeft$valueForma2 : defaultValueFormatter,
|
|
200
|
-
textAnchor: "end",
|
|
201
201
|
yAxisLabel: Boolean(yAxisLeft === null || yAxisLeft === void 0 ? void 0 : yAxisLeft.label)
|
|
202
202
|
}));
|
|
203
203
|
},
|
|
@@ -222,6 +222,7 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
222
222
|
allowDecimals: allowDecimals,
|
|
223
223
|
axisLine: false,
|
|
224
224
|
className: styles.label,
|
|
225
|
+
domain: yAxisRight === null || yAxisRight === void 0 ? void 0 : yAxisRight.domain,
|
|
225
226
|
fill: "",
|
|
226
227
|
hide: !showYAxis,
|
|
227
228
|
orientation: "right",
|
|
@@ -230,8 +231,8 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
230
231
|
var _yAxisRight$valueForm2;
|
|
231
232
|
return /*#__PURE__*/_jsx(CustomYAxisTick, _objectSpread(_objectSpread({}, tickProps), {}, {
|
|
232
233
|
align: "right",
|
|
234
|
+
anchor: "start",
|
|
233
235
|
formatter: (_yAxisRight$valueForm2 = yAxisRight === null || yAxisRight === void 0 ? void 0 : yAxisRight.valueFormatter) !== null && _yAxisRight$valueForm2 !== void 0 ? _yAxisRight$valueForm2 : defaultValueFormatter,
|
|
234
|
-
textAnchor: "start",
|
|
235
236
|
yAxisLabel: Boolean(yAxisRight === null || yAxisRight === void 0 ? void 0 : yAxisRight.label)
|
|
236
237
|
}));
|
|
237
238
|
},
|
|
@@ -252,40 +253,9 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
252
253
|
},
|
|
253
254
|
children: yAxisRight.label
|
|
254
255
|
})
|
|
255
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
256
|
-
content: showTooltip ? function (_ref) {
|
|
257
|
-
var active = _ref.active,
|
|
258
|
-
payload = _ref.payload,
|
|
259
|
-
label = _ref.label;
|
|
260
|
-
return /*#__PURE__*/_jsx(ChartTooltip, {
|
|
261
|
-
active: active,
|
|
262
|
-
categoryColors: categoryColors,
|
|
263
|
-
customCategories: customCategories,
|
|
264
|
-
label: label,
|
|
265
|
-
payload: payload,
|
|
266
|
-
valueFormatter: function valueFormatter(value, name) {
|
|
267
|
-
var _ref2, _currentSeries$valueF;
|
|
268
|
-
var currentSeries = series.find(function (item) {
|
|
269
|
-
return item.key === name;
|
|
270
|
-
});
|
|
271
|
-
var formatter = (_ref2 = (_currentSeries$valueF = currentSeries === null || currentSeries === void 0 ? void 0 : currentSeries.valueFormatter) !== null && _currentSeries$valueF !== void 0 ? _currentSeries$valueF : (currentSeries === null || currentSeries === void 0 ? void 0 : currentSeries.axis) === 'right' ? yAxisRight === null || yAxisRight === void 0 ? void 0 : yAxisRight.valueFormatter : yAxisLeft === null || yAxisLeft === void 0 ? void 0 : yAxisLeft.valueFormatter) !== null && _ref2 !== void 0 ? _ref2 : defaultValueFormatter;
|
|
272
|
-
return formatter(value);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
} : undefined,
|
|
276
|
-
cursor: {
|
|
277
|
-
fill: cssVar.colorFillTertiary
|
|
278
|
-
},
|
|
279
|
-
isAnimationActive: false,
|
|
280
|
-
position: {
|
|
281
|
-
y: 0
|
|
282
|
-
},
|
|
283
|
-
wrapperStyle: {
|
|
284
|
-
outline: 'none'
|
|
285
|
-
}
|
|
286
256
|
}), showLegend && /*#__PURE__*/_jsx(Legend, {
|
|
287
|
-
content: function content(
|
|
288
|
-
var payload =
|
|
257
|
+
content: function content(_ref) {
|
|
258
|
+
var payload = _ref.payload;
|
|
289
259
|
return ChartLegend({
|
|
290
260
|
payload: payload
|
|
291
261
|
}, categoryColors, setLegendHeight, undefined, undefined, enableLegendSlider, customCategories);
|
|
@@ -322,6 +292,38 @@ var ComposedChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
322
292
|
}, s.key);
|
|
323
293
|
}
|
|
324
294
|
return null;
|
|
295
|
+
}), showTooltip && /*#__PURE__*/_jsx(Tooltip, {
|
|
296
|
+
content: function content(_ref2) {
|
|
297
|
+
var active = _ref2.active,
|
|
298
|
+
payload = _ref2.payload,
|
|
299
|
+
label = _ref2.label;
|
|
300
|
+
return /*#__PURE__*/_jsx(ChartTooltip, {
|
|
301
|
+
active: active,
|
|
302
|
+
categoryColors: categoryColors,
|
|
303
|
+
customCategories: customCategories,
|
|
304
|
+
label: label,
|
|
305
|
+
payload: payload,
|
|
306
|
+
valueFormatter: function valueFormatter(value, name) {
|
|
307
|
+
var _ref3, _currentSeries$valueF;
|
|
308
|
+
var currentSeries = series.find(function (item) {
|
|
309
|
+
return item.key === name;
|
|
310
|
+
});
|
|
311
|
+
var formatter = (_ref3 = (_currentSeries$valueF = currentSeries === null || currentSeries === void 0 ? void 0 : currentSeries.valueFormatter) !== null && _currentSeries$valueF !== void 0 ? _currentSeries$valueF : (currentSeries === null || currentSeries === void 0 ? void 0 : currentSeries.axis) === 'right' ? yAxisRight === null || yAxisRight === void 0 ? void 0 : yAxisRight.valueFormatter : yAxisLeft === null || yAxisLeft === void 0 ? void 0 : yAxisLeft.valueFormatter) !== null && _ref3 !== void 0 ? _ref3 : defaultValueFormatter;
|
|
312
|
+
return formatter(value);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
cursor: {
|
|
317
|
+
stroke: cssVar.colorTextSecondary,
|
|
318
|
+
strokeWidth: 1
|
|
319
|
+
},
|
|
320
|
+
isAnimationActive: false,
|
|
321
|
+
position: {
|
|
322
|
+
y: 0
|
|
323
|
+
},
|
|
324
|
+
wrapperStyle: {
|
|
325
|
+
outline: 'none'
|
|
326
|
+
}
|
|
325
327
|
})]
|
|
326
328
|
}) : /*#__PURE__*/_jsx(NoData, {
|
|
327
329
|
noDataText: noDataText
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import type { AxisDomain } from 'recharts/types/util/types';
|
|
2
3
|
import type { NoDataProps } from "../common/NoData";
|
|
3
4
|
import type { IntervalType, LabelFormatter, ValueFormatter } from "../types/charts";
|
|
4
5
|
import type BaseAnimationTimingProps from '../common/BaseAnimationTimingProps';
|
|
@@ -20,6 +21,11 @@ export interface SeriesItem {
|
|
|
20
21
|
valueFormatter?: ValueFormatter;
|
|
21
22
|
}
|
|
22
23
|
export interface YAxisConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Forward to recharts `YAxis.domain`.
|
|
26
|
+
* Accepts numbers or `'auto'` / `'dataMin'` / `'dataMax'` / `'dataMin - N'` etc.
|
|
27
|
+
*/
|
|
28
|
+
domain?: AxisDomain;
|
|
23
29
|
/** Label string rendered alongside the axis */
|
|
24
30
|
label?: string;
|
|
25
31
|
/** Custom tick formatter */
|
package/es/LineChart/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
var _templateObject, _templateObject2, _templateObject3;
|
|
5
|
-
var _excluded = ["data", "categories", "index", "colors", "valueFormatter", "xAxisLabelFormatter", "startEndOnly", "showXAxis", "showYAxis", "yAxisWidth", "intervalType", "animationDuration", "showAnimation", "yAxisAlign", "showTooltip", "showLegend", "showGridLines", "autoMinValue", "curveType", "minValue", "maxValue", "connectNulls", "allowDecimals", "noDataText", "className", "onValueChange", "enableLegendSlider", "customTooltip", "rotateLabelX", "tickGap", "xAxisLabel", "yAxisLabel", "width", "height", "style", "customCategories", "loading"];
|
|
5
|
+
var _excluded = ["data", "categories", "index", "colors", "valueFormatter", "xAxisLabelFormatter", "startEndOnly", "showXAxis", "showYAxis", "yAxisWidth", "intervalType", "animationDuration", "showAnimation", "yAxisAlign", "showTooltip", "showLegend", "showGridLines", "autoMinValue", "curveType", "minValue", "maxValue", "connectNulls", "allowDecimals", "noDataText", "className", "onValueChange", "enableLegendSlider", "customTooltip", "rotateLabelX", "tickGap", "xAxisLabel", "yAxisLabel", "yAxisDomain", "width", "height", "style", "customCategories", "loading"];
|
|
6
6
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
@@ -87,6 +87,7 @@ var LineChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
87
87
|
tickGap = _props$tickGap === void 0 ? 5 : _props$tickGap,
|
|
88
88
|
xAxisLabel = props.xAxisLabel,
|
|
89
89
|
yAxisLabel = props.yAxisLabel,
|
|
90
|
+
yAxisDomainOverride = props.yAxisDomain,
|
|
90
91
|
_props$width = props.width,
|
|
91
92
|
width = _props$width === void 0 ? '100%' : _props$width,
|
|
92
93
|
_props$height = props.height,
|
|
@@ -124,7 +125,7 @@ var LineChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
124
125
|
var CustomTooltip = customTooltip;
|
|
125
126
|
var paddingValue = !showXAxis && !showYAxis ? 0 : 20;
|
|
126
127
|
var categoryColors = constructCategoryColors(categories, colors);
|
|
127
|
-
var yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);
|
|
128
|
+
var yAxisDomain = yAxisDomainOverride !== null && yAxisDomainOverride !== void 0 ? yAxisDomainOverride : getYAxisDomain(autoMinValue, minValue, maxValue);
|
|
128
129
|
var hasOnValueChange = !!onValueChange;
|
|
129
130
|
var onDotClick = function onDotClick(itemData, event) {
|
|
130
131
|
event.stopPropagation();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentType, HTMLAttributes } from 'react';
|
|
2
|
+
import type { AxisDomain } from 'recharts/types/util/types';
|
|
2
3
|
import type { NoDataProps } from "./NoData";
|
|
3
4
|
import { IntervalType, LabelFormatter, ValueFormatter } from "../types/charts";
|
|
4
5
|
import type BaseAnimationTimingProps from './BaseAnimationTimingProps';
|
|
@@ -47,6 +48,10 @@ interface BaseChartProps extends BaseAnimationTimingProps, HTMLAttributes<HTMLDi
|
|
|
47
48
|
xAxisLabel?: string;
|
|
48
49
|
xAxisLabelFormatter?: LabelFormatter;
|
|
49
50
|
yAxisAlign?: 'left' | 'right';
|
|
51
|
+
/**
|
|
52
|
+
* Forward to recharts `YAxis.domain`. When set, overrides `autoMinValue` / `minValue` / `maxValue`.
|
|
53
|
+
*/
|
|
54
|
+
yAxisDomain?: AxisDomain;
|
|
50
55
|
yAxisLabel?: string;
|
|
51
56
|
yAxisWidth?: number;
|
|
52
57
|
}
|
|
@@ -7,15 +7,17 @@ var CustomYAxisTick = /*#__PURE__*/memo(function (_ref) {
|
|
|
7
7
|
y = _ref.y,
|
|
8
8
|
payload = _ref.payload,
|
|
9
9
|
align = _ref.align,
|
|
10
|
-
formatter = _ref.formatter
|
|
10
|
+
formatter = _ref.formatter,
|
|
11
|
+
anchor = _ref.anchor;
|
|
11
12
|
var yAxisLabelWidth = yAxisLabel ? 24 : 0;
|
|
13
|
+
var resolvedTextAnchor = anchor !== null && anchor !== void 0 ? anchor : align === 'left' ? 'start' : 'end';
|
|
12
14
|
return /*#__PURE__*/_jsx("g", {
|
|
13
15
|
transform: "translate(".concat(align === 'left' ? yAxisLabelWidth : x + yAxisLabelWidth, ",").concat(y, ")"),
|
|
14
16
|
children: /*#__PURE__*/_jsx("text", {
|
|
15
17
|
dy: 4,
|
|
16
18
|
fill: cssVar.colorTextDescription,
|
|
17
19
|
fontSize: 12,
|
|
18
|
-
textAnchor:
|
|
20
|
+
textAnchor: resolvedTextAnchor,
|
|
19
21
|
x: 0,
|
|
20
22
|
y: 0,
|
|
21
23
|
children: formatter(payload.value)
|
package/es/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { type Bar, default as BarList, type BarListProps } from './BarList';
|
|
|
5
5
|
export { default as ChartTooltip, type ChartTooltipProps } from './common/ChartTooltip';
|
|
6
6
|
export { default as ChartTooltipFrame } from './common/ChartTooltip/ChartTooltipFrame';
|
|
7
7
|
export { default as ChartTooltipRow } from './common/ChartTooltip/ChartTooltipRow';
|
|
8
|
-
export { default as ComposedChart, type ComposedChartProps, type SeriesItem } from './ComposedChart';
|
|
8
|
+
export { default as ComposedChart, type ComposedChartProps, type SeriesItem, type YAxisConfig, } from './ComposedChart';
|
|
9
9
|
export * from './DataBars';
|
|
10
10
|
export { default as DonutChart, type DonutChartProps } from './DonutChart';
|
|
11
11
|
export { default as FunnelChart, type FunnelChartProps } from './FunnelChart';
|