@perses-dev/pie-chart-plugin 0.6.0 → 0.7.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/palette-gen.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ChartVisualOptions, QuerySettingsOptions } from './model';\nimport { getConsistentColor } from './palette';\n\nexport interface SeriesColorProps {\n categoricalPalette: string[];\n visual: ChartVisualOptions;\n muiPrimaryColor: string;\n seriesName: string;\n seriesIndex: number;\n querySettings?: QuerySettingsOptions;\n queryHasMultipleResults?: boolean;\n}\n\n/**\n * Get line color as well as color for tooltip and legend, account for whether palette is 'categorical' or 'auto' aka generative\n */\nexport function getSeriesColor(props: SeriesColorProps): string {\n const {\n categoricalPalette,\n visual,\n muiPrimaryColor,\n seriesName,\n seriesIndex,\n querySettings,\n queryHasMultipleResults,\n } = props;\n\n // Use color overrides defined in query settings in priority, if applicable\n if (querySettings) {\n if (querySettings.colorMode === 'fixed') {\n return querySettings.colorValue;\n } else if (querySettings.colorMode === 'fixed-single' && !queryHasMultipleResults) {\n return querySettings.colorValue;\n }\n }\n\n // Fallback is unlikely to set unless echarts theme palette in charts theme provider is undefined.\n const fallbackColor =\n Array.isArray(categoricalPalette) && categoricalPalette[0]\n ? (categoricalPalette[0] as string) // Needed since echarts color property isn't always an array.\n : muiPrimaryColor;\n\n // Explicit way to always cycle through classical palette instead of changing when based on number of series.\n if (visual.palette?.mode === 'categorical') {\n return getCategoricalPaletteColor(categoricalPalette, seriesIndex, fallbackColor);\n }\n\n return getAutoPaletteColor(seriesName, fallbackColor);\n}\n\n/**\n * Get color from generative color palette, this approaches uses series name as the seed and\n * allows for consistent colors across panels (when all panels use this approach).\n */\nexport function getAutoPaletteColor(name: string, fallbackColor: string): string {\n // corresponds to 'Auto' in palette.kind for generative color palette\n const generatedColor = getConsistentSeriesNameColor(name);\n return generatedColor ?? fallbackColor;\n}\n\n/**\n * Default classical qualitative palette that cycles through the colors array by index.\n */\nexport function getCategoricalPaletteColor(palette: string[], seriesIndex: number, fallbackColor: string): string {\n if (palette === undefined) {\n return fallbackColor;\n }\n // Loop through predefined static color palette\n const paletteTotalColors = palette.length ?? 1;\n const paletteIndex = seriesIndex % paletteTotalColors;\n // fallback color comes from echarts theme\n const seriesColor = palette[paletteIndex] ?? fallbackColor;\n return seriesColor;\n}\n\n/*\n * Generate a consistent series name color (if series name includes 'error', it will have a red hue).\n */\nexport function getConsistentSeriesNameColor(inputString: string): string {\n return getConsistentColor(inputString, inputString.toLowerCase().includes('error'));\n}\n"],"names":["getConsistentColor","getSeriesColor","props","categoricalPalette","visual","muiPrimaryColor","seriesName","seriesIndex","querySettings","queryHasMultipleResults","colorMode","colorValue","fallbackColor","Array","isArray","palette","mode","getCategoricalPaletteColor","getAutoPaletteColor","name","generatedColor","getConsistentSeriesNameColor","undefined","paletteTotalColors","length","paletteIndex","seriesColor","inputString","toLowerCase","includes"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,kBAAkB,QAAQ,YAAY;AAY/C;;CAEC,GACD,OAAO,SAASC,eAAeC,KAAuB;IACpD,MAAM,EACJC,kBAAkB,EAClBC,MAAM,EACNC,eAAe,EACfC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,uBAAuB,EACxB,GAAGP;IAEJ,2EAA2E;IAC3E,IAAIM,eAAe;QACjB,IAAIA,cAAcE,SAAS,KAAK,SAAS;YACvC,OAAOF,cAAcG,UAAU;QACjC,OAAO,IAAIH,cAAcE,SAAS,KAAK,kBAAkB,CAACD,yBAAyB;YACjF,OAAOD,cAAcG,UAAU;QACjC;IACF;IAEA,kGAAkG;IAClG,MAAMC,gBACJC,MAAMC,OAAO,CAACX,uBAAuBA,kBAAkB,CAAC,EAAE,GACrDA,kBAAkB,CAAC,EAAE,CAAY,6DAA6D;OAC/FE;IAEN,6GAA6G;IAC7G,IAAID,OAAOW,OAAO,EAAEC,SAAS,eAAe;QAC1C,OAAOC,2BAA2Bd,oBAAoBI,aAAaK;IACrE;IAEA,OAAOM,oBAAoBZ,YAAYM;AACzC;AAEA;;;CAGC,GACD,OAAO,SAASM,oBAAoBC,IAAY,EAAEP,aAAqB;IACrE,qEAAqE;IACrE,MAAMQ,iBAAiBC,6BAA6BF;IACpD,OAAOC,kBAAkBR;AAC3B;AAEA;;CAEC,GACD,OAAO,SAASK,2BAA2BF,OAAiB,EAAER,WAAmB,EAAEK,aAAqB;IACtG,IAAIG,YAAYO,WAAW;QACzB,OAAOV;IACT;IACA,+CAA+C;IAC/C,MAAMW,qBAAqBR,QAAQS,MAAM,IAAI;IAC7C,MAAMC,eAAelB,cAAcgB;IACnC,0CAA0C;IAC1C,MAAMG,cAAcX,OAAO,CAACU,aAAa,IAAIb;IAC7C,OAAOc;AACT;AAEA;;CAEC,GACD,OAAO,SAASL,6BAA6BM,WAAmB;IAC9D,OAAO3B,mBAAmB2B,aAAaA,YAAYC,WAAW,GAAGC,QAAQ,CAAC;AAC5E"}
1
+ {"version":3,"sources":["../../src/palette-gen.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { getConsistentColor } from './palette';\n\nexport interface SeriesColorProps {\n categoricalPalette: string[];\n muiPrimaryColor: string;\n seriesName: string;\n}\n\n/**\n * Get line color as well as color for tooltip and legend, account for whether palette is 'categorical' or 'auto' aka generative\n */\nexport function getSeriesColor(props: SeriesColorProps): string {\n const { categoricalPalette, muiPrimaryColor, seriesName } = props;\n\n // Fallback is unlikely to set unless echarts theme palette in charts theme provider is undefined.\n const fallbackColor =\n Array.isArray(categoricalPalette) && categoricalPalette[0]\n ? (categoricalPalette[0] as string) // Needed since echarts color property isn't always an array.\n : muiPrimaryColor;\n\n return getAutoPaletteColor(seriesName, fallbackColor);\n}\n\n/**\n * Get color from generative color palette, this approaches uses series name as the seed and\n * allows for consistent colors across panels (when all panels use this approach).\n */\nexport function getAutoPaletteColor(name: string, fallbackColor: string): string {\n // corresponds to 'Auto' in palette.kind for generative color palette\n const generatedColor = getConsistentSeriesNameColor(name);\n return generatedColor ?? fallbackColor;\n}\n\n/**\n * Default classical qualitative palette that cycles through the colors array by index.\n */\nexport function getCategoricalPaletteColor(palette: string[], seriesIndex: number, fallbackColor: string): string {\n if (palette === undefined) {\n return fallbackColor;\n }\n // Loop through predefined static color palette\n const paletteTotalColors = palette.length ?? 1;\n const paletteIndex = seriesIndex % paletteTotalColors;\n // fallback color comes from echarts theme\n const seriesColor = palette[paletteIndex] ?? fallbackColor;\n return seriesColor;\n}\n\n/*\n * Generate a consistent series name color (if series name includes 'error', it will have a red hue).\n */\nexport function getConsistentSeriesNameColor(inputString: string): string {\n return getConsistentColor(inputString, inputString.toLowerCase().includes('error'));\n}\n"],"names":["getConsistentColor","getSeriesColor","props","categoricalPalette","muiPrimaryColor","seriesName","fallbackColor","Array","isArray","getAutoPaletteColor","name","generatedColor","getConsistentSeriesNameColor","getCategoricalPaletteColor","palette","seriesIndex","undefined","paletteTotalColors","length","paletteIndex","seriesColor","inputString","toLowerCase","includes"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAQ,YAAY;AAQ/C;;CAEC,GACD,OAAO,SAASC,eAAeC,KAAuB;IACpD,MAAM,EAAEC,kBAAkB,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGH;IAE5D,kGAAkG;IAClG,MAAMI,gBACJC,MAAMC,OAAO,CAACL,uBAAuBA,kBAAkB,CAAC,EAAE,GACrDA,kBAAkB,CAAC,EAAE,CAAY,6DAA6D;OAC/FC;IAEN,OAAOK,oBAAoBJ,YAAYC;AACzC;AAEA;;;CAGC,GACD,OAAO,SAASG,oBAAoBC,IAAY,EAAEJ,aAAqB;IACrE,qEAAqE;IACrE,MAAMK,iBAAiBC,6BAA6BF;IACpD,OAAOC,kBAAkBL;AAC3B;AAEA;;CAEC,GACD,OAAO,SAASO,2BAA2BC,OAAiB,EAAEC,WAAmB,EAAET,aAAqB;IACtG,IAAIQ,YAAYE,WAAW;QACzB,OAAOV;IACT;IACA,+CAA+C;IAC/C,MAAMW,qBAAqBH,QAAQI,MAAM,IAAI;IAC7C,MAAMC,eAAeJ,cAAcE;IACnC,0CAA0C;IAC1C,MAAMG,cAAcN,OAAO,CAACK,aAAa,IAAIb;IAC7C,OAAOc;AACT;AAEA;;CAEC,GACD,OAAO,SAASR,6BAA6BS,WAAmB;IAC9D,OAAOrB,mBAAmBqB,aAAaA,YAAYC,WAAW,GAAGC,QAAQ,CAAC;AAC5E"}
@@ -1,71 +1,20 @@
1
1
  import { ModeOption, SortOption } from '@perses-dev/components';
2
2
  import { CalculationType, Definition, FormatOptions } from '@perses-dev/core';
3
3
  import { LegendSpecOptions, OptionsEditorProps } from '@perses-dev/plugin-system';
4
- import { QuerySettingsOptions, StackOptions } from './model';
5
- export declare const DEFAULT_CONNECT_NULLS = false;
6
- export declare const POINT_SIZE_OFFSET = 1.5;
7
4
  export declare const DEFAULT_FORMAT: FormatOptions;
8
5
  export declare const DEFAULT_SORT: SortOption;
9
6
  export declare const DEFAULT_MODE: ModeOption;
10
- export declare const DEFAULT_LINE_WIDTH = 1.25;
11
- export declare const DEFAULT_AREA_OPACITY = 0;
12
- export declare const DEFAULT_POINT_RADIUS: number;
13
- export declare const VISUAL_CONFIG: {
14
- lineWidth: {
15
- label: string;
16
- testId: string;
17
- min: number;
18
- max: number;
19
- step: number;
20
- };
21
- pointRadius: {
22
- label: string;
23
- testId: string;
24
- min: number;
25
- max: number;
26
- step: number;
27
- };
28
- areaOpacity: {
29
- label: string;
30
- testId: string;
31
- min: number;
32
- max: number;
33
- step: number;
34
- };
35
- stack: {
36
- label: string;
37
- };
38
- connectNulls: {
39
- label: string;
40
- };
41
- };
42
7
  export interface BarChartDefinition extends Definition<PieChartOptions> {
43
8
  kind: 'PieChart';
44
9
  }
45
- export declare const DEFAULT_VISUAL: PieChartVisualOptions;
46
- export interface PieChartPaletteOptions {
47
- mode: 'auto' | 'categorical';
48
- }
49
10
  export interface PieChartOptions {
50
11
  legend?: LegendSpecOptions;
51
- visual?: PieChartVisualOptions;
52
- querySettings?: QuerySettingsOptions[];
53
12
  calculation: CalculationType;
54
13
  radius: number;
55
14
  format?: FormatOptions;
56
15
  sort?: SortOption;
57
16
  mode?: ModeOption;
58
17
  }
59
- export type PieChartVisualOptions = {
60
- display?: 'line' | 'bar';
61
- lineWidth?: number;
62
- areaOpacity?: number;
63
- showPoints?: 'auto' | 'always';
64
- palette?: PieChartPaletteOptions;
65
- pointRadius?: number;
66
- stack?: StackOptions;
67
- connectNulls?: boolean;
68
- };
69
18
  export type PieChartOptionsEditorProps = OptionsEditorProps<PieChartOptions>;
70
19
  export declare function createInitialPieChartOptions(): PieChartOptions;
71
20
  //# sourceMappingURL=pie-chart-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pie-chart-model.d.ts","sourceRoot":"","sources":["../../src/pie-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,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAC3C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,cAAc,EAAE,aAAsD,CAAC;AACpF,eAAO,MAAM,YAAY,EAAE,UAAmB,CAAC;AAC/C,eAAO,MAAM,YAAY,EAAE,UAAoB,CAAC;AAChD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,oBAAoB,QAAyC,CAAC;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BzB,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,eAAe,CAAC;IACrE,IAAI,EAAE,UAAU,CAAC;CAClB;AACD,eAAO,MAAM,cAAc,EAAE,qBAK5B,CAAC;AACF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACvC,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC/B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAE7E,wBAAgB,4BAA4B,IAAI,eAAe,CAS9D"}
1
+ {"version":3,"file":"pie-chart-model.d.ts","sourceRoot":"","sources":["../../src/pie-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,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAElF,eAAO,MAAM,cAAc,EAAE,aAAsD,CAAC;AACpF,eAAO,MAAM,YAAY,EAAE,UAAmB,CAAC;AAC/C,eAAO,MAAM,YAAY,EAAE,UAAoB,CAAC;AAEhD,MAAM,WAAW,kBAAmB,SAAQ,UAAU,CAAC,eAAe,CAAC;IACrE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,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,wBAAgB,4BAA4B,IAAI,eAAe,CAQ9D"}
@@ -11,60 +11,19 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { DEFAULT_CALCULATION } from '@perses-dev/core';
14
- export const DEFAULT_CONNECT_NULLS = false;
15
- export const POINT_SIZE_OFFSET = 1.5;
16
14
  export const DEFAULT_FORMAT = {
17
15
  unit: 'decimal',
18
16
  shortValues: true
19
17
  };
20
18
  export const DEFAULT_SORT = 'desc';
21
19
  export const DEFAULT_MODE = 'value';
22
- export const DEFAULT_LINE_WIDTH = 1.25;
23
- export const DEFAULT_AREA_OPACITY = 0;
24
- export const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;
25
- export const VISUAL_CONFIG = {
26
- lineWidth: {
27
- label: 'Line Width',
28
- testId: 'slider-line-width',
29
- min: 0.25,
30
- max: 3,
31
- step: 0.25
32
- },
33
- pointRadius: {
34
- label: 'Point Radius',
35
- testId: 'slider-point-radius',
36
- min: 0,
37
- max: 6,
38
- step: 0.25
39
- },
40
- areaOpacity: {
41
- label: 'Area Opacity',
42
- testId: 'slider-area-opacity',
43
- min: 0,
44
- max: 1,
45
- step: 0.05
46
- },
47
- stack: {
48
- label: 'Stack Series'
49
- },
50
- connectNulls: {
51
- label: 'Connect Nulls'
52
- }
53
- };
54
- export const DEFAULT_VISUAL = {
55
- lineWidth: DEFAULT_LINE_WIDTH,
56
- areaOpacity: DEFAULT_AREA_OPACITY,
57
- pointRadius: DEFAULT_POINT_RADIUS,
58
- connectNulls: DEFAULT_CONNECT_NULLS
59
- };
60
20
  export function createInitialPieChartOptions() {
61
21
  return {
62
22
  calculation: DEFAULT_CALCULATION,
63
23
  format: DEFAULT_FORMAT,
64
24
  radius: 50,
65
25
  sort: DEFAULT_SORT,
66
- mode: DEFAULT_MODE,
67
- visual: DEFAULT_VISUAL
26
+ mode: DEFAULT_MODE
68
27
  };
69
28
  }
70
29
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pie-chart-model.ts"],"sourcesContent":["// Copyright 2024 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 { LegendSpecOptions, OptionsEditorProps } from '@perses-dev/plugin-system';\n\nimport { QuerySettingsOptions, StackOptions } from './model';\n\nexport const DEFAULT_CONNECT_NULLS = false;\nexport const POINT_SIZE_OFFSET = 1.5;\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal', shortValues: true };\nexport const DEFAULT_SORT: SortOption = 'desc';\nexport const DEFAULT_MODE: ModeOption = 'value';\nexport const DEFAULT_LINE_WIDTH = 1.25;\nexport const DEFAULT_AREA_OPACITY = 0;\nexport const DEFAULT_POINT_RADIUS = DEFAULT_LINE_WIDTH + POINT_SIZE_OFFSET;\n\nexport const VISUAL_CONFIG = {\n lineWidth: {\n label: 'Line Width',\n testId: 'slider-line-width',\n min: 0.25,\n max: 3,\n step: 0.25,\n },\n pointRadius: {\n label: 'Point Radius',\n testId: 'slider-point-radius',\n min: 0,\n max: 6,\n step: 0.25,\n },\n areaOpacity: {\n label: 'Area Opacity',\n testId: 'slider-area-opacity',\n min: 0,\n max: 1,\n step: 0.05,\n },\n stack: {\n label: 'Stack Series',\n },\n connectNulls: {\n label: 'Connect Nulls',\n },\n};\n\nexport interface BarChartDefinition extends Definition<PieChartOptions> {\n kind: 'PieChart';\n}\nexport const DEFAULT_VISUAL: PieChartVisualOptions = {\n lineWidth: DEFAULT_LINE_WIDTH,\n areaOpacity: DEFAULT_AREA_OPACITY,\n pointRadius: DEFAULT_POINT_RADIUS,\n connectNulls: DEFAULT_CONNECT_NULLS,\n};\nexport interface PieChartPaletteOptions {\n mode: 'auto' | 'categorical';\n}\n\nexport interface PieChartOptions {\n legend?: LegendSpecOptions;\n visual?: PieChartVisualOptions;\n querySettings?: QuerySettingsOptions[];\n calculation: CalculationType;\n radius: number;\n format?: FormatOptions;\n sort?: SortOption;\n mode?: ModeOption;\n}\n\nexport type PieChartVisualOptions = {\n display?: 'line' | 'bar';\n lineWidth?: number;\n areaOpacity?: number;\n showPoints?: 'auto' | 'always';\n palette?: PieChartPaletteOptions;\n pointRadius?: number;\n stack?: StackOptions;\n connectNulls?: boolean;\n};\n\nexport type PieChartOptionsEditorProps = OptionsEditorProps<PieChartOptions>;\n\nexport function createInitialPieChartOptions(): PieChartOptions {\n return {\n calculation: DEFAULT_CALCULATION,\n format: DEFAULT_FORMAT,\n radius: 50,\n sort: DEFAULT_SORT,\n mode: DEFAULT_MODE,\n visual: DEFAULT_VISUAL,\n };\n}\n"],"names":["DEFAULT_CALCULATION","DEFAULT_CONNECT_NULLS","POINT_SIZE_OFFSET","DEFAULT_FORMAT","unit","shortValues","DEFAULT_SORT","DEFAULT_MODE","DEFAULT_LINE_WIDTH","DEFAULT_AREA_OPACITY","DEFAULT_POINT_RADIUS","VISUAL_CONFIG","lineWidth","label","testId","min","max","step","pointRadius","areaOpacity","stack","connectNulls","DEFAULT_VISUAL","createInitialPieChartOptions","calculation","format","radius","sort","mode","visual"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAA0BA,mBAAmB,QAAmC,mBAAmB;AAKnG,OAAO,MAAMC,wBAAwB,MAAM;AAC3C,OAAO,MAAMC,oBAAoB,IAAI;AACrC,OAAO,MAAMC,iBAAgC;IAAEC,MAAM;IAAWC,aAAa;AAAK,EAAE;AACpF,OAAO,MAAMC,eAA2B,OAAO;AAC/C,OAAO,MAAMC,eAA2B,QAAQ;AAChD,OAAO,MAAMC,qBAAqB,KAAK;AACvC,OAAO,MAAMC,uBAAuB,EAAE;AACtC,OAAO,MAAMC,uBAAuBF,qBAAqBN,kBAAkB;AAE3E,OAAO,MAAMS,gBAAgB;IAC3BC,WAAW;QACTC,OAAO;QACPC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,MAAM;IACR;IACAC,aAAa;QACXL,OAAO;QACPC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,MAAM;IACR;IACAE,aAAa;QACXN,OAAO;QACPC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,MAAM;IACR;IACAG,OAAO;QACLP,OAAO;IACT;IACAQ,cAAc;QACZR,OAAO;IACT;AACF,EAAE;AAKF,OAAO,MAAMS,iBAAwC;IACnDV,WAAWJ;IACXW,aAAaV;IACbS,aAAaR;IACbW,cAAcpB;AAChB,EAAE;AA6BF,OAAO,SAASsB;IACd,OAAO;QACLC,aAAaxB;QACbyB,QAAQtB;QACRuB,QAAQ;QACRC,MAAMrB;QACNsB,MAAMrB;QACNsB,QAAQP;IACV;AACF"}
1
+ {"version":3,"sources":["../../src/pie-chart-model.ts"],"sourcesContent":["// Copyright 2024 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 { LegendSpecOptions, 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\nexport interface BarChartDefinition extends Definition<PieChartOptions> {\n kind: 'PieChart';\n}\n\nexport interface PieChartOptions {\n legend?: LegendSpecOptions;\n calculation: CalculationType;\n radius: number;\n format?: FormatOptions;\n sort?: SortOption;\n mode?: ModeOption;\n}\n\nexport type PieChartOptionsEditorProps = OptionsEditorProps<PieChartOptions>;\n\nexport function createInitialPieChartOptions(): PieChartOptions {\n return {\n calculation: DEFAULT_CALCULATION,\n format: DEFAULT_FORMAT,\n radius: 50,\n sort: DEFAULT_SORT,\n mode: DEFAULT_MODE,\n };\n}\n"],"names":["DEFAULT_CALCULATION","DEFAULT_FORMAT","unit","shortValues","DEFAULT_SORT","DEFAULT_MODE","createInitialPieChartOptions","calculation","format","radius","sort","mode"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;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;AAiBhD,OAAO,SAASC;IACd,OAAO;QACLC,aAAaP;QACbQ,QAAQP;QACRQ,QAAQ;QACRC,MAAMN;QACNO,MAAMN;IACR;AACF"}
package/mf-manifest.json CHANGED
@@ -5,11 +5,11 @@
5
5
  "name": "PieChart",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.6.0",
8
+ "buildVersion": "0.7.0",
9
9
  "buildName": "@perses-dev/pie-chart-plugin"
10
10
  },
11
11
  "remoteEntry": {
12
- "name": "__mf/js/PieChart.9e5c2bf5.js",
12
+ "name": "__mf/js/PieChart.84baed80.js",
13
13
  "path": "",
14
14
  "type": "global"
15
15
  },
@@ -134,11 +134,12 @@
134
134
  "__mf/js/async/740.b86dfa00.js",
135
135
  "__mf/js/async/238.5287310b.js",
136
136
  "__mf/js/async/75.905151a5.js",
137
- "__mf/js/async/996.9e160813.js",
137
+ "__mf/js/async/470.9e513ba5.js",
138
+ "__mf/js/async/658.78ccd02d.js",
138
139
  "__mf/js/async/360.fdc4e499.js",
139
140
  "__mf/js/async/331.a0d6355f.js",
140
141
  "__mf/js/async/738.4ac98841.js",
141
- "__mf/js/async/610.8c8cf7f2.js",
142
+ "__mf/js/async/610.0d00ec39.js",
142
143
  "__mf/js/async/981.3ecbf5ea.js"
143
144
  ],
144
145
  "sync": [
@@ -182,7 +183,7 @@
182
183
  "js": {
183
184
  "async": [],
184
185
  "sync": [
185
- "__mf/js/async/610.8c8cf7f2.js"
186
+ "__mf/js/async/610.0d00ec39.js"
186
187
  ]
187
188
  },
188
189
  "css": {
@@ -281,10 +282,11 @@
281
282
  "assets": {
282
283
  "js": {
283
284
  "sync": [
285
+ "__mf/js/async/470.9e513ba5.js",
284
286
  "__mf/js/async/973.74031340.js",
285
287
  "__mf/js/async/331.a0d6355f.js",
286
288
  "__mf/js/async/707.55fda5d1.js",
287
- "__mf/js/async/__federation_expose_PieChart.f03b1180.js"
289
+ "__mf/js/async/__federation_expose_PieChart.5f41b08c.js"
288
290
  ],
289
291
  "async": [
290
292
  "__mf/js/async/964.6df60c3e.js",
@@ -297,12 +299,12 @@
297
299
  "__mf/js/async/488.0fc5dcbb.js",
298
300
  "__mf/js/async/238.5287310b.js",
299
301
  "__mf/js/async/224.dbeed4db.js",
300
- "__mf/js/async/996.9e160813.js",
302
+ "__mf/js/async/658.78ccd02d.js",
301
303
  "__mf/js/async/360.fdc4e499.js",
302
304
  "__mf/js/async/738.4ac98841.js",
303
305
  "__mf/js/async/173.ee70b493.js",
304
306
  "__mf/js/async/75.905151a5.js",
305
- "__mf/js/async/610.8c8cf7f2.js",
307
+ "__mf/js/async/610.0d00ec39.js",
306
308
  "__mf/js/async/740.b86dfa00.js",
307
309
  "__mf/js/async/981.3ecbf5ea.js"
308
310
  ]
package/mf-stats.json CHANGED
@@ -5,11 +5,11 @@
5
5
  "name": "PieChart",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.6.0",
8
+ "buildVersion": "0.7.0",
9
9
  "buildName": "@perses-dev/pie-chart-plugin"
10
10
  },
11
11
  "remoteEntry": {
12
- "name": "__mf/js/PieChart.9e5c2bf5.js",
12
+ "name": "__mf/js/PieChart.84baed80.js",
13
13
  "path": "",
14
14
  "type": "global"
15
15
  },
@@ -150,11 +150,12 @@
150
150
  "__mf/js/async/740.b86dfa00.js",
151
151
  "__mf/js/async/238.5287310b.js",
152
152
  "__mf/js/async/75.905151a5.js",
153
- "__mf/js/async/996.9e160813.js",
153
+ "__mf/js/async/470.9e513ba5.js",
154
+ "__mf/js/async/658.78ccd02d.js",
154
155
  "__mf/js/async/360.fdc4e499.js",
155
156
  "__mf/js/async/331.a0d6355f.js",
156
157
  "__mf/js/async/738.4ac98841.js",
157
- "__mf/js/async/610.8c8cf7f2.js",
158
+ "__mf/js/async/610.0d00ec39.js",
158
159
  "__mf/js/async/981.3ecbf5ea.js"
159
160
  ],
160
161
  "sync": [
@@ -206,7 +207,7 @@
206
207
  "js": {
207
208
  "async": [],
208
209
  "sync": [
209
- "__mf/js/async/610.8c8cf7f2.js"
210
+ "__mf/js/async/610.0d00ec39.js"
210
211
  ]
211
212
  },
212
213
  "css": {
@@ -327,10 +328,11 @@
327
328
  "assets": {
328
329
  "js": {
329
330
  "sync": [
331
+ "__mf/js/async/470.9e513ba5.js",
330
332
  "__mf/js/async/973.74031340.js",
331
333
  "__mf/js/async/331.a0d6355f.js",
332
334
  "__mf/js/async/707.55fda5d1.js",
333
- "__mf/js/async/__federation_expose_PieChart.f03b1180.js"
335
+ "__mf/js/async/__federation_expose_PieChart.5f41b08c.js"
334
336
  ],
335
337
  "async": [
336
338
  "__mf/js/async/964.6df60c3e.js",
@@ -343,12 +345,12 @@
343
345
  "__mf/js/async/488.0fc5dcbb.js",
344
346
  "__mf/js/async/238.5287310b.js",
345
347
  "__mf/js/async/224.dbeed4db.js",
346
- "__mf/js/async/996.9e160813.js",
348
+ "__mf/js/async/658.78ccd02d.js",
347
349
  "__mf/js/async/360.fdc4e499.js",
348
350
  "__mf/js/async/738.4ac98841.js",
349
351
  "__mf/js/async/173.ee70b493.js",
350
352
  "__mf/js/async/75.905151a5.js",
351
- "__mf/js/async/610.8c8cf7f2.js",
353
+ "__mf/js/async/610.0d00ec39.js",
352
354
  "__mf/js/async/740.b86dfa00.js",
353
355
  "__mf/js/async/981.3ecbf5ea.js"
354
356
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/pie-chart-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "scripts": {
5
5
  "dev": "rsbuild dev",
6
6
  "build": "npm run build-mf && concurrently \"npm:build:*\"",