@pulzr/perses-timeseries-panel 0.1.3 → 0.1.4
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 +2 -1
- package/__mf/js/{PulzrTimeSeriesChart.8af05eb298.js → PulzrTimeSeriesChart.7c3ead7012.js} +2 -2
- package/__mf/js/async/{0.97d9b1e0c4.js → 0.5ef0431536.js} +2 -2
- package/__mf/js/async/{07.f2f50f0b10.js → 07.069fbddc67.js} +2 -2
- package/__mf/js/async/{0p.4e1d1fe39a.js → 0p.45231180d3.js} +2 -2
- package/__mf/js/async/{1.aceea72600.js → 1.75df3ae4b0.js} +2 -2
- package/__mf/js/async/{2.d99477aed1.js → 2.a727b9416d.js} +2 -2
- package/__mf/js/async/{24.317de98277.js → 24.aff881525a.js} +1 -1
- package/__mf/js/async/{3.7d1614f6e7.js → 3.1a66608288.js} +1 -1
- package/__mf/js/async/4.3c9a2b4233.js +1 -0
- package/__mf/js/async/{5.900dc50d56.js → 5.5d8820f557.js} +1 -1
- package/__mf/js/async/{6.91e38df626.js → 6.d90805485a.js} +1 -1
- package/__mf/js/async/{6x.fd1c612797.js → 6x.368a17e295.js} +1 -1
- package/__mf/js/async/{7.dcc88aa9b6.js → 7.f40ccc96ba.js} +2 -2
- package/__mf/js/async/{9.c3bada9a67.js → 9.d08e848582.js} +1 -1
- package/__mf/js/async/{__federation_expose_PulzrTimeSeriesChart.cde156b788.js → __federation_expose_PulzrTimeSeriesChart.f8cb14738c.js} +1 -1
- package/__mf/js/async/{aw.70e118cbc9.js → aw.bedacdca5d.js} +1 -1
- package/__mf/js/async/b.e5082f36ba.js +1 -0
- package/__mf/js/async/{c.2d6088333b.js → c.783005e082.js} +1 -1
- package/__mf/js/async/{f.96d3bb04bb.js → f.1ee31f4c44.js} +2 -2
- package/__mf/js/async/{f6.89ff65957d.js → f6.ffd252b334.js} +1 -1
- package/__mf/js/async/{g.692bd4d1a6.js → g.adaadebd2d.js} +1 -1
- package/__mf/js/async/{i.e37122ab8c.js → i.a9f4f52e01.js} +1 -1
- package/__mf/js/async/{k.6b0ad1bfcf.js → k.4a35cfdf19.js} +2 -2
- package/__mf/js/async/kk.a702691f9e.js +1 -0
- package/__mf/js/async/{m.4678fdbb11.js → m.e7706a5825.js} +2 -2
- package/__mf/js/async/{n.0f1729eb57.js → n.dada4ae652.js} +1 -1
- package/__mf/js/async/{o.0d3a98da9a.js → o.27f2fd5272.js} +1 -1
- package/__mf/js/async/{o8.c61bd6ac39.js → o8.aeb40cdeea.js} +1 -1
- package/__mf/js/async/{os.ad10d51845.js → os.f5826c65d5.js} +2 -2
- package/__mf/js/async/{p.318393ba38.js → p.7d81f7ca97.js} +2 -2
- package/__mf/js/async/{pj.99233c78ca.js → pj.a85577346e.js} +1 -1
- package/__mf/js/async/{s.d7727bb096.js → s.db986f308e.js} +1 -1
- package/__mf/js/async/{s9.fb2e5e8a04.js → s9.5f6d9374f6.js} +1 -1
- package/__mf/js/async/{se.5e663361de.js → se.02a1c72b61.js} +2 -2
- package/__mf/js/async/{sp.0f633853b4.js → sp.dfb099e3e6.js} +1 -1
- package/__mf/js/async/{sr.19b889668c.js → sr.694c7e4e84.js} +1 -1
- package/__mf/js/async/{t.d2b9f3a9ba.js → t.4fcc93a4ee.js} +1 -1
- package/__mf/js/async/{tl.924f906110.js → tl.252b3303c9.js} +1 -1
- package/__mf/js/async/{uz.0d07cc3f87.js → uz.9126a376c9.js} +1 -1
- package/__mf/js/async/{x.d9c364c1d4.js → x.d033ab938e.js} +1 -1
- package/__mf/js/async/{xr.87b81c2efb.js → xr.2f4b0bfea6.js} +1 -1
- package/__mf/js/async/{y.cc71ee1d51.js → y.a7adb70718.js} +1 -1
- package/__mf/js/async/{yk.b74f365b85.js → yk.79c1e2f705.js} +2 -2
- package/__mf/js/{main.ad2fd370ef.js → main.c525171587.js} +2 -2
- package/lib/TimeSeriesChartPanel.d.ts.map +1 -1
- package/lib/TimeSeriesChartPanel.js +41 -19
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/time-series-chart-model.d.ts +7 -0
- package/lib/time-series-chart-model.d.ts.map +1 -1
- package/lib/time-series-chart-model.js.map +1 -1
- package/mf-manifest.json +42 -42
- package/mf-stats.json +42 -42
- package/package.json +1 -1
- package/__mf/js/async/4.b3b501a5a4.js +0 -1
- package/__mf/js/async/b.71a696a6e8.js +0 -1
- package/__mf/js/async/kk.2c9a7e0b39.js +0 -1
- /package/__mf/js/async/{0.97d9b1e0c4.js.LICENSE.txt → 0.5ef0431536.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{07.f2f50f0b10.js.LICENSE.txt → 07.069fbddc67.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{0p.4e1d1fe39a.js.LICENSE.txt → 0p.45231180d3.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1.aceea72600.js.LICENSE.txt → 1.75df3ae4b0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2.d99477aed1.js.LICENSE.txt → 2.a727b9416d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7.dcc88aa9b6.js.LICENSE.txt → 7.f40ccc96ba.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{f.96d3bb04bb.js.LICENSE.txt → f.1ee31f4c44.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{k.6b0ad1bfcf.js.LICENSE.txt → k.4a35cfdf19.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{m.4678fdbb11.js.LICENSE.txt → m.e7706a5825.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{os.ad10d51845.js.LICENSE.txt → os.f5826c65d5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{p.318393ba38.js.LICENSE.txt → p.7d81f7ca97.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{se.5e663361de.js.LICENSE.txt → se.02a1c72b61.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{yk.b74f365b85.js.LICENSE.txt → yk.79c1e2f705.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSeriesChartPanel.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesChartPanel.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,2BAA2B,CAAC;AAQ7E,OAAO,KAAK,EAAsB,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAGjG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAY,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAuBlF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAuBtF,iBAAS,6BAA6B,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"TimeSeriesChartPanel.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesChartPanel.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,2BAA2B,CAAC;AAQ7E,OAAO,KAAK,EAAsB,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAGjG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAY,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAuBlF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAuBtF,iBAAS,6BAA6B,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CA0iBvF;AAKD,eAAO,MAAM,oBAAoB,2EAYhC,CAAC"}
|
|
@@ -81,26 +81,38 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
81
81
|
]);
|
|
82
82
|
// Collect unique formats from query settings that differ from the base format
|
|
83
83
|
// These will create additional Y axes on the right side
|
|
84
|
-
const { additionalFormats,
|
|
84
|
+
const { additionalFormats, hiddenAxes, axisIndexOf } = useMemo(()=>{
|
|
85
85
|
const baseUnit = format?.unit ?? 'decimal';
|
|
86
86
|
const additionalFormats = [];
|
|
87
87
|
const formatToYAxisIndex = new Map();
|
|
88
|
+
const hiddenAxes = new Set();
|
|
89
|
+
// A query's axis: the base one, unless its unit differs or it asks for its own (right, or hidden).
|
|
90
|
+
const keyOf = (qs)=>{
|
|
91
|
+
const unit = qs?.format?.unit ?? baseUnit;
|
|
92
|
+
return unit === baseUnit && !qs?.axis ? baseUnit : `${unit}|${qs?.axis ?? ''}`;
|
|
93
|
+
};
|
|
88
94
|
// Index 0 is reserved for the base Y axis
|
|
89
95
|
formatToYAxisIndex.set(baseUnit, 0);
|
|
90
|
-
// Collect
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
// Collect the axes the query settings ask for: those drawn first, so their offsets on the right are as Perses
|
|
97
|
+
// works them out, and the hidden ones after them.
|
|
98
|
+
const asked = (querySettingsList ?? []).filter((qs)=>!formatToYAxisIndex.has(keyOf(qs)));
|
|
99
|
+
for (const qs of [
|
|
100
|
+
...asked.filter((q)=>q.axis !== 'hidden'),
|
|
101
|
+
...asked.filter((q)=>q.axis === 'hidden')
|
|
102
|
+
]){
|
|
103
|
+
const key = keyOf(qs);
|
|
104
|
+
if (!formatToYAxisIndex.has(key)) {
|
|
105
|
+
// Add new format - index is 1 + position in additionalFormats array
|
|
106
|
+
formatToYAxisIndex.set(key, 1 + additionalFormats.length);
|
|
107
|
+
additionalFormats.push(qs.format ?? format);
|
|
108
|
+
if (qs.axis === 'hidden') hiddenAxes.add(additionalFormats.length);
|
|
99
109
|
}
|
|
100
110
|
}
|
|
111
|
+
const axisIndexOf = (qs)=>formatToYAxisIndex.get(keyOf(qs)) ?? 0;
|
|
101
112
|
return {
|
|
102
113
|
additionalFormats,
|
|
103
|
-
|
|
114
|
+
hiddenAxes,
|
|
115
|
+
axisIndexOf
|
|
104
116
|
};
|
|
105
117
|
}, [
|
|
106
118
|
format,
|
|
@@ -188,7 +200,7 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
188
200
|
queryHasMultipleResults: series.length > 1
|
|
189
201
|
}),
|
|
190
202
|
seriesLabels: timeSeries.labels,
|
|
191
|
-
yAxisIndex:
|
|
203
|
+
yAxisIndex: axisIndexOf(querySettings),
|
|
192
204
|
negativeY: querySettings?.negativeY,
|
|
193
205
|
exemplars: []
|
|
194
206
|
});
|
|
@@ -210,7 +222,7 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
210
222
|
categoricalPalette,
|
|
211
223
|
visual,
|
|
212
224
|
muiTheme.palette.primary.main,
|
|
213
|
-
|
|
225
|
+
axisIndexOf
|
|
214
226
|
]);
|
|
215
227
|
// Populate series data based on query results
|
|
216
228
|
const { timeChartData, timeSeriesMapping, legendItems, seriesFormatMap: computedSeriesFormatMap, maxValuesByFormat } = useMemo(()=>{
|
|
@@ -244,7 +256,7 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
244
256
|
for (const [queryIndex, { querySettings, series }] of preparedQueries.entries()){
|
|
245
257
|
const band = {
|
|
246
258
|
id: `${chartId}band${queryIndex}`,
|
|
247
|
-
yAxisIndex:
|
|
259
|
+
yAxisIndex: axisIndexOf(querySettings),
|
|
248
260
|
querySettings,
|
|
249
261
|
edges: {}
|
|
250
262
|
};
|
|
@@ -281,10 +293,14 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
281
293
|
const datasetIndex = timeChartData.length;
|
|
282
294
|
// Determine yAxisIndex based on the query's format setting
|
|
283
295
|
const queryFormat = querySettings?.format;
|
|
284
|
-
const yAxisIndex =
|
|
296
|
+
const yAxisIndex = axisIndexOf(querySettings);
|
|
285
297
|
// Each series is stored as a separate dataset source.
|
|
286
298
|
// https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets
|
|
287
|
-
timeSeriesMapping.push(getTimeSeries(seriesId, datasetIndex, formattedSeriesName,
|
|
299
|
+
timeSeriesMapping.push(getTimeSeries(seriesId, datasetIndex, formattedSeriesName, // A query may be bars under a panel of lines, or a line over its bars.
|
|
300
|
+
querySettings?.display ? {
|
|
301
|
+
...visual,
|
|
302
|
+
display: querySettings.display
|
|
303
|
+
} : visual, timeScale, seriesColor, querySettings, yAxisIndex, visibleSeriesCount));
|
|
288
304
|
// Store the format for this series for tooltip formatting
|
|
289
305
|
if (queryFormat) {
|
|
290
306
|
seriesFormatMap.set(seriesId, queryFormat);
|
|
@@ -373,7 +389,7 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
373
389
|
categoricalPalette,
|
|
374
390
|
chartsTheme.thresholds,
|
|
375
391
|
muiTheme.palette.primary.main,
|
|
376
|
-
|
|
392
|
+
axisIndexOf,
|
|
377
393
|
chartId
|
|
378
394
|
]);
|
|
379
395
|
// Create multiple Y axes if there are additional formats
|
|
@@ -387,12 +403,18 @@ function TimeSeriesChartPanelComponent(props) {
|
|
|
387
403
|
const unitKey = fmt.unit;
|
|
388
404
|
return unitKey ? maxValuesByFormat?.get(unitKey) ?? 1000 : 1000;
|
|
389
405
|
});
|
|
390
|
-
|
|
406
|
+
const axes = getFormattedMultipleYAxes(echartsYAxis, format, additionalFormats, maxValues);
|
|
407
|
+
// An axis asked hidden keeps its scale and draws nothing; it comes after every drawn one, so none moves for it.
|
|
408
|
+
return axes.map((axis, index)=>hiddenAxes.has(index) ? {
|
|
409
|
+
...axis,
|
|
410
|
+
show: false
|
|
411
|
+
} : axis);
|
|
391
412
|
}, [
|
|
392
413
|
echartsYAxis,
|
|
393
414
|
format,
|
|
394
415
|
additionalFormats,
|
|
395
|
-
maxValuesByFormat
|
|
416
|
+
maxValuesByFormat,
|
|
417
|
+
hiddenAxes
|
|
396
418
|
]);
|
|
397
419
|
// Translate the legend values into columns for the table legend.
|
|
398
420
|
const legendColumns = useMemo(()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesChartPanel.tsx"],"sourcesContent":["// Copyright 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 { Box, useTheme } from '@mui/material';\nimport type {\n ChartInstance,\n ZoomEventData,\n SelectedLegendItemState,\n TableColumnConfig,\n LegendItem,\n LegendProps,\n TooltipConfig,\n TimeChartSeriesMapping,\n StepOptions,\n} from '@perses-dev/components';\nimport {\n YAxisLabel,\n useChartsTheme,\n ContentWithLegend,\n DEFAULT_TOOLTIP_CONFIG,\n getFormattedMultipleYAxes,\n DEFAULT_LEGEND,\n formatValue,\n} from '@perses-dev/components';\nimport { usePanelAnnotationsWithData } from '@perses-dev/dashboards';\nimport type { PanelProps, CalculationType } from '@perses-dev/plugin-system';\nimport {\n LEGEND_VALUE_CONFIG,\n useTimeRange,\n validateLegendSpec,\n legendValues,\n getCalculations,\n} from '@perses-dev/plugin-system';\nimport type { Labels, TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport type { GridComponentOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\nimport { memo, useCallback, useId, useMemo, useRef, useState } from 'react';\n\nimport type { BandEdge, TimeSeriesChartOptions } from './time-series-chart-model';\nimport {\n BAND_LABEL,\n DEFAULT_BAND_OPACITY,\n DEFAULT_FORMAT,\n DEFAULT_VISUAL,\n THRESHOLD_PLOT_INTERVAL,\n} from './time-series-chart-model';\nimport { TimeSeriesChartBase } from './TimeSeriesChartBase';\nimport type { TimeSeriesAnnotation } from './utils/annotation';\nimport { convertAnnotationToTimeSeriesAnnotation } from './utils/annotation';\nimport type { ExemplarChartData } from './utils/data-transform';\nimport {\n getBandSeries,\n getTimeSeries,\n getTimeSeriesValues,\n getCommonTimeScaleForQueries,\n convertPanelYAxis,\n getThresholdSeries,\n convertPercentThreshold,\n} from './utils/data-transform';\nimport { getSeriesColor } from './utils/palette-gen';\n\nexport type TimeSeriesChartProps = PanelProps<TimeSeriesChartOptions, TimeSeriesData>;\n\n/**\n * Stable string key for a labels record, so exemplars can be matched to their\n * series regardless of the labels order.\n */\nfunction labelsKey(labels: Labels): string {\n return JSON.stringify(\n Object.keys(labels)\n .toSorted()\n .map((labelName) => [labelName, labels[labelName]]),\n );\n}\n\n// Using an \"ALL\" value to handle the case on first loading the chart where we\n// want to select all, but do not want all of the legend items to be visually highlighted.\n// This helps us differentiate those cases more clearly instead of inferring it\n// based on the state of the data. This also helps us avoid some coding\n// complexity around initializing a full record for the initial load that would\n// currently require significantly more refactoring of this component.\n// TODO: simplify this if we switch the list-based legend UI to use checkboxes,\n// where we *would* want to visually select all items in this case.\n\nfunction TimeSeriesChartPanelComponent(props: TimeSeriesChartProps): ReactElement | null {\n const {\n spec: { thresholds, yAxis, tooltip, querySettings: querySettingsList },\n contentDimensions,\n queryResults,\n } = props;\n const chartsTheme = useChartsTheme();\n const muiTheme = useTheme();\n const chartId = useId();\n\n const chartRef = useRef<ChartInstance>(null);\n\n // ECharts theme comes from ChartsProvider, more info: https://echarts.apache.org/en/option.html#color\n // Colors are manually applied since our legend and tooltip are built custom with React.\n const categoricalPalette = chartsTheme.echartsTheme.color;\n\n // TODO: consider refactoring how the layout/spacing/alignment are calculated\n // the next time significant changes are made to the time series panel (e.g.\n // when making improvements to the legend to more closely match designs).\n // This may also want to include moving some of this logic down to the shared,\n // embeddable components.\n const contentPadding = chartsTheme.container.padding.default;\n const adjustedContentDimensions: typeof contentDimensions = contentDimensions\n ? {\n width: contentDimensions.width - contentPadding * 2,\n height: contentDimensions.height - contentPadding * 2,\n }\n : undefined;\n\n // populate default 'position' and other future properties\n const legend = useMemo(() => {\n return props.spec.legend && validateLegendSpec(props.spec.legend)\n ? merge({}, DEFAULT_LEGEND, props.spec.legend)\n : undefined;\n }, [props.spec.legend]);\n\n // TODO: add support for y_axis_alt.format\n const format = props.spec.yAxis?.format ?? DEFAULT_FORMAT;\n\n // ensures there are fallbacks for unset properties since most\n // users should not need to customize visual display\n const visual = useMemo(() => {\n return merge({}, DEFAULT_VISUAL, props.spec.visual);\n }, [props.spec.visual]);\n\n // convert Perses dashboard format to be ECharts compatible\n const echartsYAxis = useMemo(() => {\n return convertPanelYAxis(yAxis);\n }, [yAxis]);\n\n // Collect unique formats from query settings that differ from the base format\n // These will create additional Y axes on the right side\n const { additionalFormats, formatToYAxisIndex } = useMemo(() => {\n const baseUnit = format?.unit ?? 'decimal';\n const additionalFormats: Array<typeof format> = [];\n const formatToYAxisIndex = new Map<string, number>();\n\n // Index 0 is reserved for the base Y axis\n formatToYAxisIndex.set(baseUnit, 0);\n\n // Collect unique formats from query settings\n for (const qs of querySettingsList ?? []) {\n if (qs.format?.unit && qs.format.unit !== baseUnit) {\n const unitKey = qs.format.unit;\n if (!formatToYAxisIndex.has(unitKey)) {\n // Add new format - index is 1 + position in additionalFormats array\n formatToYAxisIndex.set(unitKey, 1 + additionalFormats.length);\n additionalFormats.push(qs.format);\n }\n }\n }\n\n return { additionalFormats, formatToYAxisIndex };\n }, [format, querySettingsList]);\n\n const [selectedLegendItems, setSelectedLegendItems] = useState<SelectedLegendItemState>('ALL');\n const [legendSorting, setLegendSorting] = useState<NonNullable<LegendProps['tableProps']>['sorting']>();\n\n const { setTimeRange } = useTimeRange();\n\n const annotationsWithData = usePanelAnnotationsWithData(props.definition?.spec.annotations);\n\n const annotations: TimeSeriesAnnotation[] = useMemo(\n () => convertAnnotationToTimeSeriesAnnotation(annotationsWithData),\n [annotationsWithData],\n );\n\n const calculationTypes = legend?.values;\n\n // Point processing and legend statistics depend on query data, not legend selection.\n // Reuse these arrays when toggling series instead of rescanning every sample.\n const { timeScale, preparedQueries } = useMemo(() => {\n const commonScale = getCommonTimeScaleForQueries(queryResults);\n const settingsByQuery = new Map(querySettingsList?.map((settings) => [settings.queryIndex, settings]));\n let seriesIndex = 0;\n const queries = commonScale\n ? queryResults.map((result, queryIndex) => {\n const querySettings = settingsByQuery.get(queryIndex);\n const series = result.data.series.map((timeSeries) => {\n const baseValues = getTimeSeriesValues(timeSeries, commonScale);\n const values = querySettings?.negativeY\n ? baseValues.map(([t, v]): TimeSeriesValueTuple => [t, v === null ? null : -v])\n : baseValues;\n const calculations = calculationTypes\n ? getCalculations(timeSeries.values, calculationTypes as CalculationType[])\n : undefined;\n let maxValue = 0;\n if (querySettings?.format?.unit) {\n for (const [, value] of timeSeries.values) {\n maxValue = Math.max(maxValue, Math.abs(value ?? 0));\n }\n }\n const seriesId = `${chartId}${timeSeries.name}${seriesIndex}`;\n seriesIndex += 1;\n return { timeSeries, seriesId, values, calculations, maxValue };\n });\n return { querySettings, series, exemplars: result.data.exemplars };\n })\n : [];\n return { timeScale: commonScale, preparedQueries: queries };\n }, [queryResults, querySettingsList, calculationTypes, chartId]);\n\n // Prepare all exemplar groups independently of legend selection. The base chart\n // filters their scatter series without rebuilding marker data for visible groups.\n const chartExemplars = useMemo(() => {\n const groups: ExemplarChartData[] = [];\n let seriesIndex = 0;\n for (const { querySettings, series, exemplars } of preparedQueries) {\n // Labels identify a series within a query, not across different queries.\n const seriesByLabels = new Map<string, ExemplarChartData>();\n for (const { timeSeries, seriesId } of series) {\n const seriesName = timeSeries.formattedName ?? timeSeries.name;\n if (exemplars?.length && timeSeries.labels) {\n seriesByLabels.set(labelsKey(timeSeries.labels), {\n seriesId,\n seriesName,\n color: getSeriesColor({\n defaultCategoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName,\n seriesIndex,\n querySettings,\n queryHasMultipleResults: series.length > 1,\n }),\n seriesLabels: timeSeries.labels,\n yAxisIndex: formatToYAxisIndex.get(querySettings?.format?.unit ?? '') ?? 0,\n negativeY: querySettings?.negativeY,\n exemplars: [],\n });\n }\n seriesIndex += 1;\n }\n for (const group of exemplars ?? []) {\n if (group.exemplars.length === 0) continue;\n const matched = seriesByLabels.get(labelsKey(group.seriesLabels));\n if (matched) groups.push({ ...matched, exemplars: group.exemplars });\n }\n }\n return groups;\n }, [preparedQueries, categoricalPalette, visual, muiTheme.palette.primary.main, formatToYAxisIndex]);\n\n // Populate series data based on query results\n const {\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap: computedSeriesFormatMap,\n maxValuesByFormat,\n } = useMemo(() => {\n if (timeScale === undefined) {\n return {\n timeChartData: [] as TimeSeries[],\n timeSeriesMapping: [] as TimeChartSeriesMapping,\n legendItems: [] as LegendItem[],\n seriesFormatMap: new Map(),\n maxValuesByFormat: new Map<string, number>(),\n };\n }\n\n const legendItems: LegendItem[] = [];\n\n // Utilizes ECharts dataset so raw data is separate from series option style properties\n // https://apache.github.io/echarts-handbook/en/concepts/dataset/\n const timeChartData: TimeSeries[] = [];\n const timeSeriesMapping: TimeChartSeriesMapping = [];\n\n // Track max values for each format unit (used for dynamic Y axis offset calculation)\n const maxValuesByFormat = new Map<string, number>();\n const seriesFormatMap = new Map<string, typeof format>();\n\n let visibleSeriesCount = 0;\n for (const { series } of preparedQueries) {\n for (const { seriesId } of series) {\n if (selectedLegendItems === 'ALL' || selectedLegendItems[seriesId]) visibleSeriesCount++;\n }\n }\n\n // Index is counted across multiple queries which ensures the categorical color palette does not reset for every query\n let seriesIndex = 0;\n\n // A query's band edges, drawn after every other series (see getBandSeries)\n const bands: Array<{\n id: string;\n color?: string;\n yAxisIndex: number;\n querySettings?: (typeof preparedQueries)[number]['querySettings'];\n edges: Partial<Record<BandEdge, TimeSeriesValueTuple[]>>;\n }> = [];\n\n for (const [queryIndex, { querySettings, series }] of preparedQueries.entries()) {\n const band: (typeof bands)[number] = {\n id: `${chartId}band${queryIndex}`,\n yAxisIndex: querySettings?.format?.unit ? (formatToYAxisIndex.get(querySettings.format.unit) ?? 0) : 0,\n querySettings,\n edges: {},\n };\n bands.push(band);\n for (const { timeSeries, seriesId, values, calculations, maxValue } of series) {\n const edge = timeSeries.labels?.[BAND_LABEL];\n if (edge === 'lo' || edge === 'hi') {\n band.edges[edge] = values;\n continue;\n }\n // Format is determined by seriesNameFormat in query spec\n const formattedSeriesName = timeSeries.formattedName ?? timeSeries.name;\n\n // Color is used for line, tooltip, and legend\n const seriesColor = getSeriesColor({\n // ECharts type for color is not always an array but it is always an array in ChartsProvider\n defaultCategoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName: formattedSeriesName,\n seriesIndex,\n querySettings: querySettings,\n queryHasMultipleResults: series.length > 1,\n });\n if (band.color === undefined) band.color = seriesColor;\n\n // When we initially load the chart, we want to show all series, but\n // DO NOT want to visualy highlight all the items in the legend.\n const isSelectAll = selectedLegendItems === 'ALL';\n const isSelected = !isSelectAll && !!selectedLegendItems[seriesId];\n const showTimeSeries = isSelected || isSelectAll;\n\n if (showTimeSeries) {\n // Use timeChartData.length to ensure the data that is passed into the tooltip accounts for\n // which legend items are selected. This must happen before timeChartData.push to avoid an\n // off-by-one error, seriesIndex cannot be used since it's needed to cycle through palette\n const datasetIndex = timeChartData.length;\n\n // Determine yAxisIndex based on the query's format setting\n const queryFormat = querySettings?.format;\n const yAxisIndex = queryFormat?.unit ? (formatToYAxisIndex.get(queryFormat.unit) ?? 0) : 0;\n\n // Each series is stored as a separate dataset source.\n // https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets\n timeSeriesMapping.push(\n getTimeSeries(\n seriesId,\n datasetIndex,\n formattedSeriesName,\n visual,\n timeScale,\n seriesColor,\n querySettings,\n yAxisIndex,\n visibleSeriesCount,\n ),\n );\n\n // Store the format for this series for tooltip formatting\n if (queryFormat) {\n seriesFormatMap.set(seriesId, queryFormat);\n\n // Track max value for this format unit (used for dynamic Y axis offset calculation)\n const unitKey = queryFormat.unit;\n if (unitKey) {\n const currentMax = maxValuesByFormat.get(unitKey) ?? 0;\n if (maxValue > currentMax) {\n maxValuesByFormat.set(unitKey, maxValue);\n }\n }\n }\n\n timeChartData.push({\n name: formattedSeriesName,\n values,\n });\n }\n\n if (legend && legendItems) {\n legendItems.push({\n id: seriesId, // Avoids duplicate key console errors when there are duplicate series names\n label: formattedSeriesName,\n color: seriesColor,\n data: calculations,\n });\n }\n\n // Used for repeating colors in Categorical palette\n seriesIndex += 1;\n }\n }\n\n // map thresholds only if there is at least one time series to avoid displaying thresholds without any data\n if (thresholds && thresholds.steps && timeChartData.length > 0) {\n // Convert how thresholds are defined in the panel spec to valid ECharts 'line' series.\n // These are styled with predefined colors and a dashed style to look different than series from query results.\n // Regular series are used instead of markLines since thresholds currently show in our React TimeSeriesTooltip.\n const thresholdsColors = chartsTheme.thresholds;\n const defaultThresholdColor = thresholds.defaultColor ?? thresholdsColors.defaultColor;\n thresholds.steps.forEach((step: StepOptions, index: number) => {\n const stepPaletteColor = thresholdsColors.palette[index] ?? defaultThresholdColor;\n const thresholdLineColor = step.color ?? stepPaletteColor;\n const stepOption: StepOptions = {\n color: thresholdLineColor,\n value:\n // yAxis is passed here since it corresponds to dashboard JSON instead of the already converted ECharts yAxis\n thresholds.mode === 'percent'\n ? convertPercentThreshold(step.value, timeChartData, yAxis?.max, yAxis?.min)\n : step.value,\n };\n const thresholdName = step.name ?? `Threshold ${index + 1}`;\n\n // Generates array of [time, step.value] where time ranges from timescale.startMs to timescale.endMs with an interval of 15s\n const thresholdTimeValueTuple: TimeSeriesValueTuple[] = [];\n let currentTimestamp = timeScale.startMs;\n while (currentTimestamp <= timeScale.endMs) {\n thresholdTimeValueTuple.push([currentTimestamp, stepOption.value]);\n // Used to plot fake thresholds datapoints so correct nearby threshold series shows in tooltip without flicker\n currentTimestamp += 1000 * THRESHOLD_PLOT_INTERVAL;\n }\n\n timeChartData.push({\n name: thresholdName,\n values: thresholdTimeValueTuple,\n });\n timeSeriesMapping.push(getThresholdSeries(thresholdName, stepOption, seriesIndex));\n seriesIndex += 1;\n });\n }\n\n for (const { id, color, yAxisIndex, querySettings, edges } of bands) {\n if (!edges.lo || !edges.hi) continue;\n timeSeriesMapping.push(\n ...getBandSeries(\n id,\n edges.lo,\n edges.hi,\n color ?? muiTheme.palette.primary.main,\n visual.bandOpacity ?? DEFAULT_BAND_OPACITY,\n yAxisIndex,\n querySettings?.lineInterpolation ?? visual.lineInterpolation,\n ),\n );\n }\n\n return {\n timeScale,\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap,\n maxValuesByFormat,\n };\n }, [\n preparedQueries,\n timeScale,\n thresholds,\n selectedLegendItems,\n legend,\n visual,\n yAxis?.max,\n yAxis?.min,\n categoricalPalette,\n chartsTheme.thresholds,\n muiTheme.palette.primary.main,\n formatToYAxisIndex,\n chartId,\n ]);\n\n // Create multiple Y axes if there are additional formats\n // Uses max values from data to compute dynamic offsets that adapt to label widths\n const multipleYAxes = useMemo(() => {\n if (additionalFormats.length === 0) {\n return undefined; // Use single Y axis (default behavior)\n }\n // Build array of max values for each additional format (in order)\n const maxValues = additionalFormats.map((fmt) => {\n const unitKey = fmt.unit;\n return unitKey ? (maxValuesByFormat?.get(unitKey) ?? 1000) : 1000;\n });\n return getFormattedMultipleYAxes(echartsYAxis, format, additionalFormats, maxValues);\n }, [echartsYAxis, format, additionalFormats, maxValuesByFormat]);\n\n // Translate the legend values into columns for the table legend.\n const legendColumns = useMemo(() => {\n if (!legend?.values) {\n return [];\n }\n\n // Iterating the predefined list of possible values to retain a specific\n // intended order of values.\n return legendValues.reduce(\n (columns, legendValue) => {\n const legendConfig = LEGEND_VALUE_CONFIG[legendValue];\n\n if (legendConfig && legend?.values?.includes(legendValue)) {\n columns.push({\n accessorKey: `data.${legendValue}`,\n header: legendConfig.label,\n headerDescription: legendConfig.description,\n // Intentionally hardcoding a column width to start based on discussions\n // with design around keeping this simple to start. This may need\n // revisiting in the future to handle edge cases with very large values.\n width: 72,\n align: 'right',\n cell: ({ getValue }) => {\n const cellValue = getValue();\n return typeof cellValue === 'number' && format ? formatValue(cellValue, format) : cellValue;\n },\n cellDescription: true,\n enableSorting: true,\n });\n }\n\n return columns;\n },\n [] as Array<TableColumnConfig<LegendItem>>,\n );\n }, [legend?.values, format]);\n\n const gridOverrides: GridComponentOption = useMemo(() => {\n // When Y axes are hidden, disable containLabel to prevent auto-spacing, but add bottom padding for X axis\n return echartsYAxis.show === false\n ? {\n left: 0,\n right: 0,\n bottom: 30,\n containLabel: false,\n }\n : {\n left: yAxis && yAxis.label ? 30 : 20,\n // With containLabel: true in theme, ECharts auto-reserves space for axis labels.\n // For multiple right axes, add extra padding for the last axis labels that extend beyond the grid.\n right: additionalFormats.length > 0 ? 10 : 20,\n bottom: 0,\n containLabel: true,\n };\n }, [echartsYAxis.show, yAxis, additionalFormats.length]);\n\n const handleDataZoom = useCallback(\n (event: ZoomEventData): void => {\n setTimeRange({ start: new Date(event.start), end: new Date(event.end) });\n },\n [setTimeRange],\n );\n\n if (adjustedContentDimensions === undefined) {\n return null;\n }\n\n // Used to opt in to ECharts trigger item which show subgroup data accurately.\n // Derived from the actual series mapping rather than `visual.stack` alone so that\n // bar charts stacked only via per-query overrides also use the right tooltip mode.\n const isStackedBar =\n visual.display === 'bar' && timeSeriesMapping.some((s) => s?.type === 'bar' && s.stack === 'all');\n\n // Turn on tooltip pinning by default but opt out for stacked bar or if explicitly set in tooltip panel spec\n let enablePinning = true;\n if (isStackedBar) {\n enablePinning = false;\n } else if (tooltip?.enablePinning !== undefined) {\n enablePinning = tooltip.enablePinning;\n }\n const tooltipConfig: TooltipConfig = {\n ...DEFAULT_TOOLTIP_CONFIG,\n enablePinning,\n };\n\n return (\n <Box sx={{ padding: `${contentPadding}px` }}>\n <ContentWithLegend\n width={adjustedContentDimensions.width}\n height={adjustedContentDimensions.height}\n // Making this small enough that the medium size doesn't get\n // responsive-handling-ed away when in the panel options editor.\n minChildrenHeight={50}\n legendSize={legend?.size}\n legendProps={\n legend && {\n options: legend,\n data: legendItems || [],\n selectedItems: selectedLegendItems,\n onSelectedItemsChange: setSelectedLegendItems,\n tableProps: {\n columns: legendColumns,\n sorting: legendSorting,\n onSortingChange: setLegendSorting,\n },\n onItemMouseOver: (e, { id }): void => {\n chartRef.current?.highlightSeries({ name: id });\n },\n onItemMouseOut: (): void => {\n chartRef.current?.clearHighlightedSeries();\n },\n }\n }\n >\n {({ height, width }) => {\n return (\n <Box style={{ height, width }}>\n {yAxis && yAxis.show && yAxis.label && <YAxisLabel name={yAxis.label} height={height} />}\n <TimeSeriesChartBase\n ref={chartRef}\n height={height}\n data={timeChartData}\n seriesMapping={timeSeriesMapping}\n exemplars={chartExemplars}\n annotations={annotations}\n timeScale={timeScale}\n yAxis={multipleYAxes ?? echartsYAxis}\n format={format}\n seriesFormatMap={computedSeriesFormatMap}\n grid={gridOverrides}\n isStackedBar={isStackedBar}\n tooltipConfig={tooltipConfig}\n syncGroup=\"default-panel-group\" // TODO: make configurable from dashboard settings and per panel-group overrides\n onDataZoom={handleDataZoom}\n // Show an empty chart when there is no data because the user unselected all items in\n // the legend. Otherwise, show a \"no data\" message.\n noDataVariant={!timeChartData.length && legendItems && legendItems.length > 0 ? 'chart' : 'message'}\n />\n </Box>\n );\n }}\n </ContentWithLegend>\n </Box>\n );\n}\n\n// PanelContent recreates the queryResults array and its wrappers on dashboard\n// hover/focus updates. Compare the underlying references in query order so those\n// updates do not invalidate data preparation or scan the samples and exemplars.\nexport const TimeSeriesChartPanel = memo(\n TimeSeriesChartPanelComponent,\n (previous, next): boolean =>\n previous.spec === next.spec &&\n previous.definition === next.definition &&\n previous.contentDimensions?.width === next.contentDimensions?.width &&\n previous.contentDimensions?.height === next.contentDimensions?.height &&\n previous.queryResults.length === next.queryResults.length &&\n previous.queryResults.every(\n (query, index) =>\n query.data === next.queryResults[index]?.data && query.definition === next.queryResults[index]?.definition,\n ),\n);\n"],"names":["Box","useTheme","YAxisLabel","useChartsTheme","ContentWithLegend","DEFAULT_TOOLTIP_CONFIG","getFormattedMultipleYAxes","DEFAULT_LEGEND","formatValue","usePanelAnnotationsWithData","LEGEND_VALUE_CONFIG","useTimeRange","validateLegendSpec","legendValues","getCalculations","merge","memo","useCallback","useId","useMemo","useRef","useState","BAND_LABEL","DEFAULT_BAND_OPACITY","DEFAULT_FORMAT","DEFAULT_VISUAL","THRESHOLD_PLOT_INTERVAL","TimeSeriesChartBase","convertAnnotationToTimeSeriesAnnotation","getBandSeries","getTimeSeries","getTimeSeriesValues","getCommonTimeScaleForQueries","convertPanelYAxis","getThresholdSeries","convertPercentThreshold","getSeriesColor","labelsKey","labels","JSON","stringify","Object","keys","toSorted","map","labelName","TimeSeriesChartPanelComponent","props","spec","thresholds","yAxis","tooltip","querySettings","querySettingsList","contentDimensions","queryResults","chartsTheme","muiTheme","chartId","chartRef","categoricalPalette","echartsTheme","color","contentPadding","container","padding","default","adjustedContentDimensions","width","height","undefined","legend","format","visual","echartsYAxis","additionalFormats","formatToYAxisIndex","baseUnit","unit","Map","set","qs","unitKey","has","length","push","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","setTimeRange","annotationsWithData","definition","annotations","calculationTypes","values","timeScale","preparedQueries","commonScale","settingsByQuery","settings","queryIndex","seriesIndex","queries","result","get","series","data","timeSeries","baseValues","negativeY","t","v","calculations","maxValue","value","Math","max","abs","seriesId","name","exemplars","chartExemplars","groups","seriesByLabels","seriesName","formattedName","defaultCategoricalPalette","muiPrimaryColor","palette","primary","main","queryHasMultipleResults","seriesLabels","yAxisIndex","group","matched","timeChartData","timeSeriesMapping","legendItems","seriesFormatMap","computedSeriesFormatMap","maxValuesByFormat","visibleSeriesCount","bands","entries","band","id","edges","edge","formattedSeriesName","seriesColor","isSelectAll","isSelected","showTimeSeries","datasetIndex","queryFormat","currentMax","label","steps","thresholdsColors","defaultThresholdColor","defaultColor","forEach","step","index","stepPaletteColor","thresholdLineColor","stepOption","mode","min","thresholdName","thresholdTimeValueTuple","currentTimestamp","startMs","endMs","lo","hi","bandOpacity","lineInterpolation","multipleYAxes","maxValues","fmt","legendColumns","reduce","columns","legendValue","legendConfig","includes","accessorKey","header","headerDescription","description","align","cell","getValue","cellValue","cellDescription","enableSorting","gridOverrides","show","left","right","bottom","containLabel","handleDataZoom","event","start","Date","end","isStackedBar","display","some","s","type","stack","enablePinning","tooltipConfig","sx","minChildrenHeight","legendSize","size","legendProps","options","selectedItems","onSelectedItemsChange","tableProps","sorting","onSortingChange","onItemMouseOver","e","current","highlightSeries","onItemMouseOut","clearHighlightedSeries","style","ref","seriesMapping","grid","syncGroup","onDataZoom","noDataVariant","TimeSeriesChartPanel","previous","next","every","query"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AAY9C,SACEC,UAAU,EACVC,cAAc,EACdC,iBAAiB,EACjBC,sBAAsB,EACtBC,yBAAyB,EACzBC,cAAc,EACdC,WAAW,QACN,yBAAyB;AAChC,SAASC,2BAA2B,QAAQ,yBAAyB;AAErE,SACEC,mBAAmB,EACnBC,YAAY,EACZC,kBAAkB,EAClBC,YAAY,EACZC,eAAe,QACV,4BAA4B;AAGnC,OAAOC,WAAW,eAAe;AAEjC,SAASC,IAAI,EAAEC,WAAW,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAG5E,SACEC,UAAU,EACVC,oBAAoB,EACpBC,cAAc,EACdC,cAAc,EACdC,uBAAuB,QAClB,+BAA4B;AACnC,SAASC,mBAAmB,QAAQ,2BAAwB;AAE5D,SAASC,uCAAuC,QAAQ,wBAAqB;AAE7E,SACEC,aAAa,EACbC,aAAa,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F,MAAM3I,IAAI,KAAKyI,KAAK7L,YAAY,CAAC8G,MAAM,EAAE1D,QAAQ2I,MAAM1J,UAAU,KAAKwJ,KAAK7L,YAAY,CAAC8G,MAAM,EAAEzE,aAEtG"}
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesChartPanel.tsx"],"sourcesContent":["// Copyright 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 { Box, useTheme } from '@mui/material';\nimport type {\n ChartInstance,\n ZoomEventData,\n SelectedLegendItemState,\n TableColumnConfig,\n LegendItem,\n LegendProps,\n TooltipConfig,\n TimeChartSeriesMapping,\n StepOptions,\n} from '@perses-dev/components';\nimport {\n YAxisLabel,\n useChartsTheme,\n ContentWithLegend,\n DEFAULT_TOOLTIP_CONFIG,\n getFormattedMultipleYAxes,\n DEFAULT_LEGEND,\n formatValue,\n} from '@perses-dev/components';\nimport { usePanelAnnotationsWithData } from '@perses-dev/dashboards';\nimport type { PanelProps, CalculationType } from '@perses-dev/plugin-system';\nimport {\n LEGEND_VALUE_CONFIG,\n useTimeRange,\n validateLegendSpec,\n legendValues,\n getCalculations,\n} from '@perses-dev/plugin-system';\nimport type { Labels, TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport type { GridComponentOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\nimport { memo, useCallback, useId, useMemo, useRef, useState } from 'react';\n\nimport type { BandEdge, TimeSeriesChartOptions } from './time-series-chart-model';\nimport {\n BAND_LABEL,\n DEFAULT_BAND_OPACITY,\n DEFAULT_FORMAT,\n DEFAULT_VISUAL,\n THRESHOLD_PLOT_INTERVAL,\n} from './time-series-chart-model';\nimport { TimeSeriesChartBase } from './TimeSeriesChartBase';\nimport type { TimeSeriesAnnotation } from './utils/annotation';\nimport { convertAnnotationToTimeSeriesAnnotation } from './utils/annotation';\nimport type { ExemplarChartData } from './utils/data-transform';\nimport {\n getBandSeries,\n getTimeSeries,\n getTimeSeriesValues,\n getCommonTimeScaleForQueries,\n convertPanelYAxis,\n getThresholdSeries,\n convertPercentThreshold,\n} from './utils/data-transform';\nimport { getSeriesColor } from './utils/palette-gen';\n\nexport type TimeSeriesChartProps = PanelProps<TimeSeriesChartOptions, TimeSeriesData>;\n\n/**\n * Stable string key for a labels record, so exemplars can be matched to their\n * series regardless of the labels order.\n */\nfunction labelsKey(labels: Labels): string {\n return JSON.stringify(\n Object.keys(labels)\n .toSorted()\n .map((labelName) => [labelName, labels[labelName]]),\n );\n}\n\n// Using an \"ALL\" value to handle the case on first loading the chart where we\n// want to select all, but do not want all of the legend items to be visually highlighted.\n// This helps us differentiate those cases more clearly instead of inferring it\n// based on the state of the data. This also helps us avoid some coding\n// complexity around initializing a full record for the initial load that would\n// currently require significantly more refactoring of this component.\n// TODO: simplify this if we switch the list-based legend UI to use checkboxes,\n// where we *would* want to visually select all items in this case.\n\nfunction TimeSeriesChartPanelComponent(props: TimeSeriesChartProps): ReactElement | null {\n const {\n spec: { thresholds, yAxis, tooltip, querySettings: querySettingsList },\n contentDimensions,\n queryResults,\n } = props;\n const chartsTheme = useChartsTheme();\n const muiTheme = useTheme();\n const chartId = useId();\n\n const chartRef = useRef<ChartInstance>(null);\n\n // ECharts theme comes from ChartsProvider, more info: https://echarts.apache.org/en/option.html#color\n // Colors are manually applied since our legend and tooltip are built custom with React.\n const categoricalPalette = chartsTheme.echartsTheme.color;\n\n // TODO: consider refactoring how the layout/spacing/alignment are calculated\n // the next time significant changes are made to the time series panel (e.g.\n // when making improvements to the legend to more closely match designs).\n // This may also want to include moving some of this logic down to the shared,\n // embeddable components.\n const contentPadding = chartsTheme.container.padding.default;\n const adjustedContentDimensions: typeof contentDimensions = contentDimensions\n ? {\n width: contentDimensions.width - contentPadding * 2,\n height: contentDimensions.height - contentPadding * 2,\n }\n : undefined;\n\n // populate default 'position' and other future properties\n const legend = useMemo(() => {\n return props.spec.legend && validateLegendSpec(props.spec.legend)\n ? merge({}, DEFAULT_LEGEND, props.spec.legend)\n : undefined;\n }, [props.spec.legend]);\n\n // TODO: add support for y_axis_alt.format\n const format = props.spec.yAxis?.format ?? DEFAULT_FORMAT;\n\n // ensures there are fallbacks for unset properties since most\n // users should not need to customize visual display\n const visual = useMemo(() => {\n return merge({}, DEFAULT_VISUAL, props.spec.visual);\n }, [props.spec.visual]);\n\n // convert Perses dashboard format to be ECharts compatible\n const echartsYAxis = useMemo(() => {\n return convertPanelYAxis(yAxis);\n }, [yAxis]);\n\n // Collect unique formats from query settings that differ from the base format\n // These will create additional Y axes on the right side\n const { additionalFormats, hiddenAxes, axisIndexOf } = useMemo(() => {\n const baseUnit = format?.unit ?? 'decimal';\n const additionalFormats: Array<typeof format> = [];\n const formatToYAxisIndex = new Map<string, number>();\n const hiddenAxes = new Set<number>();\n\n // A query's axis: the base one, unless its unit differs or it asks for its own (right, or hidden).\n const keyOf = (qs?: { format?: typeof format; axis?: 'right' | 'hidden' }): string => {\n const unit = qs?.format?.unit ?? baseUnit;\n return unit === baseUnit && !qs?.axis ? baseUnit : `${unit}|${qs?.axis ?? ''}`;\n };\n\n // Index 0 is reserved for the base Y axis\n formatToYAxisIndex.set(baseUnit, 0);\n\n // Collect the axes the query settings ask for: those drawn first, so their offsets on the right are as Perses\n // works them out, and the hidden ones after them.\n const asked = (querySettingsList ?? []).filter((qs) => !formatToYAxisIndex.has(keyOf(qs)));\n for (const qs of [...asked.filter((q) => q.axis !== 'hidden'), ...asked.filter((q) => q.axis === 'hidden')]) {\n const key = keyOf(qs);\n if (!formatToYAxisIndex.has(key)) {\n // Add new format - index is 1 + position in additionalFormats array\n formatToYAxisIndex.set(key, 1 + additionalFormats.length);\n additionalFormats.push(qs.format ?? format);\n if (qs.axis === 'hidden') hiddenAxes.add(additionalFormats.length);\n }\n }\n\n const axisIndexOf = (qs?: { format?: typeof format; axis?: 'right' | 'hidden' }): number =>\n formatToYAxisIndex.get(keyOf(qs)) ?? 0;\n return { additionalFormats, hiddenAxes, axisIndexOf };\n }, [format, querySettingsList]);\n\n const [selectedLegendItems, setSelectedLegendItems] = useState<SelectedLegendItemState>('ALL');\n const [legendSorting, setLegendSorting] = useState<NonNullable<LegendProps['tableProps']>['sorting']>();\n\n const { setTimeRange } = useTimeRange();\n\n const annotationsWithData = usePanelAnnotationsWithData(props.definition?.spec.annotations);\n\n const annotations: TimeSeriesAnnotation[] = useMemo(\n () => convertAnnotationToTimeSeriesAnnotation(annotationsWithData),\n [annotationsWithData],\n );\n\n const calculationTypes = legend?.values;\n\n // Point processing and legend statistics depend on query data, not legend selection.\n // Reuse these arrays when toggling series instead of rescanning every sample.\n const { timeScale, preparedQueries } = useMemo(() => {\n const commonScale = getCommonTimeScaleForQueries(queryResults);\n const settingsByQuery = new Map(querySettingsList?.map((settings) => [settings.queryIndex, settings]));\n let seriesIndex = 0;\n const queries = commonScale\n ? queryResults.map((result, queryIndex) => {\n const querySettings = settingsByQuery.get(queryIndex);\n const series = result.data.series.map((timeSeries) => {\n const baseValues = getTimeSeriesValues(timeSeries, commonScale);\n const values = querySettings?.negativeY\n ? baseValues.map(([t, v]): TimeSeriesValueTuple => [t, v === null ? null : -v])\n : baseValues;\n const calculations = calculationTypes\n ? getCalculations(timeSeries.values, calculationTypes as CalculationType[])\n : undefined;\n let maxValue = 0;\n if (querySettings?.format?.unit) {\n for (const [, value] of timeSeries.values) {\n maxValue = Math.max(maxValue, Math.abs(value ?? 0));\n }\n }\n const seriesId = `${chartId}${timeSeries.name}${seriesIndex}`;\n seriesIndex += 1;\n return { timeSeries, seriesId, values, calculations, maxValue };\n });\n return { querySettings, series, exemplars: result.data.exemplars };\n })\n : [];\n return { timeScale: commonScale, preparedQueries: queries };\n }, [queryResults, querySettingsList, calculationTypes, chartId]);\n\n // Prepare all exemplar groups independently of legend selection. The base chart\n // filters their scatter series without rebuilding marker data for visible groups.\n const chartExemplars = useMemo(() => {\n const groups: ExemplarChartData[] = [];\n let seriesIndex = 0;\n for (const { querySettings, series, exemplars } of preparedQueries) {\n // Labels identify a series within a query, not across different queries.\n const seriesByLabels = new Map<string, ExemplarChartData>();\n for (const { timeSeries, seriesId } of series) {\n const seriesName = timeSeries.formattedName ?? timeSeries.name;\n if (exemplars?.length && timeSeries.labels) {\n seriesByLabels.set(labelsKey(timeSeries.labels), {\n seriesId,\n seriesName,\n color: getSeriesColor({\n defaultCategoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName,\n seriesIndex,\n querySettings,\n queryHasMultipleResults: series.length > 1,\n }),\n seriesLabels: timeSeries.labels,\n yAxisIndex: axisIndexOf(querySettings),\n negativeY: querySettings?.negativeY,\n exemplars: [],\n });\n }\n seriesIndex += 1;\n }\n for (const group of exemplars ?? []) {\n if (group.exemplars.length === 0) continue;\n const matched = seriesByLabels.get(labelsKey(group.seriesLabels));\n if (matched) groups.push({ ...matched, exemplars: group.exemplars });\n }\n }\n return groups;\n }, [preparedQueries, categoricalPalette, visual, muiTheme.palette.primary.main, axisIndexOf]);\n\n // Populate series data based on query results\n const {\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap: computedSeriesFormatMap,\n maxValuesByFormat,\n } = useMemo(() => {\n if (timeScale === undefined) {\n return {\n timeChartData: [] as TimeSeries[],\n timeSeriesMapping: [] as TimeChartSeriesMapping,\n legendItems: [] as LegendItem[],\n seriesFormatMap: new Map(),\n maxValuesByFormat: new Map<string, number>(),\n };\n }\n\n const legendItems: LegendItem[] = [];\n\n // Utilizes ECharts dataset so raw data is separate from series option style properties\n // https://apache.github.io/echarts-handbook/en/concepts/dataset/\n const timeChartData: TimeSeries[] = [];\n const timeSeriesMapping: TimeChartSeriesMapping = [];\n\n // Track max values for each format unit (used for dynamic Y axis offset calculation)\n const maxValuesByFormat = new Map<string, number>();\n const seriesFormatMap = new Map<string, typeof format>();\n\n let visibleSeriesCount = 0;\n for (const { series } of preparedQueries) {\n for (const { seriesId } of series) {\n if (selectedLegendItems === 'ALL' || selectedLegendItems[seriesId]) visibleSeriesCount++;\n }\n }\n\n // Index is counted across multiple queries which ensures the categorical color palette does not reset for every query\n let seriesIndex = 0;\n\n // A query's band edges, drawn after every other series (see getBandSeries)\n const bands: Array<{\n id: string;\n color?: string;\n yAxisIndex: number;\n querySettings?: (typeof preparedQueries)[number]['querySettings'];\n edges: Partial<Record<BandEdge, TimeSeriesValueTuple[]>>;\n }> = [];\n\n for (const [queryIndex, { querySettings, series }] of preparedQueries.entries()) {\n const band: (typeof bands)[number] = {\n id: `${chartId}band${queryIndex}`,\n yAxisIndex: axisIndexOf(querySettings),\n querySettings,\n edges: {},\n };\n bands.push(band);\n for (const { timeSeries, seriesId, values, calculations, maxValue } of series) {\n const edge = timeSeries.labels?.[BAND_LABEL];\n if (edge === 'lo' || edge === 'hi') {\n band.edges[edge] = values;\n continue;\n }\n // Format is determined by seriesNameFormat in query spec\n const formattedSeriesName = timeSeries.formattedName ?? timeSeries.name;\n\n // Color is used for line, tooltip, and legend\n const seriesColor = getSeriesColor({\n // ECharts type for color is not always an array but it is always an array in ChartsProvider\n defaultCategoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName: formattedSeriesName,\n seriesIndex,\n querySettings: querySettings,\n queryHasMultipleResults: series.length > 1,\n });\n if (band.color === undefined) band.color = seriesColor;\n\n // When we initially load the chart, we want to show all series, but\n // DO NOT want to visualy highlight all the items in the legend.\n const isSelectAll = selectedLegendItems === 'ALL';\n const isSelected = !isSelectAll && !!selectedLegendItems[seriesId];\n const showTimeSeries = isSelected || isSelectAll;\n\n if (showTimeSeries) {\n // Use timeChartData.length to ensure the data that is passed into the tooltip accounts for\n // which legend items are selected. This must happen before timeChartData.push to avoid an\n // off-by-one error, seriesIndex cannot be used since it's needed to cycle through palette\n const datasetIndex = timeChartData.length;\n\n // Determine yAxisIndex based on the query's format setting\n const queryFormat = querySettings?.format;\n const yAxisIndex = axisIndexOf(querySettings);\n\n // Each series is stored as a separate dataset source.\n // https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets\n timeSeriesMapping.push(\n getTimeSeries(\n seriesId,\n datasetIndex,\n formattedSeriesName,\n // A query may be bars under a panel of lines, or a line over its bars.\n querySettings?.display ? { ...visual, display: querySettings.display } : visual,\n timeScale,\n seriesColor,\n querySettings,\n yAxisIndex,\n visibleSeriesCount,\n ),\n );\n\n // Store the format for this series for tooltip formatting\n if (queryFormat) {\n seriesFormatMap.set(seriesId, queryFormat);\n\n // Track max value for this format unit (used for dynamic Y axis offset calculation)\n const unitKey = queryFormat.unit;\n if (unitKey) {\n const currentMax = maxValuesByFormat.get(unitKey) ?? 0;\n if (maxValue > currentMax) {\n maxValuesByFormat.set(unitKey, maxValue);\n }\n }\n }\n\n timeChartData.push({\n name: formattedSeriesName,\n values,\n });\n }\n\n if (legend && legendItems) {\n legendItems.push({\n id: seriesId, // Avoids duplicate key console errors when there are duplicate series names\n label: formattedSeriesName,\n color: seriesColor,\n data: calculations,\n });\n }\n\n // Used for repeating colors in Categorical palette\n seriesIndex += 1;\n }\n }\n\n // map thresholds only if there is at least one time series to avoid displaying thresholds without any data\n if (thresholds && thresholds.steps && timeChartData.length > 0) {\n // Convert how thresholds are defined in the panel spec to valid ECharts 'line' series.\n // These are styled with predefined colors and a dashed style to look different than series from query results.\n // Regular series are used instead of markLines since thresholds currently show in our React TimeSeriesTooltip.\n const thresholdsColors = chartsTheme.thresholds;\n const defaultThresholdColor = thresholds.defaultColor ?? thresholdsColors.defaultColor;\n thresholds.steps.forEach((step: StepOptions, index: number) => {\n const stepPaletteColor = thresholdsColors.palette[index] ?? defaultThresholdColor;\n const thresholdLineColor = step.color ?? stepPaletteColor;\n const stepOption: StepOptions = {\n color: thresholdLineColor,\n value:\n // yAxis is passed here since it corresponds to dashboard JSON instead of the already converted ECharts yAxis\n thresholds.mode === 'percent'\n ? convertPercentThreshold(step.value, timeChartData, yAxis?.max, yAxis?.min)\n : step.value,\n };\n const thresholdName = step.name ?? `Threshold ${index + 1}`;\n\n // Generates array of [time, step.value] where time ranges from timescale.startMs to timescale.endMs with an interval of 15s\n const thresholdTimeValueTuple: TimeSeriesValueTuple[] = [];\n let currentTimestamp = timeScale.startMs;\n while (currentTimestamp <= timeScale.endMs) {\n thresholdTimeValueTuple.push([currentTimestamp, stepOption.value]);\n // Used to plot fake thresholds datapoints so correct nearby threshold series shows in tooltip without flicker\n currentTimestamp += 1000 * THRESHOLD_PLOT_INTERVAL;\n }\n\n timeChartData.push({\n name: thresholdName,\n values: thresholdTimeValueTuple,\n });\n timeSeriesMapping.push(getThresholdSeries(thresholdName, stepOption, seriesIndex));\n seriesIndex += 1;\n });\n }\n\n for (const { id, color, yAxisIndex, querySettings, edges } of bands) {\n if (!edges.lo || !edges.hi) continue;\n timeSeriesMapping.push(\n ...getBandSeries(\n id,\n edges.lo,\n edges.hi,\n color ?? muiTheme.palette.primary.main,\n visual.bandOpacity ?? DEFAULT_BAND_OPACITY,\n yAxisIndex,\n querySettings?.lineInterpolation ?? visual.lineInterpolation,\n ),\n );\n }\n\n return {\n timeScale,\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap,\n maxValuesByFormat,\n };\n }, [\n preparedQueries,\n timeScale,\n thresholds,\n selectedLegendItems,\n legend,\n visual,\n yAxis?.max,\n yAxis?.min,\n categoricalPalette,\n chartsTheme.thresholds,\n muiTheme.palette.primary.main,\n axisIndexOf,\n chartId,\n ]);\n\n // Create multiple Y axes if there are additional formats\n // Uses max values from data to compute dynamic offsets that adapt to label widths\n const multipleYAxes = useMemo(() => {\n if (additionalFormats.length === 0) {\n return undefined; // Use single Y axis (default behavior)\n }\n // Build array of max values for each additional format (in order)\n const maxValues = additionalFormats.map((fmt) => {\n const unitKey = fmt.unit;\n return unitKey ? (maxValuesByFormat?.get(unitKey) ?? 1000) : 1000;\n });\n const axes = getFormattedMultipleYAxes(echartsYAxis, format, additionalFormats, maxValues);\n // An axis asked hidden keeps its scale and draws nothing; it comes after every drawn one, so none moves for it.\n return axes.map((axis, index) => (hiddenAxes.has(index) ? { ...axis, show: false } : axis));\n }, [echartsYAxis, format, additionalFormats, maxValuesByFormat, hiddenAxes]);\n\n // Translate the legend values into columns for the table legend.\n const legendColumns = useMemo(() => {\n if (!legend?.values) {\n return [];\n }\n\n // Iterating the predefined list of possible values to retain a specific\n // intended order of values.\n return legendValues.reduce(\n (columns, legendValue) => {\n const legendConfig = LEGEND_VALUE_CONFIG[legendValue];\n\n if (legendConfig && legend?.values?.includes(legendValue)) {\n columns.push({\n accessorKey: `data.${legendValue}`,\n header: legendConfig.label,\n headerDescription: legendConfig.description,\n // Intentionally hardcoding a column width to start based on discussions\n // with design around keeping this simple to start. This may need\n // revisiting in the future to handle edge cases with very large values.\n width: 72,\n align: 'right',\n cell: ({ getValue }) => {\n const cellValue = getValue();\n return typeof cellValue === 'number' && format ? formatValue(cellValue, format) : cellValue;\n },\n cellDescription: true,\n enableSorting: true,\n });\n }\n\n return columns;\n },\n [] as Array<TableColumnConfig<LegendItem>>,\n );\n }, [legend?.values, format]);\n\n const gridOverrides: GridComponentOption = useMemo(() => {\n // When Y axes are hidden, disable containLabel to prevent auto-spacing, but add bottom padding for X axis\n return echartsYAxis.show === false\n ? {\n left: 0,\n right: 0,\n bottom: 30,\n containLabel: false,\n }\n : {\n left: yAxis && yAxis.label ? 30 : 20,\n // With containLabel: true in theme, ECharts auto-reserves space for axis labels.\n // For multiple right axes, add extra padding for the last axis labels that extend beyond the grid.\n right: additionalFormats.length > 0 ? 10 : 20,\n bottom: 0,\n containLabel: true,\n };\n }, [echartsYAxis.show, yAxis, additionalFormats.length]);\n\n const handleDataZoom = useCallback(\n (event: ZoomEventData): void => {\n setTimeRange({ start: new Date(event.start), end: new Date(event.end) });\n },\n [setTimeRange],\n );\n\n if (adjustedContentDimensions === undefined) {\n return null;\n }\n\n // Used to opt in to ECharts trigger item which show subgroup data accurately.\n // Derived from the actual series mapping rather than `visual.stack` alone so that\n // bar charts stacked only via per-query overrides also use the right tooltip mode.\n const isStackedBar =\n visual.display === 'bar' && timeSeriesMapping.some((s) => s?.type === 'bar' && s.stack === 'all');\n\n // Turn on tooltip pinning by default but opt out for stacked bar or if explicitly set in tooltip panel spec\n let enablePinning = true;\n if (isStackedBar) {\n enablePinning = false;\n } else if (tooltip?.enablePinning !== undefined) {\n enablePinning = tooltip.enablePinning;\n }\n const tooltipConfig: TooltipConfig = {\n ...DEFAULT_TOOLTIP_CONFIG,\n enablePinning,\n };\n\n return (\n <Box sx={{ padding: `${contentPadding}px` }}>\n <ContentWithLegend\n width={adjustedContentDimensions.width}\n height={adjustedContentDimensions.height}\n // Making this small enough that the medium size doesn't get\n // responsive-handling-ed away when in the panel options editor.\n minChildrenHeight={50}\n legendSize={legend?.size}\n legendProps={\n legend && {\n options: legend,\n data: legendItems || [],\n selectedItems: selectedLegendItems,\n onSelectedItemsChange: setSelectedLegendItems,\n tableProps: {\n columns: legendColumns,\n sorting: legendSorting,\n onSortingChange: setLegendSorting,\n },\n onItemMouseOver: (e, { id }): void => {\n chartRef.current?.highlightSeries({ name: id });\n },\n onItemMouseOut: (): void => {\n chartRef.current?.clearHighlightedSeries();\n },\n }\n }\n >\n {({ height, width }) => {\n return (\n <Box style={{ height, width }}>\n {yAxis && yAxis.show && yAxis.label && <YAxisLabel name={yAxis.label} height={height} />}\n <TimeSeriesChartBase\n ref={chartRef}\n height={height}\n data={timeChartData}\n seriesMapping={timeSeriesMapping}\n exemplars={chartExemplars}\n annotations={annotations}\n timeScale={timeScale}\n yAxis={multipleYAxes ?? echartsYAxis}\n format={format}\n seriesFormatMap={computedSeriesFormatMap}\n grid={gridOverrides}\n isStackedBar={isStackedBar}\n tooltipConfig={tooltipConfig}\n syncGroup=\"default-panel-group\" // TODO: make configurable from dashboard settings and per panel-group overrides\n onDataZoom={handleDataZoom}\n // Show an empty chart when there is no data because the user unselected all items in\n // the legend. Otherwise, show a \"no data\" message.\n noDataVariant={!timeChartData.length && legendItems && legendItems.length > 0 ? 'chart' : 'message'}\n />\n </Box>\n );\n }}\n </ContentWithLegend>\n </Box>\n );\n}\n\n// PanelContent recreates the queryResults array and its wrappers on dashboard\n// hover/focus updates. Compare the underlying references in query order so those\n// updates do not invalidate data preparation or scan the samples and exemplars.\nexport const TimeSeriesChartPanel = memo(\n TimeSeriesChartPanelComponent,\n (previous, next): boolean =>\n previous.spec === next.spec &&\n previous.definition === next.definition &&\n previous.contentDimensions?.width === next.contentDimensions?.width &&\n previous.contentDimensions?.height === next.contentDimensions?.height &&\n previous.queryResults.length === next.queryResults.length &&\n previous.queryResults.every(\n (query, index) =>\n query.data === next.queryResults[index]?.data && query.definition === next.queryResults[index]?.definition,\n ),\n);\n"],"names":["Box","useTheme","YAxisLabel","useChartsTheme","ContentWithLegend","DEFAULT_TOOLTIP_CONFIG","getFormattedMultipleYAxes","DEFAULT_LEGEND","formatValue","usePanelAnnotationsWithData","LEGEND_VALUE_CONFIG","useTimeRange","validateLegendSpec","legendValues","getCalculations","merge","memo","useCallback","useId","useMemo","useRef","useState","BAND_LABEL","DEFAULT_BAND_OPACITY","DEFAULT_FORMAT","DEFAULT_VISUAL","THRESHOLD_PLOT_INTERVAL","TimeSeriesChartBase","convertAnnotationToTimeSeriesAnnotation","getBandSeries","getTimeSeries","getTimeSeriesValues","getCommonTimeScaleForQueries","convertPanelYAxis","getThresholdSeries","convertPercentThreshold","getSeriesColor","labelsKey","labels","JSON","stringify","Object","keys","toSorted","map","labelName","TimeSeriesChartPanelComponent","props","spec","thresholds","yAxis","tooltip","querySettings","querySettingsList","contentDimensions","queryResults","chartsTheme","muiTheme","chartId","chartRef","categoricalPalette","echartsTheme","color","contentPadding","container","padding","default","adjustedContentDimensions","width","height","undefined","legend","format","visual","echartsYAxis","additionalFormats","hiddenAxes","axisIndexOf","baseUnit","unit","formatToYAxisIndex","Map","Set","keyOf","qs","axis","set","asked","filter","has","q","key","length","push","add","get","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","setTimeRange","annotationsWithData","definition","annotations","calculationTypes","values","timeScale","preparedQueries","commonScale","settingsByQuery","settings","queryIndex","seriesIndex","queries","result","series","data","timeSeries","baseValues","negativeY","t","v","calculations","maxValue","value","Math","max","abs","seriesId","name","exemplars","chartExemplars","groups","seriesByLabels","seriesName","formattedName","defaultCategoricalPalette","muiPrimaryColor","palette","primary","main","queryHasMultipleResults","seriesLabels","yAxisIndex","group","matched","timeChartData","timeSeriesMapping","legendItems","seriesFormatMap","computedSeriesFormatMap","maxValuesByFormat","visibleSeriesCount","bands","entries","band","id","edges","edge","formattedSeriesName","seriesColor","isSelectAll","isSelected","showTimeSeries","datasetIndex","queryFormat","display","unitKey","currentMax","label","steps","thresholdsColors","defaultThresholdColor","defaultColor","forEach","step","index","stepPaletteColor","thresholdLineColor","stepOption","mode","min","thresholdName","thresholdTimeValueTuple","currentTimestamp","startMs","endMs","lo","hi","bandOpacity","lineInterpolation","multipleYAxes","maxValues","fmt","axes","show","legendColumns","reduce","columns","legendValue","legendConfig","includes","accessorKey","header","headerDescription","description","align","cell","getValue","cellValue","cellDescription","enableSorting","gridOverrides","left","right","bottom","containLabel","handleDataZoom","event","start","Date","end","isStackedBar","some","s","type","stack","enablePinning","tooltipConfig","sx","minChildrenHeight","legendSize","size","legendProps","options","selectedItems","onSelectedItemsChange","tableProps","sorting","onSortingChange","onItemMouseOver","e","current","highlightSeries","onItemMouseOut","clearHighlightedSeries","style","ref","seriesMapping","grid","syncGroup","onDataZoom","noDataVariant","TimeSeriesChartPanel","previous","next","every","query"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C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YAAY,CAACqC,MAAM,IACzDkK,SAASvM,YAAY,CAACyM,KAAK,CACzB,CAACC,OAAOjF,QACNiF,MAAM7I,IAAI,KAAK2I,KAAKxM,YAAY,CAACyH,MAAM,EAAE5D,QAAQ6I,MAAM3J,UAAU,KAAKyJ,KAAKxM,YAAY,CAACyH,MAAM,EAAE1E,aAEtG"}
|
|
@@ -39,6 +39,13 @@ export interface QuerySettingsOptions {
|
|
|
39
39
|
*/
|
|
40
40
|
negativeY?: boolean;
|
|
41
41
|
stack?: boolean;
|
|
42
|
+
/** The query drawn as bars or as a line, whatever the panel's `visual.display`: bars with a line over them. */
|
|
43
|
+
display?: 'line' | 'bar';
|
|
44
|
+
/**
|
|
45
|
+
* The query's own y axis even where its unit is the panel's: `right`, on the right with its own scale; `hidden`,
|
|
46
|
+
* its own scale with no axis drawn (a line read against nothing but its shape and tooltip).
|
|
47
|
+
*/
|
|
48
|
+
axis?: 'right' | 'hidden';
|
|
42
49
|
}
|
|
43
50
|
export type TimeSeriesChartOptionsEditorProps = OptionsEditorProps<TimeSeriesChartOptions>;
|
|
44
51
|
export interface TimeSeriesChartYAxisOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-series-chart-model.d.ts","sourceRoot":"","sources":["../../src/time-series-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE1D,wGAAwG;AACxG,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,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,MAAM,YAAY;IACvB,IAAI;QAAI,KAAK;;IACb,GAAG;QAAI,KAAK;;CAGb,CAAC;AAEF,eAAO,MAAM,aAAa;;QAEZ,YAAY;;;QAAZ,YAAY;IAGxB,CAAC;AAEH,eAAO,MAAM,iBAAiB;IAC5B,KAAK;QAAI,KAAK;;IACd,MAAM;QAAI,KAAK;;IACf,MAAM;QAAI,KAAK;;CAChB,CAAC;AAEF,eAAO,MAAM,yBAAyB;IACpC,MAAM;QAAI,KAAK;;IACf,MAAM;QAAI,KAAK;;IACf,UAAU;QAAI,KAAK;;IACnB,SAAS;QAAI,KAAK;;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc;IACzB,KAAK;IACL,MAAM;IACN,GAAG;IACH,GAAG;IACH,IAAI;CACL,CAAC;AAGF,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC;AAG1C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,CAI5E,CAAC;AAGF,eAAO,MAAM,gBAAgB;WAPyB,MAAM;SAAO,QAAQ;QAQ/D,MAAM;GAEf,CAAC;AAKJ,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,sBAAsB,CAE5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/time-series-chart-model.ts"],"sourcesContent":["// Copyright 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 type { FormatOptions, ThresholdOptions } from '@perses-dev/components';\nimport type { LegendSpecOptions, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\nimport { schemeCategory10, schemeDark2, schemeSet1, schemeSet2, schemeSet3, schemeTableau10 } from 'd3-scale-chromatic';\n\n/**\n * Line style options for time series charts.\n */\nexport type LineStyleType = 'solid' | 'dashed' | 'dotted';\n\n/** How a line joins its points. The step names are Grafana's: stepBefore rises at the earlier point. */\nexport type LineInterpolation = 'linear' | 'smooth' | 'stepBefore' | 'stepAfter';\n\n/**\n * The schema for a TimeSeriesChart panel.\n */\nexport interface TimeSeriesChartDefinition extends Definition<TimeSeriesChartOptions> {\n kind: 'PulzrTimeSeriesChart';\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 lineInterpolation?: LineInterpolation;\n areaOpacity?: number;\n format?: FormatOptions;\n /**\n * If true, the query's series values are negated for display so they render\n * below the X axis. The original (positive) values are preserved for legend\n * calculations and CSV export, matching Grafana's `transform: \"negative-Y\"` behavior.\n */\n negativeY?: boolean;\n stack?: boolean;\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 logBase?: LOG_BASE;\n}\n\nexport interface TooltipSpecOptions {\n enablePinning: boolean;\n}\n\nexport type TimeSeriesChartPaletteMode = 'auto' | 'categorical';\n\nexport const CATEGORICAL_PALETTE_SCHEMES = {\n category10: schemeCategory10,\n tableau10: schemeTableau10,\n set1: schemeSet1,\n set2: schemeSet2,\n set3: schemeSet3,\n dark2: schemeDark2,\n} as const;\n\nexport type CategoricalPaletteName = keyof typeof CATEGORICAL_PALETTE_SCHEMES;\n\nexport const CATEGORICAL_PALETTE_NAMES = Object.keys(CATEGORICAL_PALETTE_SCHEMES) as CategoricalPaletteName[];\n\nexport interface CategoricalSchemeMetadata {\n label: string;\n}\n\nexport const CATEGORICAL_SCHEME_METADATA: Record<CategoricalPaletteName, CategoricalSchemeMetadata> = {\n category10: { label: 'D3 Category 10' },\n tableau10: { label: 'Tableau 10' },\n set1: { label: 'ColorBrewer Set 1' },\n set2: { label: 'ColorBrewer Set 2' },\n set3: { label: 'ColorBrewer Set 3' },\n dark2: { label: 'ColorBrewer Dark 2' },\n};\n\nexport type TimeSeriesChartPaletteOptions =\n | { mode: 'auto' }\n | {\n mode: 'categorical';\n // Omitting falls back to the ECharts theme palette.\n name?: CategoricalPaletteName;\n };\n\nexport const PALETTE_DROPDOWN_TOOLTIP =\n 'Auto derives a unique color from the series name — same name always maps to the same color across panels. ' +\n 'Categorical palettes assign colors from a fixed set by series order.';\n\nexport type TimeSeriesChartVisualOptions = {\n display?: 'line' | 'bar';\n lineWidth?: number;\n lineStyle?: LineStyleType;\n lineInterpolation?: LineInterpolation;\n areaOpacity?: number;\n /** Fill of a band: a query's series labelled band=lo and band=hi. */\n bandOpacity?: number;\n showPoints?: 'auto' | 'always';\n palette?: TimeSeriesChartPaletteOptions;\n pointRadius?: number;\n stack?: StackOptions;\n connectNulls?: boolean;\n /** Bars at most this wide, in px: for a few days' bars not to fill the width. */\n maxBarWidth?: number;\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 logBase: 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 logBase: { label: 'Log Base' },\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;\nexport const DEFAULT_BAND_OPACITY = 0.15;\n\n/** The label, and its two values, that mark a series as a band edge. */\nexport const BAND_LABEL = 'band';\nexport type BandEdge = 'lo' | 'hi';\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 lineInterpolation: {\n label: 'Line Interpolation',\n },\n bandOpacity: {\n label: 'Band Opacity',\n testId: 'slider-band-opacity',\n min: 0,\n max: 1,\n step: 0.05,\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 colorPalette: {\n label: 'Color Palette',\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 LINE_INTERPOLATION_CONFIG = {\n linear: { label: 'Linear' },\n smooth: { label: 'Smooth' },\n stepBefore: { label: 'Step before' },\n stepAfter: { label: 'Step after' },\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// LogBase outlines the allowed log bases for the log-supported charts.\nexport type LOG_BASE = undefined | 2 | 10;\n\n// Single source of truth for log base configuration\nexport const LOG_BASE_CONFIG: Record<string, { label: string; log: LOG_BASE }> = {\n none: { label: 'None', log: undefined },\n '2': { label: '2', log: 2 },\n '10': { label: '10', log: 10 },\n};\n\n// Options array for SettingsAutocomplete\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\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":["schemeCategory10","schemeDark2","schemeSet1","schemeSet2","schemeSet3","schemeTableau10","CATEGORICAL_PALETTE_SCHEMES","category10","tableau10","set1","set2","set3","dark2","CATEGORICAL_PALETTE_NAMES","Object","keys","CATEGORICAL_SCHEME_METADATA","label","PALETTE_DROPDOWN_TOOLTIP","DEFAULT_FORMAT","unit","shortValues","DEFAULT_Y_AXIS","show","format","min","undefined","max","logBase","Y_AXIS_CONFIG","DEFAULT_DISPLAY","DEFAULT_LINE_WIDTH","DEFAULT_LINE_STYLE","DEFAULT_AREA_OPACITY","POINT_SIZE_OFFSET","DEFAULT_POINT_RADIUS","DEFAULT_CONNECT_NULLS","DEFAULT_BAND_OPACITY","BAND_LABEL","DEFAULT_VISUAL","display","lineWidth","lineStyle","areaOpacity","pointRadius","connectNulls","THRESHOLD_PLOT_INTERVAL","VISUAL_CONFIG","testId","step","lineInterpolation","bandOpacity","stack","colorPalette","STACK_CONFIG","none","all","STACK_OPTIONS","entries","map","id","config","LINE_STYLE_CONFIG","solid","dashed","dotted","LINE_INTERPOLATION_CONFIG","linear","smooth","stepBefore","stepAfter","OPACITY_CONFIG","LOG_BASE_CONFIG","log","LOG_BASE_OPTIONS","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULTIPLIER","createInitialTimeSeriesChartOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,SAASA,gBAAgB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAEC,eAAe,QAAQ,qBAAqB;AA+DxH,OAAO,MAAMC,8BAA8B;IACzCC,YAAYP;IACZQ,WAAWH;IACXI,MAAMP;IACNQ,MAAMP;IACNQ,MAAMP;IACNQ,O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,iBAAiB;IAC5BtD,OAAO;IACP+B,QAAQ;IACRvB,KAAK;IACLE,KAAK;IACLsB,MAAM;AACR,EAAE;AAKF,oDAAoD;AACpD,OAAO,MAAMuB,kBAAoE;IAC/EjB,MAAM;QAAEtC,OAAO;QAAQwD,KAAK/C;IAAU;IACtC,KAAK;QAAET,OAAO;QAAKwD,KAAK;IAAE;IAC1B,MAAM;QAAExD,OAAO;QAAMwD,KAAK;IAAG;AAC/B,EAAE;AAEF,yCAAyC;AACzC,OAAO,MAAMC,mBAAmB5D,OAAO4C,OAAO,CAACc,iBAAiBb,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAEJ,oFAAoF;AACpF,gFAAgF;AAChF,mFAAmF;AACnF,OAAO,MAAMc,gCAAgC,IAAI;AACjD,OAAO,MAAMC,gCAAgC,IAAI;AAEjD;;CAEC,GACD,OAAO,SAASC;IACd,OAAO,CAAC;AACV"}
|
|
1
|
+
{"version":3,"sources":["../../src/time-series-chart-model.ts"],"sourcesContent":["// Copyright 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 type { FormatOptions, ThresholdOptions } from '@perses-dev/components';\nimport type { LegendSpecOptions, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\nimport { schemeCategory10, schemeDark2, schemeSet1, schemeSet2, schemeSet3, schemeTableau10 } from 'd3-scale-chromatic';\n\n/**\n * Line style options for time series charts.\n */\nexport type LineStyleType = 'solid' | 'dashed' | 'dotted';\n\n/** How a line joins its points. The step names are Grafana's: stepBefore rises at the earlier point. */\nexport type LineInterpolation = 'linear' | 'smooth' | 'stepBefore' | 'stepAfter';\n\n/**\n * The schema for a TimeSeriesChart panel.\n */\nexport interface TimeSeriesChartDefinition extends Definition<TimeSeriesChartOptions> {\n kind: 'PulzrTimeSeriesChart';\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 lineInterpolation?: LineInterpolation;\n areaOpacity?: number;\n format?: FormatOptions;\n /**\n * If true, the query's series values are negated for display so they render\n * below the X axis. The original (positive) values are preserved for legend\n * calculations and CSV export, matching Grafana's `transform: \"negative-Y\"` behavior.\n */\n negativeY?: boolean;\n stack?: boolean;\n /** The query drawn as bars or as a line, whatever the panel's `visual.display`: bars with a line over them. */\n display?: 'line' | 'bar';\n /**\n * The query's own y axis even where its unit is the panel's: `right`, on the right with its own scale; `hidden`,\n * its own scale with no axis drawn (a line read against nothing but its shape and tooltip).\n */\n axis?: 'right' | 'hidden';\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 logBase?: LOG_BASE;\n}\n\nexport interface TooltipSpecOptions {\n enablePinning: boolean;\n}\n\nexport type TimeSeriesChartPaletteMode = 'auto' | 'categorical';\n\nexport const CATEGORICAL_PALETTE_SCHEMES = {\n category10: schemeCategory10,\n tableau10: schemeTableau10,\n set1: schemeSet1,\n set2: schemeSet2,\n set3: schemeSet3,\n dark2: schemeDark2,\n} as const;\n\nexport type CategoricalPaletteName = keyof typeof CATEGORICAL_PALETTE_SCHEMES;\n\nexport const CATEGORICAL_PALETTE_NAMES = Object.keys(CATEGORICAL_PALETTE_SCHEMES) as CategoricalPaletteName[];\n\nexport interface CategoricalSchemeMetadata {\n label: string;\n}\n\nexport const CATEGORICAL_SCHEME_METADATA: Record<CategoricalPaletteName, CategoricalSchemeMetadata> = {\n category10: { label: 'D3 Category 10' },\n tableau10: { label: 'Tableau 10' },\n set1: { label: 'ColorBrewer Set 1' },\n set2: { label: 'ColorBrewer Set 2' },\n set3: { label: 'ColorBrewer Set 3' },\n dark2: { label: 'ColorBrewer Dark 2' },\n};\n\nexport type TimeSeriesChartPaletteOptions =\n | { mode: 'auto' }\n | {\n mode: 'categorical';\n // Omitting falls back to the ECharts theme palette.\n name?: CategoricalPaletteName;\n };\n\nexport const PALETTE_DROPDOWN_TOOLTIP =\n 'Auto derives a unique color from the series name — same name always maps to the same color across panels. ' +\n 'Categorical palettes assign colors from a fixed set by series order.';\n\nexport type TimeSeriesChartVisualOptions = {\n display?: 'line' | 'bar';\n lineWidth?: number;\n lineStyle?: LineStyleType;\n lineInterpolation?: LineInterpolation;\n areaOpacity?: number;\n /** Fill of a band: a query's series labelled band=lo and band=hi. */\n bandOpacity?: number;\n showPoints?: 'auto' | 'always';\n palette?: TimeSeriesChartPaletteOptions;\n pointRadius?: number;\n stack?: StackOptions;\n connectNulls?: boolean;\n /** Bars at most this wide, in px: for a few days' bars not to fill the width. */\n maxBarWidth?: number;\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 logBase: 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 logBase: { label: 'Log Base' },\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;\nexport const DEFAULT_BAND_OPACITY = 0.15;\n\n/** The label, and its two values, that mark a series as a band edge. */\nexport const BAND_LABEL = 'band';\nexport type BandEdge = 'lo' | 'hi';\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 lineInterpolation: {\n label: 'Line Interpolation',\n },\n bandOpacity: {\n label: 'Band Opacity',\n testId: 'slider-band-opacity',\n min: 0,\n max: 1,\n step: 0.05,\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 colorPalette: {\n label: 'Color Palette',\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 LINE_INTERPOLATION_CONFIG = {\n linear: { label: 'Linear' },\n smooth: { label: 'Smooth' },\n stepBefore: { label: 'Step before' },\n stepAfter: { label: 'Step after' },\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// LogBase outlines the allowed log bases for the log-supported charts.\nexport type LOG_BASE = undefined | 2 | 10;\n\n// Single source of truth for log base configuration\nexport const LOG_BASE_CONFIG: Record<string, { label: string; log: LOG_BASE }> = {\n none: { label: 'None', log: undefined },\n '2': { label: '2', log: 2 },\n '10': { label: '10', log: 10 },\n};\n\n// Options array for SettingsAutocomplete\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\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":["schemeCategory10","schemeDark2","schemeSet1","schemeSet2","schemeSet3","schemeTableau10","CATEGORICAL_PALETTE_SCHEMES","category10","tableau10","set1","set2","set3","dark2","CATEGORICAL_PALETTE_NAMES","Object","keys","CATEGORICAL_SCHEME_METADATA","label","PALETTE_DROPDOWN_TOOLTIP","DEFAULT_FORMAT","unit","shortValues","DEFAULT_Y_AXIS","show","format","min","undefined","max","logBase","Y_AXIS_CONFIG","DEFAULT_DISPLAY","DEFAULT_LINE_WIDTH","DEFAULT_LINE_STYLE","DEFAULT_AREA_OPACITY","POINT_SIZE_OFFSET","DEFAULT_POINT_RADIUS","DEFAULT_CONNECT_NULLS","DEFAULT_BAND_OPACITY","BAND_LABEL","DEFAULT_VISUAL","display","lineWidth","lineStyle","areaOpacity","pointRadius","connectNulls","THRESHOLD_PLOT_INTERVAL","VISUAL_CONFIG","testId","step","lineInterpolation","bandOpacity","stack","colorPalette","STACK_CONFIG","none","all","STACK_OPTIONS","entries","map","id","config","LINE_STYLE_CONFIG","solid","dashed","dotted","LINE_INTERPOLATION_CONFIG","linear","smooth","stepBefore","stepAfter","OPACITY_CONFIG","LOG_BASE_CONFIG","log","LOG_BASE_OPTIONS","POSITIVE_MIN_VALUE_MULTIPLIER","NEGATIVE_MIN_VALUE_MULTIPLIER","createInitialTimeSeriesChartOptions"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,SAASA,gBAAgB,EAAEC,WAAW,EAAEC,UAAU,EAAEC,UAAU,EAAEC,UAAU,EAAEC,eAAe,QAAQ,qBAAqB;AAsExH,OAAO,MAAMC,8BAA8B;IACzCC,YAAYP;IACZQ,WAAWH;IACXI,MAAMP;IACNQ,MAAMP;IACNQ,MAAMP;IACNQ,OAAOX;AACT,EAAW;AAIX,OAAO,MAAMY,4BAA4BC,OAAOC,IAAI,CAACT,6BAAyD;AAM9G,OAAO,MAAMU,8BAAyF;IACpGT,YAA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