amazing-react-charts 0.7.6 → 0.7.7
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/dist/core/AreaChart.js +9 -1
- package/dist/core/types.d.ts +3 -1
- package/package.json +1 -1
- package/src/core/AreaChart.tsx +12 -3
- package/src/core/types.ts +2 -1
package/dist/core/AreaChart.js
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.TOOLBOX_DEFAULT_PROPS = void 0;
|
|
9
9
|
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
10
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
13
|
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -140,7 +142,13 @@ var AreaChart = function AreaChart(props) {
|
|
|
140
142
|
type: 'line',
|
|
141
143
|
data: yData,
|
|
142
144
|
label: {
|
|
143
|
-
formatter:
|
|
145
|
+
formatter: function formatter(item) {
|
|
146
|
+
if (typeof yComplement === 'function' && (0, _typeof2.default)(item) === 'object') {
|
|
147
|
+
return yComplement(item.data);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
typeof yComplement === 'function' ? yComplement : formatLabel;
|
|
151
|
+
},
|
|
144
152
|
show: true,
|
|
145
153
|
position: 'top',
|
|
146
154
|
fontSize: yType === 'time' ? 10 : 11.5,
|
package/dist/core/types.d.ts
CHANGED
|
@@ -29,7 +29,9 @@ export interface IDefaultChartProps {
|
|
|
29
29
|
scrollStart?: number;
|
|
30
30
|
onClickBar?(itemProps?: Record<string, unknown>, itemFunctions?: Record<string, unknown>): void;
|
|
31
31
|
}
|
|
32
|
-
export declare type Complement = string | ((value: string | number
|
|
32
|
+
export declare type Complement = string | ((value: string | number | {
|
|
33
|
+
data: number;
|
|
34
|
+
}) => string);
|
|
33
35
|
declare type ToolboxEntryProps = {
|
|
34
36
|
saveAsImage?: string;
|
|
35
37
|
dataView?: string;
|
package/package.json
CHANGED
package/src/core/AreaChart.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from './types'
|
|
22
22
|
|
|
23
23
|
const STYLES = { width: '99.9%', height: 300 }
|
|
24
|
+
|
|
24
25
|
export const TOOLBOX_DEFAULT_PROPS = {
|
|
25
26
|
showTitle: false,
|
|
26
27
|
right: '9.52%',
|
|
@@ -155,9 +156,17 @@ const AreaChart = (props: IDefaultChartProps) => {
|
|
|
155
156
|
type: 'line' as const,
|
|
156
157
|
data: yData,
|
|
157
158
|
label: {
|
|
158
|
-
formatter:
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
formatter: (item: number | string | {data: number}) => {
|
|
160
|
+
if(typeof yComplement === 'function' && typeof item === 'object') {
|
|
161
|
+
return yComplement(item.data)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
typeof yComplement === 'function'
|
|
166
|
+
? yComplement
|
|
167
|
+
: formatLabel
|
|
168
|
+
|
|
169
|
+
},
|
|
161
170
|
show: true,
|
|
162
171
|
position: 'top',
|
|
163
172
|
fontSize: yType === 'time' ? 10 : 11.5,
|
package/src/core/types.ts
CHANGED
|
@@ -34,7 +34,8 @@ export interface IDefaultChartProps {
|
|
|
34
34
|
): void;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export type Complement =
|
|
37
|
+
export type Complement =
|
|
38
|
+
string | ((value: string | number | {data: number}) => string);
|
|
38
39
|
|
|
39
40
|
type ToolboxEntryProps = {
|
|
40
41
|
saveAsImage?: string;
|