bento-charts 2.6.3 → 2.6.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/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Bento Charts
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/bento-platform/Bento-Charts)
|
|
4
3
|
[](https://coveralls.io/github/bento-platform/Bento-Charts?branch=master)
|
|
5
4
|
[](https://badge.fury.io/js/bento-charts)
|
|
6
5
|
|
|
@@ -41,21 +41,12 @@ var BentoBarChart = function (_a) {
|
|
|
41
41
|
if (data.length === 0) {
|
|
42
42
|
return _jsx(NoData, { height: height });
|
|
43
43
|
}
|
|
44
|
-
var cartesianGridVerticalCoordinatesGenerator = function (_a) {
|
|
45
|
-
var _b;
|
|
46
|
-
var xAxis = _a.xAxis;
|
|
47
|
-
var points = [(_b = xAxis === null || xAxis === void 0 ? void 0 : xAxis.x) !== null && _b !== void 0 ? _b : 0];
|
|
48
|
-
for (var i = 0; i <= data.length; i++) {
|
|
49
|
-
points.push(points[i] + xAxis.bandSize);
|
|
50
|
-
}
|
|
51
|
-
return points;
|
|
52
|
-
};
|
|
53
44
|
// Regarding XAxis.ticks below:
|
|
54
45
|
// The weird conditional is added from https://github.com/recharts/recharts/issues/2593#issuecomment-1311678397
|
|
55
46
|
// Basically, if data is empty, Recharts will default to a domain of [0, "auto"] and our tickFormatter trips up
|
|
56
47
|
// on formatting a non-string. This hack manually overrides the ticks for the axis and blanks it out.
|
|
57
48
|
// - David L, 2023-01-03
|
|
58
|
-
return (_jsxs(ChartWrapper, { children: [_jsx("div", { style: TITLE_STYLE, children: title }), _jsx(ResponsiveContainer, { width: width !== null && width !== void 0 ? width : '100%', height: height, children: _jsxs(BarChart, { data: data, margin: BAR_CHART_MARGINS, children: [_jsx(XAxis, { dataKey: "x", height: 20, angle: -45, ticks: data.length ? undefined : [''], tickFormatter: tickFormatter, tickMargin: TICK_MARGIN, textAnchor: "end", interval: data.length < TICKS_SHOW_ALL_LABELS_BELOW ? 0 : 'preserveStartEnd', children: _jsx(Label, { value: units, offset: UNITS_LABEL_OFFSET, position: "insideBottom" }) }), _jsx(YAxis, { children: _jsx(Label, { value: t[COUNT_KEY], offset: -10, position: "left", angle: 270 }) }), _jsx(CartesianGrid, { strokeDasharray: "3 3",
|
|
49
|
+
return (_jsxs(ChartWrapper, { children: [_jsx("div", { style: TITLE_STYLE, children: title }), _jsx(ResponsiveContainer, { width: width !== null && width !== void 0 ? width : '100%', height: height, children: _jsxs(BarChart, { data: data, margin: BAR_CHART_MARGINS, children: [_jsx(XAxis, { dataKey: "x", height: 20, angle: -45, ticks: data.length ? undefined : [''], tickFormatter: tickFormatter, tickMargin: TICK_MARGIN, textAnchor: "end", interval: data.length < TICKS_SHOW_ALL_LABELS_BELOW ? 0 : 'preserveStartEnd', children: _jsx(Label, { value: units, offset: UNITS_LABEL_OFFSET, position: "insideBottom" }) }), _jsx(YAxis, { children: _jsx(Label, { value: t[COUNT_KEY], offset: -10, position: "left", angle: 270 }) }), _jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }), _jsx(Tooltip, { content: _jsx(BarTooltip, { totalCount: totalCount }) }), _jsx(Bar, { dataKey: "y", isAnimationActive: false, onClick: onClick, onMouseEnter: onHover, maxBarSize: 70, children: data.map(function (entry, index) { return (_jsx(Cell, { fill: fill(entry, index) }, entry.x)); }) })] }) })] }));
|
|
59
50
|
};
|
|
60
51
|
var BarTooltip = function (_a) {
|
|
61
52
|
var _b, _c, _d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BentoBarChart.js","sourceRoot":"","sources":["../../../src/Components/Charts/BentoBarChart.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,GAAG,EACH,QAAQ,EAER,aAAa,
|
|
1
|
+
{"version":3,"file":"BentoBarChart.js","sourceRoot":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AU,gBAAA;IAMV,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAM,IAAI,GAAG,CAAC,OAAO,KAAI,MAAA,MAAA,OAAO,CAAC,CAAC,CAAC,0CAAE,OAAO,0CAAE,CAAC,CAAA,CAAC,IAAI,EAAE,CAAC;IACvD,IAAM,KAAK,GAAG,CAAC,OAAO,KAAI,MAAA,OAAO,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAA,CAAC,IAAI,CAAC,CAAC;IAClD,IAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3E,OAAO,CACL,eAAK,KAAK,EAAE,cAAc,aACxB,YAAG,KAAK,EAAE,WAAW,YAAG,IAAI,GAAK,EACjC,aAAG,KAAK,EAAE,WAAW,aAClB,KAAK,QAAI,UAAU,UAClB,IACA,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bento-charts",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
4
4
|
"description": "Charts library for Bento-platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,26 @@
|
|
|
17
17
|
"main"
|
|
18
18
|
],
|
|
19
19
|
"plugins": [
|
|
20
|
-
|
|
20
|
+
[
|
|
21
|
+
"@semantic-release/commit-analyzer",
|
|
22
|
+
{
|
|
23
|
+
"preset": "angular",
|
|
24
|
+
"releaseRules": [
|
|
25
|
+
{
|
|
26
|
+
"type": "chore",
|
|
27
|
+
"release": "patch"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "refact",
|
|
31
|
+
"release": "minor"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "refactor",
|
|
35
|
+
"release": "minor"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
],
|
|
21
40
|
"@semantic-release/release-notes-generator",
|
|
22
41
|
"@semantic-release/npm",
|
|
23
42
|
"@semantic-release/github",
|
|
@@ -54,16 +73,16 @@
|
|
|
54
73
|
}
|
|
55
74
|
},
|
|
56
75
|
"devDependencies": {
|
|
57
|
-
"@commitlint/cli": "^
|
|
58
|
-
"@commitlint/config-conventional": "^
|
|
76
|
+
"@commitlint/cli": "^18.6.1",
|
|
77
|
+
"@commitlint/config-conventional": "^18.6.2",
|
|
59
78
|
"@semantic-release/git": "^10.0.1",
|
|
60
79
|
"@types/leaflet": "^1.9.6",
|
|
61
80
|
"@types/react": "^18.2.24",
|
|
62
81
|
"@types/react-dom": "^18.2.8",
|
|
63
82
|
"@types/react-leaflet": "^3.0.0",
|
|
64
83
|
"@types/recharts": "^1.8.25",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
66
|
-
"@typescript-eslint/parser": "^
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
85
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
67
86
|
"@webpack-cli/serve": "^2.0.5",
|
|
68
87
|
"antd": "^5.9.4",
|
|
69
88
|
"css-loader": "^6.8.1",
|
|
@@ -73,15 +92,15 @@
|
|
|
73
92
|
"geojson": "^0.5.0",
|
|
74
93
|
"html-webpack-plugin": "^5.5.3",
|
|
75
94
|
"husky": "^8.0.3",
|
|
76
|
-
"prettier": "3.
|
|
95
|
+
"prettier": "3.2.5",
|
|
77
96
|
"react-router-dom": "^6.16.0",
|
|
78
|
-
"semantic-release": "^
|
|
97
|
+
"semantic-release": "^23.0.2",
|
|
79
98
|
"style-loader": "^3.3.3",
|
|
80
99
|
"ts-loader": "^9.4.4",
|
|
81
100
|
"typescript": "^5.2.2",
|
|
82
101
|
"webpack": "^5.88.2",
|
|
83
102
|
"webpack-cli": "^5.1.4",
|
|
84
|
-
"webpack-dev-server": "^
|
|
103
|
+
"webpack-dev-server": "^5.0.1"
|
|
85
104
|
},
|
|
86
105
|
"prettier": {
|
|
87
106
|
"trailingComma": "es5",
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
BarChart,
|
|
5
5
|
BarProps,
|
|
6
6
|
CartesianGrid,
|
|
7
|
-
CartesianGridProps,
|
|
8
7
|
Cell,
|
|
9
8
|
Label,
|
|
10
9
|
ResponsiveContainer,
|
|
@@ -62,14 +61,6 @@ const BentoBarChart = ({ height, width, units, title, onClick, colorTheme = 'def
|
|
|
62
61
|
return <NoData height={height} />;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
const cartesianGridVerticalCoordinatesGenerator: CartesianGridProps['verticalCoordinatesGenerator'] = ({ xAxis }) => {
|
|
66
|
-
const points = [xAxis?.x ?? 0];
|
|
67
|
-
for (let i = 0; i <= data.length; i++) {
|
|
68
|
-
points.push(points[i] + xAxis.bandSize);
|
|
69
|
-
}
|
|
70
|
-
return points;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
64
|
// Regarding XAxis.ticks below:
|
|
74
65
|
// The weird conditional is added from https://github.com/recharts/recharts/issues/2593#issuecomment-1311678397
|
|
75
66
|
// Basically, if data is empty, Recharts will default to a domain of [0, "auto"] and our tickFormatter trips up
|
|
@@ -95,12 +86,9 @@ const BentoBarChart = ({ height, width, units, title, onClick, colorTheme = 'def
|
|
|
95
86
|
<YAxis>
|
|
96
87
|
<Label value={t[COUNT_KEY]} offset={-10} position="left" angle={270} />
|
|
97
88
|
</YAxis>
|
|
98
|
-
<CartesianGrid
|
|
99
|
-
strokeDasharray="3 3"
|
|
100
|
-
verticalCoordinatesGenerator={cartesianGridVerticalCoordinatesGenerator}
|
|
101
|
-
/>
|
|
89
|
+
<CartesianGrid strokeDasharray="3 3" vertical={false} />
|
|
102
90
|
<Tooltip content={<BarTooltip totalCount={totalCount} />} />
|
|
103
|
-
<Bar dataKey="y" isAnimationActive={false} onClick={onClick} onMouseEnter={onHover} maxBarSize={
|
|
91
|
+
<Bar dataKey="y" isAnimationActive={false} onClick={onClick} onMouseEnter={onHover} maxBarSize={70}>
|
|
104
92
|
{data.map((entry, index) => (
|
|
105
93
|
<Cell key={entry.x} fill={fill(entry, index)} />
|
|
106
94
|
))}
|