@perses-dev/timeseries-chart-plugin 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{TimeSeriesChart.2f8b193b.js → TimeSeriesChart.2e93229a.js} +5 -6
- package/__mf/js/async/109.f05e61af.js +73 -0
- package/__mf/js/async/{964.719c530c.js → 110.8b9c7f4b.js} +2 -2
- package/__mf/js/async/186.b17dcce5.js +1 -0
- package/__mf/js/async/{547.bb4f1e58.js → 547.a80ef962.js} +2 -2
- package/__mf/js/async/964.e89cbd3b.js +110 -0
- package/__mf/js/async/{580.5f4b0dbd.js → 971.6fcf317e.js} +3 -3
- package/__mf/js/async/__federation_expose_TimeSeriesChart.f017c9e5.js +3 -0
- package/__mf/js/{main.42f3cc3e.js → main.25080a30.js} +5 -6
- package/lib/GeneralSettingsEditor.d.ts +4 -0
- package/lib/GeneralSettingsEditor.d.ts.map +1 -0
- package/lib/{TimeSeriesChartOptionsEditorSettings.js → GeneralSettingsEditor.js} +3 -14
- package/lib/GeneralSettingsEditor.js.map +1 -0
- package/lib/QuerySettingsEditor.d.ts +3 -17
- package/lib/QuerySettingsEditor.d.ts.map +1 -1
- package/lib/QuerySettingsEditor.js +370 -88
- package/lib/QuerySettingsEditor.js.map +1 -1
- package/lib/TimeSeriesChart.d.ts.map +1 -1
- package/lib/TimeSeriesChart.js +8 -3
- package/lib/TimeSeriesChart.js.map +1 -1
- package/lib/TimeSeriesChartPanel.js +1 -1
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/VisualOptionsEditor.d.ts.map +1 -1
- package/lib/VisualOptionsEditor.js +84 -64
- package/lib/VisualOptionsEditor.js.map +1 -1
- package/lib/cjs/{TimeSeriesChartOptionsEditorSettings.js → GeneralSettingsEditor.js} +4 -15
- package/lib/cjs/QuerySettingsEditor.js +410 -95
- package/lib/cjs/TimeSeriesChart.js +8 -3
- package/lib/cjs/TimeSeriesChartPanel.js +1 -1
- package/lib/cjs/VisualOptionsEditor.js +82 -62
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/time-series-chart-model.js +37 -0
- package/lib/cjs/utils/data-transform.js +7 -5
- package/lib/cjs/utils/palette-gen.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/time-series-chart-model.d.ts +32 -2
- package/lib/time-series-chart-model.d.ts.map +1 -1
- package/lib/time-series-chart-model.js +25 -0
- package/lib/time-series-chart-model.js.map +1 -1
- package/lib/utils/data-transform.d.ts +5 -2
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +7 -5
- package/lib/utils/data-transform.js.map +1 -1
- package/lib/utils/palette-gen.js +2 -2
- package/lib/utils/palette-gen.js.map +1 -1
- package/mf-manifest.json +13 -13
- package/mf-stats.json +13 -13
- package/package.json +5 -5
- package/__mf/js/async/109.604f6c41.js +0 -73
- package/__mf/js/async/133.c48c8cc8.js +0 -110
- package/__mf/js/async/686.0cd9a75c.js +0 -1
- package/__mf/js/async/__federation_expose_TimeSeriesChart.f20a0aca.js +0 -3
- package/lib/TimeSeriesChartOptionsEditorSettings.d.ts +0 -4
- package/lib/TimeSeriesChartOptionsEditorSettings.d.ts.map +0 -1
- package/lib/TimeSeriesChartOptionsEditorSettings.js.map +0 -1
- /package/__mf/js/async/{109.604f6c41.js.LICENSE.txt → 109.f05e61af.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{964.719c530c.js.LICENSE.txt → 110.8b9c7f4b.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{547.bb4f1e58.js.LICENSE.txt → 547.a80ef962.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{133.c48c8cc8.js.LICENSE.txt → 964.e89cbd3b.js.LICENSE.txt} +0 -0
|
@@ -45,61 +45,6 @@ function VisualOptionsEditor({ value, onChange }) {
|
|
|
45
45
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
|
|
46
46
|
title: "Visual",
|
|
47
47
|
children: [
|
|
48
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
49
|
-
label: "Display",
|
|
50
|
-
control: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.ToggleButtonGroup, {
|
|
51
|
-
color: "primary",
|
|
52
|
-
exclusive: true,
|
|
53
|
-
value: value.display,
|
|
54
|
-
onChange: (__, newValue)=>{
|
|
55
|
-
onChange({
|
|
56
|
-
...value,
|
|
57
|
-
display: newValue
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
children: [
|
|
61
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
|
|
62
|
-
value: "line",
|
|
63
|
-
selected: value.display === undefined || value.display === 'line',
|
|
64
|
-
"aria-label": "display line series",
|
|
65
|
-
children: "Line"
|
|
66
|
-
}),
|
|
67
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
|
|
68
|
-
value: "bar",
|
|
69
|
-
"aria-label": "display bar series",
|
|
70
|
-
children: "Bar"
|
|
71
|
-
})
|
|
72
|
-
]
|
|
73
|
-
})
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
76
|
-
label: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.label,
|
|
77
|
-
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
|
|
78
|
-
"data-testid": _timeserieschartmodel.VISUAL_CONFIG.lineWidth.testId,
|
|
79
|
-
value: value.lineWidth ?? _timeserieschartmodel.DEFAULT_LINE_WIDTH,
|
|
80
|
-
valueLabelDisplay: "auto",
|
|
81
|
-
step: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.step,
|
|
82
|
-
marks: true,
|
|
83
|
-
min: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.min,
|
|
84
|
-
max: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.max,
|
|
85
|
-
disabled: value.display === 'bar',
|
|
86
|
-
onChange: handleLineWidthChange
|
|
87
|
-
})
|
|
88
|
-
}),
|
|
89
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
90
|
-
label: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.label,
|
|
91
|
-
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
|
|
92
|
-
"data-testid": _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.testId,
|
|
93
|
-
value: value.areaOpacity ?? _timeserieschartmodel.DEFAULT_AREA_OPACITY,
|
|
94
|
-
valueLabelDisplay: "auto",
|
|
95
|
-
step: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.step,
|
|
96
|
-
marks: true,
|
|
97
|
-
min: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.min,
|
|
98
|
-
max: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.max,
|
|
99
|
-
disabled: value.display === 'bar',
|
|
100
|
-
onChange: handleAreaOpacityChange
|
|
101
|
-
})
|
|
102
|
-
}),
|
|
103
48
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
104
49
|
label: _timeserieschartmodel.VISUAL_CONFIG.stack.label,
|
|
105
50
|
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SettingsAutocomplete, {
|
|
@@ -124,17 +69,92 @@ function VisualOptionsEditor({ value, onChange }) {
|
|
|
124
69
|
})
|
|
125
70
|
}),
|
|
126
71
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
127
|
-
label:
|
|
128
|
-
control: /*#__PURE__*/ (0, _jsxruntime.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
72
|
+
label: "Display",
|
|
73
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.ToggleButtonGroup, {
|
|
74
|
+
color: "primary",
|
|
75
|
+
exclusive: true,
|
|
76
|
+
value: value.display ?? _timeserieschartmodel.DEFAULT_DISPLAY,
|
|
77
|
+
onChange: (__, newValue)=>{
|
|
132
78
|
onChange({
|
|
133
79
|
...value,
|
|
134
|
-
|
|
80
|
+
display: newValue
|
|
135
81
|
});
|
|
136
|
-
}
|
|
82
|
+
},
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
|
|
85
|
+
value: "line",
|
|
86
|
+
selected: value.display === undefined || value.display === 'line',
|
|
87
|
+
"aria-label": "display line series",
|
|
88
|
+
children: "Line"
|
|
89
|
+
}),
|
|
90
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
|
|
91
|
+
value: "bar",
|
|
92
|
+
"aria-label": "display bar series",
|
|
93
|
+
children: "Bar"
|
|
94
|
+
})
|
|
95
|
+
]
|
|
137
96
|
})
|
|
97
|
+
}),
|
|
98
|
+
value.display === 'line' && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
99
|
+
children: [
|
|
100
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
101
|
+
label: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.label,
|
|
102
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
|
|
103
|
+
"data-testid": _timeserieschartmodel.VISUAL_CONFIG.lineWidth.testId,
|
|
104
|
+
value: value.lineWidth ?? _timeserieschartmodel.DEFAULT_LINE_WIDTH,
|
|
105
|
+
valueLabelDisplay: "auto",
|
|
106
|
+
step: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.step,
|
|
107
|
+
marks: true,
|
|
108
|
+
min: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.min,
|
|
109
|
+
max: _timeserieschartmodel.VISUAL_CONFIG.lineWidth.max,
|
|
110
|
+
onChange: handleLineWidthChange
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
114
|
+
label: _timeserieschartmodel.VISUAL_CONFIG.lineStyle.label,
|
|
115
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButtonGroup, {
|
|
116
|
+
color: "primary",
|
|
117
|
+
exclusive: true,
|
|
118
|
+
value: value.lineStyle ?? _timeserieschartmodel.DEFAULT_LINE_STYLE,
|
|
119
|
+
onChange: (__, newValue)=>{
|
|
120
|
+
onChange({
|
|
121
|
+
...value,
|
|
122
|
+
lineStyle: newValue
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
children: Object.entries(_timeserieschartmodel.LINE_STYLE_CONFIG).map(([styleValue, config])=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
|
|
126
|
+
value: styleValue,
|
|
127
|
+
"aria-label": `${styleValue} line style`,
|
|
128
|
+
children: config.label
|
|
129
|
+
}, styleValue))
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
133
|
+
label: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.label,
|
|
134
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
|
|
135
|
+
"data-testid": _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.testId,
|
|
136
|
+
value: value.areaOpacity ?? _timeserieschartmodel.DEFAULT_AREA_OPACITY,
|
|
137
|
+
valueLabelDisplay: "auto",
|
|
138
|
+
step: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.step,
|
|
139
|
+
marks: true,
|
|
140
|
+
min: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.min,
|
|
141
|
+
max: _timeserieschartmodel.VISUAL_CONFIG.areaOpacity.max,
|
|
142
|
+
onChange: handleAreaOpacityChange
|
|
143
|
+
})
|
|
144
|
+
}),
|
|
145
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
146
|
+
label: _timeserieschartmodel.VISUAL_CONFIG.connectNulls.label,
|
|
147
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
148
|
+
checked: value.connectNulls ?? _timeserieschartmodel.DEFAULT_CONNECT_NULLS,
|
|
149
|
+
onChange: (e)=>{
|
|
150
|
+
onChange({
|
|
151
|
+
...value,
|
|
152
|
+
connectNulls: e.target.checked
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
]
|
|
138
158
|
})
|
|
139
159
|
]
|
|
140
160
|
});
|
package/lib/cjs/index.js
CHANGED
|
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "getPluginModule", {
|
|
|
22
22
|
});
|
|
23
23
|
const _getPluginModule = require("./getPluginModule");
|
|
24
24
|
_export_star(require("./TimeSeriesChart"), exports);
|
|
25
|
+
_export_star(require("./GeneralSettingsEditor"), exports);
|
|
25
26
|
_export_star(require("./QuerySettingsEditor"), exports);
|
|
26
|
-
_export_star(require("./TimeSeriesChartOptionsEditorSettings"), exports);
|
|
27
27
|
_export_star(require("./VisualOptionsEditor"), exports);
|
|
28
28
|
_export_star(require("./YAxisOptionsEditor"), exports);
|
|
29
29
|
_export_star(require("./TimeSeriesChartPanel"), exports);
|
|
@@ -27,9 +27,15 @@ _export(exports, {
|
|
|
27
27
|
DEFAULT_CONNECT_NULLS: function() {
|
|
28
28
|
return DEFAULT_CONNECT_NULLS;
|
|
29
29
|
},
|
|
30
|
+
DEFAULT_DISPLAY: function() {
|
|
31
|
+
return DEFAULT_DISPLAY;
|
|
32
|
+
},
|
|
30
33
|
DEFAULT_FORMAT: function() {
|
|
31
34
|
return DEFAULT_FORMAT;
|
|
32
35
|
},
|
|
36
|
+
DEFAULT_LINE_STYLE: function() {
|
|
37
|
+
return DEFAULT_LINE_STYLE;
|
|
38
|
+
},
|
|
33
39
|
DEFAULT_LINE_WIDTH: function() {
|
|
34
40
|
return DEFAULT_LINE_WIDTH;
|
|
35
41
|
},
|
|
@@ -42,9 +48,15 @@ _export(exports, {
|
|
|
42
48
|
DEFAULT_Y_AXIS: function() {
|
|
43
49
|
return DEFAULT_Y_AXIS;
|
|
44
50
|
},
|
|
51
|
+
LINE_STYLE_CONFIG: function() {
|
|
52
|
+
return LINE_STYLE_CONFIG;
|
|
53
|
+
},
|
|
45
54
|
NEGATIVE_MIN_VALUE_MULTIPLIER: function() {
|
|
46
55
|
return NEGATIVE_MIN_VALUE_MULTIPLIER;
|
|
47
56
|
},
|
|
57
|
+
OPACITY_CONFIG: function() {
|
|
58
|
+
return OPACITY_CONFIG;
|
|
59
|
+
},
|
|
48
60
|
POINT_SIZE_OFFSET: function() {
|
|
49
61
|
return POINT_SIZE_OFFSET;
|
|
50
62
|
},
|
|
@@ -98,13 +110,17 @@ const Y_AXIS_CONFIG = {
|
|
|
98
110
|
label: 'Max'
|
|
99
111
|
}
|
|
100
112
|
};
|
|
113
|
+
const DEFAULT_DISPLAY = 'line';
|
|
101
114
|
const DEFAULT_LINE_WIDTH = 1.25;
|
|
115
|
+
const DEFAULT_LINE_STYLE = 'solid';
|
|
102
116
|
const DEFAULT_AREA_OPACITY = 0;
|
|
103
117
|
const POINT_SIZE_OFFSET = 1.5;
|
|
104
118
|
const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;
|
|
105
119
|
const DEFAULT_CONNECT_NULLS = false;
|
|
106
120
|
const DEFAULT_VISUAL = {
|
|
121
|
+
display: DEFAULT_DISPLAY,
|
|
107
122
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
123
|
+
lineStyle: DEFAULT_LINE_STYLE,
|
|
108
124
|
areaOpacity: DEFAULT_AREA_OPACITY,
|
|
109
125
|
pointRadius: DEFAULT_POINT_RADIUS,
|
|
110
126
|
connectNulls: DEFAULT_CONNECT_NULLS
|
|
@@ -118,6 +134,9 @@ const VISUAL_CONFIG = {
|
|
|
118
134
|
max: 3,
|
|
119
135
|
step: 0.25
|
|
120
136
|
},
|
|
137
|
+
lineStyle: {
|
|
138
|
+
label: 'Line Style'
|
|
139
|
+
},
|
|
121
140
|
pointRadius: {
|
|
122
141
|
label: 'Point Radius',
|
|
123
142
|
testId: 'slider-point-radius',
|
|
@@ -153,6 +172,24 @@ const STACK_OPTIONS = Object.entries(STACK_CONFIG).map(([id, config])=>{
|
|
|
153
172
|
...config
|
|
154
173
|
};
|
|
155
174
|
});
|
|
175
|
+
const LINE_STYLE_CONFIG = {
|
|
176
|
+
solid: {
|
|
177
|
+
label: 'Solid'
|
|
178
|
+
},
|
|
179
|
+
dashed: {
|
|
180
|
+
label: 'Dashes'
|
|
181
|
+
},
|
|
182
|
+
dotted: {
|
|
183
|
+
label: 'Dots'
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const OPACITY_CONFIG = {
|
|
187
|
+
label: 'Opacity',
|
|
188
|
+
testId: 'slider-opacity',
|
|
189
|
+
min: 0,
|
|
190
|
+
max: 1,
|
|
191
|
+
step: 0.05
|
|
192
|
+
};
|
|
156
193
|
const POSITIVE_MIN_VALUE_MULTIPLIER = 0.8;
|
|
157
194
|
const NEGATIVE_MIN_VALUE_MULTIPLIER = 1.2;
|
|
158
195
|
function createInitialTimeSeriesChartOptions() {
|
|
@@ -63,7 +63,7 @@ function getCommonTimeScaleForQueries(queries) {
|
|
|
63
63
|
const seriesData = queries.map((query)=>query.data);
|
|
64
64
|
return (0, _core.getCommonTimeScale)(seriesData);
|
|
65
65
|
}
|
|
66
|
-
function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, paletteColor) {
|
|
66
|
+
function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, paletteColor, querySettings) {
|
|
67
67
|
const lineWidth = visual.lineWidth ?? _timeserieschartmodel.DEFAULT_LINE_WIDTH;
|
|
68
68
|
const pointRadius = visual.pointRadius ?? _timeserieschartmodel.DEFAULT_POINT_RADIUS;
|
|
69
69
|
// Shows datapoint symbols when selected time range is roughly 15 minutes or less
|
|
@@ -102,10 +102,10 @@ function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, palet
|
|
|
102
102
|
symbolSize: pointRadius,
|
|
103
103
|
lineStyle: {
|
|
104
104
|
width: lineWidth,
|
|
105
|
-
|
|
105
|
+
type: querySettings?.lineStyle ?? visual.lineStyle
|
|
106
106
|
},
|
|
107
107
|
areaStyle: {
|
|
108
|
-
opacity: visual.areaOpacity ?? _timeserieschartmodel.DEFAULT_AREA_OPACITY
|
|
108
|
+
opacity: querySettings?.areaOpacity ?? visual.areaOpacity ?? _timeserieschartmodel.DEFAULT_AREA_OPACITY
|
|
109
109
|
},
|
|
110
110
|
// https://echarts.apache.org/en/option.html#series-line.emphasis
|
|
111
111
|
emphasis: {
|
|
@@ -113,7 +113,8 @@ function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, palet
|
|
|
113
113
|
disabled: visual.areaOpacity !== undefined && visual.areaOpacity > 0,
|
|
114
114
|
lineStyle: {
|
|
115
115
|
width: lineWidth + 1,
|
|
116
|
-
opacity: 1
|
|
116
|
+
opacity: 1,
|
|
117
|
+
type: visual.lineStyle
|
|
117
118
|
}
|
|
118
119
|
},
|
|
119
120
|
selectedMode: 'single',
|
|
@@ -126,7 +127,8 @@ function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, palet
|
|
|
126
127
|
blur: {
|
|
127
128
|
lineStyle: {
|
|
128
129
|
width: lineWidth,
|
|
129
|
-
opacity: BLUR_FADEOUT_OPACITY
|
|
130
|
+
opacity: BLUR_FADEOUT_OPACITY,
|
|
131
|
+
type: visual.lineStyle
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
};
|
|
@@ -39,9 +39,9 @@ function getSeriesColor(props) {
|
|
|
39
39
|
const { categoricalPalette, visual, muiPrimaryColor, seriesName, seriesIndex, querySettings, queryHasMultipleResults } = props;
|
|
40
40
|
// Use color overrides defined in query settings in priority, if applicable
|
|
41
41
|
if (querySettings) {
|
|
42
|
-
if (querySettings.colorMode === 'fixed') {
|
|
42
|
+
if (querySettings.colorMode === 'fixed' && querySettings.colorValue) {
|
|
43
43
|
return querySettings.colorValue;
|
|
44
|
-
} else if (querySettings.colorMode === 'fixed-single' && !queryHasMultipleResults) {
|
|
44
|
+
} else if (querySettings.colorMode === 'fixed-single' && !queryHasMultipleResults && querySettings.colorValue) {
|
|
45
45
|
return querySettings.colorValue;
|
|
46
46
|
}
|
|
47
47
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { getPluginModule } from './getPluginModule';
|
|
2
2
|
export * from './TimeSeriesChart';
|
|
3
|
+
export * from './GeneralSettingsEditor';
|
|
3
4
|
export * from './QuerySettingsEditor';
|
|
4
|
-
export * from './TimeSeriesChartOptionsEditorSettings';
|
|
5
5
|
export * from './VisualOptionsEditor';
|
|
6
6
|
export * from './YAxisOptionsEditor';
|
|
7
7
|
export * from './TimeSeriesChartPanel';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
export { getPluginModule } from './getPluginModule';
|
|
14
14
|
export * from './TimeSeriesChart';
|
|
15
|
+
export * from './GeneralSettingsEditor';
|
|
15
16
|
export * from './QuerySettingsEditor';
|
|
16
|
-
export * from './TimeSeriesChartOptionsEditorSettings';
|
|
17
17
|
export * from './VisualOptionsEditor';
|
|
18
18
|
export * from './YAxisOptionsEditor';
|
|
19
19
|
export * from './TimeSeriesChartPanel';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2025 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 { getPluginModule } from './getPluginModule';\nexport * from './TimeSeriesChart';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2025 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 { getPluginModule } from './getPluginModule';\nexport * from './TimeSeriesChart';\nexport * from './GeneralSettingsEditor';\nexport * from './QuerySettingsEditor';\nexport * from './VisualOptionsEditor';\nexport * from './YAxisOptionsEditor';\nexport * from './TimeSeriesChartPanel';\nexport * from './TimeSeriesChartBase';\nexport * from './time-series-chart-model';\nexport * from './CSVExportUtils';\n"],"names":["getPluginModule"],"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,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,oBAAoB;AAClC,cAAc,0BAA0B;AACxC,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,wBAAwB;AACtC,cAAc,4BAA4B;AAC1C,cAAc,mBAAmB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Definition, ThresholdOptions, FormatOptions } from '@perses-dev/core';
|
|
2
2
|
import { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';
|
|
3
|
+
/**
|
|
4
|
+
* Line style options for time series charts.
|
|
5
|
+
*/
|
|
6
|
+
export type LineStyleType = 'solid' | 'dashed' | 'dotted';
|
|
3
7
|
/**
|
|
4
8
|
* The schema for a TimeSeriesChart panel.
|
|
5
9
|
*/
|
|
@@ -19,8 +23,10 @@ export interface TimeSeriesChartOptions {
|
|
|
19
23
|
}
|
|
20
24
|
export interface QuerySettingsOptions {
|
|
21
25
|
queryIndex: number;
|
|
22
|
-
colorMode
|
|
23
|
-
colorValue
|
|
26
|
+
colorMode?: 'fixed' | 'fixed-single';
|
|
27
|
+
colorValue?: string;
|
|
28
|
+
lineStyle?: LineStyleType;
|
|
29
|
+
areaOpacity?: number;
|
|
24
30
|
}
|
|
25
31
|
export type TimeSeriesChartOptionsEditorProps = OptionsEditorProps<TimeSeriesChartOptions>;
|
|
26
32
|
export interface TimeSeriesChartYAxisOptions {
|
|
@@ -39,6 +45,7 @@ export interface TimeSeriesChartPaletteOptions {
|
|
|
39
45
|
export type TimeSeriesChartVisualOptions = {
|
|
40
46
|
display?: 'line' | 'bar';
|
|
41
47
|
lineWidth?: number;
|
|
48
|
+
lineStyle?: LineStyleType;
|
|
42
49
|
areaOpacity?: number;
|
|
43
50
|
showPoints?: 'auto' | 'always';
|
|
44
51
|
palette?: TimeSeriesChartPaletteOptions;
|
|
@@ -65,7 +72,9 @@ export declare const Y_AXIS_CONFIG: {
|
|
|
65
72
|
label: string;
|
|
66
73
|
};
|
|
67
74
|
};
|
|
75
|
+
export declare const DEFAULT_DISPLAY = "line";
|
|
68
76
|
export declare const DEFAULT_LINE_WIDTH = 1.25;
|
|
77
|
+
export declare const DEFAULT_LINE_STYLE = "solid";
|
|
69
78
|
export declare const DEFAULT_AREA_OPACITY = 0;
|
|
70
79
|
export declare const POINT_SIZE_OFFSET = 1.5;
|
|
71
80
|
export declare const DEFAULT_POINT_RADIUS: number;
|
|
@@ -80,6 +89,9 @@ export declare const VISUAL_CONFIG: {
|
|
|
80
89
|
max: number;
|
|
81
90
|
step: number;
|
|
82
91
|
};
|
|
92
|
+
lineStyle: {
|
|
93
|
+
label: string;
|
|
94
|
+
};
|
|
83
95
|
pointRadius: {
|
|
84
96
|
label: string;
|
|
85
97
|
testId: string;
|
|
@@ -117,6 +129,24 @@ export declare const STACK_OPTIONS: ({
|
|
|
117
129
|
label: string;
|
|
118
130
|
id: StackOptions;
|
|
119
131
|
})[];
|
|
132
|
+
export declare const LINE_STYLE_CONFIG: {
|
|
133
|
+
solid: {
|
|
134
|
+
label: string;
|
|
135
|
+
};
|
|
136
|
+
dashed: {
|
|
137
|
+
label: string;
|
|
138
|
+
};
|
|
139
|
+
dotted: {
|
|
140
|
+
label: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export declare const OPACITY_CONFIG: {
|
|
144
|
+
label: string;
|
|
145
|
+
testId: string;
|
|
146
|
+
min: number;
|
|
147
|
+
max: number;
|
|
148
|
+
step: number;
|
|
149
|
+
};
|
|
120
150
|
export declare const POSITIVE_MIN_VALUE_MULTIPLIER = 0.8;
|
|
121
151
|
export declare const NEGATIVE_MIN_VALUE_MULTIPLIER = 1.2;
|
|
122
152
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-series-chart-model.d.ts","sourceRoot":"","sources":["../../src/time-series-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACnF,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,2BAA2B,CAAC;IACpC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,MAAM,CAAC,EAAE,4BAA4B,CAAC;IACtC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"time-series-chart-model.d.ts","sourceRoot":"","sources":["../../src/time-series-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAElF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,W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40
40
|
};
|
|
41
|
+
export const DEFAULT_DISPLAY = 'line';
|
|
41
42
|
export const DEFAULT_LINE_WIDTH = 1.25;
|
|
43
|
+
export const DEFAULT_LINE_STYLE = 'solid';
|
|
42
44
|
export const DEFAULT_AREA_OPACITY = 0;
|
|
43
45
|
// How much larger datapoint symbols are than line width, also applied in VisualOptionsEditor.
|
|
44
46
|
export const POINT_SIZE_OFFSET = 1.5;
|
|
45
47
|
export const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;
|
|
46
48
|
export const DEFAULT_CONNECT_NULLS = false;
|
|
47
49
|
export const DEFAULT_VISUAL = {
|
|
50
|
+
display: DEFAULT_DISPLAY,
|
|
48
51
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
52
|
+
lineStyle: DEFAULT_LINE_STYLE,
|
|
49
53
|
areaOpacity: DEFAULT_AREA_OPACITY,
|
|
50
54
|
pointRadius: DEFAULT_POINT_RADIUS,
|
|
51
55
|
connectNulls: DEFAULT_CONNECT_NULLS
|
|
@@ -61,6 +65,9 @@ export const VISUAL_CONFIG = {
|
|
|
61
65
|
max: 3,
|
|
62
66
|
step: 0.25
|
|
63
67
|
},
|
|
68
|
+
lineStyle: {
|
|
69
|
+
label: 'Line Style'
|
|
70
|
+
},
|
|
64
71
|
pointRadius: {
|
|
65
72
|
label: 'Point Radius',
|
|
66
73
|
testId: 'slider-point-radius',
|
|
@@ -96,6 +103,24 @@ export const STACK_OPTIONS = Object.entries(STACK_CONFIG).map(([id, config])=>{
|
|
|
96
103
|
...config
|
|
97
104
|
};
|
|
98
105
|
});
|
|
106
|
+
export const LINE_STYLE_CONFIG = {
|
|
107
|
+
solid: {
|
|
108
|
+
label: 'Solid'
|
|
109
|
+
},
|
|
110
|
+
dashed: {
|
|
111
|
+
label: 'Dashes'
|
|
112
|
+
},
|
|
113
|
+
dotted: {
|
|
114
|
+
label: 'Dots'
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
export const OPACITY_CONFIG = {
|
|
118
|
+
label: 'Opacity',
|
|
119
|
+
testId: 'slider-opacity',
|
|
120
|
+
min: 0,
|
|
121
|
+
max: 1,
|
|
122
|
+
step: 0.05
|
|
123
|
+
};
|
|
99
124
|
// Both of these constants help produce a value that is LESS THAN the initial value.
|
|
100
125
|
// For positive values, we multiply by a number less than 1 to get this outcome.
|
|
101
126
|
// For negative values, we multiply to a number greater than 1 to get this outcome.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/time-series-chart-model.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 { Definition, ThresholdOptions, FormatOptions } from '@perses-dev/core';\nimport { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';\n\n/**\n * The schema for a TimeSeriesChart panel.\n */\nexport interface TimeSeriesChartDefinition extends Definition<TimeSeriesChartOptions> {\n kind: 'TimeSeriesChart';\n}\n\n/**\n * The Options object supported by the TimeSeriesChartPanel plugin.\n */\nexport interface TimeSeriesChartOptions {\n legend?: LegendSpecOptions;\n yAxis?: TimeSeriesChartYAxisOptions;\n thresholds?: ThresholdOptions;\n visual?: TimeSeriesChartVisualOptions;\n tooltip?: TooltipSpecOptions;\n querySettings?: QuerySettingsOptions[];\n}\n\nexport interface QuerySettingsOptions {\n queryIndex: number;\n colorMode
|
|
1
|
+
{"version":3,"sources":["../../src/time-series-chart-model.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 { Definition, ThresholdOptions, FormatOptions } from '@perses-dev/core';\nimport { OptionsEditorProps, LegendSpecOptions } from '@perses-dev/plugin-system';\n\n/**\n * Line style options for time series charts.\n */\nexport type LineStyleType = 'solid' | 'dashed' | 'dotted';\n\n/**\n * The schema for a TimeSeriesChart panel.\n */\nexport interface TimeSeriesChartDefinition extends Definition<TimeSeriesChartOptions> {\n kind: 'TimeSeriesChart';\n}\n\n/**\n * The Options object supported by the TimeSeriesChartPanel plugin.\n */\nexport interface TimeSeriesChartOptions {\n legend?: LegendSpecOptions;\n yAxis?: TimeSeriesChartYAxisOptions;\n thresholds?: ThresholdOptions;\n visual?: TimeSeriesChartVisualOptions;\n tooltip?: TooltipSpecOptions;\n querySettings?: QuerySettingsOptions[];\n}\n\nexport interface QuerySettingsOptions {\n queryIndex: number;\n colorMode?: 'fixed' | 'fixed-single';\n colorValue?: string;\n lineStyle?: LineStyleType;\n areaOpacity?: number;\n}\n\nexport type TimeSeriesChartOptionsEditorProps = OptionsEditorProps<TimeSeriesChartOptions>;\n\nexport interface TimeSeriesChartYAxisOptions {\n show?: boolean;\n label?: string;\n format?: FormatOptions;\n min?: number;\n max?: number;\n}\n\nexport interface TooltipSpecOptions {\n enablePinning: boolean;\n}\n\nexport interface TimeSeriesChartPaletteOptions {\n mode: 'auto' | 'categorical';\n}\n\nexport type TimeSeriesChartVisualOptions = {\n display?: 'line' | 'bar';\n lineWidth?: number;\n lineStyle?: LineStyleType;\n areaOpacity?: number;\n showPoints?: 'auto' | 'always';\n palette?: TimeSeriesChartPaletteOptions;\n pointRadius?: number;\n stack?: StackOptions;\n connectNulls?: boolean;\n};\n\nexport const DEFAULT_FORMAT: FormatOptions = {\n unit: 'decimal',\n shortValues: true,\n};\n\nexport const DEFAULT_Y_AXIS: TimeSeriesChartYAxisOptions = {\n show: true,\n label: '',\n format: DEFAULT_FORMAT,\n min: undefined,\n max: undefined,\n};\n\nexport const Y_AXIS_CONFIG = {\n show: { label: 'Show' },\n label: { label: 'Label' },\n unit: { label: 'Unit' },\n min: { label: 'Min' },\n max: { label: 'Max' },\n};\n\nexport const DEFAULT_DISPLAY = 'line';\nexport const DEFAULT_LINE_WIDTH = 1.25;\nexport const DEFAULT_LINE_STYLE = 'solid';\nexport const DEFAULT_AREA_OPACITY = 0;\n// How much larger datapoint symbols are than line width, also applied in VisualOptionsEditor.\nexport const POINT_SIZE_OFFSET = 1.5;\nexport const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;\nexport const DEFAULT_CONNECT_NULLS = false;\n\nexport const DEFAULT_VISUAL: TimeSeriesChartVisualOptions = {\n display: DEFAULT_DISPLAY,\n lineWidth: DEFAULT_LINE_WIDTH,\n lineStyle: DEFAULT_LINE_STYLE,\n areaOpacity: DEFAULT_AREA_OPACITY,\n pointRadius: DEFAULT_POINT_RADIUS,\n connectNulls: DEFAULT_CONNECT_NULLS,\n};\n\n// Controls how often static threshold values should be plotted so threshold data shows\n// in tooltip without flicker.\nexport const THRESHOLD_PLOT_INTERVAL = 15;\n\nexport const VISUAL_CONFIG = {\n lineWidth: {\n label: 'Line Width',\n testId: 'slider-line-width',\n min: 0.25,\n max: 3,\n step: 0.25,\n },\n lineStyle: {\n label: 'Line Style',\n },\n pointRadius: {\n label: 'Point Radius',\n testId: 'slider-point-radius',\n min: 0,\n max: 6,\n step: 0.25,\n },\n areaOpacity: {\n label: 'Area Opacity',\n testId: 'slider-area-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n },\n stack: {\n label: 'Stack Series',\n },\n connectNulls: {\n label: 'Connect Nulls',\n },\n};\n\n// None is equivalent to undefined since stack is optional\nexport type StackOptions = 'none' | 'all'; // TODO: add percent option support\n\nexport const STACK_CONFIG = {\n none: { label: 'None' },\n all: { label: 'All' },\n // TODO: enable option after 'Percent' implemented\n // percent: { label: 'Percent', disabled: true }, // hidden since not implemented yet\n};\n\nexport const STACK_OPTIONS = Object.entries(STACK_CONFIG).map(([id, config]) => {\n return {\n id: id as StackOptions,\n ...config,\n };\n});\n\nexport const LINE_STYLE_CONFIG = {\n solid: { label: 'Solid' },\n dashed: { label: 'Dashes' },\n dotted: { label: 'Dots' },\n};\n\nexport const OPACITY_CONFIG = {\n label: 'Opacity',\n testId: 'slider-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n};\n\n// Both of these constants help produce a value that is LESS THAN the initial value.\n// For positive values, we multiply by a number less than 1 to get this outcome.\n// For negative values, we multiply to a number greater than 1 to get this outcome.\nexport const POSITIVE_MIN_VALUE_MULTIPLIER = 0.8;\nexport const NEGATIVE_MIN_VALUE_MULTIPLIER = 1.2;\n\n/**\n * Creates an initial/empty options object for the TimeSeriesChartPanel.\n */\nexport function createInitialTimeSeriesChartOptions(): TimeSeriesChartOptions {\n return {};\n}\n"],"names":["DEFAULT_FORMAT","unit","shortValues","DEFAULT_Y_AXIS","show","label","format","min","undefined","max","Y_AXIS_CONFIG","DEFAULT_DISPLAY","DEFAULT_LINE_WIDTH","DEFAULT_LINE_STYLE","DEFAULT_AREA_OPACITY","POINT_SIZE_OFFSET","DEFAULT_POINT_RADIUS","DEFAULT_CONNECT_NULLS","DEFAULT_VISUAL","display","lineWidth","lineStyle","areaOpacity","pointRadius","connectNulls","THRESHOLD_PLOT_INTERVAL","VISUAL_CONFIG","testId","step","stack","STACK_CONFIG","none","all","STACK_OPTIONS","Object","entries","map","id","config","LINE_STYLE_CONFIG","solid","dashed","dotted","OPACITY_CONFIG","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULTIPLIER","createInitialTimeSeriesChartOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;A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K;QACLmB,MAAM;IACR;IACAC,OAAO;QACLxB,OAAO;IACT;IACAmB,cAAc;QACZnB,OAAO;IACT;AACF,EAAE;AAKF,OAAO,MAAMyB,eAAe;IAC1BC,MAAM;QAAE1B,OAAO;IAAO;IACtB2B,KAAK;QAAE3B,OAAO;IAAM;AAGtB,EAAE;AAEF,OAAO,MAAM4B,gBAAgBC,OAAOC,OAAO,CAACL,cAAcM,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACzE,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF,GAAG;AAEH,OAAO,MAAMC,oBAAoB;IAC/BC,OAAO;QAAEnC,OAAO;IAAQ;IACxBoC,QAAQ;QAAEpC,OAAO;IAAS;IAC1BqC,QAAQ;QAAErC,OAAO;IAAO;AAC1B,EAAE;AAEF,OAAO,MAAMsC,iBAAiB;IAC5BtC,OAAO;IACPsB,QAAQ;IACRpB,KAAK;IACLE,KAAK;IACLmB,MAAM;AACR,EAAE;AAEF,oFAAoF;AACpF,gFAAgF;AAChF,mFAAmF;AACnF,OAAO,MAAMgB,gCAAgC,IAAI;AACjD,OAAO,MAAMC,gCAAgC,IAAI;AAEjD;;CAEC,GACD,OAAO,SAASC;IACd,OAAO,CAAC;AACV"}
|
|
@@ -3,7 +3,7 @@ import { LineSeriesOption } from 'echarts/charts';
|
|
|
3
3
|
import { StepOptions, TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/core';
|
|
4
4
|
import { LegacyTimeSeries, EChartsDataFormat, TimeSeriesOption } from '@perses-dev/components';
|
|
5
5
|
import { useTimeSeriesQueries, PanelData } from '@perses-dev/plugin-system';
|
|
6
|
-
import { TimeSeriesChartVisualOptions, TimeSeriesChartYAxisOptions } from '../time-series-chart-model';
|
|
6
|
+
import { TimeSeriesChartVisualOptions, TimeSeriesChartYAxisOptions, LineStyleType } from '../time-series-chart-model';
|
|
7
7
|
export type RunningQueriesState = ReturnType<typeof useTimeSeriesQueries>;
|
|
8
8
|
export declare const EMPTY_GRAPH_DATA: EChartsDataFormat;
|
|
9
9
|
export declare const HIDE_DATAPOINTS_LIMIT = 70;
|
|
@@ -17,7 +17,10 @@ export declare function getCommonTimeScaleForQueries(queries: Array<PanelData<Ti
|
|
|
17
17
|
/**
|
|
18
18
|
* Gets ECharts line series option properties for regular trends
|
|
19
19
|
*/
|
|
20
|
-
export declare function getTimeSeries(id: string, datasetIndex: number, formattedName: string, visual: TimeSeriesChartVisualOptions, timeScale: TimeScale, paletteColor: string
|
|
20
|
+
export declare function getTimeSeries(id: string, datasetIndex: number, formattedName: string, visual: TimeSeriesChartVisualOptions, timeScale: TimeScale, paletteColor: string, querySettings?: {
|
|
21
|
+
lineStyle?: LineStyleType;
|
|
22
|
+
areaOpacity?: number;
|
|
23
|
+
}): TimeSeriesOption;
|
|
21
24
|
/**
|
|
22
25
|
* Gets threshold-specific line series styles
|
|
23
26
|
* markLine cannot be used since it does not update yAxis max / min
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EAGV,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,gBAAgB,EAChB,iBAAiB,EAEjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAQL,4BAA4B,EAC5B,2BAA2B,
|
|
1
|
+
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,E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,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAMR;AA4BD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,2BAAgC,GAAG,oBAAoB,CA8BnG;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C"}
|
|
@@ -30,7 +30,7 @@ export const BLUR_FADEOUT_OPACITY = 0.5;
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Gets ECharts line series option properties for regular trends
|
|
33
|
-
*/ export function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, paletteColor) {
|
|
33
|
+
*/ export function getTimeSeries(id, datasetIndex, formattedName, visual, timeScale, paletteColor, querySettings) {
|
|
34
34
|
const lineWidth = visual.lineWidth ?? DEFAULT_LINE_WIDTH;
|
|
35
35
|
const pointRadius = visual.pointRadius ?? DEFAULT_POINT_RADIUS;
|
|
36
36
|
// Shows datapoint symbols when selected time range is roughly 15 minutes or less
|
|
@@ -69,10 +69,10 @@ export const BLUR_FADEOUT_OPACITY = 0.5;
|
|
|
69
69
|
symbolSize: pointRadius,
|
|
70
70
|
lineStyle: {
|
|
71
71
|
width: lineWidth,
|
|
72
|
-
|
|
72
|
+
type: querySettings?.lineStyle ?? visual.lineStyle
|
|
73
73
|
},
|
|
74
74
|
areaStyle: {
|
|
75
|
-
opacity: visual.areaOpacity ?? DEFAULT_AREA_OPACITY
|
|
75
|
+
opacity: querySettings?.areaOpacity ?? visual.areaOpacity ?? DEFAULT_AREA_OPACITY
|
|
76
76
|
},
|
|
77
77
|
// https://echarts.apache.org/en/option.html#series-line.emphasis
|
|
78
78
|
emphasis: {
|
|
@@ -80,7 +80,8 @@ export const BLUR_FADEOUT_OPACITY = 0.5;
|
|
|
80
80
|
disabled: visual.areaOpacity !== undefined && visual.areaOpacity > 0,
|
|
81
81
|
lineStyle: {
|
|
82
82
|
width: lineWidth + 1,
|
|
83
|
-
opacity: 1
|
|
83
|
+
opacity: 1,
|
|
84
|
+
type: visual.lineStyle
|
|
84
85
|
}
|
|
85
86
|
},
|
|
86
87
|
selectedMode: 'single',
|
|
@@ -93,7 +94,8 @@ export const BLUR_FADEOUT_OPACITY = 0.5;
|
|
|
93
94
|
blur: {
|
|
94
95
|
lineStyle: {
|
|
95
96
|
width: lineWidth,
|
|
96
|
-
opacity: BLUR_FADEOUT_OPACITY
|
|
97
|
+
opacity: BLUR_FADEOUT_OPACITY,
|
|
98
|
+
type: visual.lineStyle
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
};
|