@perses-dev/heatmap-chart-plugin 0.5.0 → 0.6.0-beta.1

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.
Files changed (94) hide show
  1. package/__mf/js/{HeatMapChart.6c4e6e06.js → HeatMapChart.db5f27ab.js} +7 -7
  2. package/__mf/js/async/121.f56fd949.js +2 -0
  3. package/__mf/js/async/362.ff9e490c.js +1 -0
  4. package/__mf/js/async/392.a629cdbc.js +2 -0
  5. package/__mf/js/async/470.f1cf6ff6.js +2 -0
  6. package/__mf/js/async/569.a2e6f431.js +71 -0
  7. package/__mf/js/async/888.afaddc9f.js +1 -0
  8. package/__mf/js/async/941.8f0ae6a3.js +2 -0
  9. package/__mf/js/async/963.78267324.js +1 -0
  10. package/__mf/js/async/{980.03e0a41f.js → 980.a766b9cd.js} +2 -2
  11. package/__mf/js/async/{__federation_expose_HeatMapChart.b3d43042.js → __federation_expose_HeatMapChart.579a5a06.js} +2 -2
  12. package/__mf/js/{main.bec55b3a.js → main.7925ba05.js} +3 -3
  13. package/lib/HeatMapChart.d.ts +3 -3
  14. package/lib/HeatMapChart.d.ts.map +1 -1
  15. package/lib/HeatMapChart.js +2 -2
  16. package/lib/HeatMapChart.js.map +1 -1
  17. package/lib/bootstrap.js +2 -2
  18. package/lib/components/HeatMapChart.d.ts +4 -4
  19. package/lib/components/HeatMapChart.d.ts.map +1 -1
  20. package/lib/components/HeatMapChart.js +8 -8
  21. package/lib/components/HeatMapChart.js.map +1 -1
  22. package/lib/components/HeatMapChartOptionsEditorSettings.d.ts +2 -2
  23. package/lib/components/HeatMapChartOptionsEditorSettings.d.ts.map +1 -1
  24. package/lib/components/HeatMapChartOptionsEditorSettings.js +6 -6
  25. package/lib/components/HeatMapChartOptionsEditorSettings.js.map +1 -1
  26. package/lib/components/HeatMapChartPanel.d.ts +4 -4
  27. package/lib/components/HeatMapChartPanel.d.ts.map +1 -1
  28. package/lib/components/HeatMapChartPanel.js +6 -6
  29. package/lib/components/HeatMapChartPanel.js.map +1 -1
  30. package/lib/components/HeatMapTooltip.d.ts +3 -3
  31. package/lib/components/HeatMapTooltip.d.ts.map +1 -1
  32. package/lib/components/HeatMapTooltip.js +2 -2
  33. package/lib/components/HeatMapTooltip.js.map +1 -1
  34. package/lib/components/index.js +3 -3
  35. package/lib/components/index.js.map +1 -1
  36. package/lib/getPluginModule.d.ts +1 -1
  37. package/lib/getPluginModule.d.ts.map +1 -1
  38. package/lib/getPluginModule.js +3 -1
  39. package/lib/getPluginModule.js.map +1 -1
  40. package/lib/heat-map-chart-model.d.ts +3 -3
  41. package/lib/heat-map-chart-model.d.ts.map +1 -1
  42. package/lib/heat-map-chart-model.js.map +1 -1
  43. package/lib/index-federation.js +1 -1
  44. package/lib/index.js +4 -4
  45. package/lib/index.js.map +1 -1
  46. package/lib/setup-tests.d.ts +1 -1
  47. package/lib/setup-tests.d.ts.map +1 -1
  48. package/lib/setup-tests.js +2 -2
  49. package/lib/setup-tests.js.map +1 -1
  50. package/lib/utils/data-transform.d.ts +2 -2
  51. package/lib/utils/data-transform.d.ts.map +1 -1
  52. package/lib/utils/data-transform.js +1 -1
  53. package/lib/utils/data-transform.js.map +1 -1
  54. package/lib/utils/get-formatted-axis-label.js +1 -1
  55. package/lib/utils/index.js +3 -3
  56. package/lib/utils/index.js.map +1 -1
  57. package/lib/utils/thresholds.d.ts +1 -1
  58. package/lib/utils/thresholds.d.ts.map +1 -1
  59. package/lib/utils/thresholds.js.map +1 -1
  60. package/mf-manifest.json +18 -18
  61. package/mf-stats.json +18 -18
  62. package/package.json +10 -10
  63. package/__mf/js/async/121.c8aa4904.js +0 -2
  64. package/__mf/js/async/392.97acdaa7.js +0 -2
  65. package/__mf/js/async/470.c23991fd.js +0 -2
  66. package/__mf/js/async/535.e475e67c.js +0 -1
  67. package/__mf/js/async/695.a3b5a24f.js +0 -71
  68. package/__mf/js/async/888.6a71bc7f.js +0 -1
  69. package/__mf/js/async/941.86aff2f9.js +0 -2
  70. package/__mf/js/async/963.ddc66183.js +0 -1
  71. package/lib/cjs/HeatMapChart.js +0 -40
  72. package/lib/cjs/bootstrap.js +0 -26
  73. package/lib/cjs/components/HeatMapChart.js +0 -227
  74. package/lib/cjs/components/HeatMapChartOptionsEditorSettings.js +0 -140
  75. package/lib/cjs/components/HeatMapChartPanel.js +0 -227
  76. package/lib/cjs/components/HeatMapTooltip.js +0 -57
  77. package/lib/cjs/components/index.js +0 -32
  78. package/lib/cjs/env.d.js +0 -14
  79. package/lib/cjs/getPluginModule.js +0 -39
  80. package/lib/cjs/heat-map-chart-model.js +0 -80
  81. package/lib/cjs/index-federation.js +0 -55
  82. package/lib/cjs/index.js +0 -47
  83. package/lib/cjs/setup-tests.js +0 -19
  84. package/lib/cjs/utils/data-transform.js +0 -46
  85. package/lib/cjs/utils/get-formatted-axis-label.js +0 -48
  86. package/lib/cjs/utils/index.js +0 -32
  87. package/lib/cjs/utils/thresholds.js +0 -34
  88. /package/__mf/css/async/{695.85c2cbf6.css → 569.85c2cbf6.css} +0 -0
  89. /package/__mf/js/async/{121.c8aa4904.js.LICENSE.txt → 121.f56fd949.js.LICENSE.txt} +0 -0
  90. /package/__mf/js/async/{392.97acdaa7.js.LICENSE.txt → 392.a629cdbc.js.LICENSE.txt} +0 -0
  91. /package/__mf/js/async/{470.c23991fd.js.LICENSE.txt → 470.f1cf6ff6.js.LICENSE.txt} +0 -0
  92. /package/__mf/js/async/{695.a3b5a24f.js.LICENSE.txt → 569.a2e6f431.js.LICENSE.txt} +0 -0
  93. /package/__mf/js/async/{941.86aff2f9.js.LICENSE.txt → 941.8f0ae6a3.js.LICENSE.txt} +0 -0
  94. /package/__mf/js/async/{980.03e0a41f.js.LICENSE.txt → 980.a766b9cd.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/HeatMapChart.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 { HeatMapChartOptionsEditorSettings, HeatMapChartPanel, HeatMapChartPanelProps } from './components';\nimport { createInitialHeatMapChartOptions, HeatMapChartOptions } from './heat-map-chart-model';\n\n/**\n * The core HeatMapChart panel plugin for Perses.\n */\nexport const HeatMapChart: PanelPlugin<HeatMapChartOptions, HeatMapChartPanelProps> = {\n PanelComponent: HeatMapChartPanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n queryOptions: {\n mode: 'range',\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: HeatMapChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialHeatMapChartOptions,\n};\n"],"names":["HeatMapChartOptionsEditorSettings","HeatMapChartPanel","createInitialHeatMapChartOptions","HeatMapChart","PanelComponent","supportedQueryTypes","queryOptions","mode","panelOptionsEditorComponents","label","content","createInitialOptions"],"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,iCAAiC,EAAEC,iBAAiB,QAAgC,eAAe;AAC5G,SAASC,gCAAgC,QAA6B,yBAAyB;AAE/F;;CAEC,GACD,OAAO,MAAMC,eAAyE;IACpFC,gBAAgBH;IAChBI,qBAAqB;QAAC;KAAkB;IACxCC,cAAc;QACZC,MAAM;IACR;IACAC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASV;QACX;KACD;IACDW,sBAAsBT;AACxB,EAAE"}
1
+ {"version":3,"sources":["../../src/HeatMapChart.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 { PanelPlugin } from '@perses-dev/plugin-system';\n\nimport type { HeatMapChartPanelProps } from './components';\nimport { HeatMapChartOptionsEditorSettings, HeatMapChartPanel } from './components';\nimport type { HeatMapChartOptions } from './heat-map-chart-model';\nimport { createInitialHeatMapChartOptions } from './heat-map-chart-model';\n\n/**\n * The core HeatMapChart panel plugin for Perses.\n */\nexport const HeatMapChart: PanelPlugin<HeatMapChartOptions, HeatMapChartPanelProps> = {\n PanelComponent: HeatMapChartPanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n queryOptions: {\n mode: 'range',\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: HeatMapChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialHeatMapChartOptions,\n};\n"],"names":["HeatMapChartOptionsEditorSettings","HeatMapChartPanel","createInitialHeatMapChartOptions","HeatMapChart","PanelComponent","supportedQueryTypes","queryOptions","mode","panelOptionsEditorComponents","label","content","createInitialOptions"],"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,iCAAiC,EAAEC,iBAAiB,QAAQ,wBAAe;AAEpF,SAASC,gCAAgC,QAAQ,4BAAyB;AAE1E;;CAEC,GACD,OAAO,MAAMC,eAAyE;IACpFC,gBAAgBH;IAChBI,qBAAqB;QAAC;KAAkB;IACxCC,cAAc;QACZC,MAAM;IACR;IACAC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASV;QACX;KACD;IACDW,sBAAsBT;AACxB,EAAE"}
package/lib/bootstrap.js CHANGED
@@ -11,8 +11,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import React from 'react';
15
- import ReactDOM from 'react-dom/client';
14
+ import React from "react";
15
+ import ReactDOM from "react-dom/client";
16
16
  const root = ReactDOM.createRoot(document.getElementById('root'));
17
17
  root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
18
18
 
@@ -1,7 +1,7 @@
1
- import { ReactElement } from 'react';
2
- import { FormatOptions } from '@perses-dev/components';
3
- import { TimeScale } from '@perses-dev/spec';
4
- import { LOG_BASE } from '../heat-map-chart-model';
1
+ import type { FormatOptions } from '@perses-dev/components';
2
+ import type { TimeScale } from '@perses-dev/spec';
3
+ import type { ReactElement } from 'react';
4
+ import type { LOG_BASE } from '../heat-map-chart-model';
5
5
  export type HeatMapData = [number, number, number, number | undefined];
6
6
  export interface HeatMapDataItem {
7
7
  value: HeatMapData;
@@ -1 +1 @@
1
- {"version":3,"file":"HeatMapChart.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAU,aAAa,EAA4C,MAAM,wBAAwB,CAAC;AAMzG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAqBnD,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEvE,MAAM,WAAW,e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AyB,CAAC;AAqBxD,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEvE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,WAAW,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,aAAa,EACb,GAAG,EACH,GAAG,EACH,OAAO,GACR,EAAE,iBAAiB,GAAG,YAAY,GAAG,IAAI,CAwJzC"}
@@ -11,14 +11,14 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { useMemo } from 'react';
15
- import { EChart, formatValue, useChartsTheme, useTimeZone } from '@perses-dev/components';
16
- import { use } from 'echarts/core';
17
- import { CustomChart } from 'echarts/charts';
18
- import { useTheme } from '@mui/material';
19
- import { getFormattedHeatmapAxisLabel } from '../utils';
20
- import { generateTooltipHTML } from './HeatMapTooltip';
21
- use([
14
+ import { useTheme } from "@mui/material";
15
+ import { EChart, formatValue, useChartsTheme, useTimeZone } from "@perses-dev/components";
16
+ import { CustomChart } from "echarts/charts";
17
+ import { use as registerECharts } from "echarts/core";
18
+ import { useMemo } from "react";
19
+ import { getFormattedHeatmapAxisLabel } from "../utils/index.js";
20
+ import { generateTooltipHTML } from "./HeatMapTooltip.js";
21
+ registerECharts([
22
22
  CustomChart
23
23
  ]);
24
24
  // The default coloring is a blue->yellow->red gradient
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HeatMapChart.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 } from 'react';\nimport { EChart, FormatOptions, formatValue, useChartsTheme, useTimeZone } from '@perses-dev/components';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { CustomChart } from 'echarts/charts';\nimport type { CustomSeriesRenderItemAPI, CustomSeriesRenderItemParams } from 'echarts';\nimport { useTheme } from '@mui/material';\nimport { CustomSeriesRenderItemReturn } from 'echarts/types/dist/echarts';\nimport { TimeScale } from '@perses-dev/spec';\nimport { LOG_BASE } from '../heat-map-chart-model';\nimport { getFormattedHeatmapAxisLabel } from '../utils';\nimport { generateTooltipHTML } from './HeatMapTooltip';\n\nuse([CustomChart]);\n\n// The default coloring is a blue->yellow->red gradient\nconst DEFAULT_VISUAL_MAP_COLORS = [\n '#313695',\n '#4575b4',\n '#74add1',\n '#abd9e9',\n '#e0f3f8',\n '#ffffbf',\n '#fee090',\n '#fdae61',\n '#f46d43',\n '#d73027',\n '#a50026',\n];\n\nexport type HeatMapData = [number, number, number, number | undefined]; // [xIndex, yLower, yUpper, count]\n\nexport interface HeatMapDataItem {\n value: HeatMapData;\n label: string;\n itemStyle?: {\n color?: string;\n borderColor?: string;\n borderWidth?: number;\n };\n}\n\nexport interface HeatMapChartProps {\n width: number;\n height: number;\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n countMin?: number;\n countMax?: number;\n timeScale?: TimeScale;\n showVisualMap?: boolean;\n min?: number;\n max?: number;\n logBase?: LOG_BASE;\n}\n\nexport function HeatMapChart({\n width,\n height,\n data,\n xAxisCategories,\n yAxisFormat,\n countFormat,\n countMin,\n countMax,\n timeScale,\n showVisualMap,\n min,\n max,\n logBase,\n}: HeatMapChartProps): ReactElement | null {\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { timeZone } = useTimeZone();\n\n const option: EChartsCoreOption = useMemo(() => {\n return {\n tooltip: {\n appendToBody: true,\n formatter: (params: { data: HeatMapDataItem; marker: string }): string => {\n return generateTooltipHTML({\n data: params.data.value,\n label: params.data.label,\n marker: params.marker,\n xAxisCategories,\n theme,\n yAxisFormat: yAxisFormat,\n countFormat: countFormat,\n });\n },\n },\n xAxis: {\n type: 'category',\n data: xAxisCategories,\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedHeatmapAxisLabel(timeScale?.rangeMs ?? 0, timeZone),\n },\n },\n yAxis: {\n type: logBase !== undefined ? 'log' : 'value',\n logBase: logBase,\n boundaryGap: [0, '10%'],\n min: min,\n max: max,\n axisLabel: {\n hideOverlap: true,\n formatter: (value: number): string => {\n // On log scales, ECharts may generate a tick at 0 which is mathematically\n // invalid (log(0) is undefined). Return empty string to hide such labels.\n if (logBase !== undefined && value === 0) {\n return '';\n }\n return formatValue(value, yAxisFormat);\n },\n },\n },\n visualMap: {\n show: showVisualMap ?? false,\n type: 'continuous',\n min: countMin,\n max: countMax,\n realtime: false,\n itemHeight: height - 30,\n itemWidth: 10,\n orient: 'vertical',\n left: 'right',\n top: 'center',\n inRange: {\n color: DEFAULT_VISUAL_MAP_COLORS,\n },\n textStyle: {\n color: theme.palette.text.primary,\n textBorderColor: theme.palette.background.default,\n textBorderWidth: 5,\n },\n // Color by the count dimension (index 3)\n dimension: 3,\n },\n series: [\n {\n name: 'HeatMap',\n type: 'custom',\n renderItem: function (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI\n ): CustomSeriesRenderItemReturn {\n const xIndex = api.value(0) as number;\n const yLower = api.value(1) as number;\n const yUpper = api.value(2) as number;\n\n // Pixel coordinates\n const upperStart = api.coord([xIndex, yUpper]);\n const lowerStart = api.coord([xIndex, yLower]);\n const upperNext = api.coord([xIndex + 1, yUpper]);\n\n const startX = upperStart?.[0];\n const upperY = upperStart?.[1];\n const lowerY = lowerStart?.[1];\n const nextX = upperNext?.[0];\n\n if (startX === undefined || upperY === undefined || lowerY === undefined || nextX === undefined) {\n return null;\n }\n\n const topY = Math.min(upperY, lowerY);\n const bottomY = Math.max(upperY, lowerY);\n const width = nextX - startX;\n const height = bottomY - topY;\n\n return {\n type: 'rect',\n shape: { x: startX, y: topY, width, height },\n style: {\n fill: api.visual('color'),\n },\n };\n },\n label: { show: false },\n dimensions: ['xIndex', 'yLower', 'yUpper', 'count'],\n encode: { x: 0, y: [1, 2], tooltip: [1, 2, 3] },\n data: data,\n progressive: 1000,\n animation: false,\n },\n ],\n };\n }, [\n xAxisCategories,\n timeScale?.rangeMs,\n timeZone,\n yAxisFormat,\n showVisualMap,\n countMin,\n countMax,\n height,\n theme,\n data,\n countFormat,\n min,\n max,\n logBase,\n ]);\n\n const chart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n sx={{\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n ),\n [chartsTheme.container.padding.default, chartsTheme.echartsTheme, height, option, width]\n );\n\n return <>{chart}</>;\n}\n"],"names":["useMemo","EChart","formatValue","useChartsTheme","useTimeZone","use","CustomChart","useTheme","getFormattedHeatmapAxisLabel","generateTooltipHTML","DEFAULT_VISUAL_MAP_COLORS","HeatMapChart","width","height","data","xAxisCategories","yAxisFormat","countFormat","countMin","countMax","timeScale","showVisualMap","min","max","logBase","chartsTheme","theme","timeZone","option","tooltip","appendToBody","formatter","params","value","label","marker","xAxis","type","axisLabel","hideOverlap","rangeMs","yAxis","undefined","boundaryGap","visualMap","show","realtime","itemHeight","itemWidth","orient","left","top","inRange","color","textStyle","palette","text","primary","textBorderColor","background","default","textBorderWidth","dimension","series","name","renderItem","api","xIndex","yLower","yUpper","upperStart","coord","lowerStart","upperNext","startX","upperY","lowerY","nextX","topY","Math","bottomY","shape","x","y","style","fill","visual","dimensions","encode","progressive","animation","chart","sx","padding","container","echartsTheme"],"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,QAAQ,QAAQ;AAC9C,SAASC,MAAM,EAAiBC,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,yBAAyB;AACzG,SAASC,GAAG,QAA2B,eAAe;AACtD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SAASC,QAAQ,QAAQ,gBAAgB;AAIzC,SAASC,4BAA4B,QAAQ,WAAW;AACxD,SAASC,mBAAmB,QAAQ,mBAAmB;AAEvDJ,IAAI;IAACC;CAAY;AAEjB,uDAAuD;AACvD,MAAMI,4BAA4B;IAChC;IACA;I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B,MAAM,CAAC;4BACnB;wBACF;oBACF;oBACApD,OAAO;wBAAEW,MAAM;oBAAM;oBACrB0C,YAAY;wBAAC;wBAAU;wBAAU;wBAAU;qBAAQ;oBACnDC,QAAQ;wBAAEN,GAAG;wBAAGC,GAAG;4BAAC;4BAAG;yBAAE;wBAAEtD,SAAS;4BAAC;4BAAG;4BAAG;yBAAE;oBAAC;oBAC9Cf,MAAMA;oBACN2E,aAAa;oBACbC,WAAW;gBACb;aACD;QACH;IACF,GAAG;QACD3E;QACAK,WAAWoB;QACXb;QACAX;QACAK;QACAH;QACAC;QACAN;QACAa;QACAZ;QACAG;QACAK;QACAC;QACAC;KACD;IAED,MAAMmE,QAAQ3F,QACZ,kBACE,KAACC;YACCmF,OAAO;gBACLxE,OAAOA;gBACPC,QAAQA;YACV;YACA+E,IAAI;gBACFC,SAAS,GAAGpE,YAAYqE,SAAS,CAACD,OAAO,CAACjC,OAAO,CAAC,EAAE,CAAC;YACvD;YACAhC,QAAQA;YACRF,OAAOD,YAAYsE,YAAY;YAGnC;QAACtE,YAAYqE,SAAS,CAACD,OAAO,CAACjC,OAAO;QAAEnC,YAAYsE,YAAY;QAAElF;QAAQe;QAAQhB;KAAM;IAG1F,qBAAO;kBAAG+E;;AACZ"}
1
+ {"version":3,"sources":["../../../src/components/HeatMapChart.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 { useTheme } from '@mui/material';\nimport type { FormatOptions } from '@perses-dev/components';\nimport { EChart, formatValue, useChartsTheme, useTimeZone } from '@perses-dev/components';\nimport type { TimeScale } from '@perses-dev/spec';\nimport type { CustomSeriesRenderItemAPI, CustomSeriesRenderItemParams, CustomSeriesRenderItemReturn } from 'echarts';\nimport { CustomChart } from 'echarts/charts';\nimport type { EChartsCoreOption } from 'echarts/core';\nimport { use as registerECharts } from 'echarts/core';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport type { LOG_BASE } from '../heat-map-chart-model';\nimport { getFormattedHeatmapAxisLabel } from '../utils';\nimport { generateTooltipHTML } from './HeatMapTooltip';\n\nregisterECharts([CustomChart]);\n\n// The default coloring is a blue->yellow->red gradient\nconst DEFAULT_VISUAL_MAP_COLORS = [\n '#313695',\n '#4575b4',\n '#74add1',\n '#abd9e9',\n '#e0f3f8',\n '#ffffbf',\n '#fee090',\n '#fdae61',\n '#f46d43',\n '#d73027',\n '#a50026',\n];\n\nexport type HeatMapData = [number, number, number, number | undefined]; // [xIndex, yLower, yUpper, count]\n\nexport interface HeatMapDataItem {\n value: HeatMapData;\n label: string;\n itemStyle?: {\n color?: string;\n borderColor?: string;\n borderWidth?: number;\n };\n}\n\nexport interface HeatMapChartProps {\n width: number;\n height: number;\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n countMin?: number;\n countMax?: number;\n timeScale?: TimeScale;\n showVisualMap?: boolean;\n min?: number;\n max?: number;\n logBase?: LOG_BASE;\n}\n\nexport function HeatMapChart({\n width,\n height,\n data,\n xAxisCategories,\n yAxisFormat,\n countFormat,\n countMin,\n countMax,\n timeScale,\n showVisualMap,\n min,\n max,\n logBase,\n}: HeatMapChartProps): ReactElement | null {\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { timeZone } = useTimeZone();\n\n const option: EChartsCoreOption = useMemo(() => {\n return {\n tooltip: {\n appendToBody: true,\n formatter: (params: { data: HeatMapDataItem; marker: string }): string => {\n return generateTooltipHTML({\n data: params.data.value,\n label: params.data.label,\n marker: params.marker,\n xAxisCategories,\n theme,\n yAxisFormat: yAxisFormat,\n countFormat: countFormat,\n });\n },\n },\n xAxis: {\n type: 'category',\n data: xAxisCategories,\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedHeatmapAxisLabel(timeScale?.rangeMs ?? 0, timeZone),\n },\n },\n yAxis: {\n type: logBase !== undefined ? 'log' : 'value',\n logBase: logBase,\n boundaryGap: [0, '10%'],\n min: min,\n max: max,\n axisLabel: {\n hideOverlap: true,\n formatter: (value: number): string => {\n // On log scales, ECharts may generate a tick at 0 which is mathematically\n // invalid (log(0) is undefined). Return empty string to hide such labels.\n if (logBase !== undefined && value === 0) {\n return '';\n }\n return formatValue(value, yAxisFormat);\n },\n },\n },\n visualMap: {\n show: showVisualMap ?? false,\n type: 'continuous',\n min: countMin,\n max: countMax,\n realtime: false,\n itemHeight: height - 30,\n itemWidth: 10,\n orient: 'vertical',\n left: 'right',\n top: 'center',\n inRange: {\n color: DEFAULT_VISUAL_MAP_COLORS,\n },\n textStyle: {\n color: theme.palette.text.primary,\n textBorderColor: theme.palette.background.default,\n textBorderWidth: 5,\n },\n // Color by the count dimension (index 3)\n dimension: 3,\n },\n series: [\n {\n name: 'HeatMap',\n type: 'custom',\n renderItem: function (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI,\n ): CustomSeriesRenderItemReturn {\n const xIndex = api.value(0) as number;\n const yLower = api.value(1) as number;\n const yUpper = api.value(2) as number;\n\n // Pixel coordinates\n const upperStart = api.coord([xIndex, yUpper]);\n const lowerStart = api.coord([xIndex, yLower]);\n const upperNext = api.coord([xIndex + 1, yUpper]);\n\n const startX = upperStart?.[0];\n const upperY = upperStart?.[1];\n const lowerY = lowerStart?.[1];\n const nextX = upperNext?.[0];\n\n if (startX === undefined || upperY === undefined || lowerY === undefined || nextX === undefined) {\n return null;\n }\n\n const topY = Math.min(upperY, lowerY);\n const bottomY = Math.max(upperY, lowerY);\n const width = nextX - startX;\n const height = bottomY - topY;\n\n return {\n type: 'rect',\n shape: { x: startX, y: topY, width, height },\n style: {\n fill: api.visual('color'),\n },\n };\n },\n label: { show: false },\n dimensions: ['xIndex', 'yLower', 'yUpper', 'count'],\n encode: { x: 0, y: [1, 2], tooltip: [1, 2, 3] },\n data: data,\n progressive: 1000,\n animation: false,\n },\n ],\n };\n }, [\n xAxisCategories,\n timeScale?.rangeMs,\n timeZone,\n yAxisFormat,\n showVisualMap,\n countMin,\n countMax,\n height,\n theme,\n data,\n countFormat,\n min,\n max,\n logBase,\n ]);\n\n const chart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n sx={{\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n ),\n [chartsTheme.container.padding.default, chartsTheme.echartsTheme, height, option, width],\n );\n\n return <>{chart}</>;\n}\n"],"names":["useTheme","EChart","formatValue","useChartsTheme","useTimeZone","CustomChart","use","registerECharts","useMemo","getFormattedHeatmapAxisLabel","generateTooltipHTML","DEFAULT_VISUAL_MAP_COLORS","HeatMapChart","width","height","data","xAxisCategories","yAxisFormat","countFormat","countMin","countMax","timeScale","showVisualMap","min","max","logBase","chartsTheme","theme","timeZone","option","tooltip","appendToBody","formatter","params","value","label","marker","xAxis","type","axisLabel","hideOverlap","rangeMs","yAxis","undefined","boundaryGap","visualMap","show","realtime","itemHeight","itemWidth","orient","left","top","inRange","color","textStyle","palette","text","primary","textBorderColor","background","default","textBorderWidth","dimension","series","name","renderItem","api","xIndex","yLower","yUpper","upperStart","coord","lowerStart","upperNext","startX","upperY","lowerY","nextX","topY","Math","bottomY","shape","x","y","style","fill","visual","dimensions","encode","progressive","animation","chart","sx","padding","container","echartsTheme"],"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,QAAQ,QAAQ,gBAAgB;AAE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nC,WAAW;4BAC/F,OAAO;wBACT;wBAEA,MAAMoC,OAAOC,KAAKzD,GAAG,CAACqD,QAAQC;wBAC9B,MAAMI,UAAUD,KAAKxD,GAAG,CAACoD,QAAQC;wBACjC,MAAMhE,QAAQiE,QAAQH;wBACtB,MAAM7D,SAASmE,UAAUF;wBAEzB,OAAO;4BACLzC,MAAM;4BACN4C,OAAO;gCAAEC,GAAGR;gCAAQS,GAAGL;gCAAMlE;gCAAOC;4BAAO;4BAC3CuE,OAAO;gCACLC,MAAMnB,IAAIoB,MAAM,CAAC;4BACnB;wBACF;oBACF;oBACApD,OAAO;wBAAEW,MAAM;oBAAM;oBACrB0C,YAAY;wBAAC;wBAAU;wBAAU;wBAAU;qBAAQ;oBACnDC,QAAQ;wBAAEN,GAAG;wBAAGC,GAAG;4BAAC;4BAAG;yBAAE;wBAAEtD,SAAS;4BAAC;4BAAG;4BAAG;yBAAE;oBAAC;oBAC9Cf,MAAMA;oBACN2E,aAAa;oBACbC,WAAW;gBACb;aACD;QACH;IACF,GAAG;QACD3E;QACAK,WAAWoB;QACXb;QACAX;QACAK;QACAH;QACAC;QACAN;QACAa;QACAZ;QACAG;QACAK;QACAC;QACAC;KACD;IAED,MAAMmE,QAAQpF,QACZ,kBACE,KAACP;YACCoF,OAAO;gBACLxE,OAAOA;gBACPC,QAAQA;YACV;YACA+E,IAAI;gBACFC,SAAS,GAAGpE,YAAYqE,SAAS,CAACD,OAAO,CAACjC,OAAO,CAAC,EAAE,CAAC;YACvD;YACAhC,QAAQA;YACRF,OAAOD,YAAYsE,YAAY;YAGnC;QAACtE,YAAYqE,SAAS,CAACD,OAAO,CAACjC,OAAO;QAAEnC,YAAYsE,YAAY;QAAElF;QAAQe;QAAQhB;KAAM;IAG1F,qBAAO;kBAAG+E;;AACZ"}
@@ -1,4 +1,4 @@
1
- import { ReactElement } from 'react';
2
- import { HeatMapChartOptionsEditorProps } from '../heat-map-chart-model';
1
+ import type { ReactElement } from 'react';
2
+ import type { HeatMapChartOptionsEditorProps } from '../heat-map-chart-model';
3
3
  export declare function HeatMapChartOptionsEditorSettings(props: HeatMapChartOptionsEditorProps): ReactElement;
4
4
  //# sourceMappingURL=HeatMapChartOptionsEditorSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeatMapChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAGL,8BAA8B,EAG/B,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,8BAA8B,GAAG,YAAY,CA4GrG"}
1
+ {"version":3,"file":"HeatMapChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAuB,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAGnG,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,8BAA8B,GAAG,YAAY,CA4GrG"}
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  // Copyright The Perses Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,11 +10,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
14
- import { Switch, TextField } from '@mui/material';
15
- import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, SettingsAutocomplete } from '@perses-dev/components';
16
- import { produce } from 'immer';
17
- import merge from 'lodash/merge';
18
- import { DEFAULT_FORMAT, LOG_BASE_CONFIG, LOG_BASE_OPTIONS } from '../heat-map-chart-model';
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Switch, TextField } from "@mui/material";
15
+ import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, SettingsAutocomplete } from "@perses-dev/components";
16
+ import { produce } from "immer";
17
+ import merge from "lodash/merge";
18
+ import { DEFAULT_FORMAT, LOG_BASE_CONFIG, LOG_BASE_OPTIONS } from "../heat-map-chart-model.js";
19
19
  export function HeatMapChartOptionsEditorSettings(props) {
20
20
  const { onChange, value } = props;
21
21
  const handleYAxisFormatChange = (newFormat)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HeatMapChartOptionsEditorSettings.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 { Switch, SwitchProps, TextField } from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n SettingsAutocomplete,\n} from '@perses-dev/components';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport { ReactElement } from 'react';\nimport {\n DEFAULT_FORMAT,\n HeatMapChartOptions,\n HeatMapChartOptionsEditorProps,\n LOG_BASE_CONFIG,\n LOG_BASE_OPTIONS,\n} from '../heat-map-chart-model';\n\nexport function HeatMapChartOptionsEditorSettings(props: HeatMapChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleYAxisFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.yAxisFormat = newFormat;\n })\n );\n };\n\n const handleCountFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.countFormat = newFormat;\n })\n );\n };\n\n const handleShowVisualMapChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.showVisualMap = checked;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const yAxisFormat = merge({}, DEFAULT_FORMAT, value.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, value.countFormat);\n\n // Get the current log base configuration, defaulting to 'none' if not set\n const logBaseKey = value.logBase ? String(value.logBase) : 'none';\n const logBase = LOG_BASE_CONFIG[logBaseKey] ?? LOG_BASE_CONFIG['none'];\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Bucket Count\">\n <FormatControls value={countFormat} onChange={handleCountFormatChange} />\n <OptionsEditorControl\n label=\"Show Visual Map\"\n control={<Switch checked={!!value.showVisualMap} onChange={handleShowVisualMapChange} />}\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Y Axis\">\n <FormatControls value={yAxisFormat} onChange={handleYAxisFormatChange} />\n <OptionsEditorControl\n label=\"Min\"\n control={\n <TextField\n type=\"number\"\n value={value.min ?? ''}\n onChange={(e) => {\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.min = newValue;\n })\n );\n }}\n placeholder=\"Auto\"\n sx={{ width: '100%' }}\n />\n }\n />\n <OptionsEditorControl\n label=\"Max\"\n control={\n <TextField\n type=\"number\"\n value={value.max ?? ''}\n onChange={(e) => {\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.max = newValue;\n })\n );\n }}\n placeholder=\"Auto\"\n sx={{ width: '100%' }}\n />\n }\n />\n <OptionsEditorControl\n label=\"Log Base\"\n control={\n <SettingsAutocomplete\n value={{ ...logBase, id: logBase?.label ?? 'None' }}\n options={LOG_BASE_OPTIONS}\n onChange={(__, newValue) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.logBase = newValue.log;\n })\n );\n }}\n disableClearable\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Switch","TextField","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","SettingsAutocomplete","produce","merge","DEFAULT_FORMAT","LOG_BASE_CONFIG","LOG_BASE_OPTIONS","HeatMapChartOptionsEditorSettings","props","onChange","value","handleYAxisFormatChange","newFormat","draft","yAxisFormat","handleCountFormatChange","countFormat","handleShowVisualMapChange","_","checked","showVisualMap","logBaseKey","logBase","String","title","label","control","type","min","e","newValue","target","Number","undefined","placeholder","sx","width","max","id","options","__","log","disableClearable"],"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,MAAM,EAAeC,SAAS,QAAQ,gBAAgB;AAC/D,SACEC,cAAc,EAEdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,oBAAoB,QACf,yBAAyB;AAChC,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SACEC,cAAc,EAGdC,eAAe,EACfC,gBAAgB,QACX,0BAA0B;AAEjC,OAAO,SAASC,kCAAkCC,KAAqC;IACrF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,MAAMG,0BAA2D,CAACC;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oCAAEC,OAAO;gCAAO;;;sCAI1B,KAACtC;4BACC2B,OAAM;4BACNC,uBACE,KAAC/B;gCACCgC,MAAK;gCACLjB,OAAOA,MAAM2B,GAAG,IAAI;gCACpB5B,UAAU,CAACoB;oCACT,MAAMC,WAAWD,EAAEE,MAAM,CAACrB,KAAK,GAAGsB,OAAOH,EAAEE,MAAM,CAACrB,KAAK,IAAIuB;oCAC3DxB,SACEP,QAAQQ,OAAO,CAACG;wCACdA,MAAMwB,GAAG,GAAGP;oCACd;gCAEJ;gCACAI,aAAY;gCACZC,IAAI;oCAAEC,OAAO;gCAAO;;;sCAI1B,KAACtC;4BACC2B,OAAM;4BACNC,uBACE,KAACzB;gCACCS,OAAO;oCAAE,GAAGY,OAAO;oCAAEgB,IAAIhB,SAASG,SAAS;gCAAO;gCAClDc,SAASjC;gCACTG,UAAU,CAAC+B,IAAIV;oCACbrB,SACEP,QAAQQ,OAAO,CAACG;wCACdA,MAAMS,OAAO,GAAGQ,SAASW,GAAG;oCAC9B;gCAEJ;gCACAC,gBAAgB;;;;;;;;AAQhC"}
