@perses-dev/bar-chart-plugin 0.11.0 → 0.13.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/__mf/css/async/236.85c2cbf6.css +1 -0
  2. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  3. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  4. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  5. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  6. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  8. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  10. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  11. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  12. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  13. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  14. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  17. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  18. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  26. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  27. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  28. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  29. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  30. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  31. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  32. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  33. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  34. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  35. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  36. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  37. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  38. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  39. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  40. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  42. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  43. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  44. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  45. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  47. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  49. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  50. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  51. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  52. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  53. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  54. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  55. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  56. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  57. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  58. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  59. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  60. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  61. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  62. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  63. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  64. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  66. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  67. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  68. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  69. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  70. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  71. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  72. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  73. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  74. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  75. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  77. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  79. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  80. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  82. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  83. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  84. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  85. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  86. package/__mf/js/BarChart.684cf4ee.js +7 -0
  87. package/__mf/js/async/121.697325de.js +2 -0
  88. package/__mf/js/async/177.83b4a0c7.js +1 -0
  89. package/__mf/js/async/187.dce780a3.js +24 -0
  90. package/__mf/js/async/{648.477ab52d.js.LICENSE.txt → 187.dce780a3.js.LICENSE.txt} +0 -16
  91. package/__mf/js/async/192.978ad416.js +1 -0
  92. package/__mf/js/async/235.dcb2a938.js +1 -0
  93. package/__mf/js/async/236.1e90c5b6.js +7 -0
  94. package/__mf/js/async/{955.120f903e.js.LICENSE.txt → 236.1e90c5b6.js.LICENSE.txt} +19 -1
  95. package/__mf/js/async/274.48038fad.js +2 -0
  96. package/__mf/js/async/356.3310d2e7.js +1 -0
  97. package/__mf/js/async/377.fbdc975f.js +1 -0
  98. package/__mf/js/async/392.2095dbb3.js +2 -0
  99. package/__mf/js/async/435.dc0a9a8a.js +1 -0
  100. package/__mf/js/async/{77.f584b802.js → 458.8fe7d3e6.js} +1 -1
  101. package/__mf/js/async/46.f0465d0c.js +101 -0
  102. package/__mf/js/async/470.306558f6.js +2 -0
  103. package/__mf/js/async/496.1c041ac9.js +1 -0
  104. package/__mf/js/async/568.0c8cf5cf.js +1 -0
  105. package/__mf/js/async/587.f983bd0d.js +1 -0
  106. package/__mf/js/async/588.c5433cac.js +1 -0
  107. package/__mf/js/async/616.3805dee7.js +1 -0
  108. package/__mf/js/async/71.63183692.js +1 -0
  109. package/__mf/js/async/721.497b5f27.js +1 -0
  110. package/__mf/js/async/77.317669de.js +1 -0
  111. package/__mf/js/async/823.d7e96856.js +10 -0
  112. package/__mf/js/async/{255.41e8af2d.js.LICENSE.txt → 823.d7e96856.js.LICENSE.txt} +1 -1
  113. package/__mf/js/async/854.c97a2bb3.js +1 -0
  114. package/__mf/js/async/873.be346a58.js +1 -0
  115. package/__mf/js/async/934.ffdb04e7.js +2 -0
  116. package/__mf/js/async/941.4dad52d6.js +2 -0
  117. package/__mf/js/async/958.30e78b21.js +39 -0
  118. package/__mf/js/async/{148.2fc9171f.js.LICENSE.txt → 958.30e78b21.js.LICENSE.txt} +17 -1
  119. package/__mf/js/async/963.2293b290.js +1 -0
  120. package/__mf/js/async/968.fc1dd4a5.js +1 -0
  121. package/__mf/js/async/978.fd94d741.js +1 -0
  122. package/__mf/js/async/__federation_expose_BarChart.44843c4d.js +1 -0
  123. package/__mf/js/async/lib-router.354c6b86.js +2 -0
  124. package/__mf/js/main.2ce2f26b.js +7 -0
  125. package/lib/BarChart.d.ts.map +1 -1
  126. package/lib/BarChart.js +8 -1
  127. package/lib/BarChart.js.map +1 -1
  128. package/lib/BarChartBase.d.ts +12 -2
  129. package/lib/BarChartBase.d.ts.map +1 -1
  130. package/lib/BarChartBase.js +104 -12
  131. package/lib/BarChartBase.js.map +1 -1
  132. package/lib/BarChartExportAction.d.ts +4 -0
  133. package/lib/BarChartExportAction.d.ts.map +1 -0
  134. package/lib/BarChartExportAction.js +70 -0
  135. package/lib/BarChartExportAction.js.map +1 -0
  136. package/lib/BarChartOptionsEditorSettings.d.ts.map +1 -1
  137. package/lib/BarChartOptionsEditorSettings.js +98 -29
  138. package/lib/BarChartOptionsEditorSettings.js.map +1 -1
  139. package/lib/BarChartPanel.d.ts +1 -1
  140. package/lib/BarChartPanel.d.ts.map +1 -1
  141. package/lib/BarChartPanel.js +71 -4
  142. package/lib/BarChartPanel.js.map +1 -1
  143. package/lib/bar-chart-model.d.ts +9 -3
  144. package/lib/bar-chart-model.d.ts.map +1 -1
  145. package/lib/bar-chart-model.js +8 -2
  146. package/lib/bar-chart-model.js.map +1 -1
  147. package/lib/cjs/BarChart.js +8 -1
  148. package/lib/cjs/BarChartBase.js +107 -15
  149. package/lib/cjs/BarChartExportAction.js +124 -0
  150. package/lib/cjs/BarChartOptionsEditorSettings.js +95 -26
  151. package/lib/cjs/BarChartPanel.js +72 -5
  152. package/lib/cjs/bar-chart-model.js +18 -3
  153. package/lib/tresholds.d.ts +1 -1
  154. package/lib/tresholds.d.ts.map +1 -1
  155. package/lib/tresholds.js.map +1 -1
  156. package/mf-manifest.json +76 -62
  157. package/mf-stats.json +92 -64
  158. package/package.json +4 -4
  159. package/__mf/css/async/442.d3010b86.css +0 -1
  160. package/__mf/css/async/61.d3010b86.css +0 -1
  161. package/__mf/css/async/823.d3010b86.css +0 -1
  162. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  163. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  164. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  165. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  166. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  167. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  168. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  169. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  170. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  171. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  172. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  173. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  174. package/__mf/js/BarChart.cded7431.js +0 -6
  175. package/__mf/js/async/102.b7abdc1f.js +0 -1
  176. package/__mf/js/async/121.517e00e8.js +0 -2
  177. package/__mf/js/async/148.2fc9171f.js +0 -102
  178. package/__mf/js/async/160.edce75b3.js +0 -1
  179. package/__mf/js/async/177.91621efa.js +0 -1
  180. package/__mf/js/async/192.73182890.js +0 -1
  181. package/__mf/js/async/204.d6cc804e.js +0 -1
  182. package/__mf/js/async/235.f90d3b9a.js +0 -38
  183. package/__mf/js/async/255.41e8af2d.js +0 -10
  184. package/__mf/js/async/274.9bfff28e.js +0 -2
  185. package/__mf/js/async/350.d8b63400.js +0 -1
  186. package/__mf/js/async/356.6146b01c.js +0 -1
  187. package/__mf/js/async/377.5b9c90dc.js +0 -1
  188. package/__mf/js/async/392.63dbc9c4.js +0 -2
  189. package/__mf/js/async/458.cffba90f.js +0 -1
  190. package/__mf/js/async/470.82e9b967.js +0 -2
  191. package/__mf/js/async/473.2df10452.js +0 -1
  192. package/__mf/js/async/496.b35b3a0a.js +0 -1
  193. package/__mf/js/async/587.bcc920f1.js +0 -1
  194. package/__mf/js/async/588.680cfad0.js +0 -1
  195. package/__mf/js/async/616.302bdae0.js +0 -1
  196. package/__mf/js/async/648.477ab52d.js +0 -22
  197. package/__mf/js/async/703.16dd2eaa.js +0 -2
  198. package/__mf/js/async/71.dab9ec76.js +0 -1
  199. package/__mf/js/async/854.7be16fdf.js +0 -1
  200. package/__mf/js/async/873.daa0c1ab.js +0 -1
  201. package/__mf/js/async/941.4efdb193.js +0 -2
  202. package/__mf/js/async/955.120f903e.js +0 -7
  203. package/__mf/js/async/963.85d5346b.js +0 -1
  204. package/__mf/js/async/968.d562d0d2.js +0 -1
  205. package/__mf/js/async/978.458b6e7d.js +0 -1
  206. package/__mf/js/async/__federation_expose_BarChart.f725ca63.js +0 -1
  207. package/__mf/js/async/lib-router.66821436.js +0 -2
  208. package/__mf/js/main.6e028457.js +0 -6
  209. /package/__mf/js/async/{121.517e00e8.js.LICENSE.txt → 121.697325de.js.LICENSE.txt} +0 -0
  210. /package/__mf/js/async/{274.9bfff28e.js.LICENSE.txt → 274.48038fad.js.LICENSE.txt} +0 -0
  211. /package/__mf/js/async/{392.63dbc9c4.js.LICENSE.txt → 392.2095dbb3.js.LICENSE.txt} +0 -0
  212. /package/__mf/js/async/{470.82e9b967.js.LICENSE.txt → 470.306558f6.js.LICENSE.txt} +0 -0
  213. /package/__mf/js/async/{703.16dd2eaa.js.LICENSE.txt → 934.ffdb04e7.js.LICENSE.txt} +0 -0
  214. /package/__mf/js/async/{941.4efdb193.js.LICENSE.txt → 941.4dad52d6.js.LICENSE.txt} +0 -0
  215. /package/__mf/js/async/{lib-router.66821436.js.LICENSE.txt → lib-router.354c6b86.js.LICENSE.txt} +0 -0
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { BarChartPanelProps } from './BarChartPanel';
3
+ export declare const BarChartExportAction: React.FC<BarChartPanelProps>;
4
+ //# sourceMappingURL=BarChartExportAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartExportAction.d.ts","sourceRoot":"","sources":["../../src/BarChartExportAction.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAKpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6C7D,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import React, { useCallback, useMemo } from 'react';
15
+ import { exportDataAsCSV, extractExportableData, isExportableData, sanitizeFilename } from '@perses-dev/plugin-system';
16
+ import { InfoTooltip } from '@perses-dev/components';
17
+ import { IconButton } from '@mui/material';
18
+ import DownloadIcon from 'mdi-material-ui/Download';
19
+ export const BarChartExportAction = ({ queryResults, definition })=>{
20
+ const exportableData = useMemo(()=>{
21
+ return extractExportableData(queryResults);
22
+ }, [
23
+ queryResults
24
+ ]);
25
+ const canExport = useMemo(()=>{
26
+ return isExportableData(exportableData);
27
+ }, [
28
+ exportableData
29
+ ]);
30
+ const handleExport = useCallback(()=>{
31
+ if (!exportableData || !canExport) return;
32
+ try {
33
+ const title = definition?.spec?.display?.name || 'Time Series Data';
34
+ const csvBlob = exportDataAsCSV({
35
+ data: exportableData
36
+ });
37
+ const baseFilename = sanitizeFilename(title);
38
+ const filename = `${baseFilename}_data.csv`;
39
+ const link = document.createElement('a');
40
+ link.href = URL.createObjectURL(csvBlob);
41
+ link.download = filename;
42
+ document.body.appendChild(link);
43
+ link.click();
44
+ document.body.removeChild(link);
45
+ URL.revokeObjectURL(link.href);
46
+ } catch (error) {
47
+ console.error('Time series export failed:', error);
48
+ }
49
+ }, [
50
+ exportableData,
51
+ canExport,
52
+ definition
53
+ ]);
54
+ if (!canExport) {
55
+ return null;
56
+ }
57
+ return /*#__PURE__*/ _jsx(InfoTooltip, {
58
+ description: "Export as CSV",
59
+ children: /*#__PURE__*/ _jsx(IconButton, {
60
+ size: "small",
61
+ onClick: handleExport,
62
+ "aria-label": "Export time series data as CSV",
63
+ children: /*#__PURE__*/ _jsx(DownloadIcon, {
64
+ fontSize: "inherit"
65
+ })
66
+ })
67
+ });
68
+ };
69
+
70
+ //# sourceMappingURL=BarChartExportAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/BarChartExportAction.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 React, { useCallback, useMemo } from 'react';\nimport { exportDataAsCSV, extractExportableData, isExportableData, sanitizeFilename } from '@perses-dev/plugin-system';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { IconButton } from '@mui/material';\nimport DownloadIcon from 'mdi-material-ui/Download';\nimport { BarChartPanelProps } from './BarChartPanel';\n\nexport const BarChartExportAction: React.FC<BarChartPanelProps> = ({ queryResults, definition }) => {\n const exportableData = useMemo(() => {\n return extractExportableData(queryResults);\n }, [queryResults]);\n\n const canExport = useMemo(() => {\n return isExportableData(exportableData);\n }, [exportableData]);\n\n const handleExport = useCallback(() => {\n if (!exportableData || !canExport) return;\n\n try {\n const title = definition?.spec?.display?.name || 'Time Series Data';\n\n const csvBlob = exportDataAsCSV({\n data: exportableData,\n });\n\n const baseFilename = sanitizeFilename(title);\n const filename = `${baseFilename}_data.csv`;\n\n const link = document.createElement('a');\n link.href = URL.createObjectURL(csvBlob);\n link.download = filename;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(link.href);\n } catch (error) {\n console.error('Time series export failed:', error);\n }\n }, [exportableData, canExport, definition]);\n\n if (!canExport) {\n return null;\n }\n\n return (\n <InfoTooltip description=\"Export as CSV\">\n <IconButton size=\"small\" onClick={handleExport} aria-label=\"Export time series data as CSV\">\n <DownloadIcon fontSize=\"inherit\" />\n </IconButton>\n </InfoTooltip>\n );\n};\n"],"names":["React","useCallback","useMemo","exportDataAsCSV","extractExportableData","isExportableData","sanitizeFilename","InfoTooltip","IconButton","DownloadIcon","BarChartExportAction","queryResults","definition","exportableData","canExport","handleExport","title","spec","display","name","csvBlob","data","baseFilename","filename","link","document","createElement","href","URL","createObjectURL","download","body","appendChild","click","removeChild","revokeObjectURL","error","console","description","size","onClick","aria-label","fontSize"],"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,OAAOA,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AACpD,SAASC,eAAe,EAAEC,qBAAqB,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,4BAA4B;AACvH,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,OAAOC,kBAAkB,2BAA2B;AAGpD,OAAO,MAAMC,uBAAqD,CAAC,EAAEC,YAAY,EAAEC,UAAU,EAAE;IAC7F,MAAMC,iBAAiBX,QAAQ;QAC7B,OAAOE,sBAAsBO;IAC/B,GAAG;QAACA;KAAa;IAEjB,MAAMG,YAAYZ,QAAQ;QACxB,OAAOG,iBAAiBQ;IAC1B,GAAG;QAACA;KAAe;IAEnB,MAAME,eAAed,YAAY;QAC/B,IAAI,CAACY,kBAAkB,CAACC,WAAW;QAEnC,IAAI;YACF,MAAME,QAAQJ,YAAYK,MAAMC,SAASC,QAAQ;YAEjD,MAAMC,UAAUjB,gBAAgB;gBAC9BkB,MAAMR;YACR;YAEA,MAAMS,eAAehB,iBAAiBU;YACtC,MAAMO,WAAW,GAAGD,aAAa,SAAS,CAAC;YAE3C,MAAME,OAAOC,SAASC,aAAa,CAAC;YACpCF,KAAKG,IAAI,GAAGC,IAAIC,eAAe,CAACT;YAChCI,KAAKM,QAAQ,GAAGP;YAChBE,SAASM,IAAI,CAACC,WAAW,CAACR;YAC1BA,KAAKS,KAAK;YACVR,SAASM,IAAI,CAACG,WAAW,CAACV;YAC1BI,IAAIO,eAAe,CAACX,KAAKG,IAAI;QAC/B,EAAE,OAAOS,OAAO;YACdC,QAAQD,KAAK,CAAC,8BAA8BA;QAC9C;IACF,GAAG;QAACvB;QAAgBC;QAAWF;KAAW;IAE1C,IAAI,CAACE,WAAW;QACd,OAAO;IACT;IAEA,qBACE,KAACP;QAAY+B,aAAY;kBACvB,cAAA,KAAC9B;YAAW+B,MAAK;YAAQC,SAASzB;YAAc0B,cAAW;sBACzD,cAAA,KAAChC;gBAAaiC,UAAS;;;;AAI/B,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"BarChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../src/BarChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA+BA,OAAO,EAAqB,YAAY,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAEL,0BAA0B,EAI3B,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,YAAY,CAoE7F"}
1
+ {"version":3,"file":"BarChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../src/BarChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AA8CA,OAAO,EAAqB,YAAY,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAEL,0BAA0B,EAO3B,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,0BAA0B,GAAG,YAAY,CAmI7F"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createElement as _createElement } from "react";
2
3
  // Copyright The Perses Authors
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
4
5
  // you may not use this file except in compliance with the License.
