@perses-dev/components 0.0.0-snapshot-time-chart-rewrite-4667058 → 0.0.0-snapshot-panel-extra-content-3-17f9c42
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/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/Legend/ListLegendItem.d.ts +1 -1
- package/dist/LineChart/LineChart.d.ts +2 -2
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +8 -8
- 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/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 +3 -2
- package/dist/TimeChart/TimeChart.d.ts.map +1 -1
- package/dist/TimeChart/TimeChart.js +61 -21
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +6 -0
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +14 -6
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +9 -3
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +14 -6
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +1 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +7 -9
- package/dist/TimeSeriesTooltip/TooltipHeader.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 +90 -102
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +5 -0
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +7 -0
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +2 -2
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +22 -8
- package/dist/TimeSeriesTooltip/utils.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/FontSizeSelector/FontSizeSelector.js +130 -0
- package/dist/cjs/FontSizeSelector/index.js +28 -0
- package/dist/cjs/LineChart/LineChart.js +7 -7
- 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/StatChart/StatChart.js +7 -5
- package/dist/cjs/StatChart/calculateFontSize.js +5 -1
- package/dist/cjs/TimeChart/TimeChart.js +62 -17
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +13 -5
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +13 -5
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -8
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +90 -102
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +12 -1
- package/dist/cjs/TimeSeriesTooltip/utils.js +21 -7
- package/dist/cjs/UnitSelector/UnitSelector.js +3 -2
- package/dist/cjs/index.js +4 -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 +39 -7
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +14 -5
- 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/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/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 +6 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +39 -7
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +3 -3
|
@@ -43,9 +43,7 @@ const _utils = require("../utils");
|
|
|
43
43
|
_components.LegendComponent,
|
|
44
44
|
_renderers.CanvasRenderer
|
|
45
45
|
]);
|
|
46
|
-
const LineChart = /*#__PURE__*/ (0, _react.forwardRef)(function LineChart({ height , data , yAxis , unit , grid , legend , tooltipConfig ={
|
|
47
|
-
wrapLabels: true
|
|
48
|
-
} , noDataVariant ='message' , syncGroup , onDataZoom , onDoubleClick , __experimentalEChartsOptionsOverride , }, ref) {
|
|
46
|
+
const LineChart = /*#__PURE__*/ (0, _react.forwardRef)(function LineChart({ height , data , yAxis , unit , grid , legend , tooltipConfig =_timeSeriesTooltip.DEFAULT_TOOLTIP_CONFIG , noDataVariant ='message' , syncGroup , onDataZoom , onDoubleClick , __experimentalEChartsOptionsOverride , }, ref) {
|
|
49
47
|
var ref1;
|
|
50
48
|
const chartsTheme = (0, _chartsThemeProvider.useChartsTheme)();
|
|
51
49
|
const chartRef = (0, _react.useRef)();
|
|
@@ -58,7 +56,7 @@ const LineChart = /*#__PURE__*/ (0, _react.forwardRef)(function LineChart({ heig
|
|
|
58
56
|
return {
|
|
59
57
|
highlightSeries ({ id }) {
|
|
60
58
|
if (!chartRef.current) {
|
|
61
|
-
//
|
|
59
|
+
// when chart undef, do not highlight series when hovering over legend
|
|
62
60
|
return;
|
|
63
61
|
}
|
|
64
62
|
chartRef.current.dispatchAction({
|
|
@@ -68,7 +66,7 @@ const LineChart = /*#__PURE__*/ (0, _react.forwardRef)(function LineChart({ heig
|
|
|
68
66
|
},
|
|
69
67
|
clearHighlightedSeries: ()=>{
|
|
70
68
|
if (!chartRef.current) {
|
|
71
|
-
//
|
|
69
|
+
// when chart undef, do not clear highlight series
|
|
72
70
|
return;
|
|
73
71
|
}
|
|
74
72
|
(0, _utils.clearHighlightedSeries)(chartRef.current, data.timeSeries.length);
|
|
@@ -179,7 +177,7 @@ const LineChart = /*#__PURE__*/ (0, _react.forwardRef)(function LineChart({ heig
|
|
|
179
177
|
},
|
|
180
178
|
onClick: (e)=>{
|
|
181
179
|
// Pin and unpin when clicking on chart canvas but not tooltip text.
|
|
182
|
-
if (e.target instanceof HTMLCanvasElement) {
|
|
180
|
+
if (tooltipConfig.enablePinning && e.target instanceof HTMLCanvasElement) {
|
|
183
181
|
setTooltipPinnedCoords((current)=>{
|
|
184
182
|
if (current === null) {
|
|
185
183
|
return {
|
|
@@ -257,11 +255,13 @@ const LineChart = /*#__PURE__*/ (0, _react.forwardRef)(function LineChart({ heig
|
|
|
257
255
|
chartRef: chartRef,
|
|
258
256
|
chartData: data,
|
|
259
257
|
wrapLabels: tooltipConfig.wrapLabels,
|
|
258
|
+
enablePinning: tooltipConfig.enablePinning,
|
|
260
259
|
pinnedPos: tooltipPinnedCoords,
|
|
261
260
|
unit: unit,
|
|
262
261
|
onUnpinClick: ()=>{
|
|
263
262
|
setTooltipPinnedCoords(null);
|
|
264
|
-
}
|
|
263
|
+
},
|
|
264
|
+
containerId: chartsTheme.tooltipPortalContainerId
|
|
265
265
|
}),
|
|
266
266
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_echart.EChart, {
|
|
267
267
|
sx: {
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
Object.defineProperty(exports, "ModeSelector", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>ModeSelector
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _optionsEditorLayout = require("../OptionsEditorLayout");
|
|
23
|
+
const _settingsAutocomplete = require("../SettingsAutocomplete");
|
|
24
|
+
const MODE_OPTIONS = [
|
|
25
|
+
{
|
|
26
|
+
id: 'value',
|
|
27
|
+
label: 'Value'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'percentage',
|
|
31
|
+
label: 'Percentage'
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
function ModeSelector({ disablePercentageMode , onChange , value ='value' }) {
|
|
35
|
+
const handleModeChange = (_, { id })=>{
|
|
36
|
+
onChange(id);
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorLayout.OptionsEditorControl, {
|
|
39
|
+
label: "Mode",
|
|
40
|
+
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_settingsAutocomplete.SettingsAutocomplete, {
|
|
41
|
+
value: MODE_OPTIONS.find((o)=>o.id === value),
|
|
42
|
+
options: MODE_OPTIONS,
|
|
43
|
+
getOptionLabel: (o)=>o.label,
|
|
44
|
+
getOptionDisabled: (o)=>o.id === 'percentage' && disablePercentageMode,
|
|
45
|
+
onChange: handleModeChange,
|
|
46
|
+
disableClearable: true
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
_exportStar(require("./ModeSelector"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
Object.defineProperty(exports, "SortSelector", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>SortSelector
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _optionsEditorLayout = require("../OptionsEditorLayout");
|
|
23
|
+
const _settingsAutocomplete = require("../SettingsAutocomplete");
|
|
24
|
+
const SORT_OPTIONS = [
|
|
25
|
+
{
|
|
26
|
+
id: 'asc',
|
|
27
|
+
label: 'Ascending'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'desc',
|
|
31
|
+
label: 'Descending'
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
function SortSelector({ onChange , value ='desc' }) {
|
|
35
|
+
const handleSortChange = (_, { id })=>{
|
|
36
|
+
onChange(id);
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorLayout.OptionsEditorControl, {
|
|
39
|
+
label: "Sort",
|
|
40
|
+
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_settingsAutocomplete.SettingsAutocomplete, {
|
|
41
|
+
value: SORT_OPTIONS.find((o)=>o.id === value),
|
|
42
|
+
options: SORT_OPTIONS,
|
|
43
|
+
getOptionLabel: (o)=>o.label,
|
|
44
|
+
onChange: handleSortChange,
|
|
45
|
+
disableClearable: true
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
_exportStar(require("./SortSelector"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -49,7 +49,7 @@ const SERIES_NAME_FONT_WEIGHT = 400;
|
|
|
49
49
|
const VALUE_FONT_WEIGHT = 700;
|
|
50
50
|
function StatChart(props) {
|
|
51
51
|
var ref, ref1;
|
|
52
|
-
const { width , height , data , unit , color , sparkline , showSeriesName } = props;
|
|
52
|
+
const { width , height , data , unit , color , sparkline , showSeriesName , valueFontSize } = props;
|
|
53
53
|
const chartsTheme = (0, _chartsThemeProvider.useChartsTheme)();
|
|
54
54
|
let formattedValue = '';
|
|
55
55
|
if (data.calculatedValue === null) {
|
|
@@ -72,8 +72,10 @@ function StatChart(props) {
|
|
|
72
72
|
// calculate value font size and height
|
|
73
73
|
const availableWidth = width - containerPadding * 2;
|
|
74
74
|
const availableHeight = height - seriesNameHeight;
|
|
75
|
-
const
|
|
75
|
+
const optimalValueFontSize = (0, _calculateFontSize.useOptimalFontSize)({
|
|
76
76
|
text: formattedValue,
|
|
77
|
+
// override the font size if user selects it in the settings
|
|
78
|
+
fontSizeOverride: valueFontSize,
|
|
77
79
|
fontWeight: VALUE_FONT_WEIGHT,
|
|
78
80
|
// without sparkline, use only 50% of the available width so it looks better for multiseries
|
|
79
81
|
width: sparkline ? availableWidth : availableWidth * 0.5,
|
|
@@ -82,9 +84,9 @@ function StatChart(props) {
|
|
|
82
84
|
height: sparkline ? availableHeight * 0.25 : availableHeight * 0.9,
|
|
83
85
|
lineHeight: LINE_HEIGHT
|
|
84
86
|
});
|
|
85
|
-
const valueFontHeight =
|
|
87
|
+
const valueFontHeight = optimalValueFontSize * LINE_HEIGHT;
|
|
86
88
|
// make sure the series name font size is slightly smaller than value font size
|
|
87
|
-
seriesNameFontSize = Math.min(
|
|
89
|
+
seriesNameFontSize = Math.min(optimalValueFontSize * 0.7, seriesNameFontSize);
|
|
88
90
|
const option = (0, _react.useMemo)(()=>{
|
|
89
91
|
if (data.seriesData === undefined) return chartsTheme.noDataOption;
|
|
90
92
|
const series = data.seriesData;
|
|
@@ -163,7 +165,7 @@ function StatChart(props) {
|
|
|
163
165
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(Value, {
|
|
164
166
|
variant: "h3",
|
|
165
167
|
color: color,
|
|
166
|
-
fontSize:
|
|
168
|
+
fontSize: optimalValueFontSize,
|
|
167
169
|
padding: containerPadding,
|
|
168
170
|
children: formattedValue
|
|
169
171
|
}),
|
|
@@ -29,9 +29,13 @@ function getGlobalCanvasContext() {
|
|
|
29
29
|
}
|
|
30
30
|
return canvasContext;
|
|
31
31
|
}
|
|
32
|
-
function useOptimalFontSize({ text , fontWeight , width , height , lineHeight , maxSize }) {
|
|
32
|
+
function useOptimalFontSize({ text , fontWeight , width , height , lineHeight , maxSize , fontSizeOverride }) {
|
|
33
33
|
const ctx = getGlobalCanvasContext();
|
|
34
34
|
const chartsTheme = (0, _chartsThemeProvider.useChartsTheme)();
|
|
35
|
+
// if user has selected a font size in the settings, use it instead of calculating the optimal size
|
|
36
|
+
if (fontSizeOverride !== undefined) {
|
|
37
|
+
return Number(fontSizeOverride);
|
|
38
|
+
}
|
|
35
39
|
const textStyle = chartsTheme.echartsTheme.textStyle;
|
|
36
40
|
var ref;
|
|
37
41
|
const fontSize = (ref = Number(textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize)) !== null && ref !== void 0 ? ref : 12;
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "TimeChart", {
|
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _react = require("react");
|
|
23
23
|
const _material = require("@mui/material");
|
|
24
|
+
const _merge = /*#__PURE__*/ _interopRequireDefault(require("lodash/merge"));
|
|
24
25
|
const _dateFnsTz = require("date-fns-tz");
|
|
25
26
|
const _core = require("@perses-dev/core");
|
|
26
27
|
const _core1 = require("echarts/core");
|
|
@@ -28,12 +29,19 @@ const _charts = require("echarts/charts");
|
|
|
28
29
|
const _components = require("echarts/components");
|
|
29
30
|
const _renderers = require("echarts/renderers");
|
|
30
31
|
const _echart = require("../EChart");
|
|
32
|
+
const _graph = require("../model/graph");
|
|
31
33
|
const _chartsThemeProvider = require("../context/ChartsThemeProvider");
|
|
32
34
|
const _utils = require("../utils");
|
|
33
35
|
const _timeSeriesTooltip = require("../TimeSeriesTooltip");
|
|
34
36
|
const _timeZoneProvider = require("../context/TimeZoneProvider");
|
|
37
|
+
function _interopRequireDefault(obj) {
|
|
38
|
+
return obj && obj.__esModule ? obj : {
|
|
39
|
+
default: obj
|
|
40
|
+
};
|
|
41
|
+
}
|
|
35
42
|
(0, _core1.use)([
|
|
36
43
|
_charts.LineChart,
|
|
44
|
+
_charts.BarChart,
|
|
37
45
|
_components.GridComponent,
|
|
38
46
|
_components.DatasetComponent,
|
|
39
47
|
_components.DataZoomComponent,
|
|
@@ -43,12 +51,9 @@ const _timeZoneProvider = require("../context/TimeZoneProvider");
|
|
|
43
51
|
_components.TitleComponent,
|
|
44
52
|
_components.ToolboxComponent,
|
|
45
53
|
_components.TooltipComponent,
|
|
46
|
-
_components.LegendComponent,
|
|
47
54
|
_renderers.CanvasRenderer
|
|
48
55
|
]);
|
|
49
|
-
const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ height , data , seriesMapping , timeScale: timeScaleProp , yAxis , unit , grid , tooltipConfig ={
|
|
50
|
-
wrapLabels: true
|
|
51
|
-
} , noDataVariant ='message' , syncGroup , onDataZoom , onDoubleClick , __experimentalEChartsOptionsOverride , }, ref) {
|
|
56
|
+
const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ height , data , seriesMapping , timeScale: timeScaleProp , yAxis , unit , grid , isStackedBar =false , tooltipConfig =_timeSeriesTooltip.DEFAULT_TOOLTIP_CONFIG , noDataVariant ='message' , syncGroup , onDataZoom , onDoubleClick , __experimentalEChartsOptionsOverride , }, ref) {
|
|
52
57
|
var ref1;
|
|
53
58
|
const chartsTheme = (0, _chartsThemeProvider.useChartsTheme)();
|
|
54
59
|
const chartRef = (0, _react.useRef)();
|
|
@@ -85,7 +90,7 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
85
90
|
return {
|
|
86
91
|
highlightSeries ({ name }) {
|
|
87
92
|
if (!chartRef.current) {
|
|
88
|
-
//
|
|
93
|
+
// when chart undef, do not highlight series when hovering over legend
|
|
89
94
|
return;
|
|
90
95
|
}
|
|
91
96
|
chartRef.current.dispatchAction({
|
|
@@ -95,7 +100,7 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
95
100
|
},
|
|
96
101
|
clearHighlightedSeries: ()=>{
|
|
97
102
|
if (!chartRef.current) {
|
|
98
|
-
//
|
|
103
|
+
// when chart undef, do not clear highlight series
|
|
99
104
|
return;
|
|
100
105
|
}
|
|
101
106
|
(0, _utils.clearHighlightedSeries)(chartRef.current, totalSeries);
|
|
@@ -123,19 +128,19 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
123
128
|
};
|
|
124
129
|
onDataZoom(zoomEvent);
|
|
125
130
|
}
|
|
131
|
+
},
|
|
132
|
+
finished: ()=>{
|
|
133
|
+
if (chartRef.current !== undefined) {
|
|
134
|
+
(0, _utils.enableDataZoom)(chartRef.current);
|
|
135
|
+
}
|
|
126
136
|
}
|
|
127
137
|
};
|
|
128
138
|
}, [
|
|
129
139
|
onDataZoom,
|
|
130
140
|
setTooltipPinnedCoords
|
|
131
141
|
]);
|
|
132
|
-
if (chartRef.current !== undefined) {
|
|
133
|
-
(0, _utils.enableDataZoom)(chartRef.current);
|
|
134
|
-
}
|
|
135
142
|
const { noDataOption } = chartsTheme;
|
|
136
143
|
const option = (0, _react.useMemo)(()=>{
|
|
137
|
-
// TODO: fix loading state and noData variants
|
|
138
|
-
// if (data === undefined) return {};
|
|
139
144
|
// The "chart" `noDataVariant` is only used when the `timeSeries` is an
|
|
140
145
|
// empty array because a `null` value will throw an error.
|
|
141
146
|
if (data === null || data.length === 0 && noDataVariant === 'message') return noDataOption;
|
|
@@ -173,14 +178,20 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
173
178
|
axisLabel: {
|
|
174
179
|
hideOverlap: true,
|
|
175
180
|
formatter: (0, _utils.getFormattedAxisLabel)((_rangeMs = timeScale.rangeMs) !== null && _rangeMs !== void 0 ? _rangeMs : 0)
|
|
181
|
+
},
|
|
182
|
+
axisPointer: {
|
|
183
|
+
snap: false
|
|
176
184
|
}
|
|
177
185
|
},
|
|
178
186
|
yAxis: (0, _utils.getYAxes)(yAxis, unit),
|
|
179
187
|
animation: false,
|
|
180
188
|
tooltip: {
|
|
181
189
|
show: true,
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
// ECharts tooltip content hidden by default since we use custom tooltip instead.
|
|
191
|
+
// Stacked bar uses ECharts tooltip so subgroup data shows correctly.
|
|
192
|
+
showContent: isStackedBar,
|
|
193
|
+
trigger: isStackedBar ? 'item' : 'axis',
|
|
194
|
+
appendToBody: true
|
|
184
195
|
},
|
|
185
196
|
// https://echarts.apache.org/en/option.html#axisPointer
|
|
186
197
|
axisPointer: {
|
|
@@ -188,7 +199,7 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
188
199
|
z: 0,
|
|
189
200
|
triggerEmphasis: false,
|
|
190
201
|
triggerTooltip: false,
|
|
191
|
-
snap:
|
|
202
|
+
snap: false
|
|
192
203
|
},
|
|
193
204
|
toolbox: {
|
|
194
205
|
feature: {
|
|
@@ -204,6 +215,8 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
204
215
|
return __experimentalEChartsOptionsOverride(option);
|
|
205
216
|
}
|
|
206
217
|
return option;
|
|
218
|
+
// tooltipPinnedCoords is needed in dep array so crosshair stays beside pinned tooltip onClick
|
|
219
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
207
220
|
}, [
|
|
208
221
|
data,
|
|
209
222
|
seriesMapping,
|
|
@@ -214,15 +227,40 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
214
227
|
noDataOption,
|
|
215
228
|
__experimentalEChartsOptionsOverride,
|
|
216
229
|
noDataVariant,
|
|
217
|
-
timeZone
|
|
230
|
+
timeZone,
|
|
231
|
+
tooltipPinnedCoords,
|
|
232
|
+
isStackedBar
|
|
218
233
|
]);
|
|
219
234
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
220
235
|
sx: {
|
|
221
236
|
height
|
|
222
237
|
},
|
|
223
238
|
onClick: (e)=>{
|
|
239
|
+
var ref;
|
|
240
|
+
// Determine where on chart canvas to plot pinned crosshair as markLine.
|
|
241
|
+
const pointInGrid = (0, _utils.getPointInGrid)(e.nativeEvent.offsetX, e.nativeEvent.offsetY, chartRef.current);
|
|
242
|
+
if (pointInGrid === null) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
// Clear previously set pinned crosshair
|
|
246
|
+
const isCrosshairPinned = ((ref = seriesMapping[seriesMapping.length - 1]) === null || ref === void 0 ? void 0 : ref.name) === _graph.PINNED_CROSSHAIR_SERIES_NAME;
|
|
247
|
+
if (tooltipPinnedCoords !== null && isCrosshairPinned) {
|
|
248
|
+
seriesMapping.pop();
|
|
249
|
+
} else if (seriesMapping.length !== data.length + 1) {
|
|
250
|
+
// Only add pinned crosshair line series when there is not one already in seriesMapping.
|
|
251
|
+
const pinnedCrosshair = (0, _merge.default)(_graph.DEFAULT_PINNED_CROSSHAIR, {
|
|
252
|
+
markLine: {
|
|
253
|
+
data: [
|
|
254
|
+
{
|
|
255
|
+
xAxis: pointInGrid[0]
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
seriesMapping.push(pinnedCrosshair);
|
|
261
|
+
}
|
|
224
262
|
// Pin and unpin when clicking on chart canvas but not tooltip text.
|
|
225
|
-
if (e.target instanceof HTMLCanvasElement) {
|
|
263
|
+
if (tooltipConfig.enablePinning && e.target instanceof HTMLCanvasElement) {
|
|
226
264
|
setTooltipPinnedCoords((current)=>{
|
|
227
265
|
if (current === null) {
|
|
228
266
|
return {
|
|
@@ -297,12 +335,19 @@ const TimeChart = /*#__PURE__*/ (0, _react.forwardRef)(function TimeChart({ heig
|
|
|
297
335
|
},
|
|
298
336
|
children: [
|
|
299
337
|
showTooltip === true && ((ref1 = option.tooltip) === null || ref1 === void 0 ? void 0 : ref1.showContent) === false && tooltipConfig.hidden !== true && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_timeSeriesTooltip.TimeChartTooltip, {
|
|
338
|
+
containerId: chartsTheme.tooltipPortalContainerId,
|
|
300
339
|
chartRef: chartRef,
|
|
301
340
|
data: data,
|
|
302
341
|
seriesMapping: seriesMapping,
|
|
303
342
|
wrapLabels: tooltipConfig.wrapLabels,
|
|
343
|
+
enablePinning: tooltipConfig.enablePinning,
|
|
304
344
|
pinnedPos: tooltipPinnedCoords,
|
|
305
|
-
unit: unit
|
|
345
|
+
unit: unit,
|
|
346
|
+
onUnpinClick: ()=>{
|
|
347
|
+
setTooltipPinnedCoords(null);
|
|
348
|
+
// Clear previously set pinned crosshair
|
|
349
|
+
seriesMapping.pop();
|
|
350
|
+
}
|
|
306
351
|
}),
|
|
307
352
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_echart.EChart, {
|
|
308
353
|
sx: {
|
|
@@ -32,18 +32,18 @@ function _interopRequireDefault(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
const LineChartTooltip = /*#__PURE__*/ (0, _react.memo)(function LineChartTooltip({ chartRef , chartData , wrapLabels , unit , onUnpinClick , pinnedPos }) {
|
|
35
|
+
const LineChartTooltip = /*#__PURE__*/ (0, _react.memo)(function LineChartTooltip({ chartRef , chartData , enablePinning =true , wrapLabels , unit , onUnpinClick , pinnedPos , containerId }) {
|
|
36
36
|
const [showAllSeries, setShowAllSeries] = (0, _react.useState)(false);
|
|
37
37
|
const mousePos = (0, _tooltipModel.useMousePosition)();
|
|
38
38
|
const { height , width , ref: tooltipRef } = (0, _useResizeObserver.default)();
|
|
39
|
-
const
|
|
39
|
+
const transform = (0, _react.useRef)('');
|
|
40
|
+
const isTooltipPinned = pinnedPos !== null && enablePinning;
|
|
40
41
|
if (mousePos === null || mousePos.target === null) return null;
|
|
41
42
|
// Ensure user is hovering over a chart before checking for nearby series.
|
|
42
43
|
if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
|
|
43
44
|
const chart = chartRef.current;
|
|
44
45
|
var ref;
|
|
45
46
|
const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : _tooltipModel.FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
|
|
46
|
-
const cursorTransform = (0, _utils.assembleTransform)(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0);
|
|
47
47
|
// Get series nearby the cursor and pass into tooltip content children.
|
|
48
48
|
const nearbySeries = (0, _nearbySeries.legacyGetNearbySeriesData)({
|
|
49
49
|
mousePos,
|
|
@@ -57,8 +57,15 @@ const LineChartTooltip = /*#__PURE__*/ (0, _react.memo)(function LineChartToolti
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
const totalSeries = chartData.timeSeries.length;
|
|
60
|
+
const containerElement = containerId ? document.querySelector(containerId) : undefined;
|
|
61
|
+
// if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
|
|
62
|
+
const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
|
|
63
|
+
if (!isTooltipPinned) {
|
|
64
|
+
transform.current = (0, _utils.assembleTransform)(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0, containerElement);
|
|
65
|
+
}
|
|
60
66
|
var ref1;
|
|
61
67
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Portal, {
|
|
68
|
+
container: containerElement,
|
|
62
69
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
63
70
|
ref: tooltipRef,
|
|
64
71
|
sx: (theme)=>{
|
|
@@ -66,7 +73,7 @@ const LineChartTooltip = /*#__PURE__*/ (0, _react.memo)(function LineChartToolti
|
|
|
66
73
|
return {
|
|
67
74
|
minWidth: _tooltipModel.TOOLTIP_MIN_WIDTH,
|
|
68
75
|
maxWidth: _tooltipModel.TOOLTIP_MAX_WIDTH,
|
|
69
|
-
maxHeight: _tooltipModel.TOOLTIP_MAX_HEIGHT,
|
|
76
|
+
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : _tooltipModel.TOOLTIP_MAX_HEIGHT,
|
|
70
77
|
padding: 0,
|
|
71
78
|
position: 'absolute',
|
|
72
79
|
top: 0,
|
|
@@ -87,7 +94,7 @@ const LineChartTooltip = /*#__PURE__*/ (0, _react.memo)(function LineChartToolti
|
|
|
87
94
|
};
|
|
88
95
|
},
|
|
89
96
|
style: {
|
|
90
|
-
transform:
|
|
97
|
+
transform: transform.current
|
|
91
98
|
},
|
|
92
99
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
93
100
|
spacing: 0.5,
|
|
@@ -95,6 +102,7 @@ const LineChartTooltip = /*#__PURE__*/ (0, _react.memo)(function LineChartToolti
|
|
|
95
102
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_tooltipHeader.TooltipHeader, {
|
|
96
103
|
nearbySeries: nearbySeries,
|
|
97
104
|
totalSeries: totalSeries,
|
|
105
|
+
enablePinning: enablePinning,
|
|
98
106
|
isTooltipPinned: isTooltipPinned,
|
|
99
107
|
showAllSeries: showAllSeries,
|
|
100
108
|
onShowAllClick: (checked)=>setShowAllSeries(checked),
|
|
@@ -32,18 +32,24 @@ function _interopRequireDefault(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
const TimeChartTooltip = /*#__PURE__*/ (0, _react.memo)(function TimeChartTooltip({ chartRef , data , seriesMapping , wrapLabels , unit , onUnpinClick , pinnedPos }) {
|
|
35
|
+
const TimeChartTooltip = /*#__PURE__*/ (0, _react.memo)(function TimeChartTooltip({ containerId , chartRef , data , seriesMapping , enablePinning =true , wrapLabels , unit , onUnpinClick , pinnedPos }) {
|
|
36
36
|
const [showAllSeries, setShowAllSeries] = (0, _react.useState)(false);
|
|
37
|
+
const transform = (0, _react.useRef)('');
|
|
37
38
|
const mousePos = (0, _tooltipModel.useMousePosition)();
|
|
38
39
|
const { height , width , ref: tooltipRef } = (0, _useResizeObserver.default)();
|
|
39
|
-
const isTooltipPinned = pinnedPos !== null;
|
|
40
|
+
const isTooltipPinned = pinnedPos !== null && enablePinning;
|
|
40
41
|
if (mousePos === null || mousePos.target === null || data === null) return null;
|
|
41
42
|
// Ensure user is hovering over a chart before checking for nearby series.
|
|
42
43
|
if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
|
|
43
44
|
const chart = chartRef.current;
|
|
44
45
|
var ref;
|
|
45
46
|
const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : _tooltipModel.FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
|
|
46
|
-
const
|
|
47
|
+
const containerElement = containerId ? document.querySelector(containerId) : undefined;
|
|
48
|
+
// if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
|
|
49
|
+
const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
|
|
50
|
+
if (!isTooltipPinned) {
|
|
51
|
+
transform.current = (0, _utils.assembleTransform)(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0, containerElement);
|
|
52
|
+
}
|
|
47
53
|
// Get series nearby the cursor and pass into tooltip content children.
|
|
48
54
|
const nearbySeries = (0, _nearbySeries.getNearbySeriesData)({
|
|
49
55
|
mousePos,
|
|
@@ -59,11 +65,12 @@ const TimeChartTooltip = /*#__PURE__*/ (0, _react.memo)(function TimeChartToolti
|
|
|
59
65
|
}
|
|
60
66
|
const totalSeries = data.length;
|
|
61
67
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Portal, {
|
|
68
|
+
container: containerElement,
|
|
62
69
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
63
70
|
ref: tooltipRef,
|
|
64
|
-
sx: (theme)=>(0, _utils.getTooltipStyles)(theme, pinnedPos),
|
|
71
|
+
sx: (theme)=>(0, _utils.getTooltipStyles)(theme, pinnedPos, maxHeight),
|
|
65
72
|
style: {
|
|
66
|
-
transform:
|
|
73
|
+
transform: transform.current
|
|
67
74
|
},
|
|
68
75
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
69
76
|
spacing: 0.5,
|
|
@@ -71,6 +78,7 @@ const TimeChartTooltip = /*#__PURE__*/ (0, _react.memo)(function TimeChartToolti
|
|
|
71
78
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_tooltipHeader.TooltipHeader, {
|
|
72
79
|
nearbySeries: nearbySeries,
|
|
73
80
|
totalSeries: totalSeries,
|
|
81
|
+
enablePinning: enablePinning,
|
|
74
82
|
isTooltipPinned: isTooltipPinned,
|
|
75
83
|
showAllSeries: showAllSeries,
|
|
76
84
|
onShowAllClick: (checked)=>setShowAllSeries(checked),
|
|
@@ -30,7 +30,7 @@ function _interopRequireDefault(obj) {
|
|
|
30
30
|
default: obj
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const TooltipHeader = /*#__PURE__*/ (0, _react.memo)(function TooltipHeader({ nearbySeries , totalSeries , isTooltipPinned , showAllSeries , onShowAllClick , onUnpinClick }) {
|
|
33
|
+
const TooltipHeader = /*#__PURE__*/ (0, _react.memo)(function TooltipHeader({ nearbySeries , totalSeries , isTooltipPinned , showAllSeries , enablePinning =true , onShowAllClick , onUnpinClick }) {
|
|
34
34
|
var ref;
|
|
35
35
|
var ref1;
|
|
36
36
|
const seriesTimeMs = (ref1 = (ref = nearbySeries[0]) === null || ref === void 0 ? void 0 : ref.date) !== null && ref1 !== void 0 ? ref1 : null;
|
|
@@ -60,7 +60,8 @@ const TooltipHeader = /*#__PURE__*/ (0, _react.memo)(function TooltipHeader({ ne
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
// TODO: accurately calc whether more series are outside scrollable region using yBuffer, avg series name length, TOOLTIP_MAX_HEIGHT
|
|
63
|
-
const showAllSeriesToggle = totalSeries > 5;
|
|
63
|
+
const showAllSeriesToggle = enablePinning && totalSeries > 5;
|
|
64
|
+
const pinTooltipHelpText = isTooltipPinned ? _tooltipModel.UNPIN_TOOLTIP_HELP_TEXT : _tooltipModel.PIN_TOOLTIP_HELP_TEXT;
|
|
64
65
|
var ref2;
|
|
65
66
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
66
67
|
sx: (theme)=>{
|
|
@@ -126,20 +127,17 @@ const TooltipHeader = /*#__PURE__*/ (0, _react.memo)(function TooltipHeader({ ne
|
|
|
126
127
|
})
|
|
127
128
|
]
|
|
128
129
|
}),
|
|
129
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
130
|
+
enablePinning && /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
130
131
|
direction: "row",
|
|
131
132
|
alignItems: "center",
|
|
132
133
|
children: [
|
|
133
|
-
/*#__PURE__*/ (0, _jsxRuntime.
|
|
134
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
134
135
|
sx: {
|
|
135
136
|
marginRight: 0.5,
|
|
136
137
|
fontSize: 11,
|
|
137
138
|
verticalAlign: 'middle'
|
|
138
139
|
},
|
|
139
|
-
children:
|
|
140
|
-
"Click to ",
|
|
141
|
-
isTooltipPinned ? 'Unpin' : 'Pin'
|
|
142
|
-
]
|
|
140
|
+
children: pinTooltipHelpText
|
|
143
141
|
}),
|
|
144
142
|
isTooltipPinned ? /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pin.default, {
|
|
145
143
|
onClick: ()=>{
|