1
+ {"version":3,"sources":["../../../src/components/HeatMapChartOptionsEditorSettings.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 type { SwitchProps } from '@mui/material';\nimport { Switch, TextField } from '@mui/material';\nimport type { FormatControlsProps } from '@perses-dev/components';\nimport {\n FormatControls,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n SettingsAutocomplete,\n} from '@perses-dev/components';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\n\nimport type { HeatMapChartOptions, HeatMapChartOptionsEditorProps } from '../heat-map-chart-model';\nimport { DEFAULT_FORMAT, LOG_BASE_CONFIG, LOG_BASE_OPTIONS } from '../heat-map-chart-model';\n\nexport function HeatMapChartOptionsEditorSettings(props: HeatMapChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleYAxisFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.yAxisFormat = newFormat;\n }),\n );\n };\n\n const handleCountFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.countFormat = newFormat;\n }),\n );\n };\n\n const handleShowVisualMapChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.showVisualMap = checked;\n }),\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const yAxisFormat = merge({}, DEFAULT_FORMAT, value.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, value.countFormat);\n\n // Get the current log base configuration, defaulting to 'none' if not set\n const logBaseKey = value.logBase ? String(value.logBase) : 'none';\n const logBase = LOG_BASE_CONFIG[logBaseKey] ?? LOG_BASE_CONFIG['none'];\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Bucket Count\">\n <FormatControls value={countFormat} onChange={handleCountFormatChange} />\n <OptionsEditorControl\n label=\"Show Visual Map\"\n control={<Switch checked={!!value.showVisualMap} onChange={handleShowVisualMapChange} />}\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Y Axis\">\n <FormatControls value={yAxisFormat} onChange={handleYAxisFormatChange} />\n <OptionsEditorControl\n label=\"Min\"\n control={\n <TextField\n type=\"number\"\n value={value.min ?? ''}\n onChange={(e) => {\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.min = newValue;\n }),\n );\n }}\n placeholder=\"Auto\"\n sx={{ width: '100%' }}\n />\n }\n />\n <OptionsEditorControl\n label=\"Max\"\n control={\n <TextField\n type=\"number\"\n value={value.max ?? ''}\n onChange={(e) => {\n const newValue = e.target.value ? Number(e.target.value) : undefined;\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.max = newValue;\n }),\n );\n }}\n placeholder=\"Auto\"\n sx={{ width: '100%' }}\n />\n }\n />\n <OptionsEditorControl\n label=\"Log Base\"\n control={\n <SettingsAutocomplete\n value={{ ...logBase, id: logBase?.label ?? 'None' }}\n options={LOG_BASE_OPTIONS}\n onChange={(__, newValue) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.logBase = newValue.log;\n }),\n );\n }}\n disableClearable\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Switch","TextField","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","SettingsAutocomplete","produce","merge","DEFAULT_FORMAT","LOG_BASE_CONFIG","LOG_BASE_OPTIONS","HeatMapChartOptionsEditorSettings","props","onChange","value","handleYAxisFormatChange","newFormat","draft","yAxisFormat","handleCountFormatChange","countFormat","handleShowVisualMapChange","_","checked","showVisualMap","logBaseKey","logBase","String","title","label","control","type","min","e","newValue","target","Number","undefined","placeholder","sx","width","max","id","options","__","log","disableClearable"],"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,MAAM,EAAEC,SAAS,QAAQ,gBAAgB;AAElD,SACEC,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iB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BACE,KAAC/B;gCACCgC,MAAK;gCACLjB,OAAOA,MAAMkB,GAAG,IAAI;gCACpBnB,UAAU,CAACoB;oCACT,MAAMC,WAAWD,EAAEE,MAAM,CAACrB,KAAK,GAAGsB,OAAOH,EAAEE,MAAM,CAACrB,KAAK,IAAIuB;oCAC3DxB,SACEP,QAAQQ,OAAO,CAACG;wCACdA,MAAMe,GAAG,GAAGE;oCACd;gCAEJ;gCACAI,aAAY;gCACZC,IAAI;oCAAEC,OAAO;gCAAO;;;sCAI1B,KAACtC;4BACC2B,OAAM;4BACNC,uBACE,KAAC/B;gCACCgC,MAAK;gCACLjB,OAAOA,MAAM2B,GAAG,IAAI;gCACpB5B,UAAU,CAACoB;oCACT,MAAMC,WAAWD,EAAEE,MAAM,CAACrB,KAAK,GAAGsB,OAAOH,EAAEE,MAAM,CAACrB,KAAK,IAAIuB;oCAC3DxB,SACEP,QAAQQ,OAAO,CAACG;wCACdA,MAAMwB,GAAG,GAAGP;oCACd;gCAEJ;gCACAI,aAAY;gCACZC,IAAI;oCAAEC,OAAO;gCAAO;;;sCAI1B,KAACtC;4BACC2B,OAAM;4BACNC,uBACE,KAACzB;gCACCS,OAAO;oCAAE,GAAGY,OAAO;oCAAEgB,IAAIhB,SAASG,SAAS;gCAAO;gCAClDc,SAASjC;gCACTG,UAAU,CAAC+B,IAAIV;oCACbrB,SACEP,QAAQQ,OAAO,CAACG;wCACdA,MAAMS,OAAO,GAAGQ,SAASW,GAAG;oCAC9B;gCAEJ;gCACAC,gBAAgB;;;;;;;;AAQhC"}
@@ -1,7 +1,7 @@
1
- import { PanelProps } from '@perses-dev/plugin-system';
2
- import { ReactElement } from 'react';
3
- import { TimeSeriesData } from '@perses-dev/spec';
4
- import { HeatMapChartOptions } from '../heat-map-chart-model';
1
+ import type { PanelProps } from '@perses-dev/plugin-system';
2
+ import type { TimeSeriesData } from '@perses-dev/spec';
3
+ import type { ReactElement } from 'react';
4
+ import type { HeatMapChartOptions } from '../heat-map-chart-model';
5
5
  export type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;