@@ -11,13 +12,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
13
  // See the License for the specific language governing permissions and
13
14
  // limitations under the License.
14
- import { Button } from '@mui/material';
15
- import { FormatControls, ModeSelector, OptionsEditorColumn, OptionsEditorGrid, OptionsEditorGroup, SortSelector } from '@perses-dev/components';
16
- import { DEFAULT_CALCULATION, isPercentUnit } from '@perses-dev/core';
17
- import { CalculationSelector } from '@perses-dev/plugin-system';
15
+ import { Autocomplete, Button, Chip, FormControlLabel, Switch, TextField, ToggleButton, ToggleButtonGroup } from '@mui/material';
16
+ import { FormatControls, isPercentUnit, ModeSelector, OptionsEditorColumn, OptionsEditorGrid, OptionsEditorGroup, SortSelector } from '@perses-dev/components';
17
+ import { CalculationSelector, DEFAULT_CALCULATION } from '@perses-dev/plugin-system';
18
18
  import { produce } from 'immer';
19
19
  import merge from 'lodash/merge';
20
- import { DEFAULT_FORMAT, DEFAULT_MODE, DEFAULT_SORT } from './bar-chart-model';
20
+ import { DEFAULT_FORMAT, DEFAULT_MODE, DEFAULT_ORIENTATION, DEFAULT_SORT, DEFAULT_IS_STACKED, DEFAULT_GROUP_BY } from './bar-chart-model';
21
21
  export function BarChartOptionsEditorSettings(props) {
22
22
  const { onChange, value } = props;
23
23
  const handleCalculationChange = (newCalculation)=>{
@@ -46,36 +46,105 @@ export function BarChartOptionsEditorSettings(props) {
46
46
  draft.format = DEFAULT_FORMAT;
47
47
  draft.sort = DEFAULT_SORT;
48
48
  draft.mode = DEFAULT_MODE;
49
+ draft.groupBy = DEFAULT_GROUP_BY;
50
+ draft.isStacked = DEFAULT_IS_STACKED;
51
+ draft.orientation = DEFAULT_ORIENTATION;
49
52
  }));
