amazing-react-charts 1.2.2 → 1.2.4
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/commonStyles.d.ts +23 -1
- package/commonStyles.js +32 -8
- package/core/gauge-chart/GaugeChart.d.ts +21 -0
- package/core/gauge-chart/GaugeChart.js +147 -0
- package/core/gauge-chart/GaugeChart.stories.d.ts +8 -0
- package/core/line-chart/LineChart.d.ts +9 -5
- package/core/line-chart/LineChart.js +137 -184
- package/core/line-chart/LineChart.stories.d.ts +1 -1
- package/core/types.d.ts +4 -4
- package/index.d.ts +0 -1
- package/index.js +0 -7
- package/package.json +18 -17
- package/test/gauge-chart.spec.d.ts +1 -0
package/commonStyles.d.ts
CHANGED
|
@@ -19,14 +19,36 @@ export declare const TOOLTIP_DEFAULT_PROPS: {
|
|
|
19
19
|
backgroundColor: string;
|
|
20
20
|
extraCssText: string;
|
|
21
21
|
textStyle: {
|
|
22
|
-
fontFamily: string;
|
|
23
22
|
fontSize: number;
|
|
24
23
|
color: string;
|
|
24
|
+
fontFamily: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
export declare const COMMON_STYLE: {
|
|
28
|
+
fontWeight: number;
|
|
29
|
+
color: string;
|
|
30
|
+
fontFamily: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const TITLE_STYLE: {
|
|
33
|
+
fontWeight: number;
|
|
34
|
+
color: string;
|
|
35
|
+
fontFamily: string;
|
|
36
|
+
fontSize: number;
|
|
37
|
+
};
|
|
38
|
+
export declare const AXIS_SPLIT_LINE: {
|
|
39
|
+
type: string;
|
|
40
|
+
opacity: number;
|
|
41
|
+
color: string;
|
|
42
|
+
};
|
|
27
43
|
export declare const PictorialWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
28
44
|
export declare const DonutWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
29
45
|
export declare const ChartStorieWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
30
46
|
export declare const ChartWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
31
47
|
export declare const ChartTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
48
|
+
export declare const GaugeLegendContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
49
|
+
export declare const GaugeLegendContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
50
|
+
export declare const GaugeCircle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
51
|
+
color?: string;
|
|
52
|
+
}>> & string;
|
|
53
|
+
export declare const GaugeLegend: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
32
54
|
export declare const CsvDownloadButtonStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
package/commonStyles.js
CHANGED
|
@@ -4,12 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.TOOLTIP_DEFAULT_PROPS = exports.TOOLBOX_DEFAULT_PROPS = exports.STRAIGHT_LINE_ICON = exports.PictorialWrapper = exports.MIN_WIDTH = exports.DonutWrapper = exports.DASHED_LINE_ICON = exports.CsvDownloadButtonStyle = exports.ChartWrapper = exports.ChartTitle = exports.ChartStorieWrapper = exports.CHART_WIDTH = exports.CHART_HEIGHT = void 0;
|
|
7
|
+
exports.TOOLTIP_DEFAULT_PROPS = exports.TOOLBOX_DEFAULT_PROPS = exports.TITLE_STYLE = exports.STRAIGHT_LINE_ICON = exports.PictorialWrapper = exports.MIN_WIDTH = exports.GaugeLegendContent = exports.GaugeLegendContainer = exports.GaugeLegend = exports.GaugeCircle = exports.DonutWrapper = exports.DASHED_LINE_ICON = exports.CsvDownloadButtonStyle = exports.ChartWrapper = exports.ChartTitle = exports.ChartStorieWrapper = exports.COMMON_STYLE = exports.CHART_WIDTH = exports.CHART_HEIGHT = exports.AXIS_SPLIT_LINE = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
11
|
var _theme = require("flipper-ui/theme");
|
|
11
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
12
|
-
var
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
13
|
+
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; }
|
|
14
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
15
|
+
var _theme$colors = _theme.theme.colors,
|
|
16
|
+
gray = _theme$colors.gray,
|
|
17
|
+
neutral = _theme$colors.neutral;
|
|
13
18
|
var STRAIGHT_LINE_ICON = exports.STRAIGHT_LINE_ICON = 'path://M0 0H25H50V2H25H0V0Z';
|
|
14
19
|
var DASHED_LINE_ICON = exports.DASHED_LINE_ICON = 'path://M180 1000 l0 -40 200 0 200 0 0 40 0 40 -200 0 -200 0 0 -40z, M810 ' + '1000 l0 -40 200 0 200 0 0 40 0 40 -200 0 -200 0 0 -40zm, M1440 1000 l0 ' + '-40 200 0 200 0 0 40 0 40 -200 0 -200 0 0 -40z';
|
|
15
20
|
var MIN_WIDTH = exports.MIN_WIDTH = {
|
|
@@ -29,16 +34,35 @@ var TOOLBOX_DEFAULT_PROPS = exports.TOOLBOX_DEFAULT_PROPS = {
|
|
|
29
34
|
var TOOLTIP_DEFAULT_PROPS = exports.TOOLTIP_DEFAULT_PROPS = {
|
|
30
35
|
show: true,
|
|
31
36
|
backgroundColor: "".concat(neutral[200], "90"),
|
|
32
|
-
extraCssText: 'border: none; padding:
|
|
37
|
+
extraCssText: 'border: none; padding: 6px;',
|
|
33
38
|
textStyle: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
fontSize: 11.5,
|
|
40
|
+
color: neutral[50],
|
|
41
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif'
|
|
37
42
|
}
|
|
38
43
|
};
|
|
44
|
+
var COMMON_STYLE = exports.COMMON_STYLE = {
|
|
45
|
+
fontWeight: 400,
|
|
46
|
+
color: neutral[200],
|
|
47
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif'
|
|
48
|
+
};
|
|
49
|
+
var TITLE_STYLE = exports.TITLE_STYLE = _objectSpread({
|
|
50
|
+
fontSize: 16
|
|
51
|
+
}, COMMON_STYLE);
|
|
52
|
+
var AXIS_SPLIT_LINE = exports.AXIS_SPLIT_LINE = {
|
|
53
|
+
type: 'dashed',
|
|
54
|
+
opacity: 0.2,
|
|
55
|
+
color: gray[800]
|
|
56
|
+
};
|
|
39
57
|
var PictorialWrapper = exports.PictorialWrapper = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: 330px;\n margin: 0 auto;\n"])));
|
|
40
58
|
var DonutWrapper = exports.DonutWrapper = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 500px;\n margin: 0 auto;\n"])));
|
|
41
59
|
var ChartStorieWrapper = exports.ChartStorieWrapper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 50%;\n margin: 0 auto;\n"])));
|
|
42
60
|
var ChartWrapper = exports.ChartWrapper = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n position: relative;\n"])));
|
|
43
61
|
var ChartTitle = exports.ChartTitle = _styledComponents["default"].h1(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: Roboto, Helvetica, Arial, sans-serif;\n color: ", ";\n top: 5;\n margin: 0px;\n font-size: 16px;\n font-weight: 400;\n position: absolute;\n"])), neutral[200]);
|
|
44
|
-
var
|
|
62
|
+
var GaugeLegendContainer = exports.GaugeLegendContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n gap: 16px;\n align-items: center;\n justify-content: center;\n"])));
|
|
63
|
+
var GaugeLegendContent = exports.GaugeLegendContent = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n font-family: Roboto, Helvetica, Arial, sans-serif;\n"])));
|
|
64
|
+
var GaugeCircle = exports.GaugeCircle = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n width: 20px;\n height: 20px;\n margin-bottom: 4px;\n border-radius: 100%;\n background-color: ", ";\n"])), function (props) {
|
|
65
|
+
return props.color;
|
|
66
|
+
});
|
|
67
|
+
var GaugeLegend = exports.GaugeLegend = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: 14px;\n"])));
|
|
68
|
+
var CsvDownloadButtonStyle = exports.CsvDownloadButtonStyle = _styledComponents["default"].button(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: bold;\n background: ", ";\n text-transform: uppercase;\n border: none;\n width: 40px;\n height: 20px;\n cursor: pointer;\n display: block;\n position: absolute;\n margin-top: -295px;\n margin-left: 80%;\n\n &:hover::after {\n content: 'Save as CSV';\n position: absolute;\n text-transform: none;\n font-weight: lighter;\n top: 123%;\n left: 50%;\n transform: translateX(-50%);\n background-color: ", ";\n opacity: 55%;\n color: ", ";\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 12px;\n height: 19px;\n white-space: nowrap;\n text-align: center;\n display: flex;\n align-items: center;\n }\n"])), neutral[50], neutral[200], neutral[50]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IDefaultChartProps, GaugeData } from '../types';
|
|
3
|
+
export interface IProps extends Omit<IDefaultChartProps, 'data'> {
|
|
4
|
+
data: GaugeData[];
|
|
5
|
+
legendValue?: number;
|
|
6
|
+
axisLineWidth?: number;
|
|
7
|
+
titleFontSize?: number;
|
|
8
|
+
detailFontSize?: number;
|
|
9
|
+
height?: number | string;
|
|
10
|
+
colorLine?: [number, string][];
|
|
11
|
+
axisLabel?: {
|
|
12
|
+
limit: number;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
15
|
+
legendData?: {
|
|
16
|
+
icon: JSX.Element;
|
|
17
|
+
legend: number;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
declare const GaugeChart: (props: IProps) => React.JSX.Element;
|
|
21
|
+
export default GaugeChart;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
|
|
11
|
+
var _auxiliarFunctions = require("../../lib/auxiliarFunctions");
|
|
12
|
+
var _commonStyles = require("../../commonStyles");
|
|
13
|
+
var _theme = require("flipper-ui/theme");
|
|
14
|
+
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; }
|
|
15
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
16
|
+
var _theme$colors = _theme.theme.colors,
|
|
17
|
+
amber = _theme$colors.amber,
|
|
18
|
+
green = _theme$colors.green,
|
|
19
|
+
red = _theme$colors.red,
|
|
20
|
+
orange = _theme$colors.orange,
|
|
21
|
+
gray = _theme$colors.gray,
|
|
22
|
+
neutral = _theme$colors.neutral;
|
|
23
|
+
var GaugeChart = function GaugeChart(props) {
|
|
24
|
+
var _toolboxTooltip$saveA;
|
|
25
|
+
var data = props.data,
|
|
26
|
+
height = props.height,
|
|
27
|
+
tooltip = props.tooltip,
|
|
28
|
+
axisLabel = props.axisLabel,
|
|
29
|
+
colorLine = props.colorLine,
|
|
30
|
+
legendData = props.legendData,
|
|
31
|
+
legendValue = props.legendValue,
|
|
32
|
+
axisLineWidth = props.axisLineWidth,
|
|
33
|
+
titleFontSize = props.titleFontSize,
|
|
34
|
+
toolboxTooltip = props.toolboxTooltip,
|
|
35
|
+
detailFontSize = props.detailFontSize;
|
|
36
|
+
var CHART_STYLE = {
|
|
37
|
+
width: '99.9%',
|
|
38
|
+
height: height || 400
|
|
39
|
+
};
|
|
40
|
+
var getColor = function getColor(value) {
|
|
41
|
+
return value <= (legendValue !== null && legendValue !== void 0 ? legendValue : 75) ? red[500] : green[300];
|
|
42
|
+
};
|
|
43
|
+
var formatTooltip = function formatTooltip() {
|
|
44
|
+
return tooltip ? "".concat(tooltip.label, ": ").concat(Number(tooltip.labelComplement) * 100, " %") : '';
|
|
45
|
+
};
|
|
46
|
+
var formatAxisLabel = function formatAxisLabel(value) {
|
|
47
|
+
var match = axisLabel === null || axisLabel === void 0 ? void 0 : axisLabel.find(function (item) {
|
|
48
|
+
return item.limit === value;
|
|
49
|
+
});
|
|
50
|
+
return match ? match.label : '';
|
|
51
|
+
};
|
|
52
|
+
var toolbox = toolboxTooltip && {
|
|
53
|
+
showTitle: false,
|
|
54
|
+
top: '10%',
|
|
55
|
+
right: '15%',
|
|
56
|
+
feature: {
|
|
57
|
+
saveAsImage: toolboxTooltip.saveAsImage && (0, _auxiliarFunctions.getSaveAsImage)((_toolboxTooltip$saveA = toolboxTooltip.saveAsImage.title) !== null && _toolboxTooltip$saveA !== void 0 ? _toolboxTooltip$saveA : '')
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var options = {
|
|
61
|
+
series: [{
|
|
62
|
+
type: 'gauge',
|
|
63
|
+
startAngle: 180,
|
|
64
|
+
endAngle: 0,
|
|
65
|
+
center: ['50%', '70%'],
|
|
66
|
+
radius: '90%',
|
|
67
|
+
min: 0,
|
|
68
|
+
max: 1,
|
|
69
|
+
splitNumber: 8,
|
|
70
|
+
data: data,
|
|
71
|
+
axisLine: {
|
|
72
|
+
lineStyle: {
|
|
73
|
+
width: axisLineWidth !== null && axisLineWidth !== void 0 ? axisLineWidth : 75,
|
|
74
|
+
color: colorLine !== null && colorLine !== void 0 ? colorLine : [[0.25, red[500]], [0.5, orange[600]], [0.75, amber[500]], [1, green[300]]]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
pointer: {
|
|
78
|
+
width: 20,
|
|
79
|
+
length: '95%',
|
|
80
|
+
offsetCenter: [0, '-5%'],
|
|
81
|
+
icon: 'path://M12.8,-0.7l12,-40.1H0.7L12.8,-0.7z',
|
|
82
|
+
itemStyle: {
|
|
83
|
+
color: gray[900]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
axisTick: {
|
|
87
|
+
length: 0
|
|
88
|
+
},
|
|
89
|
+
splitLine: {
|
|
90
|
+
length: 0
|
|
91
|
+
},
|
|
92
|
+
axisLabel: {
|
|
93
|
+
color: gray[800],
|
|
94
|
+
fontSize: 16,
|
|
95
|
+
distance: -40,
|
|
96
|
+
rotate: 'tangential',
|
|
97
|
+
formatter: formatAxisLabel
|
|
98
|
+
},
|
|
99
|
+
title: {
|
|
100
|
+
fontSize: titleFontSize !== null && titleFontSize !== void 0 ? titleFontSize : 30,
|
|
101
|
+
color: gray[800],
|
|
102
|
+
offsetCenter: [0, '20%']
|
|
103
|
+
},
|
|
104
|
+
detail: {
|
|
105
|
+
fontSize: detailFontSize !== null && detailFontSize !== void 0 ? detailFontSize : 24,
|
|
106
|
+
color: gray[900],
|
|
107
|
+
valueAnimation: true,
|
|
108
|
+
offsetCenter: [0, '40%'],
|
|
109
|
+
formatter: function formatter(value) {
|
|
110
|
+
return Math.round(value * 100) + ' %';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}],
|
|
114
|
+
tooltip: {
|
|
115
|
+
trigger: 'item',
|
|
116
|
+
formatter: formatTooltip,
|
|
117
|
+
backgroundColor: "".concat(neutral[200], "99"),
|
|
118
|
+
textStyle: {
|
|
119
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
|
|
120
|
+
fontSize: 11.5,
|
|
121
|
+
color: neutral[50]
|
|
122
|
+
},
|
|
123
|
+
extraCssText: 'border: none; padding: 6px;'
|
|
124
|
+
},
|
|
125
|
+
toolbox: _objectSpread(_objectSpread({}, toolbox), {}, {
|
|
126
|
+
tooltip: _objectSpread(_objectSpread({}, _commonStyles.TOOLTIP_DEFAULT_PROPS), {}, {
|
|
127
|
+
// @ts-expect-error issue
|
|
128
|
+
// if the trigger it's not set to none, the tooltip shows an arrow
|
|
129
|
+
trigger: 'none',
|
|
130
|
+
formatter: function formatter(param) {
|
|
131
|
+
return "<div>".concat(param.title, "</div>");
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
};
|
|
136
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
|
|
137
|
+
option: options,
|
|
138
|
+
style: CHART_STYLE
|
|
139
|
+
}), /*#__PURE__*/_react["default"].createElement(_commonStyles.GaugeLegendContainer, null, legendData === null || legendData === void 0 ? void 0 : legendData.map(function (it, i) {
|
|
140
|
+
return /*#__PURE__*/_react["default"].createElement(_commonStyles.GaugeLegendContent, {
|
|
141
|
+
key: i
|
|
142
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, it.icon), /*#__PURE__*/_react["default"].createElement(_commonStyles.GaugeCircle, {
|
|
143
|
+
color: getColor(it.legend)
|
|
144
|
+
}), /*#__PURE__*/_react["default"].createElement(_commonStyles.GaugeLegend, null, it.legend + ' %'));
|
|
145
|
+
})));
|
|
146
|
+
};
|
|
147
|
+
var _default = exports["default"] = GaugeChart;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import GaugeChart from './GaugeChart';
|
|
3
|
+
declare const meta: Meta<typeof GaugeChart>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof GaugeChart>;
|
|
6
|
+
export declare const gaugeChart: Story;
|
|
7
|
+
export declare const gaugeChartWithoutLegend: Story;
|
|
8
|
+
export declare const gaugeChartWithLabelAndTooltip: Story;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { IDefaultChartProps
|
|
2
|
+
import type { IDefaultChartProps } from '../types';
|
|
3
3
|
export interface IProps extends Omit<IDefaultChartProps, 'data'> {
|
|
4
|
-
data:
|
|
4
|
+
data: {
|
|
5
|
+
name: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
data: number[];
|
|
8
|
+
}[];
|
|
9
|
+
smooth?: boolean;
|
|
5
10
|
colors?: string[];
|
|
11
|
+
xAxisData: string[];
|
|
6
12
|
showLabel?: boolean;
|
|
7
|
-
smooth?: boolean;
|
|
8
13
|
disableMarks?: boolean;
|
|
9
14
|
axisNames?: {
|
|
10
15
|
x: string;
|
|
11
16
|
y: string;
|
|
12
17
|
};
|
|
13
18
|
}
|
|
14
|
-
declare const LineChart: (props: IProps) => React.JSX.Element;
|
|
15
|
-
export default LineChart;
|
|
19
|
+
export declare const LineChart: (props: IProps) => React.JSX.Element;
|
|
@@ -1,240 +1,193 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
|
-
exports
|
|
8
|
+
exports.LineChart = void 0;
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var
|
|
12
|
+
var _charts = require("echarts/charts");
|
|
13
|
+
var _components = require("echarts/components");
|
|
14
|
+
var echarts = _interopRequireWildcard(require("echarts/core"));
|
|
15
|
+
var _renderers = require("echarts/renderers");
|
|
16
|
+
var _core2 = _interopRequireDefault(require("echarts-for-react/lib/core"));
|
|
12
17
|
var _auxiliarFunctions = require("../../lib/auxiliarFunctions");
|
|
13
18
|
var _commonStyles = require("../../commonStyles");
|
|
14
19
|
var _theme = require("flipper-ui/theme");
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
22
|
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; }
|
|
16
23
|
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) { (0, _defineProperty2["default"])(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; }
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var takeYdata = function takeYdata(entryData) {
|
|
21
|
-
return entryData.map(function (item) {
|
|
22
|
-
return item.result;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var LineChart = function LineChart(props) {
|
|
24
|
+
var neutral = _theme.theme.colors.neutral;
|
|
25
|
+
echarts.use([_components.GridComponent, _components.TitleComponent, _renderers.CanvasRenderer, _components.LegendComponent, _components.TooltipComponent, _components.ToolboxComponent, _charts.LineChart, _components.DataZoomInsideComponent, _components.DataZoomSliderComponent]);
|
|
26
|
+
var LineChart = exports.LineChart = function LineChart(props) {
|
|
26
27
|
var _toolboxTooltip$saveA, _toolboxTooltip$dataV;
|
|
27
28
|
var data = props.data,
|
|
29
|
+
grid = props.grid,
|
|
30
|
+
title = props.title,
|
|
28
31
|
width = props.width,
|
|
29
|
-
gridProps = props.grid,
|
|
30
|
-
colors = props.colors,
|
|
31
32
|
xType = props.xType,
|
|
33
|
+
yType = props.yType,
|
|
34
|
+
colors = props.colors,
|
|
35
|
+
smooth = props.smooth,
|
|
36
|
+
xAxisData = props.xAxisData,
|
|
37
|
+
showLabel = props.showLabel,
|
|
32
38
|
dateFormat = props.dateFormat,
|
|
33
39
|
rotateLabel = props.rotateLabel,
|
|
34
|
-
|
|
35
|
-
yType = props.yType,
|
|
40
|
+
scrollStart = props.scrollStart,
|
|
36
41
|
yComplement = props.yComplement,
|
|
37
|
-
titleProps = props.title,
|
|
38
|
-
toolboxTooltip = props.toolboxTooltip,
|
|
39
|
-
showLabel = props.showLabel,
|
|
40
|
-
smooth = props.smooth,
|
|
41
42
|
disableMarks = props.disableMarks,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var formatLabel = function formatLabel(chartValues) {
|
|
53
|
-
var data = chartValues.data;
|
|
43
|
+
fontLabelSize = props.fontLabelSize,
|
|
44
|
+
toolboxTooltip = props.toolboxTooltip;
|
|
45
|
+
var formatLabel = function formatLabel(item) {
|
|
46
|
+
var data = item.data;
|
|
47
|
+
if (typeof yComplement === 'function' && (0, _typeof2["default"])(item) === 'object') {
|
|
48
|
+
return yComplement(item.data);
|
|
49
|
+
}
|
|
50
|
+
if (typeof yComplement === 'function') {
|
|
51
|
+
return yComplement;
|
|
52
|
+
}
|
|
54
53
|
return yType === 'time' ? (0, _auxiliarFunctions.timeConvert)(Number(data)) + 'h' : (0, _auxiliarFunctions.takeLabelComplement)(Number(data), yComplement !== null && yComplement !== void 0 ? yComplement : '');
|
|
55
54
|
};
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
name: item.name,
|
|
60
|
-
data: takeYdata(item.values),
|
|
61
|
-
showSymbol: !disableMarks,
|
|
62
|
-
lineStyle: {
|
|
63
|
-
width: 1.5,
|
|
64
|
-
type: item.name === 'ref' ? 'dashed' : undefined
|
|
65
|
-
},
|
|
66
|
-
smooth: smooth,
|
|
67
|
-
label: {
|
|
68
|
-
show: showLabel,
|
|
69
|
-
position: 'top',
|
|
70
|
-
fontSize: yType === 'time' ? 10 : 11.5,
|
|
71
|
-
color: neutral[200],
|
|
72
|
-
distance: 1.1,
|
|
73
|
-
formatter: function formatter(item) {
|
|
74
|
-
if (typeof yComplement === 'function' && (0, _typeof2["default"])(item) === 'object') {
|
|
75
|
-
return yComplement(item.data);
|
|
76
|
-
}
|
|
77
|
-
if (typeof yComplement === 'function') {
|
|
78
|
-
return yComplement;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// this can't be returned
|
|
82
|
-
// it breaks the labels
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
84
|
-
formatLabel;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
55
|
+
var formatTooltip = function formatTooltip(lines) {
|
|
56
|
+
var takeComplement = function takeComplement(value) {
|
|
57
|
+
return yType === 'time' ? (0, _auxiliarFunctions.timeConvert)(Number(value)) + 'h' : (0, _auxiliarFunctions.takeLabelComplement)(Number(value), yComplement !== null && yComplement !== void 0 ? yComplement : '');
|
|
87
58
|
};
|
|
88
|
-
|
|
59
|
+
var linesTooltips = lines.map(function (line) {
|
|
60
|
+
return line.seriesName + ': ' + takeComplement(Number(line.value)) + '<br>';
|
|
61
|
+
});
|
|
62
|
+
var tooltipTitle = xType === 'time' ? (0, _auxiliarFunctions.formatTime)(dateFormat === 'yyyy-MM' ? lines[0].name + '-02' : lines[0].name, (0, _auxiliarFunctions.getDateFormatType)(dateFormat !== null && dateFormat !== void 0 ? dateFormat : 'yyyy-MM')) : lines[0].name;
|
|
63
|
+
return "".concat(tooltipTitle, " <br> ").concat(linesTooltips.join(' '));
|
|
64
|
+
};
|
|
89
65
|
var arrayInitialSize = scrollStart || (dateFormat === 'yyyy-MM' ? 12 : 30);
|
|
90
66
|
var tooltipLabelFormat = dateFormat === 'yyyy-MM' ? 'MMM/yy' : 'dd/MM/yyyy';
|
|
91
|
-
var scrollable =
|
|
67
|
+
var scrollable = xAxisData.length > arrayInitialSize ? [{
|
|
92
68
|
type: 'inside',
|
|
93
|
-
start: (0, _auxiliarFunctions.getInitialValues)(
|
|
69
|
+
start: (0, _auxiliarFunctions.getInitialValues)(xAxisData.length, dateFormat, scrollStart),
|
|
94
70
|
end: 100,
|
|
95
71
|
zoomLock: true,
|
|
96
72
|
zoomOnMouseWheel: 'shift'
|
|
97
73
|
}, {
|
|
98
|
-
bottom: 10,
|
|
99
74
|
show: true,
|
|
75
|
+
bottom: 10,
|
|
100
76
|
type: 'slider',
|
|
101
|
-
start: (0, _auxiliarFunctions.getInitialValues)(
|
|
77
|
+
start: (0, _auxiliarFunctions.getInitialValues)(xAxisData.length, dateFormat, scrollStart),
|
|
102
78
|
end: 100,
|
|
103
79
|
labelFormatter: function labelFormatter(_, item2) {
|
|
104
80
|
return (0, _auxiliarFunctions.formatTime)(item2, tooltipLabelFormat);
|
|
105
81
|
}
|
|
106
82
|
}] : [];
|
|
107
|
-
var formatTooltip = function formatTooltip(lines) {
|
|
108
|
-
var takeComplement = function takeComplement(value) {
|
|
109
|
-
return yType === 'time' ? (0, _auxiliarFunctions.timeConvert)(Number(value)) + 'h' : (0, _auxiliarFunctions.takeLabelComplement)(Number(value), yComplement !== null && yComplement !== void 0 ? yComplement : '');
|
|
110
|
-
};
|
|
111
|
-
var linesTooltips = lines.map(function (line) {
|
|
112
|
-
return line.seriesName + ': ' + takeComplement(Number(line.value)) + '<br>';
|
|
113
|
-
});
|
|
114
|
-
var tooltipTitle = xType === 'time' ? (0, _auxiliarFunctions.formatTime)(dateFormat === 'yyyy-MM' ? lines[0].name + '-02' : lines[0].name, (0, _auxiliarFunctions.getDateFormatType)(dateFormat !== null && dateFormat !== void 0 ? dateFormat : 'yyyy-MM')) : lines[0].name;
|
|
115
|
-
return "".concat(tooltipTitle, " <br> ").concat(linesTooltips.join(' '));
|
|
116
|
-
};
|
|
117
83
|
var toolbox = toolboxTooltip && _objectSpread(_objectSpread({}, _commonStyles.TOOLBOX_DEFAULT_PROPS), {}, {
|
|
118
|
-
showTitle: false,
|
|
119
|
-
right: '9.52%',
|
|
120
84
|
feature: {
|
|
121
85
|
saveAsImage: toolboxTooltip.saveAsImage && (0, _auxiliarFunctions.getSaveAsImage)((_toolboxTooltip$saveA = toolboxTooltip.saveAsImage.title) !== null && _toolboxTooltip$saveA !== void 0 ? _toolboxTooltip$saveA : ''),
|
|
122
86
|
dataView: toolboxTooltip.dataView && (0, _auxiliarFunctions.getDataView)((_toolboxTooltip$dataV = toolboxTooltip.dataView.title) !== null && _toolboxTooltip$dataV !== void 0 ? _toolboxTooltip$dataV : '')
|
|
123
87
|
}
|
|
124
88
|
});
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
show:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
color: gray[800]
|
|
138
|
-
}
|
|
89
|
+
var series = data.map(function (item) {
|
|
90
|
+
var _item$type;
|
|
91
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
92
|
+
smooth: smooth,
|
|
93
|
+
showSymbol: !disableMarks,
|
|
94
|
+
type: (_item$type = item.type) !== null && _item$type !== void 0 ? _item$type : 'line',
|
|
95
|
+
label: {
|
|
96
|
+
distance: 1.1,
|
|
97
|
+
show: showLabel,
|
|
98
|
+
color: neutral[200],
|
|
99
|
+
formatter: formatLabel,
|
|
100
|
+
fontSize: yType === 'time' ? 10 : 11.5
|
|
139
101
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
rotate: rotateLabel || 0,
|
|
145
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
|
|
146
|
-
fontWeight: 400,
|
|
147
|
-
fontSize: fontLabelSize || 11.5,
|
|
148
|
-
color: neutral[200]
|
|
102
|
+
lineStyle: {
|
|
103
|
+
width: 1.5,
|
|
104
|
+
type: item.name === 'ref' ? 'dashed' : undefined
|
|
149
105
|
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
var getOption = function getOption() {
|
|
109
|
+
return {
|
|
110
|
+
color: colors,
|
|
111
|
+
series: series,
|
|
112
|
+
dataZoom: scrollable,
|
|
113
|
+
grid: _objectSpread(_objectSpread({}, grid || {
|
|
114
|
+
bottom: 75
|
|
115
|
+
}), {}, {
|
|
116
|
+
show: true
|
|
117
|
+
}),
|
|
118
|
+
title: {
|
|
119
|
+
text: title,
|
|
120
|
+
left: '6.2%',
|
|
121
|
+
textStyle: _objectSpread({}, _commonStyles.TITLE_STYLE)
|
|
161
122
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
123
|
+
xAxis: {
|
|
124
|
+
type: 'category',
|
|
125
|
+
data: xAxisData,
|
|
126
|
+
boundaryGap: false,
|
|
127
|
+
splitLine: {
|
|
128
|
+
show: true,
|
|
129
|
+
lineStyle: _objectSpread({}, _commonStyles.AXIS_SPLIT_LINE)
|
|
166
130
|
},
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
131
|
+
axisLabel: _objectSpread(_objectSpread({}, _commonStyles.COMMON_STYLE), {}, {
|
|
132
|
+
rotate: rotateLabel || 0,
|
|
133
|
+
fontSize: fontLabelSize || 11.5,
|
|
134
|
+
formatter: function formatter(item) {
|
|
135
|
+
return xType === 'time' ? (0, _auxiliarFunctions.formatTime)(dateFormat === 'yyyy-MM' ? item + '-02' : item, (0, _auxiliarFunctions.getDateFormatType)(dateFormat !== null && dateFormat !== void 0 ? dateFormat : 'yyyy-MM')) : item;
|
|
136
|
+
}
|
|
137
|
+
})
|
|
171
138
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
139
|
+
yAxis: {
|
|
140
|
+
type: 'value',
|
|
141
|
+
splitLine: {
|
|
142
|
+
show: true,
|
|
143
|
+
lineStyle: _objectSpread({}, _commonStyles.AXIS_SPLIT_LINE)
|
|
144
|
+
},
|
|
145
|
+
axisTick: {
|
|
146
|
+
show: true
|
|
147
|
+
},
|
|
148
|
+
axisLine: {
|
|
149
|
+
show: true,
|
|
150
|
+
type: 'solid',
|
|
151
|
+
lineStyle: {
|
|
152
|
+
color: neutral[200]
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
axisLabel: _objectSpread(_objectSpread({}, _commonStyles.COMMON_STYLE), {}, {
|
|
156
|
+
fontSize: fontLabelSize || 11.5,
|
|
157
|
+
margin: yType === 'time' ? 16 : 14,
|
|
158
|
+
formatter: function formatter(item) {
|
|
159
|
+
return yType === 'time' ? (0, _auxiliarFunctions.timeConvert)(item).toString() + 'h' : (0, _auxiliarFunctions.takeLabelComplement)(item, yComplement !== null && yComplement !== void 0 ? yComplement : '');
|
|
160
|
+
}
|
|
161
|
+
})
|
|
177
162
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
color: neutral[200]
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
grid: _objectSpread(_objectSpread({}, gridProps || {
|
|
186
|
-
bottom: 75
|
|
187
|
-
}), {}, {
|
|
188
|
-
show: true
|
|
189
|
-
}),
|
|
190
|
-
// @ts-expect-error issue
|
|
191
|
-
legend: {
|
|
192
|
-
data: names,
|
|
193
|
-
icon: _commonStyles.STRAIGHT_LINE_ICON,
|
|
194
|
-
textStyle: {
|
|
195
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
|
|
196
|
-
fontWeight: 400,
|
|
197
|
-
color: neutral[200]
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
tooltip: {
|
|
201
|
-
formatter: formatTooltip,
|
|
202
|
-
trigger: 'axis',
|
|
203
|
-
backgroundColor: "".concat(neutral[200], "99"),
|
|
204
|
-
textStyle: {
|
|
205
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
|
|
206
|
-
fontSize: 11.5,
|
|
207
|
-
color: neutral[50]
|
|
163
|
+
legend: {
|
|
164
|
+
icon: _commonStyles.STRAIGHT_LINE_ICON,
|
|
165
|
+
textStyle: _objectSpread({}, _commonStyles.COMMON_STYLE)
|
|
208
166
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
fontWeight: 400,
|
|
220
|
-
color: neutral[200]
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
dataZoom: scrollable,
|
|
224
|
-
toolbox: _objectSpread(_objectSpread({}, toolbox), {}, {
|
|
225
|
-
tooltip: _objectSpread(_objectSpread({}, _commonStyles.TOOLTIP_DEFAULT_PROPS), {}, {
|
|
226
|
-
formatter: function formatter(param) {
|
|
227
|
-
return "<div>".concat(param.title, "</div>");
|
|
228
|
-
}
|
|
167
|
+
tooltip: _objectSpread({
|
|
168
|
+
trigger: 'axis',
|
|
169
|
+
formatter: formatTooltip
|
|
170
|
+
}, _commonStyles.TOOLTIP_DEFAULT_PROPS),
|
|
171
|
+
toolbox: _objectSpread(_objectSpread({}, toolbox), {}, {
|
|
172
|
+
tooltip: _objectSpread(_objectSpread({}, _commonStyles.TOOLTIP_DEFAULT_PROPS), {}, {
|
|
173
|
+
formatter: function formatter(param) {
|
|
174
|
+
return "<div>".concat(param.title, "</div>");
|
|
175
|
+
}
|
|
176
|
+
})
|
|
229
177
|
})
|
|
230
|
-
}
|
|
178
|
+
};
|
|
231
179
|
};
|
|
232
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
233
|
-
lazyUpdate: true,
|
|
180
|
+
return /*#__PURE__*/_react["default"].createElement(_core2["default"], {
|
|
234
181
|
notMerge: true,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
option:
|
|
182
|
+
lazyUpdate: true,
|
|
183
|
+
echarts: echarts,
|
|
184
|
+
option: getOption(),
|
|
185
|
+
style: {
|
|
186
|
+
width: width !== null && width !== void 0 ? width : '99.9%'
|
|
187
|
+
},
|
|
188
|
+
opts: {
|
|
189
|
+
renderer: 'canvas',
|
|
190
|
+
width: 'auto'
|
|
191
|
+
}
|
|
238
192
|
});
|
|
239
|
-
};
|
|
240
|
-
var _default = exports["default"] = LineChart;
|
|
193
|
+
};
|
package/core/types.d.ts
CHANGED
|
@@ -87,10 +87,6 @@ export type TooltipEntryProps = {
|
|
|
87
87
|
labelComplement?: string | number;
|
|
88
88
|
resultComplement?: string | number;
|
|
89
89
|
};
|
|
90
|
-
export type EntryDataLine = {
|
|
91
|
-
name?: string;
|
|
92
|
-
values: EntryData[];
|
|
93
|
-
};
|
|
94
90
|
export type EntryData = {
|
|
95
91
|
label: string;
|
|
96
92
|
result: number;
|
|
@@ -102,6 +98,10 @@ export type PictorialEntryData = {
|
|
|
102
98
|
value: number;
|
|
103
99
|
symbol: string;
|
|
104
100
|
};
|
|
101
|
+
export type GaugeData = {
|
|
102
|
+
value: number;
|
|
103
|
+
name: string;
|
|
104
|
+
};
|
|
105
105
|
export type EntryDataNTuples = Array<EntryData[]>;
|
|
106
106
|
export type DomainValues = {
|
|
107
107
|
min: number;
|
package/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { default as CoordinateLineChart } from './core/coordinate-line-chart/Coo
|
|
|
4
4
|
export { default as DonutChart } from './core/donut-chart/DonutChart';
|
|
5
5
|
export { default as ForecastAreaChart } from './core/forecast-area-chart/ForecastAreaChart';
|
|
6
6
|
export { default as HorizontalBarChart } from './core/horizontal-bar-chart/HorizontalBarChart';
|
|
7
|
-
export { default as LineChart } from './core/line-chart/LineChart';
|
|
8
7
|
export { default as MultipurposeChart } from './core/multipurpose-chart/MultipurposeChart';
|
|
9
8
|
export { default as PictorialChart } from './core/pictorial-chart/PictorialChart';
|
|
10
9
|
export { default as PieChart } from './core/pie-chart/PieChart';
|
package/index.js
CHANGED
|
@@ -46,12 +46,6 @@ Object.defineProperty(exports, "HorizontalBarChart", {
|
|
|
46
46
|
return _HorizontalBarChart["default"];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
Object.defineProperty(exports, "LineChart", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function get() {
|
|
52
|
-
return _LineChart["default"];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
49
|
Object.defineProperty(exports, "MultipurposeChart", {
|
|
56
50
|
enumerable: true,
|
|
57
51
|
get: function get() {
|
|
@@ -100,7 +94,6 @@ var _CoordinateLineChart = _interopRequireDefault(require("./core/coordinate-lin
|
|
|
100
94
|
var _DonutChart = _interopRequireDefault(require("./core/donut-chart/DonutChart"));
|
|
101
95
|
var _ForecastAreaChart = _interopRequireDefault(require("./core/forecast-area-chart/ForecastAreaChart"));
|
|
102
96
|
var _HorizontalBarChart = _interopRequireDefault(require("./core/horizontal-bar-chart/HorizontalBarChart"));
|
|
103
|
-
var _LineChart = _interopRequireDefault(require("./core/line-chart/LineChart"));
|
|
104
97
|
var _MultipurposeChart = _interopRequireDefault(require("./core/multipurpose-chart/MultipurposeChart"));
|
|
105
98
|
var _PictorialChart = _interopRequireDefault(require("./core/pictorial-chart/PictorialChart"));
|
|
106
99
|
var _PieChart = _interopRequireDefault(require("./core/pie-chart/PieChart"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amazing-react-charts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "An amazing react charts package based in echarts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test": "NODE_ENV=test jest --no-cache --verbose --passWithNoTests --noStackTrace --runInBand --updateSnapshot"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"echarts": "5.
|
|
32
|
+
"echarts": "5.6.0",
|
|
33
33
|
"echarts-for-react": "3.0.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -40,26 +40,27 @@
|
|
|
40
40
|
"@babel/preset-env": "7.26.9",
|
|
41
41
|
"@babel/preset-react": "7.26.3",
|
|
42
42
|
"@babel/preset-typescript": "7.26.0",
|
|
43
|
-
"@storybook/addon-essentials": "8.
|
|
43
|
+
"@storybook/addon-essentials": "8.6.0",
|
|
44
44
|
"@storybook/addon-webpack5-compiler-babel": "3.0.5",
|
|
45
|
-
"@storybook/blocks": "8.
|
|
46
|
-
"@storybook/react": "8.
|
|
47
|
-
"@storybook/react-webpack5": "8.
|
|
48
|
-
"@stylistic/eslint-plugin": "4.0
|
|
45
|
+
"@storybook/blocks": "8.6.0",
|
|
46
|
+
"@storybook/react": "8.6.0",
|
|
47
|
+
"@storybook/react-webpack5": "8.6.0",
|
|
48
|
+
"@stylistic/eslint-plugin": "4.1.0",
|
|
49
49
|
"@testing-library/dom": "10.4.0",
|
|
50
50
|
"@testing-library/jest-dom": "6.6.3",
|
|
51
51
|
"@testing-library/react": "16.2.0",
|
|
52
52
|
"@testing-library/user-event": "14.6.1",
|
|
53
53
|
"@types/jest": "29.5.14",
|
|
54
|
-
"@types/node": "22.13.
|
|
54
|
+
"@types/node": "22.13.5",
|
|
55
55
|
"@types/ramda": "0.30.2",
|
|
56
56
|
"@types/react": "18.3.12",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
58
|
-
"@typescript-eslint/parser": "8.
|
|
59
|
-
"canvas": "
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "8.25.0",
|
|
58
|
+
"@typescript-eslint/parser": "8.25.0",
|
|
59
|
+
"canvas": "3.1.0",
|
|
60
|
+
"cross-env": "^7.0.3",
|
|
60
61
|
"date-fns": "4.1.0",
|
|
61
|
-
"eslint": "9.
|
|
62
|
-
"eslint-config-prettier": "10.0.
|
|
62
|
+
"eslint": "9.21.0",
|
|
63
|
+
"eslint-config-prettier": "10.0.2",
|
|
63
64
|
"eslint-import-resolver-typescript": "3.8.3",
|
|
64
65
|
"eslint-plugin-import": "2.31.0",
|
|
65
66
|
"eslint-plugin-prettier": "5.2.3",
|
|
@@ -68,16 +69,16 @@
|
|
|
68
69
|
"flipper-ui": "0.35.6",
|
|
69
70
|
"jest": "29.7.0",
|
|
70
71
|
"jest-environment-jsdom": "29.7.0",
|
|
71
|
-
"prettier": "3.5.
|
|
72
|
+
"prettier": "3.5.2",
|
|
72
73
|
"ramda": "0.30.1",
|
|
73
74
|
"react": "18.3.1",
|
|
74
75
|
"react-dom": "18.3.1",
|
|
75
|
-
"storybook": "8.
|
|
76
|
+
"storybook": "8.6.0",
|
|
76
77
|
"styled-components": "6.1.15",
|
|
77
|
-
"ts-jest": "29.2.
|
|
78
|
+
"ts-jest": "29.2.6",
|
|
78
79
|
"ts-node": "10.9.2",
|
|
79
80
|
"typescript": "5.7.3",
|
|
80
|
-
"typescript-eslint": "8.
|
|
81
|
+
"typescript-eslint": "8.25.0",
|
|
81
82
|
"webpack": "5.98.0"
|
|
82
83
|
},
|
|
83
84
|
"peerDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|