6
6
  export declare function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null;
7
7
  //# sourceMappingURL=HeatMapChartPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeatMapChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChartPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAyB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAkB,mBAAmB,EAAY,MAAM,yBAAyB,CAAC;AAiBxF,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;AAErF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,GAAG,IAAI,CA0MpF"}
1
+ {"version":3,"file":"HeatMapChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChartPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAyB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,yBAAyB,CAAC;AAmB7E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;AAErF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,GAAG,IAAI,CA0MpF"}
@@ -11,12 +11,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { Stack, Typography } from '@mui/material';
15
- import merge from 'lodash/merge';
16
- import { useMemo } from 'react';
17
- import { DEFAULT_FORMAT } from '../heat-map-chart-model';
18
- import { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';
19
- import { HeatMapChart } from './HeatMapChart';
14
+ import { Stack, Typography } from "@mui/material";
15
+ import merge from "lodash/merge";
16
+ import { useMemo } from "react";
17
+ import { DEFAULT_FORMAT } from "../heat-map-chart-model.js";
18
+ import { generateCompleteTimestamps, getCommonTimeScaleForQueries } from "../utils/index.js";
19
+ import { HeatMapChart } from "./HeatMapChart.js";
20
20
  /**
21
21
  * Helper function to get the effective lower bound for log scale.
22
22
  * For values <= 0, we use a small fraction of the upper bound.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HeatMapChartPanel.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 { Stack, Typography } from '@mui/material';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/spec';\nimport { DEFAULT_FORMAT, HeatMapChartOptions, LOG_BASE } from '../heat-map-chart-model';\nimport { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';\nimport { HeatMapChart, HeatMapDataItem } from './HeatMapChart';\n\n/**\n * Helper function to get the effective lower bound for log scale.\n * For values <= 0, we use a small fraction of the upper bound.\n */\nconst getEffectiveLowerBound = (lowerBound: number, upperBound: number, logBase: LOG_BASE): number => {\n if (logBase === undefined || lowerBound > 0) {\n return lowerBound;\n }\n // For log scales with non-positive lower bounds, use a small fraction of upper bound\n // This ensures the bucket is still visible on the log scale\n return upperBound * 0.001;\n};\n\nexport type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;\n\nexport function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n\n // ensures all default format properties set if undef\n const yAxisFormat = merge({}, DEFAULT_FORMAT, pluginSpec.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, pluginSpec.countFormat);\n\n const {\n data,\n xAxisCategories,\n min,\n max,\n countMin,\n countMax,\n timeScale,\n }: {\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n min?: number;\n max?: number;\n countMin: number;\n countMax: number;\n timeScale?: TimeScale;\n } = useMemo(() => {\n if (!queryResults || queryResults.length === 0) {\n return {\n data: [],\n xAxisCategories: [],\n min: 0,\n max: 0,\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n if (\n queryResults.length !== 1 ||\n queryResults[0]!.data.series.length !== 1 ||\n queryResults[0]!.data.series[0]!.histograms === undefined\n ) {\n return {\n data: [],\n xAxisCategories: [],\n min: 0,\n max: 0,\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n const series: TimeSeries = queryResults[0]!.data.series[0]!;\n\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n const xAxisCategories: number[] = generateCompleteTimestamps(timeScale);\n\n const logBase = pluginSpec.logBase;\n\n // Dummy value that will be replaced at the first iteration\n let lowestBound = Infinity;\n let highestBound = -Infinity;\n let countMin = Infinity;\n let countMax = -Infinity;\n\n for (const [, histogram] of series?.histograms ?? []) {\n for (const bucket of histogram?.buckets ?? []) {\n const [, lowerBound, upperBound, count] = bucket;\n let lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n const countFloat = parseFloat(count);\n\n // For logarithmic scales, skip buckets that would be entirely non-positive\n if (logBase !== undefined && upperBoundFloat <= 0) {\n continue;\n }\n\n // For log scales, adjust non-positive lower bounds\n if (logBase !== undefined) {\n lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);\n }\n\n if (lowerBoundFloat < lowestBound) {\n lowestBound = lowerBoundFloat;\n }\n if (upperBoundFloat > highestBound) {\n highestBound = upperBoundFloat;\n }\n if (countFloat < countMin) {\n countMin = countFloat;\n }\n if (countFloat > countMax) {\n countMax = countFloat;\n }\n }\n }\n\n const data: HeatMapDataItem[] = [];\n // Each bucket becomes a rectangle spanning [lowerBound, upperBound] at the given x index\n for (const [time, histogram] of series?.histograms ?? []) {\n const itemIndexOnXaxis = xAxisCategories.findIndex((v) => v === time * 1000);\n\n for (const bucket of histogram?.buckets ?? []) {\n const [, lowerBound, upperBound, count] = bucket;\n let lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n\n // For logarithmic scales, skip buckets that would be entirely non-positive\n if (logBase !== undefined && upperBoundFloat <= 0) {\n continue;\n }\n\n // For log scales, adjust non-positive lower bounds\n if (logBase !== undefined) {\n lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);\n }\n\n data.push({\n value: [itemIndexOnXaxis, lowerBoundFloat, upperBoundFloat, parseFloat(count)],\n label: count,\n });\n }\n }\n return {\n data,\n xAxisCategories,\n min: lowestBound === Infinity ? undefined : lowestBound,\n max: highestBound === -Infinity ? undefined : highestBound,\n countMin,\n countMax,\n timeScale,\n };\n }, [pluginSpec.logBase, queryResults]);\n\n // Use configured min/max if provided, otherwise use calculated values\n // For logarithmic scales, ignore user-provided min if it's <= 0 (log of non-positive is undefined)\n // and let ECharts auto-calculate the range to avoid rendering issues\n const finalMin = useMemo(() => {\n if (pluginSpec.logBase !== undefined) {\n // For log scale, ignore min if it's <= 0 or let ECharts auto-calculate\n if (pluginSpec.min !== undefined && pluginSpec.min <= 0) {\n return undefined; // Let ECharts auto-calculate\n }\n return pluginSpec.min ?? min;\n }\n return pluginSpec.min ?? min;\n }, [pluginSpec.logBase, pluginSpec.min, min]);\n\n const finalMax = useMemo(() => {\n if (pluginSpec.logBase !== undefined) {\n // For log scale, ignore max if it's <= 0\n if (pluginSpec.max !== undefined && pluginSpec.max <= 0) {\n return undefined; // Let ECharts auto-calculate\n }\n return pluginSpec.max ?? max;\n }\n return pluginSpec.max ?? max;\n }, [pluginSpec.logBase, pluginSpec.max, max]);\n\n // TODO: add support for multiple queries\n if (queryResults.length > 1) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n Only one query at a time is supported for now\n </Typography>\n </Stack>\n );\n }\n\n // Mo data message handled inside chart component\n if (data.length === 0) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n No data available (only native histograms are supported for now)\n </Typography>\n </Stack>\n );\n }\n\n if (contentDimensions === undefined) return null;\n\n return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n <HeatMapChart\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={data}\n xAxisCategories={xAxisCategories}\n yAxisFormat={yAxisFormat}\n countFormat={countFormat}\n countMin={countMin}\n countMax={countMax}\n timeScale={timeScale}\n showVisualMap={pluginSpec.showVisualMap}\n min={finalMin}\n max={finalMax}\n logBase={pluginSpec.logBase}\n />\n </Stack>\n );\n}\n"],"names":["Stack","Typography","merge","useMemo","DEFAULT_FORMAT","generateCompleteTimestamps","getCommonTimeScaleForQueries","HeatMapChart","getEffectiveLowerBound","lowerBound","upperBound","logBase","undefined","HeatMapChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","yAxisFormat","countFormat","data","xAxisCategories","min","max","countMin","countMax","timeScale","length","series","histograms","lowestBound","Infinity","highestBound","histogram","bucket","buckets","count","lowerBoundFloat","parseFloat","upperBoundFloat","countFloat","time","itemIndexOnXaxis","findIndex","v","push","value","label","finalMin","finalMax","justifyContent","height","variant","textAlign","direction","alignItems","width","showVisualMap"],"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,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAElD,OAAOC,WAAW,eAAe;AACjC,SAAuBC,OAAO,QAAQ,QAAQ;AAE9C,SAASC,cAAc,QAAuC,0BAA0B;AACxF,SAASC,0BAA0B,EAAEC,4BAA4B,QAAQ,WAAW;AACpF,SAASC,YAAY,QAAyB,iBAAiB;AAE/D;;;CAGC,GACD,MAAMC,yBAAyB,CAACC,YAAoBC,YAAoBC;IACtE,IAAIA,YAAYC,aAAaH,aAAa,GAAG;QAC3C,OAAOA;IACT;IACA,qFAAqF;IACrF,4DAA4D;IAC5D,OAAOC,aAAa;AACtB;AAIA,OAAO,SAASG,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,MAAMC,UAAU,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGJ;IAE9D,qDAAqD;IACrD,MAAMK,cAAcjB,MAAM,CAAC,GAAGE,gBAAgBY,WAAWG,WAAW;IACpE,MAAMC,cAAclB,MAAM,CAAC,GAAGE,gBAAgBY,WAAWI,WAAW;IAEpE,MAAM,EACJC,IAAI,EACJC,eAAe,EACfC,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACV,GAQGxB,QAAQ;QACV,IAAI,CAACe,gBAAgBA,aAAaU,MAAM,KAAK,GAAG;YAC9C,OAAO;gBACLP,MAAM,EAAE;gBACRC,iBAAiB,EAAE;gBACnBC,KAAK;gBACLC,KAAK;gBACLC,UAAU;gBACVC,UAAU;gBACVC,WAAWf;YACb;QACF;QAEA,IACEM,aAAaU,MAAM,KAAK,KACxBV,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AAW/C,QAAQ;QACvB,IAAIa,WAAWL,OAAO,KAAKC,WAAW;YACpC,yCAAyC;YACzC,IAAII,WAAWQ,GAAG,KAAKZ,aAAaI,WAAWQ,GAAG,IAAI,GAAG;gBACvD,OAAOZ,WAAW,6BAA6B;YACjD;YACA,OAAOI,WAAWQ,GAAG,IAAIA;QAC3B;QACA,OAAOR,WAAWQ,GAAG,IAAIA;IAC3B,GAAG;QAACR,WAAWL,OAAO;QAAEK,WAAWQ,GAAG;QAAEA;KAAI;IAE5C,yCAAyC;IACzC,IAAIN,aAAaU,MAAM,GAAG,GAAG;QAC3B,qBACE,KAAC5B;YAAMmD,gBAAe;YAASC,QAAO;sBACpC,cAAA,KAACnD;gBAAWoD,SAAQ;gBAAQC,WAAU;0BAAS;;;IAKrD;IAEA,iDAAiD;IACjD,IAAIjC,KAAKO,MAAM,KAAK,GAAG;QACrB,qBACE,KAAC5B;YAAMmD,gBAAe;YAASC,QAAO;sBACpC,cAAA,KAACnD;gBAAWoD,SAAQ;gBAAQC,WAAU;0BAAS;;;IAKrD;IAEA,IAAIrC,sBAAsBL,WAAW,OAAO;IAE5C,qBACE,KAACZ;QAAMuD,WAAU;QAAMJ,gBAAe;QAASK,YAAW;kBACxD,cAAA,KAACjD;YACCkD,OAAOxC,kBAAkBwC,KAAK;YAC9BL,QAAQnC,kBAAkBmC,MAAM;YAChC/B,MAAMA;YACNC,iBAAiBA;YACjBH,aAAaA;YACbC,aAAaA;YACbK,UAAUA;YACVC,UAAUA;YACVC,WAAWA;YACX+B,eAAe1C,WAAW0C,aAAa;YACvCnC,KAAK0B;YACLzB,KAAK0B;YACLvC,SAASK,WAAWL,OAAO;;;AAInC"}
1
+ {"version":3,"sources":["../../../src/components/HeatMapChartPanel.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 { Stack, Typography } from '@mui/material';\nimport type { PanelProps } from '@perses-dev/plugin-system';\nimport type { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/spec';\nimport merge from 'lodash/merge';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport type { HeatMapChartOptions, LOG_BASE } from '../heat-map-chart-model';\nimport { DEFAULT_FORMAT } from '../heat-map-chart-model';\nimport { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';\nimport type { HeatMapDataItem } from './HeatMapChart';\nimport { HeatMapChart } from './HeatMapChart';\n\n/**\n * Helper function to get the effective lower bound for log scale.\n * For values <= 0, we use a small fraction of the upper bound.\n */\nconst getEffectiveLowerBound = (lowerBound: number, upperBound: number, logBase: LOG_BASE): number => {\n if (logBase === undefined || lowerBound > 0) {\n return lowerBound;\n }\n // For log scales with non-positive lower bounds, use a small fraction of upper bound\n // This ensures the bucket is still visible on the log scale\n return upperBound * 0.001;\n};\n\nexport type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;\n\nexport function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n\n // ensures all default format properties set if undef\n const yAxisFormat = merge({}, DEFAULT_FORMAT, pluginSpec.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, pluginSpec.countFormat);\n\n const {\n data,\n xAxisCategories,\n min,\n max,\n countMin,\n countMax,\n timeScale,\n }: {\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n min?: number;\n max?: number;\n countMin: number;\n countMax: number;\n timeScale?: TimeScale;\n } = useMemo(() => {\n if (!queryResults || queryResults.length === 0) {\n return {\n data: [],\n xAxisCategories: [],\n min: 0,\n max: 0,\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n if (\n queryResults.length !== 1 ||\n queryResults[0]!.data.series.length !== 1 ||\n queryResults[0]!.data.series[0]!.histograms === undefined\n ) {\n return {\n data: [],\n xAxisCategories: [],\n min: 0,\n max: 0,\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n const series: TimeSeries = queryResults[0]!.data.series[0]!;\n\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n const xAxisCategories: number[] = generateCompleteTimestamps(timeScale);\n\n const logBase = pluginSpec.logBase;\n\n // Dummy value that will be replaced at the first iteration\n let lowestBound = Infinity;\n let highestBound = -Infinity;\n let countMin = Infinity;\n let countMax = -Infinity;\n\n for (const [, histogram] of series?.histograms ?? []) {\n for (const bucket of histogram?.buckets ?? []) {\n const [, lowerBound, upperBound, count] = bucket;\n let lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n const countFloat = parseFloat(count);\n\n // For logarithmic scales, skip buckets that would be entirely non-positive\n if (logBase !== undefined && upperBoundFloat <= 0) {\n continue;\n }\n\n // For log scales, adjust non-positive lower bounds\n if (logBase !== undefined) {\n lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);\n }\n\n if (lowerBoundFloat < lowestBound) {\n lowestBound = lowerBoundFloat;\n }\n if (upperBoundFloat > highestBound) {\n highestBound = upperBoundFloat;\n }\n if (countFloat < countMin) {\n countMin = countFloat;\n }\n if (countFloat > countMax) {\n countMax = countFloat;\n }\n }\n }\n\n const data: HeatMapDataItem[] = [];\n // Each bucket becomes a rectangle spanning [lowerBound, upperBound] at the given x index\n for (const [time, histogram] of series?.histograms ?? []) {\n const itemIndexOnXaxis = xAxisCategories.findIndex((v) => v === time * 1000);\n\n for (const bucket of histogram?.buckets ?? []) {\n const [, lowerBound, upperBound, count] = bucket;\n let lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n\n // For logarithmic scales, skip buckets that would be entirely non-positive\n if (logBase !== undefined && upperBoundFloat <= 0) {\n continue;\n }\n\n // For log scales, adjust non-positive lower bounds\n if (logBase !== undefined) {\n lowerBoundFloat = getEffectiveLowerBound(lowerBoundFloat, upperBoundFloat, logBase);\n }\n\n data.push({\n value: [itemIndexOnXaxis, lowerBoundFloat, upperBoundFloat, parseFloat(count)],\n label: count,\n });\n }\n }\n return {\n data,\n xAxisCategories,\n min: lowestBound === Infinity ? undefined : lowestBound,\n max: highestBound === -Infinity ? undefined : highestBound,\n countMin,\n countMax,\n timeScale,\n };\n }, [pluginSpec.logBase, queryResults]);\n\n // Use configured min/max if provided, otherwise use calculated values\n // For logarithmic scales, ignore user-provided min if it's <= 0 (log of non-positive is undefined)\n // and let ECharts auto-calculate the range to avoid rendering issues\n const finalMin = useMemo(() => {\n if (pluginSpec.logBase !== undefined) {\n // For log scale, ignore min if it's <= 0 or let ECharts auto-calculate\n if (pluginSpec.min !== undefined && pluginSpec.min <= 0) {\n return undefined; // Let ECharts auto-calculate\n }\n return pluginSpec.min ?? min;\n }\n return pluginSpec.min ?? min;\n }, [pluginSpec.logBase, pluginSpec.min, min]);\n\n const finalMax = useMemo(() => {\n if (pluginSpec.logBase !== undefined) {\n // For log scale, ignore max if it's <= 0\n if (pluginSpec.max !== undefined && pluginSpec.max <= 0) {\n return undefined; // Let ECharts auto-calculate\n }\n return pluginSpec.max ?? max;\n }\n return pluginSpec.max ?? max;\n }, [pluginSpec.logBase, pluginSpec.max, max]);\n\n // TODO: add support for multiple queries\n if (queryResults.length > 1) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n Only one query at a time is supported for now\n </Typography>\n </Stack>\n );\n }\n\n // Mo data message handled inside chart component\n if (data.length === 0) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n No data available (only native histograms are supported for now)\n </Typography>\n </Stack>\n );\n }\n\n if (contentDimensions === undefined) return null;\n\n return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n <HeatMapChart\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={data}\n xAxisCategories={xAxisCategories}\n yAxisFormat={yAxisFormat}\n countFormat={countFormat}\n countMin={countMin}\n countMax={countMax}\n timeScale={timeScale}\n showVisualMap={pluginSpec.showVisualMap}\n min={finalMin}\n max={finalMax}\n logBase={pluginSpec.logBase}\n />\n </Stack>\n );\n}\n"],"names":["Stack","Typography","merge","useMemo","DEFAULT_FORMAT","generateCompleteTimestamps","getCommonTimeScaleForQueries","HeatMapChart","getEffectiveLowerBound","lowerBound","upperBound","logBase","undefined","HeatMapChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","yAxisFormat","countFormat","data","xAxisCategories","min","max","countMin","countMax","timeScale","length","series","histograms","lowestBound","Infinity","highestBound","histogram","bucket","buckets","count","lowerBoundFloat","parseFloat","upperBoundFloat","countFloat","time","itemIndexOnXaxis","findIndex","v","push","value","label","finalMin","finalMax","justifyContent","height","variant","textAlign","direction","alignItems","width","showVisualMap"],"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,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAGlD,OAAOC,WAAW,eAAe;AAEjC,SAASC,OAAO,QAAQ,QAAQ;AAGhC,SAASC,cAAc,QAAQ,6BAA0B;AACzD,SAASC,0BAA0B,EAAEC,4BAA4B,QAAQ,oBAAW;AAEpF,SAASC,YAAY,QAAQ,oBAAiB;AAE9C;;;CAGC,GACD,MAAMC,yBAAyB,CAACC,YAAoBC,YAAoBC;IACtE,IAAIA,YAAYC,aAAaH,aAAa,GAAG;QAC3C,OAAOA;IACT;IACA,qFAAqF;IACrF,4DAA4D;IAC5D,O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D,SAAQ;gBAAQC,WAAU;0BAAS;;;IAKrD;IAEA,IAAIrC,sBAAsBL,WAAW,OAAO;IAE5C,qBACE,KAACZ;QAAMuD,WAAU;QAAMJ,gBAAe;QAASK,YAAW;kBACxD,cAAA,KAACjD;YACCkD,OAAOxC,kBAAkBwC,KAAK;YAC9BL,QAAQnC,kBAAkBmC,MAAM;YAChC/B,MAAMA;YACNC,iBAAiBA;YACjBH,aAAaA;YACbC,aAAaA;YACbK,UAAUA;YACVC,UAAUA;YACVC,WAAWA;YACX+B,eAAe1C,WAAW0C,aAAa;YACvCnC,KAAK0B;YACLzB,KAAK0B;YACLvC,SAASK,WAAWL,OAAO;;;AAInC"}
@@ -1,6 +1,6 @@
1
- import { Theme } from '@mui/material';
2
- import { FormatOptions } from '@perses-dev/components';
3
- import { HeatMapData } from './HeatMapChart';
1
+ import type { Theme } from '@mui/material';
2
+ import type { FormatOptions } from '@perses-dev/components';
3
+ import type { HeatMapData } from './HeatMapChart';
4
4
  interface CustomTooltipProps {
5
5
  data: HeatMapData;
6
6
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"HeatMapTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAA+B,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,kBAAkB;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,WAAW,EACX,WAAW,GACZ,EAAE,kBAAkB,GAAG,MAAM,CAsC7B"}
1
+ {"version":3,"file":"HeatMapTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,UAAU,kBAAkB;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,WAAW,EACX,WAAW,GACZ,EAAE,kBAAkB,GAAG,MAAM,CAsC7B"}
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { css } from '@mui/material';
14
- import { formatValue, getDateAndTime } from '@perses-dev/components';
13
+ import { css } from "@mui/material";
14
+ import { formatValue, getDateAndTime } from "@perses-dev/components";
15
15
  export function generateTooltipHTML({ data, label, marker, xAxisCategories, theme, yAxisFormat, countFormat }) {
16
16
  const [xIndex, yLower, yUpper] = data;
17
17
  const xAxisLabel = xAxisCategories[xIndex];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HeatMapTooltip.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 { css, Theme } from '@mui/material';\nimport { FormatOptions, formatValue, getDateAndTime } from '@perses-dev/components';\nimport { HeatMapData } from './HeatMapChart';\n\ninterface CustomTooltipProps {\n data: HeatMapData;\n label: string;\n marker: string;\n xAxisCategories: number[];\n theme: Theme;\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n}\n\nexport function generateTooltipHTML({\n data,\n label,\n marker,\n xAxisCategories,\n theme,\n yAxisFormat,\n countFormat,\n}: CustomTooltipProps): string {\n const [xIndex, yLower, yUpper] = data;\n const xAxisLabel = xAxisCategories[xIndex];\n\n const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);\n\n const tooltipHeader = css`\n border-bottom: 1px solid ${theme.palette.grey[500]};\n padding-bottom: 8px;\n `;\n\n const tooltipContentStyles = css`\n display: flex;\n justify-content: space-between;\n padding-top: 8px;\n `;\n\n const labelStyles = css`\n margin-right: 16px;\n `;\n\n const lowerBound = yLower;\n const upperBound = yUpper;\n\n return `\n <div>\n <div style=\"${tooltipHeader.styles}\">${formattedDate} - ${formattedTime}</div>\n <div style=\"${tooltipContentStyles.styles}\">\n <div style=\"${labelStyles.styles}\">\n ${marker}\n <strong>${formatValue(lowerBound, yAxisFormat)} - ${formatValue(upperBound, yAxisFormat)}</strong>\n </div>\n <div>\n ${formatValue(parseFloat(label), countFormat)}\n </div>\n </div>\n </div>\n `;\n}\n"],"names":["css","formatValue","getDateAndTime","generateTooltipHTML","data","label","marker","xAxisCategories","theme","yAxisFormat","countFormat","xIndex","yLower","yUpper","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","lowerBound","upperBound","styles","parseFloat"],"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,QAAe,gBAAgB;AAC3C,SAAwBC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AAapF,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfC,KAAK,EACLC,WAAW,EACXC,WAAW,EACQ;IACnB,MAAM,CAACC,QAAQC,QAAQC,OAAO,GAAGT;IACjC,MAAMU,aAAaP,eAAe,CAACI,OAAO;IAE1C,MAAM,EAAEI,aAAa,EAAEC,aAAa,EAAE,GAAGd,eAAeY;IAExD,MAAMG,gBAAgBjB,GAAG,CAAC;6BACC,EAAEQ,MAAMU,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBpB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMqB,cAAcrB,GAAG,CAAC;;EAExB,CAAC;IAED,MAAMsB,aAAaV;IACnB,MAAMW,aAAaV;IAEnB,OAAO,CAAC;;kBAEQ,EAAEI,cAAcO,MAAM,CAAC,EAAE,EAAET,cAAc,GAAG,EAAEC,cAAc;kBAC5D,EAAEI,qBAAqBI,MAAM,CAAC;oBAC5B,EAAEH,YAAYG,MAAM,CAAC;UAC/B,EAAElB,OAAO;kBACD,EAAEL,YAAYqB,YAAYb,aAAa,GAAG,EAAER,YAAYsB,YAAYd,aAAa;;;UAGzF,EAAER,YAAYwB,WAAWpB,QAAQK,aAAa;;;;EAItD,CAAC;AACH"}
1
+ {"version":3,"sources":["../../../src/components/HeatMapTooltip.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 { Theme } from '@mui/material';\nimport { css } from '@mui/material';\nimport type { FormatOptions } from '@perses-dev/components';\nimport { formatValue, getDateAndTime } from '@perses-dev/components';\n\nimport type { HeatMapData } from './HeatMapChart';\n\ninterface CustomTooltipProps {\n data: HeatMapData;\n label: string;\n marker: string;\n xAxisCategories: number[];\n theme: Theme;\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n}\n\nexport function generateTooltipHTML({\n data,\n label,\n marker,\n xAxisCategories,\n theme,\n yAxisFormat,\n countFormat,\n}: CustomTooltipProps): string {\n const [xIndex, yLower, yUpper] = data;\n const xAxisLabel = xAxisCategories[xIndex];\n\n const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);\n\n const tooltipHeader = css`\n border-bottom: 1px solid ${theme.palette.grey[500]};\n padding-bottom: 8px;\n `;\n\n const tooltipContentStyles = css`\n display: flex;\n justify-content: space-between;\n padding-top: 8px;\n `;\n\n const labelStyles = css`\n margin-right: 16px;\n `;\n\n const lowerBound = yLower;\n const upperBound = yUpper;\n\n return `\n <div>\n <div style=\"${tooltipHeader.styles}\">${formattedDate} - ${formattedTime}</div>\n <div style=\"${tooltipContentStyles.styles}\">\n <div style=\"${labelStyles.styles}\">\n ${marker}\n <strong>${formatValue(lowerBound, yAxisFormat)} - ${formatValue(upperBound, yAxisFormat)}</strong>\n </div>\n <div>\n ${formatValue(parseFloat(label), countFormat)}\n </div>\n </div>\n </div>\n `;\n}\n"],"names":["css","formatValue","getDateAndTime","generateTooltipHTML","data","label","marker","xAxisCategories","theme","yAxisFormat","countFormat","xIndex","yLower","yUpper","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","lowerBound","upperBound","styles","parseFloat"],"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,GAAG,QAAQ,gBAAgB;AAEpC,SAASC,WAAW,EAAEC,cAAc,QAAQ,yBAAyB;AAcrE,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfC,KAAK,EACLC,WAAW,EACXC,WAAW,EACQ;IACnB,MAAM,CAACC,QAAQC,QAAQC,OAAO,GAAGT;IACjC,MAAMU,aAAaP,eAAe,CAACI,OAAO;IAE1C,MAAM,EAAEI,aAAa,EAAEC,aAAa,EAAE,GAAGd,eAAeY;IAExD,MAAMG,gBAAgBjB,GAAG,CAAC;6BACC,EAAEQ,MAAMU,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBpB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMqB,cAAcrB,GAAG,CAAC;;EAExB,CAAC;IAED,MAAMsB,aAAaV;IACnB,MAAMW,aAAaV;IAEnB,OAAO,CAAC;;kBAEQ,EAAEI,cAAcO,MAAM,CAAC,EAAE,EAAET,cAAc,GAAG,EAAEC,cAAc;kBAC5D,EAAEI,qBAAqBI,MAAM,CAAC;oBAC5B,EAAEH,YAAYG,MAAM,CAAC;UAC/B,EAAElB,OAAO;kBACD,EAAEL,YAAYqB,YAAYb,aAAa,GAAG,EAAER,YAAYsB,YAAYd,aAAa;;;UAGzF,EAAER,YAAYwB,WAAWpB,QAAQK,aAAa;;;;EAItD,CAAC;AACH"}
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './HeatMapChartOptionsEditorSettings';
14
- export * from './HeatMapChartPanel';
15
- export * from './HeatMapChart';
13
+ export * from "./HeatMapChartOptionsEditorSettings.js";
14
+ export * from "./HeatMapChartPanel.js";
15
+ export * from "./HeatMapChart.js";
16
16
 
17
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/index.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\nexport * from './HeatMapChartOptionsEditorSettings';\nexport * from './HeatMapChartPanel';\nexport * from './HeatMapChart';\n"],"names":[],"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,cAAc,sCAAsC;AACpD,cAAc,sBAAsB;AACpC,cAAc,iBAAiB"}
1
+ {"version":3,"sources":["../../../src/components/index.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\nexport * from './HeatMapChartOptionsEditorSettings';\nexport * from './HeatMapChartPanel';\nexport * from './HeatMapChart';\n"],"names":[],"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,cAAc,yCAAsC;AACpD,cAAc,yBAAsB;AACpC,cAAc,oBAAiB"}
@@ -1,4 +1,4 @@
1
- import { PluginModuleResource } from '@perses-dev/plugin-system';
1
+ import type { PluginModuleResource } from '@perses-dev/plugin-system';
2
2
  /**
3
3
  * Returns the plugin module information from package.json
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAGnF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
1
+ {"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAIxF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
@@ -10,7 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import packageJson from '../package.json';
13
+ import packageJson from "../package.json" with {
14
+ type: 'json'
15
+ };
14
16
  /**
15
17
  * Returns the plugin module information from package.json
16
18
  */ export function getPluginModule() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getPluginModule.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 { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\nimport packageJson from '../package.json';\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAOA,iBAAiB,kBAAkB;AAE1C;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAClC,OAAO;QACLK,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
1
+ {"version":3,"sources":["../../src/getPluginModule.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 { PluginModuleResource, PluginModuleSpec } from '@perses-dev/plugin-system';\n\nimport packageJson from '../package.json' with { type: 'json' };\n\n/**\n * Returns the plugin module information from package.json\n */\nexport function getPluginModule(): PluginModuleResource {\n const { name, version, perses } = packageJson;\n return {\n kind: 'PluginModule',\n metadata: {\n name,\n version,\n },\n spec: perses as PluginModuleSpec,\n };\n}\n"],"names":["packageJson","type","getPluginModule","name","version","perses","kind","metadata","spec"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAOA,iBAAiB,uBAAuB;IAAEC,MAAM;AAAO,EAAE;AAEhE;;CAEC,GACD,OAAO,SAASC;IACd,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGL;IAClC,OAAO;QACLM,MAAM;QACNC,UAAU;YACRJ;YACAC;QACF;QACAI,MAAMH;IACR;AACF"}
@@ -1,6 +1,6 @@
1
- import { FormatOptions } from '@perses-dev/components';
2
- import { OptionsEditorProps } from '@perses-dev/plugin-system';
3
- import { Definition } from '@perses-dev/spec';
1
+ import type { FormatOptions } from '@perses-dev/components';
2
+ import type { OptionsEditorProps } from '@perses-dev/plugin-system';
3
+ import type { Definition } from '@perses-dev/spec';
4
4
  export declare const DEFAULT_FORMAT: FormatOptions;
5
5
  export declare const DEFAULT_MIN_PERCENT = 0;
6
6
  export declare const DEFAULT_MAX_PERCENT = 100;
@@ -1 +1 @@
1
- {"version":3,"file":"heat-map-chart-model.d.ts","sourceRoot":"","sources":["../../src/heat-map-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,aAAmC,CAAC;AACjE,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,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AAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC;AAE1C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,CAI5E,CAAC;AAEF,eAAO,MAAM,gBAAgB;WANyB,MAAM;SAAO,QAAQ;QAO/D,MAAM;GAEf,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IAC7E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,8BAA8B,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AAErF;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,mBAAmB,CAMtE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/heat-map-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 { FormatOptions } from '@perses-dev/components';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal' };\nexport const DEFAULT_MIN_PERCENT = 0;\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MIN_PERCENT_DECIMAL = 0;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\nexport type LOG_BASE = undefined | 2 | 10;\n\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\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\n\n/**\n * The schema for a HeatMapChart panel.\n */\nexport interface HeatMapChartDefinition extends Definition<HeatMapChartOptions> {\n kind: 'HeatMapChart';\n}\n\n/**\n * The Options object type supported by the HeatMapChart panel plugin.\n */\nexport interface HeatMapChartOptions {\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n showVisualMap?: boolean;\n logBase?: LOG_BASE;\n min?: number;\n max?: number;\n}\n\nexport type HeatMapChartOptionsEditorProps = OptionsEditorProps<HeatMapChartOptions>;\n\n/**\n * Creates the initial/empty options for a HeatMapChart panel.\n */\nexport function createInitialHeatMapChartOptions(): HeatMapChartOptions {\n return {\n yAxisFormat: DEFAULT_FORMAT,\n countFormat: DEFAULT_FORMAT,\n showVisualMap: true,\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_MIN_PERCENT","DEFAULT_MAX_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_MAX_PERCENT_DECIMAL","LOG_BASE_CONFIG","none","label","log","undefined","LOG_BASE_OPTIONS","Object","entries","map","id","config","createInitialHeatMapChartOptions","yAxisFormat","countFormat","showVisualMap"],"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;AAMjC,OAAO,MAAMA,iBAAgC;IAAEC,MAAM;AAAU,EAAE;AACjE,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAC7C,OAAO,MAAMC,8BAA8B,EAAE;AAI7C,OAAO,MAAMC,kBAAoE;IAC/EC,MAAM;QAAEC,OAAO;QAAQC,KAAKC;IAAU;IACtC,KAAK;QAAEF,OAAO;QAAKC,KAAK;IAAE;IAC1B,MAAM;QAAED,OAAO;QAAMC,KAAK;IAAG;AAC/B,EAAE;AAEF,OAAO,MAAME,mBAAmBC,OAAOC,OAAO,CAACP,iBAAiBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAuBJ;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAalB;QACbmB,aAAanB;QACboB,eAAe;IACjB;AACF"}
1
+ {"version":3,"sources":["../../src/heat-map-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 } from '@perses-dev/components';\nimport type { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal' };\nexport const DEFAULT_MIN_PERCENT = 0;\nexport const DEFAULT_MAX_PERCENT = 100;\nexport const DEFAULT_MIN_PERCENT_DECIMAL = 0;\nexport const DEFAULT_MAX_PERCENT_DECIMAL = 1;\n\nexport type LOG_BASE = undefined | 2 | 10;\n\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\nexport const LOG_BASE_OPTIONS = Object.entries(LOG_BASE_CONFIG).map(([id, config]) => ({\n id: id as string,\n ...config,\n}));\n\n/**\n * The schema for a HeatMapChart panel.\n */\nexport interface HeatMapChartDefinition extends Definition<HeatMapChartOptions> {\n kind: 'HeatMapChart';\n}\n\n/**\n * The Options object type supported by the HeatMapChart panel plugin.\n */\nexport interface HeatMapChartOptions {\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n showVisualMap?: boolean;\n logBase?: LOG_BASE;\n min?: number;\n max?: number;\n}\n\nexport type HeatMapChartOptionsEditorProps = OptionsEditorProps<HeatMapChartOptions>;\n\n/**\n * Creates the initial/empty options for a HeatMapChart panel.\n */\nexport function createInitialHeatMapChartOptions(): HeatMapChartOptions {\n return {\n yAxisFormat: DEFAULT_FORMAT,\n countFormat: DEFAULT_FORMAT,\n showVisualMap: true,\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_MIN_PERCENT","DEFAULT_MAX_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_MAX_PERCENT_DECIMAL","LOG_BASE_CONFIG","none","label","log","undefined","LOG_BASE_OPTIONS","Object","entries","map","id","config","createInitialHeatMapChartOptions","yAxisFormat","countFormat","showVisualMap"],"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;AAMjC,OAAO,MAAMA,iBAAgC;IAAEC,MAAM;AAAU,EAAE;AACjE,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAC7C,OAAO,MAAMC,8BAA8B,EAAE;AAI7C,OAAO,MAAMC,kBAAoE;IAC/EC,MAAM;QAAEC,OAAO;QAAQC,KAAKC;IAAU;IACtC,KAAK;QAAEF,OAAO;QAAKC,KAAK;IAAE;IAC1B,MAAM;QAAED,OAAO;QAAMC,KAAK;IAAG;AAC/B,EAAE;AAEF,OAAO,MAAME,mBAAmBC,OAAOC,OAAO,CAACP,iBAAiBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO,GAAM,CAAA;QACrFD,IAAIA;QACJ,GAAGC,MAAM;IACX,CAAA,GAAI;AAuBJ;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAalB;QACbmB,aAAanB;QACboB,eAAe;IACjB;AACF"}
@@ -10,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import('./bootstrap');
13
+ import("./bootstrap.js");
14
14
 
15
15
  //# sourceMappingURL=index-federation.js.map
package/lib/index.js CHANGED
@@ -10,9 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export { getPluginModule } from './getPluginModule';
14
- export { HeatMapChartPanel } from './components';
15
- export * from './heat-map-chart-model';
16
- export * from './HeatMapChart';
13
+ export { getPluginModule } from "./getPluginModule.js";
14
+ export { HeatMapChartPanel } from "./components/index.js";
15
+ export * from "./heat-map-chart-model.js";
16
+ export * from "./HeatMapChart.js";
17
17
 
18
18
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.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\nexport { getPluginModule } from './getPluginModule';\nexport { HeatMapChartPanel } from './components';\nexport * from './heat-map-chart-model';\nexport * from './HeatMapChart';\n"],"names":["getPluginModule","HeatMapChartPanel"],"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,eAAe,QAAQ,oBAAoB;AACpD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,cAAc,yBAAyB;AACvC,cAAc,iBAAiB"}
1
+ {"version":3,"sources":["../../src/index.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\nexport { getPluginModule } from './getPluginModule';\nexport { HeatMapChartPanel } from './components';\nexport * from './heat-map-chart-model';\nexport * from './HeatMapChart';\n"],"names":["getPluginModule","HeatMapChartPanel"],"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,eAAe,QAAQ,uBAAoB;AACpD,SAASC,iBAAiB,QAAQ,wBAAe;AACjD,cAAc,4BAAyB;AACvC,cAAc,oBAAiB"}
@@ -1,2 +1,2 @@
1
- import '@testing-library/jest-dom';
1
+ import '@testing-library/jest-dom/vitest';
2
2
  //# sourceMappingURL=setup-tests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC"}
1
+ {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,kCAAkC,CAAC"}
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import '@testing-library/jest-dom';
13
+ import "@testing-library/jest-dom/vitest";
14
14
  // Always mock e-charts during tests since we don't have a proper canvas in jsdom
15
- jest.mock('echarts/core');
15
+ vi.mock('echarts/core');
16
16
 
17
17
  //# sourceMappingURL=setup-tests.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/setup-tests.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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"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,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
1
+ {"version":3,"sources":["../../src/setup-tests.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 '@testing-library/jest-dom/vitest';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\nvi.mock('echarts/core');\n"],"names":["vi","mock"],"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,OAAO,mCAAmC;AAE1C,iFAAiF;AACjFA,GAAGC,IAAI,CAAC"}
@@ -1,5 +1,5 @@
1
- import { PanelData } from '@perses-dev/plugin-system';
2
- import { TimeScale, TimeSeriesData } from '@perses-dev/spec';
1
+ import type { PanelData } from '@perses-dev/plugin-system';
2
+ import type { TimeScale, TimeSeriesData } from '@perses-dev/spec';
3
3
  export declare function getCommonTimeScaleForQueries(queries: Array<PanelData<TimeSeriesData>>): TimeScale | undefined;
4
4
  export declare function generateCompleteTimestamps(timescale?: TimeScale): number[];
5
5
  //# sourceMappingURL=data-transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAG7G;AAED,wBAAgB,0BAA0B,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CAU1E"}
1
+ {"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAG7G;AAED,wBAAgB,0BAA0B,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CAU1E"}
@@ -10,7 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { getCommonTimeScale } from '@perses-dev/components';
13
+ import { getCommonTimeScale } from "@perses-dev/components";
14
14
  export function getCommonTimeScaleForQueries(queries) {
15
15
  const seriesData = queries.map((query)=>query.data);
16
16
  return getCommonTimeScale(seriesData);