50
53
  };
51
54
  // ensures decimalPlaces defaults to correct value
52
55
  const format = merge({}, DEFAULT_FORMAT, value.format);
56
+ const groupBy = value.groupBy ?? DEFAULT_GROUP_BY;
57
+ const isStacked = value.isStacked ?? DEFAULT_IS_STACKED;
53
58
  return /*#__PURE__*/ _jsxs(OptionsEditorGrid, {
54
59
  children: [
55
- /*#__PURE__*/ _jsx(OptionsEditorColumn, {
56
- children: /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
57
- title: "Misc",
58
- children: [
59
- /*#__PURE__*/ _jsx(FormatControls, {
60
- value: format,
61
- onChange: handleUnitChange,
62
- disabled: value.mode === 'percentage'
63
- }),
64
- /*#__PURE__*/ _jsx(CalculationSelector, {
65
- value: value.calculation,
66
- onChange: handleCalculationChange
67
- }),
68
- /*#__PURE__*/ _jsx(SortSelector, {
69
- value: value.sort,
70
- onChange: handleSortChange
71
- }),
72
- /*#__PURE__*/ _jsx(ModeSelector, {
73
- value: value.mode,
74
- onChange: handleModeChange,
75
- disablePercentageMode: isPercentUnit(format)
76
- })
77
- ]
78
- })
60
+ /*#__PURE__*/ _jsxs(OptionsEditorColumn, {
61
+ children: [
62
+ /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
63
+ title: "Misc",
64
+ children: [
65
+ /*#__PURE__*/ _jsx(FormatControls, {
66
+ value: format,
67
+ onChange: handleUnitChange,
68
+ disabled: value.mode === 'percentage'
69
+ }),
70
+ /*#__PURE__*/ _jsx(CalculationSelector, {
71
+ value: value.calculation,
72
+ onChange: handleCalculationChange
73
+ }),
74
+ /*#__PURE__*/ _jsx(SortSelector, {
75
+ value: value.sort,
76
+ onChange: handleSortChange
77
+ }),
78
+ /*#__PURE__*/ _jsx(ModeSelector, {
79
+ value: value.mode,
80
+ onChange: handleModeChange,
81
+ disablePercentageMode: isPercentUnit(format)
82
+ }),
83
+ /*#__PURE__*/ _jsxs(ToggleButtonGroup, {
84
+ exclusive: true,
85
+ size: "small",
86
+ value: value.orientation ?? 'horizontal',
87
+ onChange: (_, v)=>v && onChange(produce(value, (draft)=>{
88
+ draft.orientation = v;
89
+ })),
90
+ children: [
91
+ /*#__PURE__*/ _jsx(ToggleButton, {
92
+ value: "horizontal",
93
+ children: "Horizontal"
94
+ }),
95
+ /*#__PURE__*/ _jsx(ToggleButton, {
96
+ value: "vertical",
97
+ children: "Vertical"
98
+ })
99
+ ]
100
+ })
101
+ ]
102
+ }),
103
+ /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
104
+ title: "Stacking",
105
+ children: [
106
+ /*#__PURE__*/ _jsx(Autocomplete, {
107
+ multiple: true,
108
+ freeSolo: true,
109
+ value: groupBy,
110
+ onChange: (_, newValue)=>{
111
+ const filtered = newValue.filter((v)=>v.trim() !== '');
112
+ onChange(produce(value, (draft)=>{
113
+ draft.groupBy = filtered;
114
+ if (filtered.length === 0) draft.isStacked = false;
115
+ }));
116
+ },
117
+ options: [],
118
+ renderTags: (tagValues, getTagProps)=>tagValues.map((option, index)=>/*#__PURE__*/ _createElement(Chip, {
119
+ size: "small",
120
+ variant: "outlined",
121
+ label: option,
122
+ ...getTagProps({
123
+ index
124
+ }),
125
+ key: option
126
+ })),
127
+ renderInput: (params)=>/*#__PURE__*/ _jsx(TextField, {
128
+ ...params,
129
+ size: "small",
130
+ label: "Group By Labels",
131
+ placeholder: "Type label name + Enter"
132
+ })
133
+ }),
134
+ /*#__PURE__*/ _jsx(FormControlLabel, {
135
+ control: /*#__PURE__*/ _jsx(Switch, {
136
+ size: "small",
137
+ checked: isStacked,
138
+ disabled: groupBy.length === 0,
139
+ onChange: (e)=>onChange(produce(value, (draft)=>{
140
+ draft.isStacked = e.target.checked;
141
+ }))
142
+ }),
143
+ label: "Stack bars"
144
+ })
145
+ ]
146
+ })
147
+ ]
79
148
  }),
