@perses-dev/timeseries-chart-plugin 0.13.0 → 0.14.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/TimeSeriesChart.7c5da441.js +7 -0
- package/__mf/js/async/163.cce4c882.js +22 -0
- package/__mf/js/async/202.29f2b119.js +37 -0
- package/__mf/js/async/626.9d2c051c.js +2 -0
- package/__mf/js/async/682.971bf8bf.js +3 -0
- package/__mf/js/async/996.bd40c9c2.js +2 -0
- package/__mf/js/async/{__federation_expose_TimeSeriesChart.0ab11cd4.js → __federation_expose_TimeSeriesChart.0f989a8c.js} +1 -1
- package/__mf/js/{main.691eecd6.js → main.35c70c1e.js} +2 -2
- package/lib/TimeSeriesChart.d.ts.map +1 -1
- package/lib/TimeSeriesChart.js +1 -0
- package/lib/TimeSeriesChart.js.map +1 -1
- package/lib/TimeSeriesChartPanel.js +2 -2
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/cjs/TimeSeriesChart.js +1 -0
- package/lib/cjs/TimeSeriesChartPanel.js +1 -1
- package/mf-manifest.json +14 -14
- package/mf-stats.json +14 -14
- package/package.json +5 -5
- package/__mf/js/TimeSeriesChart.42841bce.js +0 -7
- package/__mf/js/async/518.2ac1df43.js +0 -38
- package/__mf/js/async/546.5fecffa4.js +0 -3
- package/__mf/js/async/603.3b771310.js +0 -2
- package/__mf/js/async/655.2f794f77.js +0 -1
- package/__mf/js/async/984.83bd5c6d.js +0 -22
- /package/__mf/js/async/{984.83bd5c6d.js.LICENSE.txt → 163.cce4c882.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{603.3b771310.js.LICENSE.txt → 626.9d2c051c.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesChart.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 { PanelPlugin } from '@perses-dev/plugin-system';\nimport { createInitialTimeSeriesChartOptions, TimeSeriesChartOptions } from './time-series-chart-model';\nimport { TimeSeriesChartGeneralSettings } from './GeneralSettingsEditor';\nimport { QuerySettingsEditor } from './QuerySettingsEditor';\nimport { TimeSeriesChartPanel, TimeSeriesChartProps } from './TimeSeriesChartPanel';\nimport { TimeSeriesExportAction } from './TimeSeriesExportAction';\n\nexport const TimeSeriesChart: PanelPlugin<TimeSeriesChartOptions, TimeSeriesChartProps> = {\n PanelComponent: TimeSeriesChartPanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n panelOptionsEditorComponents: [\n { label: 'General Settings', content: TimeSeriesChartGeneralSettings },\n { label: 'Query Settings', content: QuerySettingsEditor },\n ],\n createInitialOptions: createInitialTimeSeriesChartOptions,\n actions: [\n {\n component: TimeSeriesExportAction,\n location: 'header',\n },\n ],\n};\n"],"names":["createInitialTimeSeriesChartOptions","TimeSeriesChartGeneralSettings","QuerySettingsEditor","TimeSeriesChartPanel","TimeSeriesExportAction","TimeSeriesChart","PanelComponent","supportedQueryTypes","panelOptionsEditorComponents","label","content","createInitialOptions","actions","component","location"],"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;AAGjC,SAASA,mCAAmC,QAAgC,4BAA4B;AACxG,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,oBAAoB,QAA8B,yBAAyB;AACpF,SAASC,sBAAsB,QAAQ,2BAA2B;AAElE,OAAO,MAAMC,kBAA6E;IACxFC,gBAAgBH;IAChBI,qBAAqB;QAAC;KAAkB;IACxCC,8BAA8B;QAC5B;YAAEC,OAAO;YAAoBC,
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesChart.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 { PanelPlugin } from '@perses-dev/plugin-system';\nimport { createInitialTimeSeriesChartOptions, TimeSeriesChartOptions } from './time-series-chart-model';\nimport { TimeSeriesChartGeneralSettings } from './GeneralSettingsEditor';\nimport { QuerySettingsEditor } from './QuerySettingsEditor';\nimport { TimeSeriesChartPanel, TimeSeriesChartProps } from './TimeSeriesChartPanel';\nimport { TimeSeriesExportAction } from './TimeSeriesExportAction';\n\nexport const TimeSeriesChart: PanelPlugin<TimeSeriesChartOptions, TimeSeriesChartProps> = {\n PanelComponent: TimeSeriesChartPanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n supportsAnnotations: true,\n panelOptionsEditorComponents: [\n { label: 'General Settings', content: TimeSeriesChartGeneralSettings },\n { label: 'Query Settings', content: QuerySettingsEditor },\n ],\n createInitialOptions: createInitialTimeSeriesChartOptions,\n actions: [\n {\n component: TimeSeriesExportAction,\n location: 'header',\n },\n ],\n};\n"],"names":["createInitialTimeSeriesChartOptions","TimeSeriesChartGeneralSettings","QuerySettingsEditor","TimeSeriesChartPanel","TimeSeriesExportAction","TimeSeriesChart","PanelComponent","supportedQueryTypes","supportsAnnotations","panelOptionsEditorComponents","label","content","createInitialOptions","actions","component","location"],"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;AAGjC,SAASA,mCAAmC,QAAgC,4BAA4B;AACxG,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,oBAAoB,QAA8B,yBAAyB;AACpF,SAASC,sBAAsB,QAAQ,2BAA2B;AAElE,OAAO,MAAMC,kBAA6E;IACxFC,gBAAgBH;IAChBI,qBAAqB;QAAC;KAAkB;IACxCC,qBAAqB;IACrBC,8BAA8B;QAC5B;YAAEC,OAAO;YAAoBC,SAASV;QAA+B;QACrE;YAAES,OAAO;YAAkBC,SAAST;QAAoB;KACzD;IACDU,sBAAsBZ;IACtBa,SAAS;QACP;YACEC,WAAWV;YACXW,UAAU;QACZ;KACD;AACH,EAAE"}
|
|
@@ -16,7 +16,7 @@ import { Box, useTheme } from '@mui/material';
|
|
|
16
16
|
import merge from 'lodash/merge';
|
|
17
17
|
import { LEGEND_VALUE_CONFIG, useTimeRange, validateLegendSpec, legendValues, getCalculations } from '@perses-dev/plugin-system';
|
|
18
18
|
import { YAxisLabel, useChartsTheme, ContentWithLegend, useId, DEFAULT_TOOLTIP_CONFIG, getFormattedMultipleYAxes, DEFAULT_LEGEND, formatValue, getTimeSeriesValues } from '@perses-dev/components';
|
|
19
|
-
import {
|
|
19
|
+
import { usePanelAnnotationsWithData } from '@perses-dev/dashboards';
|
|
20
20
|
import { DEFAULT_FORMAT, DEFAULT_VISUAL, THRESHOLD_PLOT_INTERVAL } from './time-series-chart-model';
|
|
21
21
|
import { getTimeSeries, getCommonTimeScaleForQueries, convertPanelYAxis, getThresholdSeries, convertPercentThreshold } from './utils/data-transform';
|
|
22
22
|
import { getSeriesColor } from './utils/palette-gen';
|
|
@@ -102,7 +102,7 @@ export function TimeSeriesChartPanel(props) {
|
|
|
102
102
|
const [selectedLegendItems, setSelectedLegendItems] = useState('ALL');
|
|
103
103
|
const [legendSorting, setLegendSorting] = useState();
|
|
104
104
|
const { setTimeRange } = useTimeRange();
|
|
105
|
-
const annotationsWithData =
|
|
105
|
+
const annotationsWithData = usePanelAnnotationsWithData(props.definition?.spec.annotations);
|
|
106
106
|
const annotations = useMemo(()=>convertAnnotationToTimeSeriesAnnotation(annotationsWithData), [
|
|
107
107
|
annotationsWithData
|
|
108
108
|
]);
|
|
@@ -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 { ReactElement, useMemo, useRef, useState } from 'react';\nimport { Box, useTheme } from '@mui/material';\nimport type { GridComponentOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport {\n LEGEND_VALUE_CONFIG,\n PanelProps,\n useTimeRange,\n validateLegendSpec,\n legendValues,\n getCalculations,\n CalculationType,\n} from '@perses-dev/plugin-system';\nimport {\n ChartInstance,\n YAxisLabel,\n ZoomEventData,\n useChartsTheme,\n SelectedLegendItemState,\n ContentWithLegend,\n TableColumnConfig,\n LegendItem,\n LegendProps,\n useId,\n TooltipConfig,\n DEFAULT_TOOLTIP_CONFIG,\n TimeChartSeriesMapping,\n getFormattedMultipleYAxes,\n DEFAULT_LEGEND,\n StepOptions,\n formatValue,\n getTimeSeriesValues,\n} from '@perses-dev/components';\nimport { TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport { useAnnotationsWithData } from '@perses-dev/dashboards';\nimport {\n TimeSeriesChartOptions,\n DEFAULT_FORMAT,\n DEFAULT_VISUAL,\n THRESHOLD_PLOT_INTERVAL,\n QuerySettingsOptions,\n} from './time-series-chart-model';\nimport {\n getTimeSeries,\n getCommonTimeScaleForQueries,\n convertPanelYAxis,\n getThresholdSeries,\n convertPercentThreshold,\n} from './utils/data-transform';\nimport { getSeriesColor } from './utils/palette-gen';\nimport { TimeSeriesChartBase } from './TimeSeriesChartBase';\nimport { convertAnnotationToTimeSeriesAnnotation, TimeSeriesAnnotation } from './utils/annotation';\n\nexport type TimeSeriesChartProps = PanelProps<TimeSeriesChartOptions, TimeSeriesData>;\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\nexport function TimeSeriesChartPanel(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('time-series-panel');\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, seriesFormatMap } = useMemo(() => {\n const baseUnit = format?.unit ?? 'decimal';\n const additionalFormats: Array<typeof format> = [];\n const formatToYAxisIndex = new Map<string, number>();\n const seriesFormatMap = new Map<string, typeof format>();\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, seriesFormatMap };\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 = useAnnotationsWithData();\n\n const annotations: TimeSeriesAnnotation[] = useMemo(\n () => convertAnnotationToTimeSeriesAnnotation(annotationsWithData),\n [annotationsWithData]\n );\n\n // Populate series data based on query results\n const {\n timeScale,\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap: computedSeriesFormatMap,\n maxValuesByFormat,\n } = useMemo(() => {\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n if (timeScale === undefined) {\n return {\n timeChartData: [],\n timeSeriesMapping: [],\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\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 // Mapping of each set of query results to be ECharts option compatible\n // TODO: Look into performance optimizations and moving parts of mapping to the lower level chart\n for (let queryIndex = 0; queryIndex < queryResults.length; queryIndex++) {\n const result = queryResults[queryIndex];\n\n // Retrieve querySettings for this query, if exists.\n // queries & querySettings indices do not necessarily match, so we have to check the tail value of the $ref attribute\n let querySettings: QuerySettingsOptions | undefined;\n for (const item of querySettingsList ?? []) {\n if (item.queryIndex === queryIndex) {\n querySettings = item;\n // We don't break the loop here just in case there are multiple querySettings defined for the\n // same queryIndex, because in that case we want the last one to take precedence.\n }\n }\n\n if (result) {\n for (let i = 0; i < result.data.series.length; i++) {\n const timeSeries: TimeSeries | undefined = result.data.series[i];\n if (timeSeries === undefined) {\n return { timeChartData: [], timeSeriesMapping: [], legendItems: [] };\n }\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 categoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName: formattedSeriesName,\n seriesIndex,\n querySettings: querySettings,\n queryHasMultipleResults: (queryResults[queryIndex]?.data?.series?.length ?? 0) > 1,\n });\n\n // We add a unique id for the chart to disambiguate items across charts\n // when there are multiple on the page.\n const seriesId = chartId + timeSeries.name + seriesIndex;\n\n const legendCalculations = legend?.values\n ? getCalculations(timeSeries.values, legend.values as CalculationType[])\n : undefined;\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 )\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 seriesMax = Math.max(...timeSeries.values.map((v) => Math.abs(v[1] ?? 0)));\n const currentMax = maxValuesByFormat.get(unitKey) ?? 0;\n if (seriesMax > currentMax) {\n maxValuesByFormat.set(unitKey, seriesMax);\n }\n }\n }\n\n // When negativeY is set on this query, negate the rendered values so the\n // series renders below the X axis. The original (positive) values are\n // preserved in `timeSeries.values` (used for legend calculations) and in\n // `queryResults` (used for CSV export).\n const baseValues: TimeSeriesValueTuple[] = getTimeSeriesValues(timeSeries, timeScale);\n const renderedValues: TimeSeriesValueTuple[] = querySettings?.negativeY\n ? baseValues.map((tuple: TimeSeriesValueTuple): TimeSeriesValueTuple => {\n const [t, v] = tuple;\n return [t, v === null ? null : -v];\n })\n : baseValues;\n\n timeChartData.push({\n name: formattedSeriesName,\n values: renderedValues,\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: legendCalculations,\n });\n }\n\n // Used for repeating colors in Categorical palette\n seriesIndex++;\n }\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++;\n });\n }\n\n return {\n timeScale,\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap,\n maxValuesByFormat,\n };\n }, [\n queryResults,\n thresholds,\n selectedLegendItems,\n legend,\n visual,\n querySettingsList,\n yAxis?.max,\n yAxis?.min,\n categoricalPalette,\n chartId,\n chartsTheme.thresholds,\n muiTheme.palette.primary.main,\n formatToYAxisIndex,\n seriesFormatMap,\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 if (adjustedContentDimensions === undefined) {\n return null;\n }\n\n const handleDataZoom = (event: ZoomEventData): void => {\n // TODO: add ECharts transition animation on zoom\n setTimeRange({ start: new Date(event.start), end: new Date(event.end) });\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 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"],"names":["useMemo","useRef","useState","Box","useTheme","merge","LEGEND_VALUE_CONFIG","useTimeRange","validateLegendSpec","legendValues","getCalculations","YAxisLabel","useChartsTheme","ContentWithLegend","useId","DEFAULT_TOOLTIP_CONFIG","getFormattedMultipleYAxes","DEFAULT_LEGEND","formatValue","getTimeSeriesValues","useAnnotationsWithData","DEFAULT_FORMAT","DEFAULT_VISUAL","THRESHOLD_PLOT_INTERVAL","getTimeSeries","getCommonTimeScaleForQueries","convertPanelYAxis","getThresholdSeries","convertPercentThreshold","getSeriesColor","TimeSeriesChartBase","convertAnnotationToTimeSeriesAnnotation","TimeSeriesChartPanel","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","seriesFormatMap","baseUnit","unit","Map","set","qs","unitKey","has","length","push","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","setTimeRange","annotationsWithData","annotations","timeScale","timeChartData","timeSeriesMapping","legendItems","computedSeriesFormatMap","maxValuesByFormat","seriesIndex","queryIndex","result","item","i","data","series","timeSeries","formattedSeriesName","formattedName","name","seriesColor","muiPrimaryColor","palette","primary","main","seriesName","queryHasMultipleResults","seriesId","legendCalculations","values","isSelectAll","isSelected","showTimeSeries","datasetIndex","queryFormat","yAxisIndex","get","seriesMax","Math","max","map","v","abs","currentMax","baseValues","renderedValues","negativeY","tuple","t","id","label","steps","thresholdsColors","defaultThresholdColor","defaultColor","forEach","step","index","stepPaletteColor","thresholdLineColor","stepOption","value","mode","min","thresholdName","thresholdTimeValueTuple","currentTimestamp","startMs","endMs","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"],"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,SAAuBA,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AAE9C,OAAOC,WAAW,eAAe;AACjC,SACEC,mBAAmB,EAEnBC,YAAY,EACZC,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AiBtH;gBACnB;gBACAuH,iBAAiB,CAACC,GAAG,EAAEtE,EAAE,EAAE;oBACzBjF,SAASwJ,OAAO,EAAEC,gBAAgB;wBAAEtG,MAAM8B;oBAAG;gBAC/C;gBACAyE,gBAAgB;oBACd1J,SAASwJ,OAAO,EAAEG;gBACpB;YACF;sBAGD,CAAC,EAAEjJ,MAAM,EAAED,KAAK,EAAE;gBACjB,qBACE,MAACnD;oBAAIsM,OAAO;wBAAElJ;wBAAQD;oBAAM;;wBACzBlB,SAASA,MAAMkI,IAAI,IAAIlI,MAAM2F,KAAK,kBAAI,KAACpH;4BAAWqF,MAAM5D,MAAM2F,KAAK;4BAAExE,QAAQA;;sCAC9E,KAACzB;4BACC4K,KAAK7J;4BACLU,QAAQA;4BACRoC,MAAMV;4BACN0H,eAAezH;4BACfH,aAAaA;4BACbC,WAAWA;4BACX5C,OAAO8G,iBAAiBtF;4BACxBF,QAAQA;4BACRK,iBAAiBqB;4BACjBwH,MAAMvC;4BACNW,cAAcA;4BACdO,eAAeA;4BACfsB,WAAU;4BACVC,YAAYnC;4BACZ,sFAAsF;4BACtF,mDAAmD;4BACnDoC,eAAe,CAAC9H,cAAcV,MAAM,IAAIY,eAAeA,YAAYZ,MAAM,GAAG,IAAI,UAAU;;;;YAIlG;;;AAIR"}
|
|
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 { ReactElement, useMemo, useRef, useState } from 'react';\nimport { Box, useTheme } from '@mui/material';\nimport type { GridComponentOption } from 'echarts';\nimport merge from 'lodash/merge';\nimport {\n LEGEND_VALUE_CONFIG,\n PanelProps,\n useTimeRange,\n validateLegendSpec,\n legendValues,\n getCalculations,\n CalculationType,\n} from '@perses-dev/plugin-system';\nimport {\n ChartInstance,\n YAxisLabel,\n ZoomEventData,\n useChartsTheme,\n SelectedLegendItemState,\n ContentWithLegend,\n TableColumnConfig,\n LegendItem,\n LegendProps,\n useId,\n TooltipConfig,\n DEFAULT_TOOLTIP_CONFIG,\n TimeChartSeriesMapping,\n getFormattedMultipleYAxes,\n DEFAULT_LEGEND,\n StepOptions,\n formatValue,\n getTimeSeriesValues,\n} from '@perses-dev/components';\nimport { TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport { usePanelAnnotationsWithData } from '@perses-dev/dashboards';\nimport {\n TimeSeriesChartOptions,\n DEFAULT_FORMAT,\n DEFAULT_VISUAL,\n THRESHOLD_PLOT_INTERVAL,\n QuerySettingsOptions,\n} from './time-series-chart-model';\nimport {\n getTimeSeries,\n getCommonTimeScaleForQueries,\n convertPanelYAxis,\n getThresholdSeries,\n convertPercentThreshold,\n} from './utils/data-transform';\nimport { getSeriesColor } from './utils/palette-gen';\nimport { TimeSeriesChartBase } from './TimeSeriesChartBase';\nimport { convertAnnotationToTimeSeriesAnnotation, TimeSeriesAnnotation } from './utils/annotation';\n\nexport type TimeSeriesChartProps = PanelProps<TimeSeriesChartOptions, TimeSeriesData>;\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\nexport function TimeSeriesChartPanel(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('time-series-panel');\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, seriesFormatMap } = useMemo(() => {\n const baseUnit = format?.unit ?? 'decimal';\n const additionalFormats: Array<typeof format> = [];\n const formatToYAxisIndex = new Map<string, number>();\n const seriesFormatMap = new Map<string, typeof format>();\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, seriesFormatMap };\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 // Populate series data based on query results\n const {\n timeScale,\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap: computedSeriesFormatMap,\n maxValuesByFormat,\n } = useMemo(() => {\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n if (timeScale === undefined) {\n return {\n timeChartData: [],\n timeSeriesMapping: [],\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\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 // Mapping of each set of query results to be ECharts option compatible\n // TODO: Look into performance optimizations and moving parts of mapping to the lower level chart\n for (let queryIndex = 0; queryIndex < queryResults.length; queryIndex++) {\n const result = queryResults[queryIndex];\n\n // Retrieve querySettings for this query, if exists.\n // queries & querySettings indices do not necessarily match, so we have to check the tail value of the $ref attribute\n let querySettings: QuerySettingsOptions | undefined;\n for (const item of querySettingsList ?? []) {\n if (item.queryIndex === queryIndex) {\n querySettings = item;\n // We don't break the loop here just in case there are multiple querySettings defined for the\n // same queryIndex, because in that case we want the last one to take precedence.\n }\n }\n\n if (result) {\n for (let i = 0; i < result.data.series.length; i++) {\n const timeSeries: TimeSeries | undefined = result.data.series[i];\n if (timeSeries === undefined) {\n return { timeChartData: [], timeSeriesMapping: [], legendItems: [] };\n }\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 categoricalPalette: categoricalPalette as string[],\n visual,\n muiPrimaryColor: muiTheme.palette.primary.main,\n seriesName: formattedSeriesName,\n seriesIndex,\n querySettings: querySettings,\n queryHasMultipleResults: (queryResults[queryIndex]?.data?.series?.length ?? 0) > 1,\n });\n\n // We add a unique id for the chart to disambiguate items across charts\n // when there are multiple on the page.\n const seriesId = chartId + timeSeries.name + seriesIndex;\n\n const legendCalculations = legend?.values\n ? getCalculations(timeSeries.values, legend.values as CalculationType[])\n : undefined;\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 )\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 seriesMax = Math.max(...timeSeries.values.map((v) => Math.abs(v[1] ?? 0)));\n const currentMax = maxValuesByFormat.get(unitKey) ?? 0;\n if (seriesMax > currentMax) {\n maxValuesByFormat.set(unitKey, seriesMax);\n }\n }\n }\n\n // When negativeY is set on this query, negate the rendered values so the\n // series renders below the X axis. The original (positive) values are\n // preserved in `timeSeries.values` (used for legend calculations) and in\n // `queryResults` (used for CSV export).\n const baseValues: TimeSeriesValueTuple[] = getTimeSeriesValues(timeSeries, timeScale);\n const renderedValues: TimeSeriesValueTuple[] = querySettings?.negativeY\n ? baseValues.map((tuple: TimeSeriesValueTuple): TimeSeriesValueTuple => {\n const [t, v] = tuple;\n return [t, v === null ? null : -v];\n })\n : baseValues;\n\n timeChartData.push({\n name: formattedSeriesName,\n values: renderedValues,\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: legendCalculations,\n });\n }\n\n // Used for repeating colors in Categorical palette\n seriesIndex++;\n }\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++;\n });\n }\n\n return {\n timeScale,\n timeChartData,\n timeSeriesMapping,\n legendItems,\n seriesFormatMap,\n maxValuesByFormat,\n };\n }, [\n queryResults,\n thresholds,\n selectedLegendItems,\n legend,\n visual,\n querySettingsList,\n yAxis?.max,\n yAxis?.min,\n categoricalPalette,\n chartId,\n chartsTheme.thresholds,\n muiTheme.palette.primary.main,\n formatToYAxisIndex,\n seriesFormatMap,\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 if (adjustedContentDimensions === undefined) {\n return null;\n }\n\n const handleDataZoom = (event: ZoomEventData): void => {\n // TODO: add ECharts transition animation on zoom\n setTimeRange({ start: new Date(event.start), end: new Date(event.end) });\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 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"],"names":["useMemo","useRef","useState","Box","useTheme","merge","LEGEND_VALUE_CONFIG","useTimeRange","validateLegendSpec","legendValues","getCalculations","YAxisLabel","useChartsTheme","ContentWithLegend","useId","DEFAULT_TOOLTIP_CONFIG","getFormattedMultipleYAxes","DEFAULT_LEGEND","formatValue","getTimeSeriesValues","usePanelAnnotationsWithData","DEFAULT_FORMAT","DEFAULT_VISUAL","THRESHOLD_PLOT_INTERVAL","getTimeSeries","getCommonTimeScaleForQueries","convertPanelYAxis","getThresholdSeries","convertPercentThreshold","getSeriesColor","TimeSeriesChartBase","convertAnnotationToTimeSeriesAnnotation","TimeSeriesChartPanel","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","seriesFormatMap","baseUnit","unit","Map","set","qs","unitKey","has","length","push","selectedLegendItems","setSelectedLegendItems","legendSorting","setLegendSorting","setTimeRange","annotationsWithData","definition","annotations","timeScale","timeChartData","timeSeriesMapping","legendItems","computedSeriesFormatMap","maxValuesByFormat","seriesIndex","queryIndex","result","item","i","data","series","timeSeries","formattedSeriesName","formattedName","name","seriesColor","muiPrimaryColor","palette","primary","main","seriesName","queryHasMultipleResults","seriesId","legendCalculations","values","isSelectAll","isSelected","showTimeSeries","datasetIndex","queryFormat","yAxisIndex","get","seriesMax","Math","max","map","v","abs","currentMax","baseValues","renderedValues","negativeY","tuple","t","id","label","steps","thresholdsColors","defaultThresholdColor","defaultColor","forEach","step","index","stepPaletteColor","thresholdLineColor","stepOption","value","mode","min","thresholdName","thresholdTimeValueTuple","currentTimestamp","startMs","endMs","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"],"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,SAAuBA,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AAE9C,OAAOC,WAAW,eAAe;AACjC,SACEC,mBAAmB,EAEnBC,YAAY,EACZC,kBAAkB,EAClBC,YAAY,EACZC,eAAe,QAEV,4BAA4B;AACnC,SAEEC,UAAU,EAEVC,cAAc,EAEdC,iBAAiB,EAIjBC,KAAK,EAELC,sBAAsB,EAEtBC,yBAAyB,EACzBC,cAAc,EAEdC,WAAW,EACXC,mBAAmB,QACd,yBAAyB;AAEhC,SAASC,2BAA2B,QAAQ,yBAAyB;AACrE,SAEEC,cAAc,EACdC,cAAc,EACdC,uBAAuB,QAElB,4BAA4B;AACnC,SACEC,aAAa,EACbC,4BAA4B,EAC5BC,iBAAiB,EACjBC,kBAAkB,EAClBC,uBAAuB,QAClB,yBAAyB;AAChC,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,uCAAuC,QAA8B,qBAAqB;AAInG,8EAA8E;AAC9E,0FAA0F;AAC1F,+EAA+E;AAC/E,uEAAuE;AACvE,+EAA+E;AAC/E,sEAAsE;AACtE,+EAA+E;AAC/E,mEAAmE;AAEnE,OAAO,SAASC,qBAAqBC,KAA2B;IAC9D,MAAM,EACJC,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,eAAeC,iBAAiB,EAAE,EACtEC,iBAAiB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AAcX,MAAM,IAAIa,eAAeA,YAAYb,MAAM,GAAG,IAAI,UAAU;;;;YAIlG;;;AAIR"}
|
|
@@ -109,7 +109,7 @@ function TimeSeriesChartPanel(props) {
|
|
|
109
109
|
const [selectedLegendItems, setSelectedLegendItems] = (0, _react.useState)('ALL');
|
|
110
110
|
const [legendSorting, setLegendSorting] = (0, _react.useState)();
|
|
111
111
|
const { setTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
112
|
-
const annotationsWithData = (0, _dashboards.
|
|
112
|
+
const annotationsWithData = (0, _dashboards.usePanelAnnotationsWithData)(props.definition?.spec.annotations);
|
|
113
113
|
const annotations = (0, _react.useMemo)(()=>(0, _annotation.convertAnnotationToTimeSeriesAnnotation)(annotationsWithData), [
|
|
114
114
|
annotationsWithData
|
|
115
115
|
]);
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "TimeSeriesChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.
|
|
8
|
+
"buildVersion": "0.14.0-beta.0",
|
|
9
9
|
"buildName": "@perses-dev/timeseries-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/TimeSeriesChart.
|
|
12
|
+
"name": "__mf/js/TimeSeriesChart.7c5da441.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
{
|
|
90
90
|
"id": "TimeSeriesChart:@perses-dev/components",
|
|
91
91
|
"name": "@perses-dev/components",
|
|
92
|
-
"version": "0.
|
|
92
|
+
"version": "0.55.0-beta.1",
|
|
93
93
|
"singleton": true,
|
|
94
|
-
"requiredVersion": "^0.
|
|
94
|
+
"requiredVersion": "^0.55.0-beta.1",
|
|
95
95
|
"assets": {
|
|
96
96
|
"js": {
|
|
97
97
|
"async": [],
|
|
@@ -111,14 +111,14 @@
|
|
|
111
111
|
{
|
|
112
112
|
"id": "TimeSeriesChart:@perses-dev/dashboards",
|
|
113
113
|
"name": "@perses-dev/dashboards",
|
|
114
|
-
"version": "0.
|
|
114
|
+
"version": "0.55.0-beta.1",
|
|
115
115
|
"singleton": true,
|
|
116
|
-
"requiredVersion": "^0.
|
|
116
|
+
"requiredVersion": "^0.55.0-beta.1",
|
|
117
117
|
"assets": {
|
|
118
118
|
"js": {
|
|
119
119
|
"async": [],
|
|
120
120
|
"sync": [
|
|
121
|
-
"__mf/js/async/
|
|
121
|
+
"__mf/js/async/163.cce4c882.js"
|
|
122
122
|
]
|
|
123
123
|
},
|
|
124
124
|
"css": {
|
|
@@ -131,14 +131,14 @@
|
|
|
131
131
|
{
|
|
132
132
|
"id": "TimeSeriesChart:@perses-dev/plugin-system",
|
|
133
133
|
"name": "@perses-dev/plugin-system",
|
|
134
|
-
"version": "0.
|
|
134
|
+
"version": "0.55.0-beta.1",
|
|
135
135
|
"singleton": true,
|
|
136
|
-
"requiredVersion": "^0.
|
|
136
|
+
"requiredVersion": "^0.55.0-beta.1",
|
|
137
137
|
"assets": {
|
|
138
138
|
"js": {
|
|
139
139
|
"async": [],
|
|
140
140
|
"sync": [
|
|
141
|
-
"__mf/js/async/
|
|
141
|
+
"__mf/js/async/682.971bf8bf.js"
|
|
142
142
|
]
|
|
143
143
|
},
|
|
144
144
|
"css": {
|
|
@@ -282,14 +282,14 @@
|
|
|
282
282
|
"__mf/js/async/527.f97d1b86.js",
|
|
283
283
|
"__mf/js/async/52.0d78de2b.js",
|
|
284
284
|
"__mf/js/async/724.c45dcf5b.js",
|
|
285
|
-
"__mf/js/async/__federation_expose_TimeSeriesChart.
|
|
285
|
+
"__mf/js/async/__federation_expose_TimeSeriesChart.0f989a8c.js"
|
|
286
286
|
],
|
|
287
287
|
"async": [
|
|
288
288
|
"__mf/js/async/lib-router.319c02cd.js",
|
|
289
|
-
"__mf/js/async/
|
|
290
|
-
"__mf/js/async/
|
|
289
|
+
"__mf/js/async/996.bd40c9c2.js",
|
|
290
|
+
"__mf/js/async/202.29f2b119.js",
|
|
291
291
|
"__mf/js/async/356.8170c96d.js",
|
|
292
|
-
"__mf/js/async/
|
|
292
|
+
"__mf/js/async/626.9d2c051c.js",
|
|
293
293
|
"__mf/js/async/694.0fb9ee5a.js",
|
|
294
294
|
"__mf/js/async/588.0a1aa144.js",
|
|
295
295
|
"__mf/js/async/71.8c6cf914.js",
|
package/mf-stats.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "TimeSeriesChart",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.
|
|
8
|
+
"buildVersion": "0.14.0-beta.0",
|
|
9
9
|
"buildName": "@perses-dev/timeseries-chart-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/TimeSeriesChart.
|
|
12
|
+
"name": "__mf/js/TimeSeriesChart.7c5da441.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"singleton": true,
|
|
103
|
-
"requiredVersion": "^0.
|
|
103
|
+
"requiredVersion": "^0.55.0-beta.1",
|
|
104
104
|
"shareScope": "default",
|
|
105
105
|
"name": "@perses-dev/components",
|
|
106
|
-
"version": "0.
|
|
106
|
+
"version": "0.55.0-beta.1",
|
|
107
107
|
"eager": false,
|
|
108
108
|
"id": "TimeSeriesChart:@perses-dev/components",
|
|
109
109
|
"assets": {
|
|
@@ -128,17 +128,17 @@
|
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
"singleton": true,
|
|
131
|
-
"requiredVersion": "^0.
|
|
131
|
+
"requiredVersion": "^0.55.0-beta.1",
|
|
132
132
|
"shareScope": "default",
|
|
133
133
|
"name": "@perses-dev/dashboards",
|
|
134
|
-
"version": "0.
|
|
134
|
+
"version": "0.55.0-beta.1",
|
|
135
135
|
"eager": false,
|
|
136
136
|
"id": "TimeSeriesChart:@perses-dev/dashboards",
|
|
137
137
|
"assets": {
|
|
138
138
|
"js": {
|
|
139
139
|
"async": [],
|
|
140
140
|
"sync": [
|
|
141
|
-
"__mf/js/async/
|
|
141
|
+
"__mf/js/async/163.cce4c882.js"
|
|
142
142
|
]
|
|
143
143
|
},
|
|
144
144
|
"css": {
|
|
@@ -154,17 +154,17 @@
|
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
"singleton": true,
|
|
157
|
-
"requiredVersion": "^0.
|
|
157
|
+
"requiredVersion": "^0.55.0-beta.1",
|
|
158
158
|
"shareScope": "default",
|
|
159
159
|
"name": "@perses-dev/plugin-system",
|
|
160
|
-
"version": "0.
|
|
160
|
+
"version": "0.55.0-beta.1",
|
|
161
161
|
"eager": false,
|
|
162
162
|
"id": "TimeSeriesChart:@perses-dev/plugin-system",
|
|
163
163
|
"assets": {
|
|
164
164
|
"js": {
|
|
165
165
|
"async": [],
|
|
166
166
|
"sync": [
|
|
167
|
-
"__mf/js/async/
|
|
167
|
+
"__mf/js/async/682.971bf8bf.js"
|
|
168
168
|
]
|
|
169
169
|
},
|
|
170
170
|
"css": {
|
|
@@ -346,14 +346,14 @@
|
|
|
346
346
|
"__mf/js/async/527.f97d1b86.js",
|
|
347
347
|
"__mf/js/async/52.0d78de2b.js",
|
|
348
348
|
"__mf/js/async/724.c45dcf5b.js",
|
|
349
|
-
"__mf/js/async/__federation_expose_TimeSeriesChart.
|
|
349
|
+
"__mf/js/async/__federation_expose_TimeSeriesChart.0f989a8c.js"
|
|
350
350
|
],
|
|
351
351
|
"async": [
|
|
352
352
|
"__mf/js/async/lib-router.319c02cd.js",
|
|
353
|
-
"__mf/js/async/
|
|
354
|
-
"__mf/js/async/
|
|
353
|
+
"__mf/js/async/996.bd40c9c2.js",
|
|
354
|
+
"__mf/js/async/202.29f2b119.js",
|
|
355
355
|
"__mf/js/async/356.8170c96d.js",
|
|
356
|
-
"__mf/js/async/
|
|
356
|
+
"__mf/js/async/626.9d2c051c.js",
|
|
357
357
|
"__mf/js/async/694.0fb9ee5a.js",
|
|
358
358
|
"__mf/js/async/588.0a1aa144.js",
|
|
359
359
|
"__mf/js/async/71.8c6cf914.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/timeseries-chart-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://github.com/perses/plugins/blob/main/README.md",
|
|
6
6
|
"repository": {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@emotion/react": "^11.7.1",
|
|
32
32
|
"@emotion/styled": "^11.6.0",
|
|
33
33
|
"@hookform/resolvers": "^3.2.0",
|
|
34
|
-
"@perses-dev/components": "^0.
|
|
35
|
-
"@perses-dev/dashboards": "^0.
|
|
36
|
-
"@perses-dev/plugin-system": "^0.
|
|
37
|
-
"@perses-dev/spec": "^0.
|
|
34
|
+
"@perses-dev/components": "^0.55.0-beta.1",
|
|
35
|
+
"@perses-dev/dashboards": "^0.55.0-beta.1",
|
|
36
|
+
"@perses-dev/plugin-system": "^0.55.0-beta.1",
|
|
37
|
+
"@perses-dev/spec": "^0.3.0-beta.1",
|
|
38
38
|
"date-fns": "^4.1.0",
|
|
39
39
|
"date-fns-tz": "^3.2.0",
|
|
40
40
|
"echarts": "5.5.0",
|