@perses-dev/components 0.51.0-rc.0 → 0.51.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/README.md +1 -8
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +13 -4
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.d.ts +0 -1
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +0 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/cjs/EChart/EChart.js +11 -2
- package/dist/cjs/TimeSeriesTooltip/index.js +0 -1
- package/dist/cjs/context/ChartsProvider.js +3 -1
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/test-utils/theme.js +1 -0
- package/dist/cjs/utils/axis.js +3 -18
- package/dist/cjs/utils/format.js +0 -21
- package/dist/context/ChartsProvider.d.ts +2 -0
- package/dist/context/ChartsProvider.d.ts.map +1 -1
- package/dist/context/ChartsProvider.js +3 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +0 -1
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +1 -0
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/utils/axis.d.ts +0 -4
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +0 -9
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +0 -2
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +0 -20
- package/dist/utils/format.js.map +1 -1
- package/package.json +4 -9
- package/dist/BarChart/BarChart.d.ts +0 -16
- package/dist/BarChart/BarChart.d.ts.map +0 -1
- package/dist/BarChart/BarChart.js +0 -134
- package/dist/BarChart/BarChart.js.map +0 -1
- package/dist/BarChart/index.d.ts +0 -2
- package/dist/BarChart/index.d.ts.map +0 -1
- package/dist/BarChart/index.js +0 -15
- package/dist/BarChart/index.js.map +0 -1
- package/dist/GaugeChart/GaugeChart.d.ts +0 -23
- package/dist/GaugeChart/GaugeChart.d.ts.map +0 -1
- package/dist/GaugeChart/GaugeChart.js +0 -214
- package/dist/GaugeChart/GaugeChart.js.map +0 -1
- package/dist/GaugeChart/index.d.ts +0 -2
- package/dist/GaugeChart/index.d.ts.map +0 -1
- package/dist/GaugeChart/index.js +0 -15
- package/dist/GaugeChart/index.js.map +0 -1
- package/dist/LineChart/LineChart.d.ts +0 -22
- package/dist/LineChart/LineChart.d.ts.map +0 -1
- package/dist/LineChart/LineChart.js +0 -266
- package/dist/LineChart/LineChart.js.map +0 -1
- package/dist/LineChart/index.d.ts +0 -2
- package/dist/LineChart/index.d.ts.map +0 -1
- package/dist/LineChart/index.js +0 -15
- package/dist/LineChart/index.js.map +0 -1
- package/dist/PieChart/PieChart.d.ts +0 -14
- package/dist/PieChart/PieChart.d.ts.map +0 -1
- package/dist/PieChart/PieChart.js +0 -92
- package/dist/PieChart/PieChart.js.map +0 -1
- package/dist/PieChart/index.d.ts +0 -2
- package/dist/PieChart/index.d.ts.map +0 -1
- package/dist/PieChart/index.js +0 -15
- package/dist/PieChart/index.js.map +0 -1
- package/dist/StatChart/StatChart.d.ts +0 -21
- package/dist/StatChart/StatChart.d.ts.map +0 -1
- package/dist/StatChart/StatChart.js +0 -189
- package/dist/StatChart/StatChart.js.map +0 -1
- package/dist/StatChart/calculateFontSize.d.ts +0 -16
- package/dist/StatChart/calculateFontSize.d.ts.map +0 -1
- package/dist/StatChart/calculateFontSize.js +0 -49
- package/dist/StatChart/calculateFontSize.js.map +0 -1
- package/dist/StatChart/index.d.ts +0 -2
- package/dist/StatChart/index.d.ts.map +0 -1
- package/dist/StatChart/index.js +0 -15
- package/dist/StatChart/index.js.map +0 -1
- package/dist/StatChart/utils/formatStatChartValue.d.ts +0 -3
- package/dist/StatChart/utils/formatStatChartValue.d.ts.map +0 -1
- package/dist/StatChart/utils/formatStatChartValue.js +0 -26
- package/dist/StatChart/utils/formatStatChartValue.js.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +0 -27
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.js +0 -132
- package/dist/StatusHistoryChart/StatusHistoryChart.js.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +0 -13
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js +0 -47
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +0 -1
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +0 -2
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +0 -1
- package/dist/StatusHistoryChart/get-formatted-axis-label.js +0 -41
- package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +0 -1
- package/dist/StatusHistoryChart/index.d.ts +0 -3
- package/dist/StatusHistoryChart/index.d.ts.map +0 -1
- package/dist/StatusHistoryChart/index.js +0 -16
- package/dist/StatusHistoryChart/index.js.map +0 -1
- package/dist/StatusHistoryChart/utils/get-color.d.ts +0 -6
- package/dist/StatusHistoryChart/utils/get-color.d.ts.map +0 -1
- package/dist/StatusHistoryChart/utils/get-color.js +0 -100
- package/dist/StatusHistoryChart/utils/get-color.js.map +0 -1
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +0 -3
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +0 -1
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js +0 -27
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +0 -1
- package/dist/TimeChart/TimeChart.d.ts +0 -24
- package/dist/TimeChart/TimeChart.d.ts.map +0 -1
- package/dist/TimeChart/TimeChart.js +0 -394
- package/dist/TimeChart/TimeChart.js.map +0 -1
- package/dist/TimeChart/index.d.ts +0 -2
- package/dist/TimeChart/index.d.ts.map +0 -1
- package/dist/TimeChart/index.js +0 -15
- package/dist/TimeChart/index.js.map +0 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +0 -21
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +0 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +0 -101
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +0 -1
- package/dist/cjs/BarChart/BarChart.js +0 -142
- package/dist/cjs/BarChart/index.js +0 -30
- package/dist/cjs/GaugeChart/GaugeChart.js +0 -227
- package/dist/cjs/GaugeChart/index.js +0 -30
- package/dist/cjs/LineChart/LineChart.js +0 -274
- package/dist/cjs/LineChart/index.js +0 -30
- package/dist/cjs/PieChart/PieChart.js +0 -100
- package/dist/cjs/PieChart/index.js +0 -30
- package/dist/cjs/StatChart/StatChart.js +0 -202
- package/dist/cjs/StatChart/calculateFontSize.js +0 -55
- package/dist/cjs/StatChart/index.js +0 -30
- package/dist/cjs/StatChart/utils/formatStatChartValue.js +0 -34
- package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +0 -140
- package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +0 -55
- package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +0 -48
- package/dist/cjs/StatusHistoryChart/index.js +0 -31
- package/dist/cjs/StatusHistoryChart/utils/get-color.js +0 -125
- package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +0 -35
- package/dist/cjs/TimeChart/TimeChart.js +0 -407
- package/dist/cjs/TimeChart/index.js +0 -30
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +0 -114
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 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
|
-
_export_star(require("./StatChart"), exports);
|
|
18
|
-
function _export_star(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
-
Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return from;
|
|
30
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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, "formatStatChartValue", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return formatStatChartValue;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _core = require("@perses-dev/core");
|
|
24
|
-
const formatStatChartValue = (value, format)=>{
|
|
25
|
-
if (value === null) {
|
|
26
|
-
return 'null';
|
|
27
|
-
} else if (typeof value === 'number') {
|
|
28
|
-
return (0, _core.formatValue)(value, format);
|
|
29
|
-
} else if (value === undefined) {
|
|
30
|
-
return '';
|
|
31
|
-
} else {
|
|
32
|
-
return value;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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, "StatusHistoryChart", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return StatusHistoryChart;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _material = require("@mui/material");
|
|
25
|
-
const _charts = require("echarts/charts");
|
|
26
|
-
const _components = require("echarts/components");
|
|
27
|
-
const _core = require("echarts/core");
|
|
28
|
-
const _renderers = require("echarts/renderers");
|
|
29
|
-
const _ChartsProvider = require("../context/ChartsProvider");
|
|
30
|
-
const _TimeZoneProvider = require("../context/TimeZoneProvider");
|
|
31
|
-
const _EChart = require("../EChart");
|
|
32
|
-
const _getformattedaxislabel = require("./get-formatted-axis-label");
|
|
33
|
-
const _StatusHistoryTooltip = require("./StatusHistoryTooltip");
|
|
34
|
-
(0, _core.use)([
|
|
35
|
-
_charts.HeatmapChart,
|
|
36
|
-
_components.VisualMapComponent,
|
|
37
|
-
_components.GridComponent,
|
|
38
|
-
_components.DatasetComponent,
|
|
39
|
-
_components.TitleComponent,
|
|
40
|
-
_components.TooltipComponent,
|
|
41
|
-
_renderers.CanvasRenderer
|
|
42
|
-
]);
|
|
43
|
-
const StatusHistoryChart = (props)=>{
|
|
44
|
-
const { height, data, xAxisCategories, yAxisCategories, timeScale, colors } = props;
|
|
45
|
-
const { timeZone } = (0, _TimeZoneProvider.useTimeZone)();
|
|
46
|
-
const chartsTheme = (0, _ChartsProvider.useChartsTheme)();
|
|
47
|
-
const theme = (0, _material.useTheme)();
|
|
48
|
-
const option = {
|
|
49
|
-
tooltip: {
|
|
50
|
-
appendToBody: true,
|
|
51
|
-
formatter: (params)=>{
|
|
52
|
-
return (0, _StatusHistoryTooltip.generateTooltipHTML)({
|
|
53
|
-
data: params.data.value,
|
|
54
|
-
label: params.data.label,
|
|
55
|
-
marker: params.marker,
|
|
56
|
-
xAxisCategories,
|
|
57
|
-
yAxisCategories,
|
|
58
|
-
theme
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
grid: {
|
|
63
|
-
top: '5%',
|
|
64
|
-
bottom: '5%'
|
|
65
|
-
},
|
|
66
|
-
xAxis: {
|
|
67
|
-
type: 'category',
|
|
68
|
-
data: xAxisCategories,
|
|
69
|
-
axisLine: {
|
|
70
|
-
show: false
|
|
71
|
-
},
|
|
72
|
-
splitArea: {
|
|
73
|
-
show: false
|
|
74
|
-
},
|
|
75
|
-
axisLabel: {
|
|
76
|
-
hideOverlap: true,
|
|
77
|
-
formatter: (0, _getformattedaxislabel.getFormattedStatusHistoryAxisLabel)(timeScale?.rangeMs ?? 0, timeZone)
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
yAxis: {
|
|
81
|
-
type: 'category',
|
|
82
|
-
data: yAxisCategories,
|
|
83
|
-
axisLine: {
|
|
84
|
-
show: false
|
|
85
|
-
},
|
|
86
|
-
splitArea: {
|
|
87
|
-
show: false,
|
|
88
|
-
interval: 0
|
|
89
|
-
},
|
|
90
|
-
splitLine: {
|
|
91
|
-
show: false
|
|
92
|
-
},
|
|
93
|
-
axisLabel: {
|
|
94
|
-
interval: 0
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
visualMap: {
|
|
98
|
-
show: false,
|
|
99
|
-
type: 'piecewise',
|
|
100
|
-
pieces: colors
|
|
101
|
-
},
|
|
102
|
-
series: [
|
|
103
|
-
{
|
|
104
|
-
name: 'Status history',
|
|
105
|
-
type: 'heatmap',
|
|
106
|
-
coordinateSystem: 'cartesian2d',
|
|
107
|
-
data: data,
|
|
108
|
-
label: {
|
|
109
|
-
show: false
|
|
110
|
-
},
|
|
111
|
-
itemStyle: {
|
|
112
|
-
borderWidth: 1,
|
|
113
|
-
borderType: 'solid',
|
|
114
|
-
borderColor: '#ffffff'
|
|
115
|
-
},
|
|
116
|
-
emphasis: {
|
|
117
|
-
itemStyle: {
|
|
118
|
-
opacity: 0.5
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
};
|
|
124
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
125
|
-
style: {
|
|
126
|
-
height: height
|
|
127
|
-
},
|
|
128
|
-
sx: {
|
|
129
|
-
overflow: 'auto'
|
|
130
|
-
},
|
|
131
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_EChart.EChart, {
|
|
132
|
-
sx: {
|
|
133
|
-
width: '100%',
|
|
134
|
-
height: height
|
|
135
|
-
},
|
|
136
|
-
option: option,
|
|
137
|
-
theme: chartsTheme.echartsTheme
|
|
138
|
-
})
|
|
139
|
-
});
|
|
140
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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, "generateTooltipHTML", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return generateTooltipHTML;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _material = require("@mui/material");
|
|
24
|
-
const _utils = require("../utils");
|
|
25
|
-
function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxisCategories, theme }) {
|
|
26
|
-
const [x, y] = data;
|
|
27
|
-
const xAxisLabel = xAxisCategories[x];
|
|
28
|
-
const { formattedDate, formattedTime } = (0, _utils.getDateAndTime)(xAxisLabel);
|
|
29
|
-
const tooltipHeader = (0, _material.css)`
|
|
30
|
-
border-bottom: 1px solid ${theme.palette.grey[500]};
|
|
31
|
-
padding-bottom: 8px;
|
|
32
|
-
`;
|
|
33
|
-
const tooltipContentStyles = (0, _material.css)`
|
|
34
|
-
display: flex;
|
|
35
|
-
justify-content: space-between;
|
|
36
|
-
padding-top: 8px;
|
|
37
|
-
`;
|
|
38
|
-
const labelStyles = (0, _material.css)`
|
|
39
|
-
margin-right: 16px;
|
|
40
|
-
`;
|
|
41
|
-
return `
|
|
42
|
-
<div>
|
|
43
|
-
<div style="${tooltipHeader.styles}">${formattedDate} ${formattedTime}</div>
|
|
44
|
-
<div style="${tooltipContentStyles.styles}">
|
|
45
|
-
<div style="${labelStyles.styles}">
|
|
46
|
-
${marker}
|
|
47
|
-
<strong>${yAxisCategories[y]}</strong>
|
|
48
|
-
</div>
|
|
49
|
-
<div>
|
|
50
|
-
${label}
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
`;
|
|
55
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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, "getFormattedStatusHistoryAxisLabel", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return getFormattedStatusHistoryAxisLabel;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _utils = require("../utils");
|
|
24
|
-
function getFormattedStatusHistoryAxisLabel(rangeMs, timezone) {
|
|
25
|
-
return function(value) {
|
|
26
|
-
const dayMs = 86400000;
|
|
27
|
-
const monthMs = 2629440000;
|
|
28
|
-
const yearMs = 31536000000;
|
|
29
|
-
const timeStamp = new Date(Number(value));
|
|
30
|
-
// more than 5 years
|
|
31
|
-
if (rangeMs > yearMs * 5) {
|
|
32
|
-
return (0, _utils.formatWithTimeZone)(timeStamp, 'yyy', timezone);
|
|
33
|
-
}
|
|
34
|
-
// more than 2 years
|
|
35
|
-
if (rangeMs > yearMs * 2) {
|
|
36
|
-
return (0, _utils.formatWithTimeZone)(timeStamp, 'MMM yyy', timezone);
|
|
37
|
-
}
|
|
38
|
-
// between 5 days to 6 months
|
|
39
|
-
if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {
|
|
40
|
-
return (0, _utils.formatWithTimeZone)(timeStamp, 'dd.MM', timezone); // 12-01
|
|
41
|
-
}
|
|
42
|
-
// between 2 and 10 days
|
|
43
|
-
if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {
|
|
44
|
-
return (0, _utils.formatWithTimeZone)(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30
|
|
45
|
-
}
|
|
46
|
-
return (0, _utils.formatWithTimeZone)(timeStamp, 'HH:mm', timezone);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 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
|
-
_export_star(require("./StatusHistoryChart"), exports);
|
|
18
|
-
_export_star(require("./utils/get-color"), exports);
|
|
19
|
-
function _export_star(from, to) {
|
|
20
|
-
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
22
|
-
Object.defineProperty(to, k, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function() {
|
|
25
|
-
return from[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return from;
|
|
31
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
FALLBACK_COLOR: function() {
|
|
25
|
-
return FALLBACK_COLOR;
|
|
26
|
-
},
|
|
27
|
-
getColorForValue: function() {
|
|
28
|
-
return getColorForValue;
|
|
29
|
-
},
|
|
30
|
-
getColorsForValues: function() {
|
|
31
|
-
return getColorsForValues;
|
|
32
|
-
},
|
|
33
|
-
hexToHSL: function() {
|
|
34
|
-
return hexToHSL;
|
|
35
|
-
},
|
|
36
|
-
hslToHex: function() {
|
|
37
|
-
return hslToHex;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const FALLBACK_COLOR = '#1f77b4';
|
|
41
|
-
function getColorForValue(value, baseColor) {
|
|
42
|
-
// Validate base color
|
|
43
|
-
if (!baseColor.match(/^#[0-9A-Fa-f]{6}$/)) {
|
|
44
|
-
baseColor = FALLBACK_COLOR;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const [baseH, baseS, baseL] = hexToHSL(baseColor);
|
|
48
|
-
// Ensure numeric values are valid
|
|
49
|
-
if (isNaN(baseH) || isNaN(baseS) || isNaN(baseL)) {
|
|
50
|
-
throw new Error('Invalid HSL values');
|
|
51
|
-
}
|
|
52
|
-
// Create deterministic hash
|
|
53
|
-
const hash = String(value).split('').reduce((acc, char)=>acc + char.charCodeAt(0), 0);
|
|
54
|
-
const hueStep = 60;
|
|
55
|
-
const lightnessVariation = 15;
|
|
56
|
-
const hueOffset = hash % 6 * hueStep; // 6 segments of 60° each
|
|
57
|
-
const newH = (baseH + hueOffset) % 360;
|
|
58
|
-
const newL = baseL + (hash % 2 ? lightnessVariation : -lightnessVariation);
|
|
59
|
-
// Keep saturation high for better distinction
|
|
60
|
-
const newS = Math.min(baseS + 10, 90);
|
|
61
|
-
const color = hslToHex(Math.abs(newH), Math.min(Math.max(newS, 50), 90), Math.min(Math.max(newL, 30), 70) // Keep lightness 30-70%
|
|
62
|
-
);
|
|
63
|
-
// Validate generated color
|
|
64
|
-
if (!color.match(/^#[0-9A-Fa-f]{6}$/)) {
|
|
65
|
-
throw new Error('Invalid generated color');
|
|
66
|
-
}
|
|
67
|
-
return color;
|
|
68
|
-
} catch (_) {
|
|
69
|
-
return FALLBACK_COLOR;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function getColorsForValues(uniqueValues, themeColors) {
|
|
73
|
-
// If we have enough theme colors, use them
|
|
74
|
-
if (themeColors.length >= uniqueValues.length) {
|
|
75
|
-
return themeColors.slice(0, uniqueValues.length);
|
|
76
|
-
}
|
|
77
|
-
// Use theme colors first, then generate additional ones
|
|
78
|
-
return uniqueValues.map((value, index)=>{
|
|
79
|
-
if (index < themeColors.length) {
|
|
80
|
-
return themeColors[index] || FALLBACK_COLOR;
|
|
81
|
-
}
|
|
82
|
-
return getColorForValue(value, themeColors[0] || FALLBACK_COLOR);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function hexToHSL(hex) {
|
|
86
|
-
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
87
|
-
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
88
|
-
const b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
89
|
-
const max = Math.max(r, g, b);
|
|
90
|
-
const min = Math.min(r, g, b);
|
|
91
|
-
let h = 0;
|
|
92
|
-
let s = 0;
|
|
93
|
-
const l = (max + min) / 2;
|
|
94
|
-
if (max !== min) {
|
|
95
|
-
const d = max - min;
|
|
96
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
97
|
-
switch(max){
|
|
98
|
-
case r:
|
|
99
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
100
|
-
break;
|
|
101
|
-
case g:
|
|
102
|
-
h = (b - r) / d + 2;
|
|
103
|
-
break;
|
|
104
|
-
case b:
|
|
105
|
-
h = (r - g) / d + 4;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
h /= 6;
|
|
109
|
-
}
|
|
110
|
-
return [
|
|
111
|
-
h * 360,
|
|
112
|
-
s * 100,
|
|
113
|
-
l * 100
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
function hslToHex(h, s, l) {
|
|
117
|
-
l /= 100;
|
|
118
|
-
const a = s * Math.min(l, 1 - l) / 100;
|
|
119
|
-
const f = (n)=>{
|
|
120
|
-
const k = (n + h / 30) % 12;
|
|
121
|
-
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
122
|
-
return Math.round(255 * color).toString(16).padStart(2, '0');
|
|
123
|
-
};
|
|
124
|
-
return `#${f(0)}${f(8)}${f(4)}`;
|
|
125
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 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, "getTooltipPosition", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return getTooltipPosition;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const getTooltipPosition = (...data)=>{
|
|
24
|
-
const point = data[0];
|
|
25
|
-
const size = data[4];
|
|
26
|
-
// calculate the position to avoid overflow
|
|
27
|
-
const [x, y] = point;
|
|
28
|
-
const { contentSize, viewSize } = size;
|
|
29
|
-
const posX = x + contentSize[0] > viewSize[0] ? x - contentSize[0] : x;
|
|
30
|
-
const posY = y + contentSize[1] > viewSize[1] ? y - contentSize[1] : y;
|
|
31
|
-
return [
|
|
32
|
-
posX,
|
|
33
|
-
posY
|
|
34
|
-
];
|
|
35
|
-
};
|