80
149
  /*#__PURE__*/ _jsx(OptionsEditorColumn, {
81
150
  children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/BarChartOptionsEditorSettings.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 { Button } from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n ModeOption,\n ModeSelector,\n ModeSelectorProps,\n OptionsEditorColumn,\n OptionsEditorGrid,\n OptionsEditorGroup,\n SortOption,\n SortSelector,\n SortSelectorProps,\n} from '@perses-dev/components';\nimport { CalculationType, DEFAULT_CALCULATION, FormatOptions, isPercentUnit } from '@perses-dev/core';\nimport { CalculationSelector, CalculationSelectorProps } from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport { MouseEventHandler, ReactElement } from 'react';\nimport {\n BarChartOptions,\n BarChartOptionsEditorProps,\n DEFAULT_FORMAT,\n DEFAULT_MODE,\n DEFAULT_SORT,\n} from './bar-chart-model';\n\nexport function BarChartOptionsEditorSettings(props: BarChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleCalculationChange: CalculationSelectorProps['onChange'] = (newCalculation: CalculationType) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.calculation = newCalculation;\n })\n );\n };\n\n const handleUnitChange: FormatControlsProps['onChange'] = (newFormat: FormatOptions) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.format = newFormat;\n })\n );\n };\n\n const handleSortChange: SortSelectorProps['onChange'] = (newSort: SortOption) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.sort = newSort;\n })\n );\n };\n\n const handleModeChange: ModeSelectorProps['onChange'] = (newMode: ModeOption) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.mode = newMode;\n })\n );\n };\n\n const handleResetSettings: MouseEventHandler<HTMLButtonElement> = () => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.calculation = DEFAULT_CALCULATION;\n draft.format = DEFAULT_FORMAT;\n draft.sort = DEFAULT_SORT;\n draft.mode = DEFAULT_MODE;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const format = merge({}, DEFAULT_FORMAT, value.format);\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <FormatControls value={format} onChange={handleUnitChange} disabled={value.mode === 'percentage'} />\n <CalculationSelector value={value.calculation} onChange={handleCalculationChange} />\n <SortSelector value={value.sort} onChange={handleSortChange} />\n <ModeSelector value={value.mode} onChange={handleModeChange} disablePercentageMode={isPercentUnit(format)} />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Reset Settings\">\n <Button variant=\"outlined\" color=\"secondary\" onClick={handleResetSettings}>\n Reset To Defaults\n </Button>\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Button","FormatControls","ModeSelector","OptionsEditorColumn","OptionsEditorGrid","OptionsEditorGroup","SortSelector","DEFAULT_CALCULATION","isPercentUnit","CalculationSelector","produce","merge","DEFAULT_FORMAT","DEFAULT_MODE","DEFAULT_SORT","BarChartOptionsEditorSettings","props","onChange","value","handleCalculationChange","newCalculation","draft","calculation","handleUnitChange","newFormat","format","handleSortChange","newSort","sort","handleModeChange","newMode","mode","handleResetSettings","title","disabled","disablePercentageMode","variant","color","onClick"],"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,QAAQ,gBAAgB;AACvC,SACEC,cAAc,EAGdC,YAAY,EAEZC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAElBC,YAAY,QAEP,yBAAyB;AAChC,SAA0BC,mBAAmB,EAAiBC,aAAa,QAAQ,mBAAmB;AACtG,SAASC,mBAAmB,QAAkC,4BAA4B;AAC1F,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SAGEC,cAAc,EACdC,YAAY,EACZC,YAAY,QACP,oBAAoB;AAE3B,OAAO,SAASC,8BAA8BC,KAAiC;IAC7E,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,MAAMG,0BAAgE,CAACC;QACrEH,SACEP,QAAQQ,OAAO,CAACG;YACdA,MAAMC,WAAW,GAAGF;QACtB;IAEJ;IAEA,MAAMG,mBAAoD,CAACC;QACzDP,SACEP,QAAQQ,OAAO,CAACG;YACdA,MAAMI,MAAM,GAAGD;QACjB;IAEJ;IAEA,MAAME,mBAAkD,CAACC;QACvDV,SACEP,QAAQQ,OAAO,CAACG;YACdA,MAAMO,IAAI,GAAGD;QACf;IAEJ;IAEA,MAAME,mBAAkD,CAACC;QACvDb,SACEP,QAAQQ,OAAO,CAACG;YACdA,MAAMU,IAAI,GAAGD;QACf;IAEJ;IAEA,MAAME,sBAA4D;QAChEf,SACEP,QAAQQ,OAAO,CAACG;YACdA,MAAMC,WAAW,GAAGf;YACpBc,MAAMI,MAAM,GAAGb;YACfS,MAAMO,IAAI,GAAGd;YACbO,MAAMU,IAAI,GAAGlB;QACf;IAEJ;IAEA,kDAAkD;IAClD,MAAMY,SAASd,MAAM,CAAC,GAAGC,gBAAgBM,MAAMO,MAAM;IAErD,qBACE,MAACrB;;0BACC,KAACD;0BACC,cAAA,MAACE;oBAAmB4B,OAAM;;sCACxB,KAAChC;4BAAeiB,OAAOO;4BAAQR,UAAUM;4BAAkBW,UAAUhB,MAAMa,IAAI,KAAK;;sCACpF,KAACtB;4BAAoBS,OAAOA,MAAMI,WAAW;4BAAEL,UAAUE;;sCACzD,KAACb;4BAAaY,OAAOA,MAAMU,IAAI;4BAAEX,UAAUS;;sCAC3C,KAACxB;4BAAagB,OAAOA,MAAMa,IAAI;4BAAEd,UAAUY;4BAAkBM,uBAAuB3B,cAAciB;;;;;0BAGtG,KAACtB;0BACC,cAAA,KAACE;oBAAmB4B,OAAM;8BACxB,cAAA,KAACjC;wBAAOoC,SAAQ;wBAAWC,OAAM;wBAAYC,SAASN;kCAAqB;;;;;;AAOrF"}
