@perses-dev/components 0.37.2 → 0.38.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 -0
- package/dist/BarChart/BarChart.d.ts +16 -0
- package/dist/BarChart/BarChart.d.ts.map +1 -0
- package/dist/BarChart/BarChart.js +123 -0
- package/dist/BarChart/BarChart.js.map +1 -0
- package/dist/BarChart/index.d.ts +2 -0
- package/dist/BarChart/index.d.ts.map +1 -0
- package/dist/BarChart/index.js +15 -0
- package/dist/BarChart/index.js.map +1 -0
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +10 -0
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -0
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +47 -0
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -0
- package/dist/Dialog/index.d.ts +1 -0
- package/dist/Dialog/index.d.ts.map +1 -1
- package/dist/Dialog/index.js +1 -0
- package/dist/Dialog/index.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +1 -1
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +2 -1
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.d.ts +9 -0
- package/dist/ModeSelector/ModeSelector.d.ts.map +1 -0
- package/dist/ModeSelector/ModeSelector.js +43 -0
- package/dist/ModeSelector/ModeSelector.js.map +1 -0
- package/dist/ModeSelector/index.d.ts +2 -0
- package/dist/ModeSelector/index.d.ts.map +1 -0
- package/dist/ModeSelector/index.js +15 -0
- package/dist/ModeSelector/index.js.map +1 -0
- package/dist/SortSelector/SortSelector.d.ts +8 -0
- package/dist/SortSelector/SortSelector.d.ts.map +1 -0
- package/dist/SortSelector/SortSelector.js +42 -0
- package/dist/SortSelector/SortSelector.js.map +1 -0
- package/dist/SortSelector/index.d.ts +2 -0
- package/dist/SortSelector/index.d.ts.map +1 -0
- package/dist/SortSelector/index.js +15 -0
- package/dist/SortSelector/index.js.map +1 -0
- package/dist/TimeChart/TimeChart.d.ts +1 -0
- package/dist/TimeChart/TimeChart.d.ts.map +1 -1
- package/dist/TimeChart/TimeChart.js +49 -12
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +5 -0
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +12 -5
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +87 -96
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/UnitSelector/UnitSelector.d.ts +2 -1
- package/dist/UnitSelector/UnitSelector.d.ts.map +1 -1
- package/dist/UnitSelector/UnitSelector.js +3 -2
- package/dist/UnitSelector/UnitSelector.js.map +1 -1
- package/dist/cjs/BarChart/BarChart.js +129 -0
- package/dist/cjs/BarChart/index.js +28 -0
- package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +53 -0
- package/dist/cjs/Dialog/index.js +1 -0
- package/dist/cjs/LineChart/LineChart.js +2 -1
- package/dist/cjs/ModeSelector/ModeSelector.js +49 -0
- package/dist/cjs/ModeSelector/index.js +28 -0
- package/dist/cjs/SortSelector/SortSelector.js +48 -0
- package/dist/cjs/SortSelector/index.js +28 -0
- package/dist/cjs/TimeChart/TimeChart.js +52 -10
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +11 -4
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +87 -96
- package/dist/cjs/UnitSelector/UnitSelector.js +3 -2
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/model/graph.js +35 -3
- package/dist/cjs/utils/chart-actions.js +61 -1
- package/dist/cjs/utils/theme-gen.js +34 -6
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +11 -2
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js +25 -0
- package/dist/model/graph.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +3 -0
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js +66 -0
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +34 -6
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +3 -3
|
@@ -33,6 +33,7 @@ _export(exports, {
|
|
|
33
33
|
});
|
|
34
34
|
const _core = require("@perses-dev/core");
|
|
35
35
|
const _model = require("../model");
|
|
36
|
+
const _utils = require("../utils");
|
|
36
37
|
const INCREASE_NEARBY_SERIES_MULTIPLIER = 5.5; // adjusts how many series show in tooltip (higher == more series shown)
|
|
37
38
|
const DYNAMIC_NEARBY_SERIES_MULTIPLIER = 30; // used for adjustment after series number divisor
|
|
38
39
|
const SHOW_FEWER_SERIES_LIMIT = 5;
|
|
@@ -43,11 +44,15 @@ function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, cha
|
|
|
43
44
|
var ref1;
|
|
44
45
|
const cursorY = (ref1 = pointInGrid[1]) !== null && ref1 !== void 0 ? ref1 : null;
|
|
45
46
|
if (cursorX === null || cursorY === null) return currentNearbySeriesData;
|
|
47
|
+
if (chart.dispatchAction === undefined) return currentNearbySeriesData;
|
|
46
48
|
if (!Array.isArray(data)) return currentNearbySeriesData;
|
|
47
49
|
const nearbySeriesIndexes = [];
|
|
48
50
|
const emphasizedSeriesIndexes = [];
|
|
49
51
|
const nonEmphasizedSeriesIndexes = [];
|
|
52
|
+
const emphasizedDatapoints = [];
|
|
53
|
+
const duplicateDatapoints = [];
|
|
50
54
|
const totalSeries = data.length;
|
|
55
|
+
const yValueCounts = new Map();
|
|
51
56
|
let closestTimestamp = null;
|
|
52
57
|
let closestDistance = Infinity;
|
|
53
58
|
// find the timestamp with data that is closest to cursorX
|
|
@@ -90,16 +95,35 @@ function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, cha
|
|
|
90
95
|
percentage: percentRangeToCheck
|
|
91
96
|
});
|
|
92
97
|
if (isClosestToCursor) {
|
|
98
|
+
// shows as bold in tooltip, customize 'emphasis' options in getTimeSeries util
|
|
93
99
|
emphasizedSeriesIndexes.push(seriesIdx);
|
|
100
|
+
var ref2;
|
|
101
|
+
// Used to determine which datapoint to apply select styles to.
|
|
102
|
+
// Accounts for cases where lines may be rendered directly on top of eachother.
|
|
103
|
+
const duplicateValuesCount = (ref2 = yValueCounts.get(yValue)) !== null && ref2 !== void 0 ? ref2 : 0;
|
|
104
|
+
yValueCounts.set(yValue, duplicateValuesCount + 1);
|
|
105
|
+
if (duplicateValuesCount > 0) {
|
|
106
|
+
duplicateDatapoints.push({
|
|
107
|
+
seriesIndex: seriesIdx,
|
|
108
|
+
dataIndex: datumIdx,
|
|
109
|
+
seriesName: currentSeriesName,
|
|
110
|
+
yValue: yValue
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// keep track of all bold datapoints in tooltip so that 'select' state only applied to topmost
|
|
114
|
+
emphasizedDatapoints.push({
|
|
115
|
+
seriesIndex: seriesIdx,
|
|
116
|
+
dataIndex: datumIdx,
|
|
117
|
+
seriesName: currentSeriesName,
|
|
118
|
+
yValue: yValue
|
|
119
|
+
});
|
|
94
120
|
} else {
|
|
95
121
|
nonEmphasizedSeriesIndexes.push(seriesIdx);
|
|
96
122
|
// ensure series far away from cursor are not highlighted
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
102
|
-
}
|
|
123
|
+
chart.dispatchAction({
|
|
124
|
+
type: 'downplay',
|
|
125
|
+
seriesIndex: seriesIdx
|
|
126
|
+
});
|
|
103
127
|
}
|
|
104
128
|
const formattedY = (0, _core.formatValue)(yValue, unit);
|
|
105
129
|
currentNearbySeriesData.push({
|
|
@@ -120,32 +144,7 @@ function checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, cha
|
|
|
120
144
|
}
|
|
121
145
|
}
|
|
122
146
|
}
|
|
123
|
-
|
|
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
|
-
}
|
|
147
|
+
(0, _utils.batchDispatchNearbySeriesActions)(chart, nearbySeriesIndexes, emphasizedSeriesIndexes, nonEmphasizedSeriesIndexes, emphasizedDatapoints, duplicateDatapoints);
|
|
149
148
|
return currentNearbySeriesData;
|
|
150
149
|
}
|
|
151
150
|
function legacyCheckforNearbySeries(data, pointInGrid, yBuffer, chart, unit) {
|
|
@@ -164,55 +163,54 @@ function legacyCheckforNearbySeries(data, pointInGrid, yBuffer, chart, unit) {
|
|
|
164
163
|
if (Array.isArray(data.xAxis) && Array.isArray(data.timeSeries)) {
|
|
165
164
|
for(let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++){
|
|
166
165
|
const currentSeries = data.timeSeries[seriesIdx];
|
|
166
|
+
if (currentSeries === undefined) break;
|
|
167
167
|
if (currentNearbySeriesData.length >= _model.OPTIMIZED_MODE_SERIES_LIMIT) break;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (yValue !==
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
}
|
|
168
|
+
const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';
|
|
169
|
+
var _color;
|
|
170
|
+
const markerColor = (_color = currentSeries.color) !== null && _color !== void 0 ? _color : '#000';
|
|
171
|
+
if (Array.isArray(currentSeries.data)) {
|
|
172
|
+
for(let datumIdx = 0; datumIdx < currentSeries.data.length; datumIdx++){
|
|
173
|
+
var _datumIdx;
|
|
174
|
+
const xValue = (_datumIdx = data.xAxis[datumIdx]) !== null && _datumIdx !== void 0 ? _datumIdx : 0;
|
|
175
|
+
const yValue = currentSeries.data[datumIdx];
|
|
176
|
+
// ensure null values not displayed in tooltip
|
|
177
|
+
if (yValue !== undefined && yValue !== null && cursorX === datumIdx) {
|
|
178
|
+
if (yValue !== '-' && cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {
|
|
179
|
+
// show fewer bold series in tooltip when many total series
|
|
180
|
+
const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;
|
|
181
|
+
const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);
|
|
182
|
+
const isClosestToCursor = isWithinPercentageRange({
|
|
183
|
+
valueToCheck: cursorY,
|
|
184
|
+
baseValue: yValue,
|
|
185
|
+
percentage: percentRangeToCheck
|
|
186
|
+
});
|
|
187
|
+
if (isClosestToCursor) {
|
|
188
|
+
emphasizedSeriesIndexes.push(seriesIdx);
|
|
189
|
+
} else {
|
|
190
|
+
nonEmphasizedSeriesIndexes.push(seriesIdx);
|
|
191
|
+
// ensure series not close to cursor are not highlighted
|
|
192
|
+
if ((chart === null || chart === void 0 ? void 0 : chart.dispatchAction) !== undefined) {
|
|
193
|
+
chart.dispatchAction({
|
|
194
|
+
type: 'downplay',
|
|
195
|
+
seriesIndex: seriesIdx
|
|
196
|
+
});
|
|
199
197
|
}
|
|
200
|
-
// determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201
|
|
201
|
-
const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;
|
|
202
|
-
const formattedY = (0, _core.formatValue)(yValue, unit);
|
|
203
|
-
currentNearbySeriesData.push({
|
|
204
|
-
seriesIdx: seriesIdx,
|
|
205
|
-
datumIdx: datumIdx,
|
|
206
|
-
seriesName: currentSeriesName,
|
|
207
|
-
date: xValueMilliSeconds,
|
|
208
|
-
x: xValue,
|
|
209
|
-
y: yValue,
|
|
210
|
-
formattedY: formattedY,
|
|
211
|
-
markerColor: markerColor.toString(),
|
|
212
|
-
isClosestToCursor
|
|
213
|
-
});
|
|
214
|
-
nearbySeriesIndexes.push(seriesIdx);
|
|
215
198
|
}
|
|
199
|
+
// determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201
|
|
200
|
+
const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;
|
|
201
|
+
const formattedY = (0, _core.formatValue)(yValue, unit);
|
|
202
|
+
currentNearbySeriesData.push({
|
|
203
|
+
seriesIdx: seriesIdx,
|
|
204
|
+
datumIdx: datumIdx,
|
|
205
|
+
seriesName: currentSeriesName,
|
|
206
|
+
date: xValueMilliSeconds,
|
|
207
|
+
x: xValue,
|
|
208
|
+
y: yValue,
|
|
209
|
+
formattedY: formattedY,
|
|
210
|
+
markerColor: markerColor.toString(),
|
|
211
|
+
isClosestToCursor
|
|
212
|
+
});
|
|
213
|
+
nearbySeriesIndexes.push(seriesIdx);
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
}
|
|
@@ -270,24 +268,17 @@ function getNearbySeriesData({ mousePos , pinnedPos , data , seriesMapping , cha
|
|
|
270
268
|
}
|
|
271
269
|
if (cursorTargetMatchesChart === false) return [];
|
|
272
270
|
if (chart['_model'] === undefined || data === null) return [];
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
(
|
|
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
|
-
}
|
|
271
|
+
const pointInGrid = (0, _utils.getPointInGrid)(mousePos.plotCanvas.x, mousePos.plotCanvas.y, chart);
|
|
272
|
+
if (pointInGrid !== null) {
|
|
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
|
+
return checkforNearbyTimeSeries(data, seriesMapping, pointInGrid, yBuffer, chart, unit);
|
|
291
282
|
}
|
|
292
283
|
return [];
|
|
293
284
|
}
|
|
@@ -64,7 +64,7 @@ const DECIMAL_PLACES_OPTIONS = [
|
|
|
64
64
|
function getOptionByDecimalPlaces(decimal_places) {
|
|
65
65
|
return DECIMAL_PLACES_OPTIONS.find((o)=>o.decimal_places === decimal_places);
|
|
66
66
|
}
|
|
67
|
-
function UnitSelector({ value , onChange }) {
|
|
67
|
+
function UnitSelector({ value , onChange , disabled =false }) {
|
|
68
68
|
const hasDecimalPlaces = (0, _core.isUnitWithDecimalPlaces)(value);
|
|
69
69
|
const hasAbbreviate = (0, _core.isUnitWithAbbreviate)(value);
|
|
70
70
|
const handleKindChange = (_, newValue)=>{
|
|
@@ -109,7 +109,8 @@ function UnitSelector({ value , onChange }) {
|
|
|
109
109
|
options: KIND_OPTIONS,
|
|
110
110
|
groupBy: (option)=>option.group,
|
|
111
111
|
onChange: handleKindChange,
|
|
112
|
-
disableClearable: true
|
|
112
|
+
disableClearable: true,
|
|
113
|
+
disabled: disabled
|
|
113
114
|
})
|
|
114
115
|
}),
|
|
115
116
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorLayout.OptionsEditorControl, {
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
_exportStar(require("./BarChart"), exports);
|
|
17
18
|
_exportStar(require("./ColorPicker"), exports);
|
|
18
19
|
_exportStar(require("./ContentWithLegend"), exports);
|
|
19
20
|
_exportStar(require("./DateTimeRangePicker"), exports);
|
|
@@ -28,8 +29,10 @@ _exportStar(require("./InfoTooltip"), exports);
|
|
|
28
29
|
_exportStar(require("./JSONEditor"), exports);
|
|
29
30
|
_exportStar(require("./Legend"), exports);
|
|
30
31
|
_exportStar(require("./LineChart"), exports);
|
|
32
|
+
_exportStar(require("./ModeSelector"), exports);
|
|
31
33
|
_exportStar(require("./OptionsEditorLayout"), exports);
|
|
32
34
|
_exportStar(require("./SettingsAutocomplete"), exports);
|
|
35
|
+
_exportStar(require("./SortSelector"), exports);
|
|
33
36
|
_exportStar(require("./StatChart"), exports);
|
|
34
37
|
_exportStar(require("./Table"), exports);
|
|
35
38
|
_exportStar(require("./ThresholdsEditor"), exports);
|
package/dist/cjs/model/graph.js
CHANGED
|
@@ -14,8 +14,40 @@
|
|
|
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
|
+
OPTIMIZED_MODE_SERIES_LIMIT: ()=>OPTIMIZED_MODE_SERIES_LIMIT,
|
|
25
|
+
PINNED_CROSSHAIR_SERIES_NAME: ()=>PINNED_CROSSHAIR_SERIES_NAME,
|
|
26
|
+
DEFAULT_PINNED_CROSSHAIR: ()=>DEFAULT_PINNED_CROSSHAIR
|
|
20
27
|
});
|
|
21
28
|
const OPTIMIZED_MODE_SERIES_LIMIT = 1000;
|
|
29
|
+
const PINNED_CROSSHAIR_SERIES_NAME = 'Pinned Crosshair';
|
|
30
|
+
const DEFAULT_PINNED_CROSSHAIR = {
|
|
31
|
+
name: PINNED_CROSSHAIR_SERIES_NAME,
|
|
32
|
+
type: 'line',
|
|
33
|
+
// https://echarts.apache.org/en/option.html#series-line.markLine
|
|
34
|
+
markLine: {
|
|
35
|
+
data: [],
|
|
36
|
+
lineStyle: {
|
|
37
|
+
type: 'dashed',
|
|
38
|
+
width: 2
|
|
39
|
+
},
|
|
40
|
+
emphasis: {
|
|
41
|
+
lineStyle: {
|
|
42
|
+
width: 2,
|
|
43
|
+
opacity: 1
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
blur: {
|
|
47
|
+
lineStyle: {
|
|
48
|
+
width: 2,
|
|
49
|
+
opacity: 1
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
@@ -23,7 +23,9 @@ function _export(target, all) {
|
|
|
23
23
|
_export(exports, {
|
|
24
24
|
enableDataZoom: ()=>enableDataZoom,
|
|
25
25
|
restoreChart: ()=>restoreChart,
|
|
26
|
-
clearHighlightedSeries: ()=>clearHighlightedSeries
|
|
26
|
+
clearHighlightedSeries: ()=>clearHighlightedSeries,
|
|
27
|
+
getPointInGrid: ()=>getPointInGrid,
|
|
28
|
+
batchDispatchNearbySeriesActions: ()=>batchDispatchNearbySeriesActions
|
|
27
29
|
});
|
|
28
30
|
function enableDataZoom(chart) {
|
|
29
31
|
const chartModel = chart['_model'];
|
|
@@ -55,3 +57,61 @@ function clearHighlightedSeries(chart, totalSeries) {
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
}
|
|
60
|
+
function getPointInGrid(cursorCoordX, cursorCoordY, chart) {
|
|
61
|
+
if (chart === undefined) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const pointInPixel = [
|
|
65
|
+
cursorCoordX,
|
|
66
|
+
cursorCoordY
|
|
67
|
+
];
|
|
68
|
+
if (!chart.containPixel('grid', pointInPixel)) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const pointInGrid = chart.convertFromPixel('grid', pointInPixel);
|
|
72
|
+
return pointInGrid;
|
|
73
|
+
}
|
|
74
|
+
function batchDispatchNearbySeriesActions(chart, nearbySeriesIndexes, emphasizedSeriesIndexes, nonEmphasizedSeriesIndexes, emphasizedDatapoints, duplicateDatapoints) {
|
|
75
|
+
// Accounts for multiple series that are rendered direct on top of eachother.
|
|
76
|
+
// Only applies select state to the datapoint that is visible to avoid color mismatch.
|
|
77
|
+
const lastEmphasizedDatapoint = duplicateDatapoints.length > 0 ? duplicateDatapoints[duplicateDatapoints.length - 1] : emphasizedDatapoints[emphasizedDatapoints.length - 1];
|
|
78
|
+
if (lastEmphasizedDatapoint !== undefined) {
|
|
79
|
+
// Corresponds to select options inside getTimeSeries util.
|
|
80
|
+
// https://echarts.apache.org/en/option.html#series-line.select.itemStyle
|
|
81
|
+
chart.dispatchAction({
|
|
82
|
+
type: 'select',
|
|
83
|
+
seriesIndex: lastEmphasizedDatapoint.seriesIndex,
|
|
84
|
+
dataIndex: lastEmphasizedDatapoint.dataIndex,
|
|
85
|
+
// Shared crosshair should not emphasize datapoints on adjacent charts.
|
|
86
|
+
escapeConnect: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Clears emphasis state of all lines that are not emphasized.
|
|
90
|
+
// Emphasized is a subset of just the nearby series that are closest to cursor.
|
|
91
|
+
chart.dispatchAction({
|
|
92
|
+
type: 'downplay',
|
|
93
|
+
seriesIndex: nonEmphasizedSeriesIndexes
|
|
94
|
+
});
|
|
95
|
+
// https://echarts.apache.org/en/api.html#action.highlight
|
|
96
|
+
if (emphasizedSeriesIndexes.length > 0) {
|
|
97
|
+
// Fadeout opacity of all series not closest to cursor.
|
|
98
|
+
chart.dispatchAction({
|
|
99
|
+
type: 'highlight',
|
|
100
|
+
seriesIndex: emphasizedSeriesIndexes,
|
|
101
|
+
notBlur: false,
|
|
102
|
+
escapeConnect: true
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
// When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.
|
|
106
|
+
chart.dispatchAction({
|
|
107
|
+
type: 'highlight',
|
|
108
|
+
seriesIndex: nearbySeriesIndexes,
|
|
109
|
+
notBlur: true,
|
|
110
|
+
escapeConnect: true
|
|
111
|
+
});
|
|
112
|
+
// Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting
|
|
113
|
+
chart.dispatchAction({
|
|
114
|
+
type: 'toggleSelect'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -29,9 +29,9 @@ function generateChartsTheme(muiTheme, echartsTheme, /**
|
|
|
29
29
|
* The id of the container that will have the chart tooltip appended to it.
|
|
30
30
|
* By default, chart tooltip uses the body of the top-level document object.
|
|
31
31
|
*/ tooltipPortalContainerId) {
|
|
32
|
-
var ref, ref1, ref2, ref3, ref4;
|
|
33
|
-
var
|
|
34
|
-
const primaryTextColor = (
|
|
32
|
+
var ref, ref1, ref2, ref3, ref4, ref5, ref6;
|
|
33
|
+
var ref7;
|
|
34
|
+
const primaryTextColor = (ref7 = (ref = muiTheme.palette.text) === null || ref === void 0 ? void 0 : ref.primary) !== null && ref7 !== void 0 ? ref7 : DEFAULT_TEXT_COLOR;
|
|
35
35
|
const muiConvertedTheme = {
|
|
36
36
|
title: {
|
|
37
37
|
show: false
|
|
@@ -83,7 +83,7 @@ function generateChartsTheme(muiTheme, echartsTheme, /**
|
|
|
83
83
|
lineStyle: {
|
|
84
84
|
width: 0.5,
|
|
85
85
|
color: muiTheme.palette.grey[300],
|
|
86
|
-
opacity: 0.
|
|
86
|
+
opacity: 0.4
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
splitArea: {
|
|
@@ -120,7 +120,7 @@ function generateChartsTheme(muiTheme, echartsTheme, /**
|
|
|
120
120
|
lineStyle: {
|
|
121
121
|
width: 0.5,
|
|
122
122
|
color: muiTheme.palette.grey[300],
|
|
123
|
-
opacity: 0.
|
|
123
|
+
opacity: 0.4
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
splitArea: {
|
|
@@ -169,7 +169,30 @@ function generateChartsTheme(muiTheme, echartsTheme, /**
|
|
|
169
169
|
borderColor: primaryTextColor
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
|
-
tooltip: {
|
|
172
|
+
tooltip: {
|
|
173
|
+
backgroundColor: (ref5 = muiTheme.palette.designSystem) === null || ref5 === void 0 ? void 0 : ref5.grey[800],
|
|
174
|
+
borderColor: (ref6 = muiTheme.palette.designSystem) === null || ref6 === void 0 ? void 0 : ref6.grey[800],
|
|
175
|
+
textStyle: {
|
|
176
|
+
color: '#fff',
|
|
177
|
+
fontSize: 11
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
axisPointer: {
|
|
181
|
+
lineStyle: {
|
|
182
|
+
color: muiTheme.palette.grey[500]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
markLine: {
|
|
186
|
+
symbol: 'none',
|
|
187
|
+
symbolSize: 0,
|
|
188
|
+
itemStyle: {
|
|
189
|
+
color: muiTheme.palette.grey[500]
|
|
190
|
+
},
|
|
191
|
+
lineStyle: {
|
|
192
|
+
type: 'dashed',
|
|
193
|
+
width: 1
|
|
194
|
+
}
|
|
195
|
+
},
|
|
173
196
|
line: {
|
|
174
197
|
showSymbol: false,
|
|
175
198
|
symbol: 'circle',
|
|
@@ -188,7 +211,12 @@ function generateChartsTheme(muiTheme, echartsTheme, /**
|
|
|
188
211
|
barMaxWidth: 150,
|
|
189
212
|
itemStyle: {
|
|
190
213
|
borderWidth: 0,
|
|
214
|
+
borderRadius: 0,
|
|
191
215
|
borderColor: muiTheme.palette.grey[300]
|
|
216
|
+
},
|
|
217
|
+
label: {
|
|
218
|
+
show: false,
|
|
219
|
+
color: primaryTextColor
|
|
192
220
|
}
|
|
193
221
|
},
|
|
194
222
|
gauge: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './BarChart';
|
|
1
2
|
export * from './ColorPicker';
|
|
2
3
|
export * from './ContentWithLegend';
|
|
3
4
|
export * from './DateTimeRangePicker';
|
|
@@ -12,8 +13,10 @@ export * from './InfoTooltip';
|
|
|
12
13
|
export * from './JSONEditor';
|
|
13
14
|
export * from './Legend';
|
|
14
15
|
export * from './LineChart';
|
|
16
|
+
export * from './ModeSelector';
|
|
15
17
|
export * from './OptionsEditorLayout';
|
|
16
18
|
export * from './SettingsAutocomplete';
|
|
19
|
+
export * from './SortSelector';
|
|
17
20
|
export * from './StatChart';
|
|
18
21
|
export * from './Table';
|
|
19
22
|
export * from './ThresholdsEditor';
|
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,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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,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,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,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
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
export * from './BarChart';
|
|
13
14
|
export * from './ColorPicker';
|
|
14
15
|
export * from './ContentWithLegend';
|
|
15
16
|
export * from './DateTimeRangePicker';
|
|
@@ -24,8 +25,10 @@ export * from './InfoTooltip';
|
|
|
24
25
|
export * from './JSONEditor';
|
|
25
26
|
export * from './Legend';
|
|
26
27
|
export * from './LineChart';
|
|
28
|
+
export * from './ModeSelector';
|
|
27
29
|
export * from './OptionsEditorLayout';
|
|
28
30
|
export * from './SettingsAutocomplete';
|
|
31
|
+
export * from './SortSelector';
|
|
29
32
|
export * from './StatChart';
|
|
30
33
|
export * from './Table';
|
|
31
34
|
export * from './ThresholdsEditor';
|
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 './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"}
|
|
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 './BarChart';\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 './ModeSelector';\nexport * from './OptionsEditorLayout';\nexport * from './SettingsAutocomplete';\nexport * from './SortSelector';\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,YAAY,CAAC;AAC3B,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,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeSeriesValueTuple } from '@perses-dev/core';
|
|
2
|
-
import { LineSeriesOption } from 'echarts/charts';
|
|
2
|
+
import { LineSeriesOption, BarSeriesOption } from 'echarts/charts';
|
|
3
3
|
import { LegendItem } from '../Legend';
|
|
4
4
|
export declare const OPTIMIZED_MODE_SERIES_LIMIT = 1000;
|
|
5
5
|
export declare type UnixTimeMs = number;
|
|
@@ -12,8 +12,9 @@ export declare type EChartsValues = number | null | '-';
|
|
|
12
12
|
export interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {
|
|
13
13
|
data: EChartsValues[];
|
|
14
14
|
}
|
|
15
|
-
export declare type TimeChartSeriesMapping =
|
|
15
|
+
export declare type TimeChartSeriesMapping = TimeSeriesOption[];
|
|
16
16
|
export declare type TimeChartLegendItems = LegendItem[];
|
|
17
|
+
export declare type TimeSeriesOption = LineSeriesOption | BarSeriesOption;
|
|
17
18
|
export declare type EChartsDataFormat = {
|
|
18
19
|
timeSeries: LegacyTimeSeries[];
|
|
19
20
|
xAxis: number[];
|
|
@@ -35,4 +36,12 @@ export declare type ChartInstance = {
|
|
|
35
36
|
*/
|
|
36
37
|
clearHighlightedSeries: () => void;
|
|
37
38
|
};
|
|
39
|
+
export declare const PINNED_CROSSHAIR_SERIES_NAME = "Pinned Crosshair";
|
|
40
|
+
export declare const DEFAULT_PINNED_CROSSHAIR: LineSeriesOption;
|
|
41
|
+
export interface DatapointInfo {
|
|
42
|
+
dataIndex: number;
|
|
43
|
+
seriesIndex: number;
|
|
44
|
+
seriesName: string;
|
|
45
|
+
yValue: number;
|
|
46
|
+
}
|
|
38
47
|
//# 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;
|
|
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,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,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;AAID,oBAAY,sBAAsB,GAAG,gBAAgB,EAAE,CAAC;AACxD,oBAAY,oBAAoB,GAAG,UAAU,EAAE,CAAC;AAEhD,oBAAY,gBAAgB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAIlE,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;AAEF,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D,eAAO,MAAM,wBAAwB,EAAE,gBAuBtC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/model/graph.js
CHANGED
|
@@ -12,5 +12,30 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
// adjust display when there are many time series to help with performance
|
|
14
14
|
export const OPTIMIZED_MODE_SERIES_LIMIT = 1000;
|
|
15
|
+
export const PINNED_CROSSHAIR_SERIES_NAME = 'Pinned Crosshair';
|
|
16
|
+
export const DEFAULT_PINNED_CROSSHAIR = {
|
|
17
|
+
name: PINNED_CROSSHAIR_SERIES_NAME,
|
|
18
|
+
type: 'line',
|
|
19
|
+
// https://echarts.apache.org/en/option.html#series-line.markLine
|
|
20
|
+
markLine: {
|
|
21
|
+
data: [],
|
|
22
|
+
lineStyle: {
|
|
23
|
+
type: 'dashed',
|
|
24
|
+
width: 2
|
|
25
|
+
},
|
|
26
|
+
emphasis: {
|
|
27
|
+
lineStyle: {
|
|
28
|
+
width: 2,
|
|
29
|
+
opacity: 1
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
blur: {
|
|
33
|
+
lineStyle: {
|
|
34
|
+
width: 2,
|
|
35
|
+
opacity: 1
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
15
40
|
|
|
16
41
|
//# sourceMappingURL=graph.js.map
|
package/dist/model/graph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/graph.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\nimport { TimeSeriesValueTuple } from '@perses-dev/core';\nimport { LineSeriesOption } from 'echarts/charts';\nimport { LegendItem } from '../Legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport interface GraphSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n id?: string;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {\n data: EChartsValues[];\n}\n\n//
|
|
1
|
+
{"version":3,"sources":["../../src/model/graph.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\nimport { TimeSeriesValueTuple } from '@perses-dev/core';\nimport { LineSeriesOption, BarSeriesOption } from 'echarts/charts';\nimport { LegendItem } from '../Legend';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport interface GraphSeries {\n name: string;\n values: TimeSeriesValueTuple[];\n id?: string;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface LegacyTimeSeries extends Omit<LineSeriesOption, 'data'> {\n data: EChartsValues[];\n}\n\n// Used for TimeChart dataset support, each time series returned is mapped to series options using datasetIndex\n// - https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets\nexport type TimeChartSeriesMapping = TimeSeriesOption[];\nexport type TimeChartLegendItems = LegendItem[];\n\nexport type TimeSeriesOption = LineSeriesOption | BarSeriesOption;\n\n// [DEPRECATED] used for legacy LineChart 'category' axis.\n// May delete in future when embed users migrate to TimeChart.\nexport type EChartsDataFormat = {\n timeSeries: LegacyTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n\n// Intentionally making this an object to start because it is plausible we will\n// want to support focusing by other attributes (e.g. index, name) in the future,\n// and starting with an object will make adding them a non-breaking change.\nexport type ChartInstanceFocusOpts = {\n id?: string; // LineChart uses id\n name?: string; // TimeChart uses name\n};\n\nexport type ChartInstance = {\n /**\n * Highlight the series associated with the specified options.\n */\n highlightSeries: (opts: ChartInstanceFocusOpts) => void;\n\n /**\n * Clear all highlighted series.\n */\n clearHighlightedSeries: () => void;\n};\n\nexport const PINNED_CROSSHAIR_SERIES_NAME = 'Pinned Crosshair';\n\nexport const DEFAULT_PINNED_CROSSHAIR: LineSeriesOption = {\n name: PINNED_CROSSHAIR_SERIES_NAME,\n type: 'line',\n // https://echarts.apache.org/en/option.html#series-line.markLine\n markLine: {\n data: [],\n lineStyle: {\n type: 'dashed',\n width: 2,\n },\n emphasis: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n blur: {\n lineStyle: {\n width: 2,\n opacity: 1,\n },\n },\n },\n};\n\nexport interface DatapointInfo {\n dataIndex: number;\n seriesIndex: number;\n seriesName: string;\n yValue: number;\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","PINNED_CROSSHAIR_SERIES_NAME","DEFAULT_PINNED_CROSSHAIR","name","type","markLine","data","lineStyle","width","emphasis","opacity","blur"],"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;AAMjC,0EAA0E;AAC1E,OAAO,MAAMA,2BAA2B,GAAG,IAAI,CAAC;AAqDhD,OAAO,MAAMC,4BAA4B,GAAG,kBAAkB,CAAC;AAE/D,OAAO,MAAMC,wBAAwB,GAAqB;IACxDC,IAAI,EAAEF,4BAA4B;IAClCG,IAAI,EAAE,MAAM;IACZ,iEAAiE;IACjEC,QAAQ,EAAE;QACRC,IAAI,EAAE,EAAE;QACRC,SAAS,EAAE;YACTH,IAAI,EAAE,QAAQ;YACdI,KAAK,EAAE,CAAC;SACT;QACDC,QAAQ,EAAE;YACRF,SAAS,EAAE;gBACTC,KAAK,EAAE,CAAC;gBACRE,OAAO,EAAE,CAAC;aACX;SACF;QACDC,IAAI,EAAE;YACJJ,SAAS,EAAE;gBACTC,KAAK,EAAE,CAAC;gBACRE,OAAO,EAAE,CAAC;aACX;SACF;KACF;CACF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ECharts as EChartsInstance } from 'echarts/core';
|
|
2
|
+
import { DatapointInfo } from '../model';
|
|
2
3
|
export interface ZoomEventData {
|
|
3
4
|
start: number;
|
|
4
5
|
end: number;
|
|
@@ -15,4 +16,6 @@ export declare function enableDataZoom(chart: EChartsInstance): void;
|
|
|
15
16
|
*/
|
|
16
17
|
export declare function restoreChart(chart: EChartsInstance): void;
|
|
17
18
|
export declare function clearHighlightedSeries(chart: EChartsInstance, totalSeries: number): void;
|
|
19
|
+
export declare function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null;
|
|
20
|
+
export declare function batchDispatchNearbySeriesActions(chart: EChartsInstance, nearbySeriesIndexes: number[], emphasizedSeriesIndexes: number[], nonEmphasizedSeriesIndexes: number[], emphasizedDatapoints: DatapointInfo[], duplicateDatapoints: DatapointInfo[]): void;
|
|
18
21
|
//# sourceMappingURL=chart-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-actions.d.ts","sourceRoot":"","sources":["../../src/utils/chart-actions.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-actions.d.ts","sourceRoot":"","sources":["../../src/utils/chart-actions.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IAEZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,QAapD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,QAKlD;AAMD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,QASjF;AAOD,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,eAAe,mBAYjG;AAOD,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,eAAe,EACtB,mBAAmB,EAAE,MAAM,EAAE,EAC7B,uBAAuB,EAAE,MAAM,EAAE,EACjC,0BAA0B,EAAE,MAAM,EAAE,EACpC,oBAAoB,EAAE,aAAa,EAAE,EACrC,mBAAmB,EAAE,aAAa,EAAE,QAkDrC"}
|