@gravity-ui/charts 1.48.0 → 1.48.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.
|
@@ -21,6 +21,10 @@ const tickIntervals = [
|
|
|
21
21
|
[utcMonth, 3, 3 * MONTH],
|
|
22
22
|
[utcYear, 1, YEAR],
|
|
23
23
|
];
|
|
24
|
+
// utcDay.every(2) resets its day counter at the start of each month (field = getUTCDate() - 1),
|
|
25
|
+
// so in a 31-day month the last tick lands on day 31 and the next tick is day 1 of the following
|
|
26
|
+
// month — only 1 day apart. Filtering by absolute Unix day number avoids the monthly reset.
|
|
27
|
+
const utcEvery2Days = utcDay.filter((d) => Math.floor(d.getTime() / DAY) % 2 === 0);
|
|
24
28
|
function getDateTimeTickInterval(start, stop, count) {
|
|
25
29
|
const target = Math.abs(stop - start) / count;
|
|
26
30
|
const i = bisector(([, , step]) => step).right(tickIntervals, target);
|
|
@@ -31,6 +35,9 @@ function getDateTimeTickInterval(start, stop, count) {
|
|
|
31
35
|
return utcMillisecond.every(Math.max(tickStep(start, stop, count), 1));
|
|
32
36
|
}
|
|
33
37
|
const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
|
|
38
|
+
if (t === utcDay && step === 2) {
|
|
39
|
+
return utcEvery2Days;
|
|
40
|
+
}
|
|
34
41
|
return t.every(step);
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
@@ -21,6 +21,10 @@ const tickIntervals = [
|
|
|
21
21
|
[utcMonth, 3, 3 * MONTH],
|
|
22
22
|
[utcYear, 1, YEAR],
|
|
23
23
|
];
|
|
24
|
+
// utcDay.every(2) resets its day counter at the start of each month (field = getUTCDate() - 1),
|
|
25
|
+
// so in a 31-day month the last tick lands on day 31 and the next tick is day 1 of the following
|
|
26
|
+
// month — only 1 day apart. Filtering by absolute Unix day number avoids the monthly reset.
|
|
27
|
+
const utcEvery2Days = utcDay.filter((d) => Math.floor(d.getTime() / DAY) % 2 === 0);
|
|
24
28
|
function getDateTimeTickInterval(start, stop, count) {
|
|
25
29
|
const target = Math.abs(stop - start) / count;
|
|
26
30
|
const i = bisector(([, , step]) => step).right(tickIntervals, target);
|
|
@@ -31,6 +35,9 @@ function getDateTimeTickInterval(start, stop, count) {
|
|
|
31
35
|
return utcMillisecond.every(Math.max(tickStep(start, stop, count), 1));
|
|
32
36
|
}
|
|
33
37
|
const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
|
|
38
|
+
if (t === utcDay && step === 2) {
|
|
39
|
+
return utcEvery2Days;
|
|
40
|
+
}
|
|
34
41
|
return t.every(step);
|
|
35
42
|
}
|
|
36
43
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/charts",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.1",
|
|
4
4
|
"description": "A flexible JavaScript library for data visualization and chart rendering using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -146,6 +146,9 @@
|
|
|
146
146
|
"typescript": "^5.9.3",
|
|
147
147
|
"vite": "^7.3.1"
|
|
148
148
|
},
|
|
149
|
+
"overrides": {
|
|
150
|
+
"dompurify": "^3.4.0"
|
|
151
|
+
},
|
|
149
152
|
"peerDependencies": {
|
|
150
153
|
"@gravity-ui/uikit": "^7.0.0",
|
|
151
154
|
"react": ">=17.0.0",
|