1
+ {"version":3,"sources":["../../src/BarChartOptionsEditorSettings.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 {\n Autocomplete,\n Button,\n Chip,\n FormControlLabel,\n Switch,\n TextField,\n ToggleButton,\n ToggleButtonGroup,\n} from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n FormatOptions,\n isPercentUnit,\n ModeOption,\n ModeSelector,\n ModeSelectorProps,\n OptionsEditorColumn,\n OptionsEditorGrid,\n OptionsEditorGroup,\n SortOption,\n SortSelector,\n SortSelectorProps,\n} from '@perses-dev/components';\nimport {\n CalculationSelector,\n CalculationSelectorProps,\n CalculationType,\n DEFAULT_CALCULATION,\n} from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport { MouseEventHandler, ReactElement } from 'react';\nimport {\n BarChartOptions,\n BarChartOptionsEditorProps,\n DEFAULT_FORMAT,\n DEFAULT_MODE,\n DEFAULT_ORIENTATION,\n DEFAULT_SORT,\n DEFAULT_IS_STACKED,\n DEFAULT_GROUP_BY,\n} from './bar-chart-model';\n\nexport function BarChartOptionsEditorSettings(props: BarChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleCalculationChange: CalculationSelectorProps['onChange'] = (newCalculation: CalculationType) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.calculation = newCalculation;\n })\n );\n };\n\n const handleUnitChange: FormatControlsProps['onChange'] = (newFormat: FormatOptions) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.format = newFormat;\n })\n );\n };\n\n const handleSortChange: SortSelectorProps['onChange'] = (newSort: SortOption) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.sort = newSort;\n })\n );\n };\n\n const handleModeChange: ModeSelectorProps['onChange'] = (newMode: ModeOption) => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.mode = newMode;\n })\n );\n };\n\n const handleResetSettings: MouseEventHandler<HTMLButtonElement> = () => {\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.calculation = DEFAULT_CALCULATION;\n draft.format = DEFAULT_FORMAT;\n draft.sort = DEFAULT_SORT;\n draft.mode = DEFAULT_MODE;\n draft.groupBy = DEFAULT_GROUP_BY;\n draft.isStacked = DEFAULT_IS_STACKED;\n draft.orientation = DEFAULT_ORIENTATION;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const format = merge({}, DEFAULT_FORMAT, value.format);\n const groupBy = value.groupBy ?? DEFAULT_GROUP_BY;\n const isStacked = value.isStacked ?? DEFAULT_IS_STACKED;\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <FormatControls value={format} onChange={handleUnitChange} disabled={value.mode === 'percentage'} />\n <CalculationSelector value={value.calculation} onChange={handleCalculationChange} />\n <SortSelector value={value.sort} onChange={handleSortChange} />\n <ModeSelector value={value.mode} onChange={handleModeChange} disablePercentageMode={isPercentUnit(format)} />\n <ToggleButtonGroup\n exclusive\n size=\"small\"\n value={value.orientation ?? 'horizontal'}\n onChange={(_, v) =>\n v &&\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.orientation = v;\n })\n )\n }\n >\n <ToggleButton value=\"horizontal\">Horizontal</ToggleButton>\n <ToggleButton value=\"vertical\">Vertical</ToggleButton>\n </ToggleButtonGroup>\n </OptionsEditorGroup>\n <OptionsEditorGroup title=\"Stacking\">\n <Autocomplete\n multiple\n freeSolo\n value={groupBy}\n onChange={(_, newValue) => {\n const filtered = (newValue as string[]).filter((v) => v.trim() !== '');\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.groupBy = filtered;\n if (filtered.length === 0) draft.isStacked = false;\n })\n );\n }}\n options={[]}\n renderTags={(tagValues, getTagProps) =>\n tagValues.map((option, index) => (\n <Chip size=\"small\" variant=\"outlined\" label={option} {...getTagProps({ index })} key={option} />\n ))\n }\n renderInput={(params) => (\n <TextField {...params} size=\"small\" label=\"Group By Labels\" placeholder=\"Type label name + Enter\" />\n )}\n />\n <FormControlLabel\n control={\n <Switch\n size=\"small\"\n checked={isStacked}\n disabled={groupBy.length === 0}\n onChange={(e) =>\n onChange(\n produce(value, (draft: BarChartOptions) => {\n draft.isStacked = e.target.checked;\n })\n )\n }\n />\n }\n label=\"Stack bars\"\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Reset Settings\">\n <Button variant=\"outlined\" color=\"secondary\" onClick={handleResetSettings}>\n Reset To Defaults\n </Button>\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Autocomplete","Button","Chip","FormControlLabel","Switch","TextField","ToggleButton","ToggleButtonGroup","FormatControls","isPercentUnit","ModeSelector","OptionsEditorColumn","OptionsEditorGrid","OptionsEditorGroup","SortSelector","CalculationSelector","DEFAULT_CALCULATION","produce","merge","DEFAULT_FORMAT","DEFAULT_MODE","DEFAULT_ORIENTATION","DEFAULT_SORT","DEFAULT_IS_STACKED","DEFAULT_GROUP_BY","BarChartOptionsEditorSettings","props","onChange","value","handleCalculationChange","newCalculation","draft","calculation","handleUnitChange","newFormat","format","handleSortChange","newSort","sort","handleModeChange","newMode","mode","handleResetSettings","groupBy","isStacked","orientation","title","disabled","disablePercentageMode","exclusive","size","_","v","multiple","freeSolo","newValue","filtered","filter","trim","length","options","renderTags","tagValues","getTagProps","map","option","index","variant","label","key","renderInput","params","placeholder","control","checked","e","target","color","onClick"],"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,SACEA,YAAY,EACZC,MAAM,EACNC,IAAI,EACJC,gBAAgB,EAChBC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,iBAAiB,QACZ,gBAAgB;AACvB,SACEC,cAAc,EAGdC,aAAa,EAEbC,YAAY,EAEZC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAElBC,YAAY,QAEP,yBAAyB;AAChC,SACEC,mBAAmB,EAGnBC,mBAAmB,QACd,4BAA4B;AACnC,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SAGEC,cAAc,EACdC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,kBAAkB,EAClBC,gBAAgB,QACX,oBAAoB;AAE3B,OAAO,SAASC,8BAA8BC,KAAiC;IAC7E,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,MAAMG,0BAAgE,CAACC;QACrEH,SACEV,QAAQW,OAAO,CAACG;YACdA,MAAMC,WAAW,GAAGF;QACtB;IAEJ;IAEA,MAAMG,mBAAoD,CAACC;QACzDP,SACEV,QAAQW,OAAO,CAACG;YACdA,MAAMI,MAAM,GAAGD;QACjB;IAEJ;IAEA,MAAME,mBAAkD,CAACC;QACvDV,SACEV,QAAQW,OAAO,CAACG;YACdA,MAAMO,IAAI,GAAGD;QACf;IAEJ;IAEA,MAAME,mBAAkD,CAACC;QACvDb,SACEV,QAAQW,OAAO,CAACG;YACdA,MAAMU,IAAI,GAAGD;QACf;IAEJ;IAEA,MAAME,sBAA4D;QAChEf,SACEV,QAAQW,OAAO,CAACG;YACdA,MAAMC,WAAW,GAAGhB;YACpBe,MAAMI,MAAM,GAAGhB;YACfY,MAAMO,IAAI,GAAGhB;YACbS,MAAMU,IAAI,GAAGrB;YACbW,MAAMY,OAAO,GAAGnB;YAChBO,MAAMa,SAAS,GAAGrB;YAClBQ,MAAMc,WAAW,GAAGxB;QACtB;IAEJ;IAEA,kDAAkD;IAClD,MAAMc,SAASjB,MAAM,CAAC,GAAGC,gBAAgBS,MAAMO,MAAM;IACrD,MAAMQ,UAAUf,MAAMe,OAAO,IAAInB;IACjC,MAAMoB,YAAYhB,MAAMgB,SAAS,IAAIrB;IAErC,qBACE,MAACX;;0BACC,MAACD;;kCACC,MAACE;wBAAmBiC,OAAM;;0CACxB,KAACtC;gCAAeoB,OAAOO;gCAAQR,UAAUM;gCAAkBc,UAAUnB,MAAMa,IAAI,KAAK;;0CACpF,KAAC1B;gCAAoBa,OAAOA,MAAMI,WAAW;gCAAEL,UAAUE;;0CACzD,KAACf;gCAAac,OAAOA,MAAMU,IAAI;gCAAEX,UAAUS;;0CAC3C,KAAC1B;gCAAakB,OAAOA,MAAMa,IAAI;gCAAEd,UAAUY;gCAAkBS,uBAAuBvC,cAAc0B;;0CAClG,MAAC5B;gCACC0C,SAAS;gCACTC,MAAK;gCACLtB,OAAOA,MAAMiB,WAAW,IAAI;gCAC5BlB,UAAU,CAACwB,GAAGC,IACZA,KACAzB,SACEV,QAAQW,OAAO,CAACG;wCACdA,MAAMc,WAAW,GAAGO;oCACtB;;kDAIJ,KAAC9C;wCAAasB,OAAM;kDAAa;;kDACjC,KAACtB;wCAAasB,OAAM;kDAAW;;;;;;kCAGnC,MAACf;wBAAmBiC,OAAM;;0CACxB,KAAC9C;gCACCqD,QAAQ;gCACRC,QAAQ;gCACR1B,OAAOe;gCACPhB,UAAU,CAACwB,GAAGI;oCACZ,MAAMC,WAAW,AAACD,SAAsBE,MAAM,CAAC,CAACL,IAAMA,EAAEM,IAAI,OAAO;oCACnE/B,SACEV,QAAQW,OAAO,CAACG;wCACdA,MAAMY,OAAO,GAAGa;wCAChB,IAAIA,SAASG,MAAM,KAAK,GAAG5B,MAAMa,SAAS,GAAG;oCAC/C;gCAEJ;gCACAgB,SAAS,EAAE;gCACXC,YAAY,CAACC,WAAWC,cACtBD,UAAUE,GAAG,CAAC,CAACC,QAAQC,sBACrB,eAAChE;4CAAKgD,MAAK;4CAAQiB,SAAQ;4CAAWC,OAAOH;4CAAS,GAAGF,YAAY;gDAAEG;4CAAM,EAAE;4CAAEG,KAAKJ;;gCAG1FK,aAAa,CAACC,uBACZ,KAAClE;wCAAW,GAAGkE,MAAM;wCAAErB,MAAK;wCAAQkB,OAAM;wCAAkBI,aAAY;;;0CAG5E,KAACrE;gCACCsE,uBACE,KAACrE;oCACC8C,MAAK;oCACLwB,SAAS9B;oCACTG,UAAUJ,QAAQgB,MAAM,KAAK;oCAC7BhC,UAAU,CAACgD,IACThD,SACEV,QAAQW,OAAO,CAACG;4CACdA,MAAMa,SAAS,GAAG+B,EAAEC,MAAM,CAACF,OAAO;wCACpC;;gCAKRN,OAAM;;;;;;0BAIZ,KAACzD;0BACC,cAAA,KAACE;oBAAmBiC,OAAM;8BACxB,cAAA,KAAC7C;wBAAOkE,SAAQ;wBAAWU,OAAM;wBAAYC,SAASpC;kCAAqB;;;;;;AAOrF"}
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
- import { TimeSeriesData } from '@perses-dev/core';
3
2
  import { PanelProps } from '@perses-dev/plugin-system';
3
+ import { TimeSeriesData } from '@perses-dev/spec';
4
4
  import { BarChartOptions } from './bar-chart-model';
5
5
  export type BarChartPanelProps = PanelProps<BarChartOptions, TimeSeriesData>;
6
6
  export declare function BarChartPanel(props: BarChartPanelProps): ReactElement | null;
