@perses-dev/components 0.36.2 → 0.37.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.
- package/dist/FontSizeSelector/FontSizeSelector.d.ts +8 -0
- package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -0
- package/dist/FontSizeSelector/FontSizeSelector.js +124 -0
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -0
- package/dist/FontSizeSelector/index.d.ts +2 -0
- package/dist/FontSizeSelector/index.d.ts.map +1 -0
- package/dist/FontSizeSelector/index.js +15 -0
- package/dist/FontSizeSelector/index.js.map +1 -0
- package/dist/LineChart/LineChart.d.ts +5 -25
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +6 -6
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LineChart/index.d.ts +0 -1
- package/dist/LineChart/index.d.ts.map +1 -1
- package/dist/LineChart/index.js +0 -1
- package/dist/LineChart/index.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +2 -0
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +7 -5
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.d.ts +3 -1
- package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
- package/dist/StatChart/calculateFontSize.js +5 -1
- package/dist/StatChart/calculateFontSize.js.map +1 -1
- package/dist/TimeChart/TimeChart.d.ts +23 -0
- package/dist/TimeChart/TimeChart.d.ts.map +1 -0
- package/dist/TimeChart/TimeChart.js +317 -0
- package/dist/TimeChart/TimeChart.js.map +1 -0
- package/dist/TimeChart/index.d.ts +2 -0
- package/dist/TimeChart/index.d.ts.map +1 -0
- package/dist/TimeChart/index.js +15 -0
- package/dist/TimeChart/index.js.map +1 -0
- package/dist/TimeSeriesTooltip/{TimeSeriesTooltip.d.ts → LineChartTooltip.d.ts} +2 -2
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/{TimeSeriesTooltip.js → LineChartTooltip.js} +4 -4
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +21 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +78 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -9
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.d.ts +2 -1
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +2 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +23 -5
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +166 -4
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +4 -0
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +26 -1
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +41 -5
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/cjs/FontSizeSelector/FontSizeSelector.js +130 -0
- package/dist/cjs/FontSizeSelector/index.js +28 -0
- package/dist/cjs/LineChart/LineChart.js +5 -44
- package/dist/cjs/LineChart/index.js +0 -1
- package/dist/cjs/StatChart/StatChart.js +7 -5
- package/dist/cjs/StatChart/calculateFontSize.js +5 -1
- package/dist/cjs/TimeChart/TimeChart.js +323 -0
- package/dist/cjs/TimeChart/index.js +28 -0
- package/dist/cjs/TimeSeriesTooltip/{TimeSeriesTooltip.js → LineChartTooltip.js} +4 -4
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +89 -0
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -9
- package/dist/cjs/TimeSeriesTooltip/index.js +2 -1
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +162 -4
- package/dist/cjs/TimeSeriesTooltip/utils.js +47 -7
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/utils/axis.js +58 -0
- package/dist/cjs/{LineChart/utils.js → utils/chart-actions.js} +0 -54
- package/dist/cjs/utils/format.js +47 -1
- package/dist/cjs/utils/index.js +3 -1
- package/dist/cjs/utils/theme-gen.js +42 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +19 -2
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/theme.d.ts +5 -0
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/utils/axis.d.ts +14 -0
- package/dist/utils/axis.d.ts.map +1 -0
- package/dist/utils/axis.js +45 -0
- package/dist/utils/axis.js.map +1 -0
- package/dist/utils/chart-actions.d.ts +18 -0
- package/dist/utils/chart-actions.d.ts.map +1 -0
- package/dist/utils/chart-actions.js +52 -0
- package/dist/utils/chart-actions.js.map +1 -0
- package/dist/utils/format.d.ts +6 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +47 -0
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/theme-gen.d.ts +6 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +42 -1
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +3 -3
- package/dist/LineChart/utils.d.ts +0 -31
- package/dist/LineChart/utils.d.ts.map +0 -1
- package/dist/LineChart/utils.js +0 -103
- package/dist/LineChart/utils.js.map +0 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +0 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +0 -1
|
@@ -24,8 +24,10 @@ _export(exports, {
|
|
|
24
24
|
INCREASE_NEARBY_SERIES_MULTIPLIER: ()=>INCREASE_NEARBY_SERIES_MULTIPLIER,
|
|
25
25
|
DYNAMIC_NEARBY_SERIES_MULTIPLIER: ()=>DYNAMIC_NEARBY_SERIES_MULTIPLIER,
|
|
26
26
|
SHOW_FEWER_SERIES_LIMIT: ()=>SHOW_FEWER_SERIES_LIMIT,
|
|
27
|
-
|
|
27
|
+
checkforNearbyTimeSeries: ()=>checkforNearbyTimeSeries,
|
|
28
|
+
legacyCheckforNearbySeries: ()=>legacyCheckforNearbySeries,
|
|
28
29
|
getNearbySeriesData: ()=>getNearbySeriesData,
|
|
30
|
+
legacyGetNearbySeriesData: ()=>legacyGetNearbySeriesData,
|
|
29
31
|
isWithinPercentageRange: ()=>isWithinPercentageRange,
|
|
30
32
|
getYBuffer: ()=>getYBuffer
|
|
31
33
|
});
|
|
@@ -34,7 +36,119 @@ const _model = require("../model");
|
|
|
34
36
|
const INCREASE_NEARBY_SERIES_MULTIPLIER = 5.5; // adjusts how many series show in tooltip (higher == more series shown)
|
|
35
37
|
const DYNAMIC_NEARBY_SERIES_MULTIPLIER = 30; // used for adjustment after series number divisor
|
|
36
38
|
const SHOW_FEWER_SERIES_LIMIT = 5;
|
|
37
|
-
function
|
|
39
|
+
function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, unit) {
|
|
40
|
+
const currentNearbySeriesData = [];
|
|
41
|
+
var ref;
|
|
42
|
+
const cursorX = (ref = pointInGrid[0]) !== null && ref !== void 0 ? ref : null;
|
|
43
|
+
var ref1;
|
|
44
|
+
const cursorY = (ref1 = pointInGrid[1]) !== null && ref1 !== void 0 ? ref1 : null;
|
|
45
|
+
if (cursorX === null || cursorY === null) return currentNearbySeriesData;
|
|
46
|
+
if (!Array.isArray(data)) return currentNearbySeriesData;
|
|
47
|
+
const nearbySeriesIndexes = [];
|
|
48
|
+
const emphasizedSeriesIndexes = [];
|
|
49
|
+
const nonEmphasizedSeriesIndexes = [];
|
|
50
|
+
const totalSeries = data.length;
|
|
51
|
+
let closestTimestamp = null;
|
|
52
|
+
let closestDistance = Infinity;
|
|
53
|
+
// find the timestamp with data that is closest to cursorX
|
|
54
|
+
for(let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++){
|
|
55
|
+
const currentSeries = seriesMapping[seriesIdx];
|
|
56
|
+
if (currentSeries === undefined) break;
|
|
57
|
+
const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;
|
|
58
|
+
if (currentDataset == null) break;
|
|
59
|
+
const currentDatasetValues = currentDataset.values;
|
|
60
|
+
// Determine closestTimestamp before checking whether it is equal to xValue. Consolidating
|
|
61
|
+
// with second currentDatasetValues loop below would result in duplicate nearby series
|
|
62
|
+
for (const [timestamp] of currentDatasetValues){
|
|
63
|
+
const distance = Math.abs(timestamp - cursorX);
|
|
64
|
+
if (distance < closestDistance) {
|
|
65
|
+
closestTimestamp = timestamp;
|
|
66
|
+
closestDistance = distance;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (currentDatasetValues === undefined || !Array.isArray(currentDatasetValues)) break;
|
|
70
|
+
const lineSeries = currentSeries;
|
|
71
|
+
const currentSeriesName = lineSeries.name ? lineSeries.name.toString() : '';
|
|
72
|
+
var _color;
|
|
73
|
+
const markerColor = (_color = lineSeries.color) !== null && _color !== void 0 ? _color : '#000';
|
|
74
|
+
if (Array.isArray(data)) {
|
|
75
|
+
for(let datumIdx = 0; datumIdx < currentDatasetValues.length; datumIdx++){
|
|
76
|
+
const nearbyTimeSeries = currentDatasetValues[datumIdx];
|
|
77
|
+
if (nearbyTimeSeries === undefined || !Array.isArray(nearbyTimeSeries)) break;
|
|
78
|
+
const xValue = nearbyTimeSeries[0];
|
|
79
|
+
const yValue = nearbyTimeSeries[1];
|
|
80
|
+
// TODO: ensure null values not displayed in tooltip
|
|
81
|
+
if (yValue !== undefined && yValue !== null) {
|
|
82
|
+
if (closestTimestamp === xValue) {
|
|
83
|
+
if (cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {
|
|
84
|
+
// show fewer bold series in tooltip when many total series
|
|
85
|
+
const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;
|
|
86
|
+
const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);
|
|
87
|
+
const isClosestToCursor = isWithinPercentageRange({
|
|
88
|
+
valueToCheck: cursorY,
|
|
89
|
+
baseValue: yValue,
|
|
90
|
+
percentage: percentRangeToCheck
|
|
91
|
+
});
|
|
92
|
+
if (isClosestToCursor) {
|
|
93
|
+
emphasizedSeriesIndexes.push(seriesIdx);
|
|
94
|
+
} else {
|
|
95
|
+
nonEmphasizedSeriesIndexes.push(seriesIdx);
|
|
96
|
+
// ensure series far away from cursor are not highlighted
|
|
97
|
+
if ((chart === null || chart === void 0 ? void 0 : chart.dispatchAction) !== undefined) {
|
|
98
|
+
chart.dispatchAction({
|
|
99
|
+
type: 'downplay',
|
|
100
|
+
seriesIndex: seriesIdx
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const formattedY = (0, _core.formatValue)(yValue, unit);
|
|
105
|
+
currentNearbySeriesData.push({
|
|
106
|
+
seriesIdx: seriesIdx,
|
|
107
|
+
datumIdx: datumIdx,
|
|
108
|
+
seriesName: currentSeriesName,
|
|
109
|
+
date: closestTimestamp,
|
|
110
|
+
x: xValue,
|
|
111
|
+
y: yValue,
|
|
112
|
+
formattedY: formattedY,
|
|
113
|
+
markerColor: markerColor.toString(),
|
|
114
|
+
isClosestToCursor
|
|
115
|
+
});
|
|
116
|
+
nearbySeriesIndexes.push(seriesIdx);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if ((chart === null || chart === void 0 ? void 0 : chart.dispatchAction) !== undefined) {
|
|
124
|
+
// Clears emphasis state of all lines that are not emphasized.
|
|
125
|
+
// Emphasized is a subset of just the nearby series that are closest to cursor.
|
|
126
|
+
chart.dispatchAction({
|
|
127
|
+
type: 'downplay',
|
|
128
|
+
seriesIndex: nonEmphasizedSeriesIndexes
|
|
129
|
+
});
|
|
130
|
+
// https://echarts.apache.org/en/api.html#action.highlight
|
|
131
|
+
if (emphasizedSeriesIndexes.length > 0) {
|
|
132
|
+
// Fadeout opacity of all series not closest to cursor.
|
|
133
|
+
chart.dispatchAction({
|
|
134
|
+
type: 'highlight',
|
|
135
|
+
seriesIndex: emphasizedSeriesIndexes,
|
|
136
|
+
notBlur: false,
|
|
137
|
+
escapeConnect: true
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
// When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.
|
|
141
|
+
chart.dispatchAction({
|
|
142
|
+
type: 'highlight',
|
|
143
|
+
seriesIndex: nearbySeriesIndexes,
|
|
144
|
+
notBlur: true,
|
|
145
|
+
escapeConnect: true
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return currentNearbySeriesData;
|
|
150
|
+
}
|
|
151
|
+
function legacyCheckforNearbySeries(data, pointInGrid, yBuffer, chart, unit) {
|
|
38
152
|
const currentNearbySeriesData = [];
|
|
39
153
|
var ref;
|
|
40
154
|
const cursorX = (ref = pointInGrid[0]) !== null && ref !== void 0 ? ref : null;
|
|
@@ -133,7 +247,51 @@ function checkforNearbySeries(data, pointInGrid, yBuffer, chart, unit) {
|
|
|
133
247
|
}
|
|
134
248
|
return currentNearbySeriesData;
|
|
135
249
|
}
|
|
136
|
-
function getNearbySeriesData({ mousePos , pinnedPos ,
|
|
250
|
+
function getNearbySeriesData({ mousePos , pinnedPos , data , seriesMapping , chart , unit , showAllSeries =false }) {
|
|
251
|
+
if (chart === undefined || mousePos === null) return [];
|
|
252
|
+
// prevents multiple tooltips showing from adjacent charts unless tooltip is pinned
|
|
253
|
+
let cursorTargetMatchesChart = false;
|
|
254
|
+
if (mousePos.target !== null) {
|
|
255
|
+
const currentParent = mousePos.target.parentElement;
|
|
256
|
+
if (currentParent !== null) {
|
|
257
|
+
const currentGrandparent = currentParent.parentElement;
|
|
258
|
+
if (currentGrandparent !== null) {
|
|
259
|
+
const chartDom = chart.getDom();
|
|
260
|
+
if (chartDom === currentGrandparent) {
|
|
261
|
+
cursorTargetMatchesChart = true;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// allows moving cursor inside tooltip without it fading away
|
|
267
|
+
if (pinnedPos !== null) {
|
|
268
|
+
mousePos = pinnedPos;
|
|
269
|
+
cursorTargetMatchesChart = true;
|
|
270
|
+
}
|
|
271
|
+
if (cursorTargetMatchesChart === false) return [];
|
|
272
|
+
if (chart['_model'] === undefined || data === null) return [];
|
|
273
|
+
const chartModel = chart['_model'];
|
|
274
|
+
const yInterval = chartModel.getComponent('yAxis').axis.scale._interval;
|
|
275
|
+
const totalSeries = data.length;
|
|
276
|
+
const yBuffer = getYBuffer({
|
|
277
|
+
yInterval,
|
|
278
|
+
totalSeries,
|
|
279
|
+
showAllSeries
|
|
280
|
+
});
|
|
281
|
+
var _x, _y;
|
|
282
|
+
const pointInPixel = [
|
|
283
|
+
(_x = mousePos.plotCanvas.x) !== null && _x !== void 0 ? _x : 0,
|
|
284
|
+
(_y = mousePos.plotCanvas.y) !== null && _y !== void 0 ? _y : 0
|
|
285
|
+
];
|
|
286
|
+
if (chart.containPixel('grid', pointInPixel)) {
|
|
287
|
+
const pointInGrid = chart.convertFromPixel('grid', pointInPixel);
|
|
288
|
+
if (pointInGrid[0] !== undefined && pointInGrid[1] !== undefined) {
|
|
289
|
+
return checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, unit);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return [];
|
|
293
|
+
}
|
|
294
|
+
function legacyGetNearbySeriesData({ mousePos , pinnedPos , chartData , chart , unit , showAllSeries =false }) {
|
|
137
295
|
if (chart === undefined || mousePos === null) return [];
|
|
138
296
|
// prevents multiple tooltips showing from adjacent charts unless tooltip is pinned
|
|
139
297
|
let cursorTargetMatchesChart = false;
|
|
@@ -172,7 +330,7 @@ function getNearbySeriesData({ mousePos , pinnedPos , chartData , chart , unit ,
|
|
|
172
330
|
if (chart.containPixel('grid', pointInPixel)) {
|
|
173
331
|
const pointInGrid = chart.convertFromPixel('grid', pointInPixel);
|
|
174
332
|
if (pointInGrid[0] !== undefined && pointInGrid[1] !== undefined) {
|
|
175
|
-
return
|
|
333
|
+
return legacyCheckforNearbySeries(chartData, pointInGrid, yBuffer, chart, unit);
|
|
176
334
|
}
|
|
177
335
|
}
|
|
178
336
|
return [];
|
|
@@ -14,12 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
assembleTransform: ()=>assembleTransform,
|
|
25
|
+
getTooltipStyles: ()=>getTooltipStyles
|
|
20
26
|
});
|
|
21
27
|
const _tooltipModel = require("./tooltip-model");
|
|
22
|
-
function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, tooltipWidth) {
|
|
28
|
+
function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, tooltipWidth, containerElement) {
|
|
23
29
|
if (mousePos === null) {
|
|
24
30
|
return 'translate3d(0, 0)';
|
|
25
31
|
}
|
|
@@ -28,18 +34,52 @@ function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, toolt
|
|
|
28
34
|
if (pinnedPos !== null) {
|
|
29
35
|
mousePos = pinnedPos;
|
|
30
36
|
}
|
|
31
|
-
//
|
|
37
|
+
// By default, tooltip is located in a Portal attached to the body.
|
|
32
38
|
// Using page coordinates instead of viewport ensures the tooltip is
|
|
33
39
|
// absolutely positioned correctly as the user scrolls
|
|
34
|
-
|
|
40
|
+
let x = mousePos.page.x;
|
|
35
41
|
let y = mousePos.page.y + cursorPaddingY;
|
|
42
|
+
// If containerElement is defined, tooltip is attached to the containerElement instead.
|
|
43
|
+
if (containerElement) {
|
|
44
|
+
// get the container's position relative to viewport
|
|
45
|
+
const containerRect = containerElement.getBoundingClientRect();
|
|
46
|
+
// calculate the mouse position relative to container
|
|
47
|
+
x = x - containerRect.left + containerElement.scrollLeft;
|
|
48
|
+
y = y - containerRect.top + containerElement.scrollTop;
|
|
49
|
+
}
|
|
36
50
|
// adjust so tooltip does not get cut off at bottom of chart
|
|
37
51
|
if (mousePos.client.y + tooltipHeight + cursorPaddingY > window.innerHeight) {
|
|
38
52
|
// multiplier ensures tooltip isn't overly adjusted and gets cut off at the top of the viewport
|
|
39
|
-
y =
|
|
53
|
+
y = y - tooltipHeight * _tooltipModel.TOOLTIP_ADJUST_Y_POS_MULTIPLIER;
|
|
40
54
|
}
|
|
41
55
|
// use tooltip width to determine when to repos from right to left
|
|
42
56
|
const xPosAdjustThreshold = chartWidth - tooltipWidth * 0.9;
|
|
43
57
|
// reposition so tooltip is never too close to right side of chart or left side of browser window
|
|
44
58
|
return mousePos.plotCanvas.x > xPosAdjustThreshold && x > _tooltipModel.TOOLTIP_MAX_WIDTH ? `translate3d(${x - cursorPaddingX}px, ${y}px, 0) translateX(-100%)` : `translate3d(${x + cursorPaddingX}px, ${y}px, 0)`;
|
|
45
59
|
}
|
|
60
|
+
function getTooltipStyles(theme, pinnedPos) {
|
|
61
|
+
var ref;
|
|
62
|
+
var ref1;
|
|
63
|
+
return {
|
|
64
|
+
minWidth: _tooltipModel.TOOLTIP_MIN_WIDTH,
|
|
65
|
+
maxWidth: _tooltipModel.TOOLTIP_MAX_WIDTH,
|
|
66
|
+
maxHeight: _tooltipModel.TOOLTIP_MAX_HEIGHT,
|
|
67
|
+
padding: 0,
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
top: 0,
|
|
70
|
+
left: 0,
|
|
71
|
+
backgroundColor: (ref1 = (ref = theme.palette.designSystem) === null || ref === void 0 ? void 0 : ref.grey[800]) !== null && ref1 !== void 0 ? ref1 : _tooltipModel.TOOLTIP_BG_COLOR_FALLBACK,
|
|
72
|
+
borderRadius: '6px',
|
|
73
|
+
color: '#fff',
|
|
74
|
+
fontSize: '11px',
|
|
75
|
+
visibility: 'visible',
|
|
76
|
+
opacity: 1,
|
|
77
|
+
transition: 'all 0.1s ease-out',
|
|
78
|
+
// Ensure pinned tooltip shows behind edit panel drawer and sticky header
|
|
79
|
+
zIndex: pinnedPos !== null ? 'auto' : theme.zIndex.tooltip,
|
|
80
|
+
overflow: 'hidden',
|
|
81
|
+
'&:hover': {
|
|
82
|
+
overflowY: 'auto'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -22,6 +22,7 @@ _exportStar(require("./Drawer"), exports);
|
|
|
22
22
|
_exportStar(require("./EChart"), exports);
|
|
23
23
|
_exportStar(require("./ErrorAlert"), exports);
|
|
24
24
|
_exportStar(require("./ErrorBoundary"), exports);
|
|
25
|
+
_exportStar(require("./FontSizeSelector"), exports);
|
|
25
26
|
_exportStar(require("./GaugeChart"), exports);
|
|
26
27
|
_exportStar(require("./InfoTooltip"), exports);
|
|
27
28
|
_exportStar(require("./JSONEditor"), exports);
|
|
@@ -32,6 +33,7 @@ _exportStar(require("./SettingsAutocomplete"), exports);
|
|
|
32
33
|
_exportStar(require("./StatChart"), exports);
|
|
33
34
|
_exportStar(require("./Table"), exports);
|
|
34
35
|
_exportStar(require("./ThresholdsEditor"), exports);
|
|
36
|
+
_exportStar(require("./TimeChart"), exports);
|
|
35
37
|
_exportStar(require("./TimeSeriesTooltip"), exports);
|
|
36
38
|
_exportStar(require("./UnitSelector"), exports);
|
|
37
39
|
_exportStar(require("./YAxisLabel"), exports);
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
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
|
+
getYAxes: ()=>getYAxes,
|
|
25
|
+
getDateRange: ()=>getDateRange
|
|
26
|
+
});
|
|
27
|
+
const _merge = /*#__PURE__*/ _interopRequireDefault(require("lodash/merge"));
|
|
28
|
+
const _core = require("@perses-dev/core");
|
|
29
|
+
function _interopRequireDefault(obj) {
|
|
30
|
+
return obj && obj.__esModule ? obj : {
|
|
31
|
+
default: obj
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function getYAxes(yAxis, unit) {
|
|
35
|
+
// TODO: support alternate yAxis that shows on right side
|
|
36
|
+
const Y_AXIS_DEFAULT = {
|
|
37
|
+
type: 'value',
|
|
38
|
+
boundaryGap: [
|
|
39
|
+
0,
|
|
40
|
+
'10%'
|
|
41
|
+
],
|
|
42
|
+
axisLabel: {
|
|
43
|
+
formatter: (value)=>{
|
|
44
|
+
return (0, _core.formatValue)(value, unit);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return [
|
|
49
|
+
(0, _merge.default)(Y_AXIS_DEFAULT, yAxis)
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
function getDateRange(data) {
|
|
53
|
+
const defaultRange = 3600000; // hour in ms
|
|
54
|
+
if (data.length === 0) return defaultRange;
|
|
55
|
+
const lastDatum = data[data.length - 1];
|
|
56
|
+
if (data[0] === undefined || lastDatum === undefined) return defaultRange;
|
|
57
|
+
return lastDatum - data[0];
|
|
58
|
+
}
|
|
@@ -23,19 +23,8 @@ function _export(target, all) {
|
|
|
23
23
|
_export(exports, {
|
|
24
24
|
enableDataZoom: ()=>enableDataZoom,
|
|
25
25
|
restoreChart: ()=>restoreChart,
|
|
26
|
-
getDateRange: ()=>getDateRange,
|
|
27
|
-
getFormattedDate: ()=>getFormattedDate,
|
|
28
|
-
getYAxes: ()=>getYAxes,
|
|
29
26
|
clearHighlightedSeries: ()=>clearHighlightedSeries
|
|
30
27
|
});
|
|
31
|
-
const _core = require("@perses-dev/core");
|
|
32
|
-
const _merge = /*#__PURE__*/ _interopRequireDefault(require("lodash/merge"));
|
|
33
|
-
const _utils = require("../utils");
|
|
34
|
-
function _interopRequireDefault(obj) {
|
|
35
|
-
return obj && obj.__esModule ? obj : {
|
|
36
|
-
default: obj
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
28
|
function enableDataZoom(chart) {
|
|
40
29
|
const chartModel = chart['_model'];
|
|
41
30
|
if (chartModel === undefined) return;
|
|
@@ -56,49 +45,6 @@ function restoreChart(chart) {
|
|
|
56
45
|
type: 'restore'
|
|
57
46
|
});
|
|
58
47
|
}
|
|
59
|
-
function getDateRange(data) {
|
|
60
|
-
const defaultRange = 3600000; // hour in ms
|
|
61
|
-
if (data.length === 0) return defaultRange;
|
|
62
|
-
const lastDatum = data[data.length - 1];
|
|
63
|
-
if (data[0] === undefined || lastDatum === undefined) return defaultRange;
|
|
64
|
-
return lastDatum - data[0];
|
|
65
|
-
}
|
|
66
|
-
function getFormattedDate(value, rangeMs, timeZone) {
|
|
67
|
-
const dateFormatOptions = (0, _utils.dateFormatOptionsWithTimeZone)({
|
|
68
|
-
hour: 'numeric',
|
|
69
|
-
minute: 'numeric',
|
|
70
|
-
hourCycle: 'h23'
|
|
71
|
-
}, timeZone);
|
|
72
|
-
const thirtyMinMs = 1800000;
|
|
73
|
-
const dayMs = 86400000;
|
|
74
|
-
if (rangeMs <= thirtyMinMs) {
|
|
75
|
-
dateFormatOptions.second = 'numeric';
|
|
76
|
-
} else if (rangeMs >= dayMs) {
|
|
77
|
-
dateFormatOptions.month = 'numeric';
|
|
78
|
-
dateFormatOptions.day = 'numeric';
|
|
79
|
-
}
|
|
80
|
-
const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);
|
|
81
|
-
// remove comma when month / day present
|
|
82
|
-
return DATE_FORMAT.format(value).replace(/, /g, ' ');
|
|
83
|
-
}
|
|
84
|
-
function getYAxes(yAxis, unit) {
|
|
85
|
-
// TODO: support alternate yAxis that shows on right side
|
|
86
|
-
const Y_AXIS_DEFAULT = {
|
|
87
|
-
type: 'value',
|
|
88
|
-
boundaryGap: [
|
|
89
|
-
0,
|
|
90
|
-
'10%'
|
|
91
|
-
],
|
|
92
|
-
axisLabel: {
|
|
93
|
-
formatter: (value)=>{
|
|
94
|
-
return (0, _core.formatValue)(value, unit);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
return [
|
|
99
|
-
(0, _merge.default)(Y_AXIS_DEFAULT, yAxis)
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
48
|
function clearHighlightedSeries(chart, totalSeries) {
|
|
103
49
|
if (chart.dispatchAction !== undefined) {
|
|
104
50
|
for(let i = 0; i < totalSeries; i++){
|
package/dist/cjs/utils/format.js
CHANGED
|
@@ -22,7 +22,9 @@ function _export(target, all) {
|
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
24
|
dateFormatOptionsWithTimeZone: ()=>dateFormatOptionsWithTimeZone,
|
|
25
|
-
formatWithTimeZone: ()=>formatWithTimeZone
|
|
25
|
+
formatWithTimeZone: ()=>formatWithTimeZone,
|
|
26
|
+
getFormattedDate: ()=>getFormattedDate,
|
|
27
|
+
getFormattedAxisLabel: ()=>getFormattedAxisLabel
|
|
26
28
|
});
|
|
27
29
|
const _dateFnsTz = require("date-fns-tz");
|
|
28
30
|
const _dateFns = require("date-fns");
|
|
@@ -54,3 +56,47 @@ function formatWithTimeZone(date, formatString, timeZone) {
|
|
|
54
56
|
return (0, _dateFnsTz.formatInTimeZone)(date, lowerTimeZone === 'utc' ? 'UTC' : timeZone, formatString);
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
function getFormattedDate(value, rangeMs, timeZone) {
|
|
60
|
+
const dateFormatOptions = dateFormatOptionsWithTimeZone({
|
|
61
|
+
hour: 'numeric',
|
|
62
|
+
minute: 'numeric',
|
|
63
|
+
hourCycle: 'h23'
|
|
64
|
+
}, timeZone);
|
|
65
|
+
const thirtyMinMs = 1800000;
|
|
66
|
+
const dayMs = 86400000;
|
|
67
|
+
if (rangeMs <= thirtyMinMs) {
|
|
68
|
+
dateFormatOptions.second = 'numeric';
|
|
69
|
+
} else if (rangeMs >= dayMs) {
|
|
70
|
+
dateFormatOptions.month = 'numeric';
|
|
71
|
+
dateFormatOptions.day = 'numeric';
|
|
72
|
+
}
|
|
73
|
+
const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);
|
|
74
|
+
// remove comma when month / day present
|
|
75
|
+
return DATE_FORMAT.format(value).replace(/, /g, ' ');
|
|
76
|
+
}
|
|
77
|
+
function getFormattedAxisLabel(rangeMs) {
|
|
78
|
+
const dayMs = 86400000;
|
|
79
|
+
const monthMs = 2629440000;
|
|
80
|
+
const yearMs = 31536000000;
|
|
81
|
+
// more than 5 years
|
|
82
|
+
if (rangeMs > yearMs * 5) {
|
|
83
|
+
return '{yyyy}';
|
|
84
|
+
}
|
|
85
|
+
// more than 2 years
|
|
86
|
+
if (rangeMs > yearMs * 2) {
|
|
87
|
+
return '{MMM} {yyyy}';
|
|
88
|
+
}
|
|
89
|
+
// between 5 days to 6 months
|
|
90
|
+
if (rangeMs > dayMs * 5 && rangeMs < monthMs * 6) {
|
|
91
|
+
return '{MM}/{dd}'; // 12/01
|
|
92
|
+
}
|
|
93
|
+
// between 2 and 5 days
|
|
94
|
+
if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 5) {
|
|
95
|
+
return '{MM}/{dd} {HH}:{mm}'; // 12/01 12:30
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
year: '{yearStyle|{yyyy}}\n{monthStyle|{MMM}}',
|
|
99
|
+
month: '{MMM}',
|
|
100
|
+
day: '{MM}/{dd}'
|
|
101
|
+
};
|
|
102
|
+
}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
_exportStar(require("./axis"), exports);
|
|
18
|
+
_exportStar(require("./chart-actions"), exports);
|
|
17
19
|
_exportStar(require("./combine-sx"), exports);
|
|
18
|
-
_exportStar(require("./theme-gen"), exports);
|
|
19
20
|
_exportStar(require("./component-ids"), exports);
|
|
20
21
|
_exportStar(require("./format"), exports);
|
|
22
|
+
_exportStar(require("./theme-gen"), exports);
|
|
21
23
|
function _exportStar(from, to) {
|
|
22
24
|
Object.keys(from).forEach(function(k) {
|
|
23
25
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
@@ -25,7 +25,10 @@ function _interopRequireDefault(obj) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
const DEFAULT_TEXT_COLOR = '#222';
|
|
28
|
-
function generateChartsTheme(muiTheme, echartsTheme
|
|
28
|
+
function generateChartsTheme(muiTheme, echartsTheme, /**
|
|
29
|
+
* The id of the container that will have the chart tooltip appended to it.
|
|
30
|
+
* By default, chart tooltip uses the body of the top-level document object.
|
|
31
|
+
*/ tooltipPortalContainerId) {
|
|
29
32
|
var ref, ref1, ref2, ref3, ref4;
|
|
30
33
|
var ref5;
|
|
31
34
|
const primaryTextColor = (ref5 = (ref = muiTheme.palette.text) === null || ref === void 0 ? void 0 : ref.primary) !== null && ref5 !== void 0 ? ref5 : DEFAULT_TEXT_COLOR;
|
|
@@ -92,6 +95,43 @@ function generateChartsTheme(muiTheme, echartsTheme) {
|
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
},
|
|
98
|
+
timeAxis: {
|
|
99
|
+
show: true,
|
|
100
|
+
axisLabel: {
|
|
101
|
+
show: true,
|
|
102
|
+
color: primaryTextColor,
|
|
103
|
+
margin: 15
|
|
104
|
+
},
|
|
105
|
+
axisTick: {
|
|
106
|
+
show: false,
|
|
107
|
+
length: 6,
|
|
108
|
+
lineStyle: {
|
|
109
|
+
color: muiTheme.palette.grey[600]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
axisLine: {
|
|
113
|
+
show: true,
|
|
114
|
+
lineStyle: {
|
|
115
|
+
color: muiTheme.palette.grey[600]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
splitLine: {
|
|
119
|
+
show: true,
|
|
120
|
+
lineStyle: {
|
|
121
|
+
width: 0.5,
|
|
122
|
+
color: muiTheme.palette.grey[300],
|
|
123
|
+
opacity: 0.6
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
splitArea: {
|
|
127
|
+
show: false,
|
|
128
|
+
areaStyle: {
|
|
129
|
+
color: [
|
|
130
|
+
muiTheme.palette.grey[300]
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
95
135
|
valueAxis: {
|
|
96
136
|
show: true,
|
|
97
137
|
axisLabel: {
|
|
@@ -168,6 +208,7 @@ function generateChartsTheme(muiTheme, echartsTheme) {
|
|
|
168
208
|
}
|
|
169
209
|
};
|
|
170
210
|
return {
|
|
211
|
+
tooltipPortalContainerId,
|
|
171
212
|
echartsTheme: (0, _merge.default)(muiConvertedTheme, echartsTheme),
|
|
172
213
|
noDataOption: {
|
|
173
214
|
title: {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './Drawer';
|
|
|
6
6
|
export * from './EChart';
|
|
7
7
|
export * from './ErrorAlert';
|
|
8
8
|
export * from './ErrorBoundary';
|
|
9
|
+
export * from './FontSizeSelector';
|
|
9
10
|
export * from './GaugeChart';
|
|
10
11
|
export * from './InfoTooltip';
|
|
11
12
|
export * from './JSONEditor';
|
|
@@ -16,6 +17,7 @@ export * from './SettingsAutocomplete';
|
|
|
16
17
|
export * from './StatChart';
|
|
17
18
|
export * from './Table';
|
|
18
19
|
export * from './ThresholdsEditor';
|
|
20
|
+
export * from './TimeChart';
|
|
19
21
|
export * from './TimeSeriesTooltip';
|
|
20
22
|
export * from './UnitSelector';
|
|
21
23
|
export * from './YAxisLabel';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export * from './Drawer';
|
|
|
18
18
|
export * from './EChart';
|
|
19
19
|
export * from './ErrorAlert';
|
|
20
20
|
export * from './ErrorBoundary';
|
|
21
|
+
export * from './FontSizeSelector';
|
|
21
22
|
export * from './GaugeChart';
|
|
22
23
|
export * from './InfoTooltip';
|
|
23
24
|
export * from './JSONEditor';
|
|
@@ -28,6 +29,7 @@ export * from './SettingsAutocomplete';
|
|
|
28
29
|
export * from './StatChart';
|
|
29
30
|
export * from './Table';
|
|
30
31
|
export * from './ThresholdsEditor';
|
|
32
|
+
export * from './TimeChart';
|
|
31
33
|
export * from './TimeSeriesTooltip';
|
|
32
34
|
export * from './UnitSelector';
|
|
33
35
|
export * from './YAxisLabel';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './DateTimeRangePicker';\nexport * from './Dialog';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LineChart';\nexport * from './OptionsEditorLayout';\nexport * from './SettingsAutocomplete';\nexport * from './StatChart';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\nexport * from './context/SnackbarProvider';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './RefreshIntervalPicker';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 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\nexport * from './ColorPicker';\nexport * from './ContentWithLegend';\nexport * from './DateTimeRangePicker';\nexport * from './Dialog';\nexport * from './Drawer';\nexport * from './EChart';\nexport * from './ErrorAlert';\nexport * from './ErrorBoundary';\nexport * from './FontSizeSelector';\nexport * from './GaugeChart';\nexport * from './InfoTooltip';\nexport * from './JSONEditor';\nexport * from './Legend';\nexport * from './LineChart';\nexport * from './OptionsEditorLayout';\nexport * from './SettingsAutocomplete';\nexport * from './StatChart';\nexport * from './Table';\nexport * from './ThresholdsEditor';\nexport * from './TimeChart';\nexport * from './TimeSeriesTooltip';\nexport * from './UnitSelector';\nexport * from './YAxisLabel';\nexport * from './context/ChartsThemeProvider';\nexport * from './context/TimeZoneProvider';\nexport * from './context/SnackbarProvider';\nexport * from './utils';\nexport * from './model';\nexport * from './test-utils';\nexport * from './theme';\nexport * from './RefreshIntervalPicker';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC"}
|
package/dist/model/graph.d.ts
CHANGED
|
@@ -6,16 +6,33 @@ export declare type UnixTimeMs = number;
|
|
|
6
6
|
export interface GraphSeries {
|
|
7
7
|
name: string;
|
|
8
8
|
values: TimeSeriesValueTuple[];
|
|
9
|
+
id?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare type EChartsValues = number | null | '-';
|
|
11
|
-
export interface
|
|
12
|
+
export interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {
|
|
12
13
|
data: EChartsValues[];
|
|
13
14
|
}
|
|
15
|
+
export declare type TimeChartSeriesMapping = LineSeriesOption[];
|
|
16
|
+
export declare type TimeChartLegendItems = LegendItem[];
|
|
14
17
|
export declare type EChartsDataFormat = {
|
|
15
|
-
timeSeries:
|
|
18
|
+
timeSeries: LegacyTimeSeries[];
|
|
16
19
|
xAxis: number[];
|
|
17
20
|
legendItems?: LegendItem[];
|
|
18
21
|
xAxisMax?: number | string;
|
|
19
22
|
rangeMs?: number;
|
|
20
23
|
};
|
|
24
|
+
export declare type ChartInstanceFocusOpts = {
|
|
25
|
+
id?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type ChartInstance = {
|
|
29
|
+
/**
|
|
30
|
+
* Highlight the series associated with the specified options.
|
|
31
|
+
*/
|
|
32
|
+
highlightSeries: (opts: ChartInstanceFocusOpts) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Clear all highlighted series.
|
|
35
|
+
*/
|
|
36
|
+
clearHighlightedSeries: () => void;
|
|
37
|
+
};
|
|
21
38
|
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/model/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,oBAAY,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/model/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,oBAAY,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,aAAa,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC;AAEhD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC;IACtE,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAGD,oBAAY,sBAAsB,GAAG,gBAAgB,EAAE,CAAC;AACxD,oBAAY,oBAAoB,GAAG,UAAU,EAAE,CAAC;AAGhD,oBAAY,iBAAiB,GAAG;IAC9B,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF,oBAAY,sBAAsB,GAAG;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,eAAe,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAExD;;OAEG;IACH,sBAAsB,EAAE,MAAM,IAAI,CAAC;CACpC,CAAC"}
|