@perses-dev/timeseries-chart-plugin 0.12.1 → 0.13.0-beta.0
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/__mf/css/async/826.85c2cbf6.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/TimeSeriesChart.7df900ef.js +7 -0
- package/__mf/js/async/121.df4898d6.js +2 -0
- package/__mf/js/async/177.56f1be10.js +1 -0
- package/__mf/js/async/192.beef3a1a.js +1 -0
- package/__mf/js/async/2.c3740bb9.js +1 -0
- package/__mf/js/async/235.c24f24f7.js +1 -0
- package/__mf/js/async/274.d112354f.js +2 -0
- package/__mf/js/async/356.9f551c8a.js +1 -0
- package/__mf/js/async/366.084dd32e.js +24 -0
- package/__mf/js/async/377.7ec764e5.js +2 -0
- package/__mf/js/async/{544.4dd63985.js.LICENSE.txt → 377.7ec764e5.js.LICENSE.txt} +1 -1
- package/__mf/js/async/392.2350fb02.js +2 -0
- package/__mf/js/async/470.a4fd777e.js +2 -0
- package/__mf/js/async/491.6f81cf51.js +1 -0
- package/__mf/js/async/558.401fb679.js +1 -0
- package/__mf/js/async/587.c12780da.js +1 -0
- package/__mf/js/async/588.6662e16a.js +1 -0
- package/__mf/js/async/616.52acb1b4.js +1 -0
- package/__mf/js/async/702.de247ad8.js +2 -0
- package/__mf/js/async/71.84e486c9.js +1 -0
- package/__mf/js/async/721.88bf4be4.js +110 -0
- package/__mf/js/async/{390.ad50daba.js.LICENSE.txt → 721.88bf4be4.js.LICENSE.txt} +1 -1
- package/__mf/js/async/78.91de282a.js +1 -0
- package/__mf/js/async/826.c7b150c6.js +7 -0
- package/__mf/js/async/{472.fd3069f0.js.LICENSE.txt → 826.c7b150c6.js.LICENSE.txt} +19 -1
- package/__mf/js/async/873.9aad328a.js +1 -0
- package/__mf/js/async/891.18ba0e56.js +38 -0
- package/__mf/js/async/941.c0e2d25e.js +2 -0
- package/__mf/js/async/945.1a85358e.js +1 -0
- package/__mf/js/async/968.6de5fa7c.js +1 -0
- package/__mf/js/async/978.5c14e175.js +1 -0
- package/__mf/js/async/__federation_expose_TimeSeriesChart.0329eb0a.js +1 -0
- package/__mf/js/async/lib-router.1934857d.js +2 -0
- package/__mf/js/main.496219f9.js +7 -0
- package/lib/QuerySettingsEditor.d.ts.map +1 -1
- package/lib/QuerySettingsEditor.js +179 -167
- package/lib/QuerySettingsEditor.js.map +1 -1
- package/lib/TimeSeriesChartBase.d.ts.map +1 -1
- package/lib/TimeSeriesChartBase.js +12 -10
- package/lib/TimeSeriesChartBase.js.map +1 -1
- package/lib/cjs/QuerySettingsEditor.js +177 -165
- package/lib/cjs/TimeSeriesChartBase.js +10 -8
- package/lib/cjs/utils/timezone-formatter.js +48 -0
- package/lib/utils/timezone-formatter.d.ts +5 -0
- package/lib/utils/timezone-formatter.d.ts.map +1 -0
- package/lib/utils/timezone-formatter.js +42 -0
- package/lib/utils/timezone-formatter.js.map +1 -0
- package/mf-manifest.json +63 -52
- package/mf-stats.json +75 -56
- package/package.json +3 -3
- package/__mf/css/async/442.d3010b86.css +0 -1
- package/__mf/css/async/61.d3010b86.css +0 -1
- package/__mf/css/async/823.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/TimeSeriesChart.734ed3ec.js +0 -6
- package/__mf/js/async/121.a742c022.js +0 -2
- package/__mf/js/async/177.97e14ed0.js +0 -1
- package/__mf/js/async/192.30450189.js +0 -1
- package/__mf/js/async/2.68ee9e1b.js +0 -1
- package/__mf/js/async/235.a53a2591.js +0 -1
- package/__mf/js/async/274.8e8950b6.js +0 -2
- package/__mf/js/async/356.dee0f34a.js +0 -1
- package/__mf/js/async/390.ad50daba.js +0 -110
- package/__mf/js/async/392.550376f0.js +0 -2
- package/__mf/js/async/470.4c93905a.js +0 -2
- package/__mf/js/async/472.fd3069f0.js +0 -7
- package/__mf/js/async/489.8bb61ec9.js +0 -1
- package/__mf/js/async/491.35fc6280.js +0 -1
- package/__mf/js/async/544.4dd63985.js +0 -2
- package/__mf/js/async/558.5a41ebcc.js +0 -1
- package/__mf/js/async/587.40becf9b.js +0 -1
- package/__mf/js/async/588.33924c3f.js +0 -1
- package/__mf/js/async/616.6d37f37b.js +0 -1
- package/__mf/js/async/634.8646a5de.js +0 -24
- package/__mf/js/async/702.5d93a78a.js +0 -2
- package/__mf/js/async/71.e481dbdb.js +0 -1
- package/__mf/js/async/78.362ece9d.js +0 -1
- package/__mf/js/async/867.12a42f78.js +0 -38
- package/__mf/js/async/873.11e0e15e.js +0 -1
- package/__mf/js/async/941.5331fb70.js +0 -2
- package/__mf/js/async/968.2ea36b8a.js +0 -1
- package/__mf/js/async/978.844227d5.js +0 -1
- package/__mf/js/async/__federation_expose_TimeSeriesChart.54276867.js +0 -1
- package/__mf/js/async/lib-router.9730f5e9.js +0 -2
- package/__mf/js/main.22e0e85a.js +0 -6
- /package/__mf/js/async/{121.a742c022.js.LICENSE.txt → 121.df4898d6.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{274.8e8950b6.js.LICENSE.txt → 274.d112354f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{634.8646a5de.js.LICENSE.txt → 366.084dd32e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.550376f0.js.LICENSE.txt → 392.2350fb02.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{470.4c93905a.js.LICENSE.txt → 470.a4fd777e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{702.5d93a78a.js.LICENSE.txt → 702.de247ad8.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.5331fb70.js.LICENSE.txt → 941.c0e2d25e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.9730f5e9.js.LICENSE.txt → lib-router.1934857d.js.LICENSE.txt} +0 -0
|
@@ -25,13 +25,13 @@ const _react = require("react");
|
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
26
|
const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
|
|
27
27
|
const _isEqual = /*#__PURE__*/ _interop_require_default(require("lodash/isEqual"));
|
|
28
|
-
const _datefnstz = require("date-fns-tz");
|
|
29
28
|
const _core = require("@perses-dev/core");
|
|
30
29
|
const _core1 = require("echarts/core");
|
|
31
30
|
const _charts = require("echarts/charts");
|
|
32
31
|
const _components = require("echarts/components");
|
|
33
32
|
const _renderers = require("echarts/renderers");
|
|
34
33
|
const _components1 = require("@perses-dev/components");
|
|
34
|
+
const _timezoneformatter = require("./utils/timezone-formatter");
|
|
35
35
|
function _interop_require_default(obj) {
|
|
36
36
|
return obj && obj.__esModule ? obj : {
|
|
37
37
|
default: obj
|
|
@@ -61,6 +61,9 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
|
|
|
61
61
|
const [isDragging, setIsDragging] = (0, _react.useState)(false);
|
|
62
62
|
const [startX, setStartX] = (0, _react.useState)(0);
|
|
63
63
|
const { timeZone } = (0, _components1.useTimeZone)();
|
|
64
|
+
const getTimezoneAwareAxisFormatter = (0, _react.useCallback)((rangeMs)=>(0, _timezoneformatter.createTimezoneAwareAxisFormatter)(rangeMs, timeZone), [
|
|
65
|
+
timeZone
|
|
66
|
+
]);
|
|
64
67
|
let timeScale;
|
|
65
68
|
if (timeScaleProp === undefined) {
|
|
66
69
|
const commonTimeScale = (0, _core.getCommonTimeScale)(data);
|
|
@@ -142,12 +145,11 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
|
|
|
142
145
|
// Utilizes ECharts dataset so raw data is separate from series option style properties
|
|
143
146
|
// https://apache.github.io/echarts-handbook/en/concepts/dataset/
|
|
144
147
|
const dataset = [];
|
|
145
|
-
const isLocalTimeZone = timeZone === 'local';
|
|
146
148
|
data.map((d, index)=>{
|
|
147
149
|
const values = d.values.map(([timestamp, value])=>{
|
|
148
150
|
const val = value === null ? '-' : value; // echarts use '-' to represent null data
|
|
149
151
|
return [
|
|
150
|
-
|
|
152
|
+
timestamp,
|
|
151
153
|
val
|
|
152
154
|
];
|
|
153
155
|
});
|
|
@@ -171,11 +173,11 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
|
|
|
171
173
|
series: updatedSeriesMapping,
|
|
172
174
|
xAxis: {
|
|
173
175
|
type: 'time',
|
|
174
|
-
min:
|
|
175
|
-
max:
|
|
176
|
+
min: timeScale.startMs,
|
|
177
|
+
max: timeScale.endMs,
|
|
176
178
|
axisLabel: {
|
|
177
179
|
hideOverlap: true,
|
|
178
|
-
formatter: (
|
|
180
|
+
formatter: getTimezoneAwareAxisFormatter(timeScale.rangeMs ?? 0)
|
|
179
181
|
},
|
|
180
182
|
axisPointer: {
|
|
181
183
|
snap: false
|
|
@@ -224,10 +226,10 @@ const TimeSeriesChartBase = /*#__PURE__*/ (0, _react.forwardRef)(function TimeCh
|
|
|
224
226
|
noDataOption,
|
|
225
227
|
__experimentalEChartsOptionsOverride,
|
|
226
228
|
noDataVariant,
|
|
227
|
-
timeZone,
|
|
228
229
|
isStackedBar,
|
|
229
230
|
enablePinning,
|
|
230
|
-
pinnedCrosshair
|
|
231
|
+
pinnedCrosshair,
|
|
232
|
+
getTimezoneAwareAxisFormatter
|
|
231
233
|
]);
|
|
232
234
|
// Update adjacent charts so tooltip is unpinned when current chart is clicked.
|
|
233
235
|
(0, _react.useEffect)(()=>{
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "createTimezoneAwareAxisFormatter", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return createTimezoneAwareAxisFormatter;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _components = require("@perses-dev/components");
|
|
24
|
+
const DAY_MS = 86400000;
|
|
25
|
+
const MONTH_MS = 2629440000;
|
|
26
|
+
const YEAR_MS = 31536000000;
|
|
27
|
+
function createTimezoneAwareAxisFormatter(rangeMs, timeZone) {
|
|
28
|
+
return function(value) {
|
|
29
|
+
const timeStamp = new Date(Number(value));
|
|
30
|
+
// more than 5 years
|
|
31
|
+
if (rangeMs > YEAR_MS * 5) {
|
|
32
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'yyyy', timeZone);
|
|
33
|
+
}
|
|
34
|
+
// more than 2 years
|
|
35
|
+
if (rangeMs > YEAR_MS * 2) {
|
|
36
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'MMM yyyy', timeZone);
|
|
37
|
+
}
|
|
38
|
+
// between 10 days to 6 months
|
|
39
|
+
if (rangeMs > DAY_MS * 10 && rangeMs < MONTH_MS * 6) {
|
|
40
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM', timeZone);
|
|
41
|
+
}
|
|
42
|
+
// between 2 and 10 days
|
|
43
|
+
if (rangeMs > DAY_MS * 2 && rangeMs <= DAY_MS * 10) {
|
|
44
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM HH:mm', timeZone);
|
|
45
|
+
}
|
|
46
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'HH:mm', timeZone);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezone-formatter.d.ts","sourceRoot":"","sources":["../../../src/utils/timezone-formatter.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAC/D,OAAO,MAAM,KAAG,MAAM,CAyBxC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { formatWithTimeZone } from '@perses-dev/components';
|
|
14
|
+
const DAY_MS = 86400000;
|
|
15
|
+
const MONTH_MS = 2629440000;
|
|
16
|
+
const YEAR_MS = 31536000000;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a timezone-aware axis formatter function for different time ranges
|
|
19
|
+
*/ export function createTimezoneAwareAxisFormatter(rangeMs, timeZone) {
|
|
20
|
+
return function(value) {
|
|
21
|
+
const timeStamp = new Date(Number(value));
|
|
22
|
+
// more than 5 years
|
|
23
|
+
if (rangeMs > YEAR_MS * 5) {
|
|
24
|
+
return formatWithTimeZone(timeStamp, 'yyyy', timeZone);
|
|
25
|
+
}
|
|
26
|
+
// more than 2 years
|
|
27
|
+
if (rangeMs > YEAR_MS * 2) {
|
|
28
|
+
return formatWithTimeZone(timeStamp, 'MMM yyyy', timeZone);
|
|
29
|
+
}
|
|
30
|
+
// between 10 days to 6 months
|
|
31
|
+
if (rangeMs > DAY_MS * 10 && rangeMs < MONTH_MS * 6) {
|
|
32
|
+
return formatWithTimeZone(timeStamp, 'dd.MM', timeZone);
|
|
33
|
+
}
|
|
34
|
+
// between 2 and 10 days
|
|
35
|
+
if (rangeMs > DAY_MS * 2 && rangeMs <= DAY_MS * 10) {
|
|
36
|
+
return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timeZone);
|
|
37
|
+
}
|
|
38
|
+
return formatWithTimeZone(timeStamp, 'HH:mm', timeZone);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=timezone-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/timezone-formatter.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { formatWithTimeZone } from '@perses-dev/components';\n\nconst DAY_MS = 86400000;\nconst MONTH_MS = 2629440000;\nconst YEAR_MS = 31536000000;\n\n/**\n * Creates a timezone-aware axis formatter function for different time ranges\n */\nexport function createTimezoneAwareAxisFormatter(rangeMs: number, timeZone: string) {\n return function (value: number): string {\n const timeStamp = new Date(Number(value));\n\n // more than 5 years\n if (rangeMs > YEAR_MS * 5) {\n return formatWithTimeZone(timeStamp, 'yyyy', timeZone);\n }\n\n // more than 2 years\n if (rangeMs > YEAR_MS * 2) {\n return formatWithTimeZone(timeStamp, 'MMM yyyy', timeZone);\n }\n\n // between 10 days to 6 months\n if (rangeMs > DAY_MS * 10 && rangeMs < MONTH_MS * 6) {\n return formatWithTimeZone(timeStamp, 'dd.MM', timeZone);\n }\n\n // between 2 and 10 days\n if (rangeMs > DAY_MS * 2 && rangeMs <= DAY_MS * 10) {\n return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timeZone);\n }\n\n return formatWithTimeZone(timeStamp, 'HH:mm', timeZone);\n };\n}\n"],"names":["formatWithTimeZone","DAY_MS","MONTH_MS","YEAR_MS","createTimezoneAwareAxisFormatter","rangeMs","timeZone","value","timeStamp","Date","Number"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,SAAS;AACf,MAAMC,WAAW;AACjB,MAAMC,UAAU;AAEhB;;CAEC,GACD,OAAO,SAASC,iCAAiCC,OAAe,EAAEC,QAAgB;IAChF,OAAO,SAAUC,KAAa;QAC5B,MAAMC,YAAY,IAAIC,KAAKC,OAAOH;QAElC,oBAAoB;QACpB,IAAIF,UAAUF,UAAU,GAAG;YACzB,OAAOH,mBAAmBQ,WAAW,QAAQF;QAC/C;QAEA,oBAAoB;QACpB,IAAID,UAAUF,UAAU,GAAG;YACzB,OAAOH,mBAAmBQ,WAAW,YAAYF;QACnD;QAEA,8BAA8B;QAC9B,IAAID,UAAUJ,SAAS,MAAMI,UAAUH,WAAW,GAAG;YACnD,OAAOF,mBAAmBQ,WAAW,SAASF;QAChD;QAEA,wBAAwB;QACxB,IAAID,UAAUJ,SAAS,KAAKI,WAAWJ,SAAS,IAAI;YAClD,OAAOD,mBAAmBQ,WAAW,eAAeF;QACtD;QAEA,OAAON,mBAAmBQ,WAAW,SAASF;IAChD;AACF"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "TimeSeriesChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.
|
|
8
|
+
"buildVersion": "0.13.0-beta.0",
|
|
9
9
|
"buildName": "@perses-dev/timeseries-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/TimeSeriesChart.
|
|
12
|
+
"name": "__mf/js/TimeSeriesChart.7df900ef.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"api": ""
|
|
21
21
|
},
|
|
22
22
|
"globalName": "TimeSeriesChart",
|
|
23
|
-
"pluginVersion": "
|
|
24
|
-
"prefetchInterface": false,
|
|
23
|
+
"pluginVersion": "2.4.0",
|
|
25
24
|
"getPublicPath": "function() { const prefix = window.PERSES_PLUGIN_ASSETS_PATH || window.PERSES_APP_CONFIG?.api_prefix || \"\"; return prefix + \"/plugins/TimeSeriesChart/\"; }"
|
|
26
25
|
},
|
|
27
26
|
"shared": [
|
|
@@ -35,34 +34,36 @@
|
|
|
35
34
|
"js": {
|
|
36
35
|
"async": [],
|
|
37
36
|
"sync": [
|
|
38
|
-
"__mf/js/async/274.
|
|
37
|
+
"__mf/js/async/274.d112354f.js"
|
|
39
38
|
]
|
|
40
39
|
},
|
|
41
40
|
"css": {
|
|
42
41
|
"async": [],
|
|
43
42
|
"sync": []
|
|
44
43
|
}
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"fallback": ""
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"id": "TimeSeriesChart:@emotion/styled",
|
|
49
49
|
"name": "@emotion/styled",
|
|
50
|
-
"version": "11.14.
|
|
50
|
+
"version": "11.14.1",
|
|
51
51
|
"singleton": true,
|
|
52
|
-
"requiredVersion": "^11.14.
|
|
52
|
+
"requiredVersion": "^11.14.1",
|
|
53
53
|
"assets": {
|
|
54
54
|
"js": {
|
|
55
55
|
"async": [],
|
|
56
56
|
"sync": [
|
|
57
|
-
"__mf/js/async/235.
|
|
58
|
-
"__mf/js/async/616.
|
|
57
|
+
"__mf/js/async/235.c24f24f7.js",
|
|
58
|
+
"__mf/js/async/616.52acb1b4.js"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"css": {
|
|
62
62
|
"async": [],
|
|
63
63
|
"sync": []
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
"fallback": ""
|
|
66
67
|
},
|
|
67
68
|
{
|
|
68
69
|
"id": "TimeSeriesChart:@hookform/resolvers",
|
|
@@ -74,53 +75,58 @@
|
|
|
74
75
|
"js": {
|
|
75
76
|
"async": [],
|
|
76
77
|
"sync": [
|
|
77
|
-
"__mf/js/async/587.
|
|
78
|
-
"__mf/js/async/968.
|
|
78
|
+
"__mf/js/async/587.c12780da.js",
|
|
79
|
+
"__mf/js/async/968.6de5fa7c.js"
|
|
79
80
|
]
|
|
80
81
|
},
|
|
81
82
|
"css": {
|
|
82
83
|
"async": [],
|
|
83
84
|
"sync": []
|
|
84
85
|
}
|
|
85
|
-
}
|
|
86
|
+
},
|
|
87
|
+
"fallback": ""
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
90
|
"id": "TimeSeriesChart:@perses-dev/components",
|
|
89
91
|
"name": "@perses-dev/components",
|
|
90
|
-
"version": "0.
|
|
92
|
+
"version": "0.54.0-beta.1",
|
|
91
93
|
"singleton": true,
|
|
92
|
-
"requiredVersion": "^0.
|
|
94
|
+
"requiredVersion": "^0.54.0-beta.1",
|
|
93
95
|
"assets": {
|
|
94
96
|
"js": {
|
|
95
97
|
"async": [],
|
|
96
98
|
"sync": [
|
|
97
|
-
"__mf/js/async/
|
|
99
|
+
"__mf/js/async/826.c7b150c6.js"
|
|
98
100
|
]
|
|
99
101
|
},
|
|
100
102
|
"css": {
|
|
101
103
|
"async": [],
|
|
102
|
-
"sync": [
|
|
104
|
+
"sync": [
|
|
105
|
+
"__mf/css/async/826.85c2cbf6.css"
|
|
106
|
+
]
|
|
103
107
|
}
|
|
104
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"fallback": ""
|
|
105
110
|
},
|
|
106
111
|
{
|
|
107
112
|
"id": "TimeSeriesChart:@perses-dev/plugin-system",
|
|
108
113
|
"name": "@perses-dev/plugin-system",
|
|
109
|
-
"version": "0.
|
|
114
|
+
"version": "0.54.0-beta.1",
|
|
110
115
|
"singleton": true,
|
|
111
|
-
"requiredVersion": "^0.
|
|
116
|
+
"requiredVersion": "^0.54.0-beta.1",
|
|
112
117
|
"assets": {
|
|
113
118
|
"js": {
|
|
114
119
|
"async": [],
|
|
115
120
|
"sync": [
|
|
116
|
-
"__mf/js/async/
|
|
121
|
+
"__mf/js/async/366.084dd32e.js"
|
|
117
122
|
]
|
|
118
123
|
},
|
|
119
124
|
"css": {
|
|
120
125
|
"async": [],
|
|
121
126
|
"sync": []
|
|
122
127
|
}
|
|
123
|
-
}
|
|
128
|
+
},
|
|
129
|
+
"fallback": ""
|
|
124
130
|
},
|
|
125
131
|
{
|
|
126
132
|
"id": "TimeSeriesChart:date-fns",
|
|
@@ -132,14 +138,15 @@
|
|
|
132
138
|
"js": {
|
|
133
139
|
"async": [],
|
|
134
140
|
"sync": [
|
|
135
|
-
"__mf/js/async/192.
|
|
141
|
+
"__mf/js/async/192.beef3a1a.js"
|
|
136
142
|
]
|
|
137
143
|
},
|
|
138
144
|
"css": {
|
|
139
145
|
"async": [],
|
|
140
146
|
"sync": []
|
|
141
147
|
}
|
|
142
|
-
}
|
|
148
|
+
},
|
|
149
|
+
"fallback": ""
|
|
143
150
|
},
|
|
144
151
|
{
|
|
145
152
|
"id": "TimeSeriesChart:echarts",
|
|
@@ -151,33 +158,35 @@
|
|
|
151
158
|
"js": {
|
|
152
159
|
"async": [],
|
|
153
160
|
"sync": [
|
|
154
|
-
"__mf/js/async/873.
|
|
161
|
+
"__mf/js/async/873.9aad328a.js"
|
|
155
162
|
]
|
|
156
163
|
},
|
|
157
164
|
"css": {
|
|
158
165
|
"async": [],
|
|
159
166
|
"sync": []
|
|
160
167
|
}
|
|
161
|
-
}
|
|
168
|
+
},
|
|
169
|
+
"fallback": ""
|
|
162
170
|
},
|
|
163
171
|
{
|
|
164
172
|
"id": "TimeSeriesChart:lodash",
|
|
165
173
|
"name": "lodash",
|
|
166
|
-
"version": "4.
|
|
174
|
+
"version": "4.18.1",
|
|
167
175
|
"singleton": true,
|
|
168
|
-
"requiredVersion": "^4.
|
|
176
|
+
"requiredVersion": "^4.18.1",
|
|
169
177
|
"assets": {
|
|
170
178
|
"js": {
|
|
171
179
|
"async": [],
|
|
172
180
|
"sync": [
|
|
173
|
-
"__mf/js/async/392.
|
|
181
|
+
"__mf/js/async/392.2350fb02.js"
|
|
174
182
|
]
|
|
175
183
|
},
|
|
176
184
|
"css": {
|
|
177
185
|
"async": [],
|
|
178
186
|
"sync": []
|
|
179
187
|
}
|
|
180
|
-
}
|
|
188
|
+
},
|
|
189
|
+
"fallback": ""
|
|
181
190
|
},
|
|
182
191
|
{
|
|
183
192
|
"id": "TimeSeriesChart:react-dom",
|
|
@@ -189,14 +198,15 @@
|
|
|
189
198
|
"js": {
|
|
190
199
|
"async": [],
|
|
191
200
|
"sync": [
|
|
192
|
-
"__mf/js/async/470.
|
|
201
|
+
"__mf/js/async/470.a4fd777e.js"
|
|
193
202
|
]
|
|
194
203
|
},
|
|
195
204
|
"css": {
|
|
196
205
|
"async": [],
|
|
197
206
|
"sync": []
|
|
198
207
|
}
|
|
199
|
-
}
|
|
208
|
+
},
|
|
209
|
+
"fallback": ""
|
|
200
210
|
},
|
|
201
211
|
{
|
|
202
212
|
"id": "TimeSeriesChart:react",
|
|
@@ -208,14 +218,15 @@
|
|
|
208
218
|
"js": {
|
|
209
219
|
"async": [],
|
|
210
220
|
"sync": [
|
|
211
|
-
"__mf/js/async/121.
|
|
221
|
+
"__mf/js/async/121.df4898d6.js"
|
|
212
222
|
]
|
|
213
223
|
},
|
|
214
224
|
"css": {
|
|
215
225
|
"async": [],
|
|
216
226
|
"sync": []
|
|
217
227
|
}
|
|
218
|
-
}
|
|
228
|
+
},
|
|
229
|
+
"fallback": ""
|
|
219
230
|
},
|
|
220
231
|
{
|
|
221
232
|
"id": "TimeSeriesChart:date-fns-tz",
|
|
@@ -227,14 +238,15 @@
|
|
|
227
238
|
"js": {
|
|
228
239
|
"async": [],
|
|
229
240
|
"sync": [
|
|
230
|
-
"__mf/js/async/978.
|
|
241
|
+
"__mf/js/async/978.5c14e175.js"
|
|
231
242
|
]
|
|
232
243
|
},
|
|
233
244
|
"css": {
|
|
234
245
|
"async": [],
|
|
235
246
|
"sync": []
|
|
236
247
|
}
|
|
237
|
-
}
|
|
248
|
+
},
|
|
249
|
+
"fallback": ""
|
|
238
250
|
}
|
|
239
251
|
],
|
|
240
252
|
"remotes": [],
|
|
@@ -245,28 +257,27 @@
|
|
|
245
257
|
"assets": {
|
|
246
258
|
"js": {
|
|
247
259
|
"sync": [
|
|
248
|
-
"__mf/js/async/702.
|
|
249
|
-
"__mf/js/async/
|
|
250
|
-
"__mf/js/async/78.
|
|
251
|
-
"__mf/js/async/
|
|
252
|
-
"__mf/js/async/
|
|
253
|
-
"__mf/js/async/__federation_expose_TimeSeriesChart.
|
|
260
|
+
"__mf/js/async/702.de247ad8.js",
|
|
261
|
+
"__mf/js/async/721.88bf4be4.js",
|
|
262
|
+
"__mf/js/async/78.91de282a.js",
|
|
263
|
+
"__mf/js/async/377.7ec764e5.js",
|
|
264
|
+
"__mf/js/async/945.1a85358e.js",
|
|
265
|
+
"__mf/js/async/__federation_expose_TimeSeriesChart.0329eb0a.js"
|
|
254
266
|
],
|
|
255
267
|
"async": [
|
|
256
|
-
"__mf/js/async/
|
|
257
|
-
"__mf/js/async/
|
|
258
|
-
"__mf/js/async/
|
|
259
|
-
"__mf/js/async/
|
|
260
|
-
"__mf/js/async/491.
|
|
261
|
-
"__mf/js/async/lib-router.
|
|
262
|
-
"__mf/js/async/177.
|
|
268
|
+
"__mf/js/async/588.6662e16a.js",
|
|
269
|
+
"__mf/js/async/356.9f551c8a.js",
|
|
270
|
+
"__mf/js/async/71.84e486c9.js",
|
|
271
|
+
"__mf/js/async/891.18ba0e56.js",
|
|
272
|
+
"__mf/js/async/491.6f81cf51.js",
|
|
273
|
+
"__mf/js/async/lib-router.1934857d.js",
|
|
274
|
+
"__mf/js/async/177.56f1be10.js"
|
|
263
275
|
]
|
|
264
276
|
},
|
|
265
277
|
"css": {
|
|
266
278
|
"sync": [],
|
|
267
279
|
"async": [
|
|
268
|
-
"__mf/css/async/
|
|
269
|
-
"__mf/css/async/823.d3010b86.css"
|
|
280
|
+
"__mf/css/async/826.85c2cbf6.css"
|
|
270
281
|
]
|
|
271
282
|
}
|
|
272
283
|
},
|