@@ -1 +1 @@
1
- {"version":3,"file":"BarChartPanel.d.ts","sourceRoot":"","sources":["../../src/BarChartPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAoC,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;AAE7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,GAAG,IAAI,CA4C5E"}
1
+ {"version":3,"file":"BarChartPanel.d.ts","sourceRoot":"","sources":["../../src/BarChartPanel.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAoC,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;AAE7E,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,GAAG,IAAI,CAiH5E"}
@@ -14,14 +14,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useChartsTheme } from '@perses-dev/components';
15
15
  import { Box } from '@mui/material';
16
16
  import { useMemo } from 'react';
17
- import { CalculationsMap } from '@perses-dev/core';
17
+ import { CalculationsMap } from '@perses-dev/plugin-system';
18
18
  import { calculatePercentages, sortSeriesData } from './utils';
19
19
  import { BarChartBase } from './BarChartBase';
20
20
  export function BarChartPanel(props) {
21
- const { spec: { calculation, format, sort, mode }, contentDimensions, queryResults } = props;
21
+ const { spec: { calculation, format, sort, mode, groupBy = [], isStacked = false, orientation = 'horizontal' }, contentDimensions, queryResults } = props;
22
22
  const chartsTheme = useChartsTheme();
23
23
  const PADDING = chartsTheme.container.padding.default;
24
24
  const barChartData = useMemo(()=>{
25
+ if (groupBy.length > 0) return [];
25
26
  const calculate = CalculationsMap[calculation];
26
27
  const barChartData = [];
27
28
  for (const result of queryResults){
@@ -43,9 +44,72 @@ export function BarChartPanel(props) {
43
44
  queryResults,
44
45
  sort,
45
46
  mode,
47
+ calculation,
48
+ groupBy
49
+ ]);
50
+ const stackedBarChartData = useMemo(()=>{
51
+ if (groupBy.length === 0) return null;
52
+ const calculate = CalculationsMap[calculation];
53
+ const groupMap = new Map();
54
+ const segmentNamesOrdered = [];
55
+ const segmentNamesSet = new Set();
56
+ for (const queryResult of queryResults){
57
+ for (const seriesData of queryResult.data.series){
58
+ const labels = seriesData.labels ?? {};
59
+ const groupKey = groupBy.map((k)=>labels[k] ?? '').join(' / ');
60
+ const remainingEntries = Object.entries(labels).filter(([k])=>!groupBy.includes(k));
61
+ const segmentName = remainingEntries.length > 0 ? '{' + remainingEntries.map(([k, v])=>`${k}="${v}"`).join(', ') + '}' : seriesData.formattedName ?? seriesData.name;
62
+ if (!groupMap.has(groupKey)) {
63
+ groupMap.set(groupKey, new Map());
64
+ }
65
+ const segMap = groupMap.get(groupKey);
66
+ if (!segMap) continue;
67
+ const value = calculate(seriesData.values) ?? 0;
68
+ segMap.set(segmentName, (segMap.get(segmentName) ?? 0) + value);
69
+ if (!segmentNamesSet.has(segmentName)) {
70
+ segmentNamesSet.add(segmentName);
71
+ segmentNamesOrdered.push(segmentName);
72
+ }
73
+ }
74
+ }
75
+ if (groupMap.size === 0) return null;
76
+ const getTotalValue = (cat)=>Array.from(groupMap.get(cat)?.values() ?? []).reduce((a, b)=>a + b, 0);
77
+ let categories = Array.from(groupMap.keys());
78
+ if (sort === 'asc') {
79
+ categories = categories.sort((a, b)=>getTotalValue(a) - getTotalValue(b));
80
+ } else if (sort === 'desc') {
81
+ categories = categories.sort((a, b)=>getTotalValue(b) - getTotalValue(a));
82
+ }
83
+ const series = segmentNamesOrdered.map((segName)=>{
84
+ const values = categories.map((cat)=>{
85
+ const rawVal = groupMap.get(cat)?.get(segName) ?? null;
86
+ if (mode === 'percentage' && rawVal !== null) {
87
+ const total = getTotalValue(cat);
88
+ return total > 0 ? rawVal / total * 100 : 0;
89
+ }
90
+ return rawVal;
91
+ });
92
+ return {
93
+ name: segName,
94
+ values
95
+ };
96
+ });
97
+ return {
98
+ categories,
99
+ series
100
+ };
101
+ }, [
102
+ queryResults,
103
+ groupBy,
104
+ sort,
105
+ mode,
46
106
  calculation
47
107
  ]);
48
108
  if (contentDimensions === undefined) return null;
109
+ const effectiveFormat = mode === 'percentage' ? {
110
+ unit: 'percent',
111
+ decimalPlaces: format?.decimalPlaces
112
+ } : format;
49
113
  return /*#__PURE__*/ _jsx(Box, {
50
114
  sx: {
51
115
  padding: `${PADDING}px`
@@ -54,8 +118,11 @@ export function BarChartPanel(props) {
54
118
  width: contentDimensions.width - PADDING * 2,
55
119
  height: contentDimensions.height - PADDING * 2,
56
120
  data: barChartData,
57
- format: format,
58
- mode: mode
121
+ format: groupBy.length > 0 ? effectiveFormat : format,
122
+ mode: mode,
123
+ groupedData: stackedBarChartData,
124
+ isStacked: isStacked,
125
+ orientation: orientation
59
126
  })
60
127
  });
61
128
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/BarChartPanel.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 { useChartsTheme } from '@perses-dev/components';\nimport { Box } from '@mui/material';\nimport { ReactElement, useMemo } from 'react';\nimport { CalculationType, CalculationsMap, TimeSeriesData } from '@perses-dev/core';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport { BarChartOptions } from './bar-chart-model';\nimport { calculatePercentages, sortSeriesData } from './utils';\nimport { BarChartBase, BarChartData } from './BarChartBase';\n\nexport type BarChartPanelProps = PanelProps<BarChartOptions, TimeSeriesData>;\n\nexport function BarChartPanel(props: BarChartPanelProps): ReactElement | null {\n const {\n spec: { calculation, format, sort, mode },\n contentDimensions,\n queryResults,\n } = props;\n\n const chartsTheme = useChartsTheme();\n const PADDING = chartsTheme.container.padding.default;\n\n const barChartData: BarChartData[] = useMemo(() => {\n const calculate = CalculationsMap[calculation as CalculationType];\n const barChartData: BarChartData[] = [];\n for (const result of queryResults) {\n for (const seriesData of result.data.series) {\n const series = {\n value: calculate(seriesData.values) ?? null,\n label: seriesData.formattedName ?? '',\n };\n barChartData.push(series);\n }\n }\n\n const sortedBarChartData = sortSeriesData(barChartData, sort);\n if (mode === 'percentage') {\n return calculatePercentages(sortedBarChartData);\n } else {\n return sortedBarChartData;\n }\n }, [queryResults, sort, mode, calculation]);\n\n if (contentDimensions === undefined) return null;\n\n return (\n <Box sx={{ padding: `${PADDING}px` }}>\n <BarChartBase\n width={contentDimensions.width - PADDING * 2}\n height={contentDimensions.height - PADDING * 2}\n data={barChartData}\n format={format}\n mode={mode}\n />\n </Box>\n );\n}\n"],"names":["useChartsTheme","Box","useMemo","CalculationsMap","calculatePercentages","sortSeriesData","BarChartBase","BarChartPanel","props","spec","calculation","format","sort","mode","contentDimensions","queryResults","chartsTheme","PADDING","container","padding","default","barChartData","calculate","result","seriesData","data","series","value","values","label","formattedName","push","sortedBarChartData","undefined","sx","width","height"],"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,cAAc,QAAQ,yBAAyB;AACxD,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAA0BC,eAAe,QAAwB,mBAAmB;AAGpF,SAASC,oBAAoB,EAAEC,cAAc,QAAQ,UAAU;AAC/D,SAASC,YAAY,QAAsB,iBAAiB;AAI5D,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EACJC,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAE,EACzCC,iBAAiB,EACjBC,YAAY,EACb,GAAGP;IAEJ,MAAMQ,cAAchB;IACpB,MAAMiB,UAAUD,YAAYE,SAAS,CAACC,OAAO,CAACC,OAAO;IAErD,MAAMC,eAA+BnB,QAAQ;QAC3C,MAAMoB,YAAYnB,eAAe,CAACO,YAA+B;QACjE,MAAMW,eAA+B,EAAE;QACvC,KAAK,MAAME,UAAUR,aAAc;YACjC,KAAK,MAAMS,cAAcD,OAAOE,IAAI,CAACC,MAAM,CAAE;gBAC3C,MAAMA,SAAS;oBACbC,OAAOL,UAAUE,WAAWI,MAAM,KAAK;oBACvCC,OAAOL,WAAWM,aAAa,IAAI;gBACrC;gBACAT,aAAaU,IAAI,CAACL;YACpB;QACF;QAEA,MAAMM,qBAAqB3B,eAAegB,cAAcT;QACxD,IAAIC,SAAS,cAAc;YACzB,OAAOT,qBAAqB4B;QAC9B,OAAO;YACL,OAAOA;QACT;IACF,GAAG;QAACjB;QAAcH;QAAMC;QAAMH;KAAY;IAE1C,IAAII,sBAAsBmB,WAAW,OAAO;IAE5C,qBACE,KAAChC;QAAIiC,IAAI;YAAEf,SAAS,GAAGF,QAAQ,EAAE,CAAC;QAAC;kBACjC,cAAA,KAACX;YACC6B,OAAOrB,kBAAkBqB,KAAK,GAAGlB,UAAU;YAC3CmB,QAAQtB,kBAAkBsB,MAAM,GAAGnB,UAAU;YAC7CQ,MAAMJ;YACNV,QAAQA;YACRE,MAAMA;;;AAId"}
1
+ {"version":3,"sources":["../../src/BarChartPanel.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 { useChartsTheme } from '@perses-dev/components';\nimport { Box } from '@mui/material';\nimport { ReactElement, useMemo } from 'react';\nimport { CalculationsMap, CalculationType, PanelProps } from '@perses-dev/plugin-system';\nimport { TimeSeriesData } from '@perses-dev/spec';\nimport { BarChartOptions } from './bar-chart-model';\nimport { calculatePercentages, sortSeriesData } from './utils';\nimport { BarChartBase, BarChartData, StackedBarChartData, StackedBarChartSeries } from './BarChartBase';\n\nexport type BarChartPanelProps = PanelProps<BarChartOptions, TimeSeriesData>;\n\nexport function BarChartPanel(props: BarChartPanelProps): ReactElement | null {\n const {\n spec: { calculation, format, sort, mode, groupBy = [], isStacked = false, orientation = 'horizontal' },\n contentDimensions,\n queryResults,\n } = props;\n\n const chartsTheme = useChartsTheme();\n const PADDING = chartsTheme.container.padding.default;\n\n const barChartData: BarChartData[] = useMemo(() => {\n if (groupBy.length > 0) return [];\n\n const calculate = CalculationsMap[calculation as CalculationType];\n const barChartData: BarChartData[] = [];\n for (const result of queryResults) {\n for (const seriesData of result.data.series) {\n const series = {\n value: calculate(seriesData.values) ?? null,\n label: seriesData.formattedName ?? '',\n };\n barChartData.push(series);\n }\n }\n\n const sortedBarChartData = sortSeriesData(barChartData, sort);\n if (mode === 'percentage') {\n return calculatePercentages(sortedBarChartData);\n } else {\n return sortedBarChartData;\n }\n }, [queryResults, sort, mode, calculation, groupBy]);\n\n const stackedBarChartData: StackedBarChartData | null = useMemo(() => {\n if (groupBy.length === 0) return null;\n\n const calculate = CalculationsMap[calculation as CalculationType];\n const groupMap = new Map<string, Map<string, number>>();\n const segmentNamesOrdered: string[] = [];\n const segmentNamesSet = new Set<string>();\n\n for (const queryResult of queryResults) {\n for (const seriesData of queryResult.data.series) {\n const labels = seriesData.labels ?? {};\n\n const groupKey = groupBy.map((k) => labels[k] ?? '').join(' / ');\n\n const remainingEntries = Object.entries(labels).filter(([k]) => !groupBy.includes(k));\n const segmentName =\n remainingEntries.length > 0\n ? '{' + remainingEntries.map(([k, v]) => `${k}=\"${v}\"`).join(', ') + '}'\n : (seriesData.formattedName ?? seriesData.name);\n\n if (!groupMap.has(groupKey)) {\n groupMap.set(groupKey, new Map());\n }\n const segMap = groupMap.get(groupKey);\n if (!segMap) continue;\n const value = calculate(seriesData.values) ?? 0;\n segMap.set(segmentName, (segMap.get(segmentName) ?? 0) + value);\n\n if (!segmentNamesSet.has(segmentName)) {\n segmentNamesSet.add(segmentName);\n segmentNamesOrdered.push(segmentName);\n }\n }\n }\n\n if (groupMap.size === 0) return null;\n const getTotalValue = (cat: string): number =>\n Array.from(groupMap.get(cat)?.values() ?? []).reduce((a, b) => a + b, 0);\n\n let categories = Array.from(groupMap.keys());\n if (sort === 'asc') {\n categories = categories.sort((a, b) => getTotalValue(a) - getTotalValue(b));\n } else if (sort === 'desc') {\n categories = categories.sort((a, b) => getTotalValue(b) - getTotalValue(a));\n }\n\n const series: StackedBarChartSeries[] = segmentNamesOrdered.map((segName) => {\n const values = categories.map((cat) => {\n const rawVal = groupMap.get(cat)?.get(segName) ?? null;\n if (mode === 'percentage' && rawVal !== null) {\n const total = getTotalValue(cat);\n return total > 0 ? (rawVal / total) * 100 : 0;\n }\n return rawVal;\n });\n return { name: segName, values };\n });\n\n return { categories, series };\n }, [queryResults, groupBy, sort, mode, calculation]);\n\n if (contentDimensions === undefined) return null;\n\n const effectiveFormat =\n mode === 'percentage' ? { unit: 'percent' as const, decimalPlaces: format?.decimalPlaces } : format;\n\n return (\n <Box sx={{ padding: `${PADDING}px` }}>\n <BarChartBase\n width={contentDimensions.width - PADDING * 2}\n height={contentDimensions.height - PADDING * 2}\n data={barChartData}\n format={groupBy.length > 0 ? effectiveFormat : format}\n mode={mode}\n groupedData={stackedBarChartData}\n isStacked={isStacked}\n orientation={orientation}\n />\n </Box>\n );\n}\n"],"names":["useChartsTheme","Box","useMemo","CalculationsMap","calculatePercentages","sortSeriesData","BarChartBase","BarChartPanel","props","spec","calculation","format","sort","mode","groupBy","isStacked","orientation","contentDimensions","queryResults","chartsTheme","PADDING","container","padding","default","barChartData","length","calculate","result","seriesData","data","series","value","values","label","formattedName","push","sortedBarChartData","stackedBarChartData","groupMap","Map","segmentNamesOrdered","segmentNamesSet","Set","queryResult","labels","groupKey","map","k","join","remainingEntries","Object","entries","filter","includes","segmentName","v","name","has","set","segMap","get","add","size","getTotalValue","cat","Array","from","reduce","a","b","categories","keys","segName","rawVal","total","undefined","effectiveFormat","unit","decimalPlaces","sx","width","height","groupedData"],"mappings":"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"}
@@ -1,9 +1,12 @@
1
- import { ModeOption, SortOption } from '@perses-dev/components';
2
- import { CalculationType, Definition, FormatOptions } from '@perses-dev/core';
3
- import { OptionsEditorProps } from '@perses-dev/plugin-system';
1
+ import { FormatOptions, ModeOption, SortOption } from '@perses-dev/components';
2
+ import { CalculationType, OptionsEditorProps } from '@perses-dev/plugin-system';
3
+ import { Definition } from '@perses-dev/spec';
4
4
  export declare const DEFAULT_FORMAT: FormatOptions;
5
5
  export declare const DEFAULT_SORT: SortOption;
6
6
  export declare const DEFAULT_MODE: ModeOption;
7
+ export declare const DEFAULT_ORIENTATION: 'horizontal' | 'vertical';
8
+ export declare const DEFAULT_GROUP_BY: string[];
9
+ export declare const DEFAULT_IS_STACKED = false;
7
10
  /**
8
11
  * The schema for a BarChart panel.
9
12
  */
@@ -18,6 +21,9 @@ export interface BarChartOptions {
18
21
  format?: FormatOptions;
19
22
  sort?: SortOption;
20
23
  mode?: ModeOption;
24
+ orientation?: 'horizontal' | 'vertical';
25
+ groupBy?: string[];
26
+ isStacked?: boolean;
21
27
  }
22
28
  export type BarChartOptionsEditorProps = OptionsEditorProps<BarChartOptions>;
23
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart-model.d.ts","sourceRoot":"","sources":["../../src/bar-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAuB,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,cAAc,EAAE,aAAsD,CAAC;AACpF,eAAO,MAAM,YAAY,EAAE,UAAmB,CAAC;AAC/C,eAAO,MAAM,YAAY,EAAE,UAAoB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,eAAe,CAAC;IACrE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAE7E;;GAEG;AACH,wBAAgB,4BAA4B,IAAI,eAAe,CAO9D"}
1
+ {"version":3,"file":"bar-chart-model.d.ts","sourceRoot":"","sources":["../../src/bar-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAuB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,aAAsD,CAAC;AACpF,eAAO,MAAM,YAAY,EAAE,UAAmB,CAAC;AAC/C,eAAO,MAAM,YAAY,EAAE,UAAoB,CAAC;AAChD,eAAO,MAAM,mBAAmB,EAAE,YAAY,GAAG,UAAyB,CAAC;AAC3E,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAAO,CAAC;AAC7C,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,eAAe,CAAC;IACrE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAE7E;;GAEG;AACH,wBAAgB,4BAA4B,IAAI,eAAe,CAU9D"}
@@ -10,13 +10,16 @@
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 { DEFAULT_CALCULATION } from '@perses-dev/core';
13
+ import { DEFAULT_CALCULATION } from '@perses-dev/plugin-system';
14
14
  export const DEFAULT_FORMAT = {
15
15
  unit: 'decimal',
16
16
  shortValues: true
17
17
  };
18
18
  export const DEFAULT_SORT = 'desc';
19
19
  export const DEFAULT_MODE = 'value';
20
+ export const DEFAULT_ORIENTATION = 'horizontal';
21
+ export const DEFAULT_GROUP_BY = [];
22
+ export const DEFAULT_IS_STACKED = false;
20
23
  /**
21
24
  * Creates the initial/empty options for a BarChart panel.
22
25
  */ export function createInitialBarChartOptions() {
@@ -24,7 +27,10 @@ export const DEFAULT_MODE = 'value';
24
27
  calculation: DEFAULT_CALCULATION,
25
28
  format: DEFAULT_FORMAT,
26
29
  sort: DEFAULT_SORT,
27
- mode: DEFAULT_MODE
30
+ mode: DEFAULT_MODE,
31
+ orientation: DEFAULT_ORIENTATION,
32
+ groupBy: DEFAULT_GROUP_BY,
33
+ isStacked: DEFAULT_IS_STACKED
28
34
  };
29
35
  }
30
36
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bar-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 { ModeOption, SortOption } from '@perses-dev/components';\nimport { CalculationType, DEFAULT_CALCULATION, Definition, FormatOptions } from '@perses-dev/core';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal', shortValues: true };\nexport const DEFAULT_SORT: SortOption = 'desc';\nexport const DEFAULT_MODE: ModeOption = 'value';\n\n/**\n * The schema for a BarChart panel.\n */\nexport interface BarChartDefinition extends Definition<BarChartOptions> {\n kind: 'BarChart';\n}\n\n/**\n * The Options object type supported by the BarChart panel plugin.\n */\nexport interface BarChartOptions {\n calculation: CalculationType;\n format?: FormatOptions;\n sort?: SortOption;\n mode?: ModeOption;\n}\n\nexport type BarChartOptionsEditorProps = OptionsEditorProps<BarChartOptions>;\n\n/**\n * Creates the initial/empty options for a BarChart panel.\n */\nexport function createInitialBarChartOptions(): BarChartOptions {\n return {\n calculation: DEFAULT_CALCULATION,\n format: DEFAULT_FORMAT,\n sort: DEFAULT_SORT,\n mode: DEFAULT_MODE,\n };\n}\n"],"names":["DEFAULT_CALCULATION","DEFAULT_FORMAT","unit","shortValues","DEFAULT_SORT","DEFAULT_MODE","createInitialBarChartOptions","calculation","format","sort","mode"],"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,SAA0BA,mBAAmB,QAAmC,mBAAmB;AAGnG,OAAO,MAAMC,iBAAgC;IAAEC,MAAM;IAAWC,aAAa;AAAK,EAAE;AACpF,OAAO,MAAMC,eAA2B,OAAO;AAC/C,OAAO,MAAMC,eAA2B,QAAQ;AAqBhD;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAaP;QACbQ,QAAQP;QACRQ,MAAML;QACNM,MAAML;IACR;AACF"}
1
+ {"version":3,"sources":["../../src/bar-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, ModeOption, SortOption } from '@perses-dev/components';\nimport { CalculationType, DEFAULT_CALCULATION, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Definition } from '@perses-dev/spec';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal', shortValues: true };\nexport const DEFAULT_SORT: SortOption = 'desc';\nexport const DEFAULT_MODE: ModeOption = 'value';\nexport const DEFAULT_ORIENTATION: 'horizontal' | 'vertical' = 'horizontal';\nexport const DEFAULT_GROUP_BY: string[] = [];\nexport const DEFAULT_IS_STACKED = false;\n\n/**\n * The schema for a BarChart panel.\n */\nexport interface BarChartDefinition extends Definition<BarChartOptions> {\n kind: 'BarChart';\n}\n\n/**\n * The Options object type supported by the BarChart panel plugin.\n */\nexport interface BarChartOptions {\n calculation: CalculationType;\n format?: FormatOptions;\n sort?: SortOption;\n mode?: ModeOption;\n orientation?: 'horizontal' | 'vertical';\n groupBy?: string[];\n isStacked?: boolean;\n}\n\nexport type BarChartOptionsEditorProps = OptionsEditorProps<BarChartOptions>;\n\n/**\n * Creates the initial/empty options for a BarChart panel.\n */\nexport function createInitialBarChartOptions(): BarChartOptions {\n return {\n calculation: DEFAULT_CALCULATION,\n format: DEFAULT_FORMAT,\n sort: DEFAULT_SORT,\n mode: DEFAULT_MODE,\n orientation: DEFAULT_ORIENTATION,\n groupBy: DEFAULT_GROUP_BY,\n isStacked: DEFAULT_IS_STACKED,\n };\n}\n"],"names":["DEFAULT_CALCULATION","DEFAULT_FORMAT","unit","shortValues","DEFAULT_SORT","DEFAULT_MODE","DEFAULT_ORIENTATION","DEFAULT_GROUP_BY","DEFAULT_IS_STACKED","createInitialBarChartOptions","calculation","format","sort","mode","orientation","groupBy","isStacked"],"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,SAA0BA,mBAAmB,QAA4B,4BAA4B;AAGrG,OAAO,MAAMC,iBAAgC;IAAEC,MAAM;IAAWC,aAAa;AAAK,EAAE;AACpF,OAAO,MAAMC,eAA2B,OAAO;AAC/C,OAAO,MAAMC,eAA2B,QAAQ;AAChD,OAAO,MAAMC,sBAAiD,aAAa;AAC3E,OAAO,MAAMC,mBAA6B,EAAE,CAAC;AAC7C,OAAO,MAAMC,qBAAqB,MAAM;AAwBxC;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAaV;QACbW,QAAQV;QACRW,MAAMR;QACNS,MAAMR;QACNS,aAAaR;QACbS,SAASR;QACTS,WAAWR;IACb;AACF"}
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "BarChart", {
23
23
  const _barchartmodel = require("./bar-chart-model");
24
24
  const _BarChartOptionsEditorSettings = require("./BarChartOptionsEditorSettings");
25
25
  const _BarChartPanel = require("./BarChartPanel");
26
+ const _BarChartExportAction = require("./BarChartExportAction");
26
27
  const BarChart = {
27
28
  PanelComponent: _BarChartPanel.BarChartPanel,
28
29
  panelOptionsEditorComponents: [
@@ -34,5 +35,11 @@ const BarChart = {
34
35
  supportedQueryTypes: [
35
36
  'TimeSeriesQuery'
36
37
  ],
37
- createInitialOptions: _barchartmodel.createInitialBarChartOptions
38
+ createInitialOptions: _barchartmodel.createInitialBarChartOptions,
39
+ actions: [
40
+ {
41
+ component: _BarChartExportAction.BarChartExportAction,
42
+ location: 'header'
43
+ }
44
+ ]
38
45
  };