@object-ui/plugin-charts 16.1.0 → 17.2.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.
@@ -23,7 +23,19 @@ export interface ChartRendererProps {
23
23
  chartType?: 'bar' | 'column' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'radar' | 'scatter' | 'funnel' | 'combo' | 'treemap' | 'sankey';
24
24
  data?: Array<Record<string, any>>;
25
25
  config?: Record<string, any>;
26
+ /** Internal binding. Authors write the spec `xAxis: { field }` (or the
27
+ * report surface's bare string); `normalizeChartSchema` resolves both. */
26
28
  xAxisKey?: string;
29
+ /**
30
+ * Plotted series — **both shapes**, unlike the bindings below.
31
+ *
32
+ * `series` is the one binding the spec and the internal contract spell with
33
+ * the same key, so declaring only the internal shape here made
34
+ * `series: [{ name: 'total' }]` a type error on an author who was writing
35
+ * the protocol correctly — and, until #2945, one whose chart also rendered
36
+ * blank. `normalizeChartSchema` translates; an array that already speaks the
37
+ * internal shape passes through untouched.
38
+ */
27
39
  series?: Array<{
28
40
  dataKey: string;
29
41
  label?: string;
@@ -31,12 +43,46 @@ export interface ChartRendererProps {
31
43
  opacity?: number;
32
44
  dashArray?: string;
33
45
  chartType?: 'bar' | 'line' | 'area';
46
+ stack?: string;
47
+ yAxis?: 'left' | 'right';
48
+ color?: string;
49
+ } | {
50
+ name: string;
51
+ label?: unknown;
52
+ type?: string;
53
+ variant?: 'current' | 'comparison' | 'primary';
54
+ opacity?: number;
55
+ dashArray?: string;
56
+ stack?: string;
57
+ yAxis?: 'left' | 'right';
58
+ color?: string;
34
59
  }>;
60
+ /** Spec `ChartConfig` shape — honored via `normalizeChartSchema`
61
+ * (objectui#2880). Listed here so the author-facing contract type-checks;
62
+ * the internal props above win when both are present. */
63
+ xAxis?: unknown;
64
+ yAxis?: unknown;
65
+ showLegend?: boolean;
66
+ showDataLabels?: boolean;
67
+ title?: unknown;
68
+ subtitle?: unknown;
69
+ description?: unknown;
70
+ height?: number;
71
+ annotations?: Array<Record<string, any>>;
72
+ interaction?: Record<string, any>;
73
+ /** An author `type` rescued from the SDUI envelope's discriminator
74
+ * collision by the react-page wrapper — see `normalizeChartSchema`. */
75
+ specType?: string;
35
76
  colors?: string[];
36
77
  /** Per-category colour map (value/label → colour). Wins over `colors` per
37
78
  * category; see AdvancedChartImpl. Set by ObjectChart from select/lookup
38
79
  * dimension option colours and/or an explicit author map. */
39
80
  categoryColors?: Record<string, string>;
81
+ /** Declared category order (value/label keys, in domain order) for
82
+ * ordered-sequence charts — funnel/pyramid stages. Set by DatasetWidget
83
+ * from the dimension's picklist order or an explicit `stageOrder`; see
84
+ * AdvancedChartImpl. Omitted → the funnel's value-descending default. */
85
+ categoryOrder?: string[];
40
86
  /** Pass `false` for a deterministic, export-safe render with no entrance
41
87
  * animation (see AdvancedChartImpl). Omitted → animated default. */
42
88
  isAnimationActive?: boolean;
@@ -4,13 +4,29 @@ import { default as React } from 'react';
4
4
  * Local implementation to avoid a dependency on @object-ui/fields.
5
5
  */
6
6
  export declare function humanizeLabel(value: string): string;
7
+ /**
8
+ * The result column an object-bound `aggregate` projects its value under
9
+ * (framework#3701, `chartAggregateValueKey` in `@objectstack/spec/ui`).
10
+ *
11
+ * The raw `field` name — an object-bound aggregate does NOT decorate it the way
12
+ * a dataset measure is named (`sum_amount`). Only `count` may omit `field`, and
13
+ * it then lands under the literal `'count'`, which is the alias the engine
14
+ * projects `COUNT(*)` under. Exported so every path that builds these rows
15
+ * agrees on one key instead of each re-deriving it.
16
+ */
17
+ export declare function aggregateValueKey(aggregate: {
18
+ field?: string;
19
+ function?: string;
20
+ }): string;
21
+ /** Suffix the previous-window value carries under a compareTo overlay. */
22
+ export declare const COMPARISON_SUFFIX = "__comparison";
7
23
  /**
8
24
  * Client-side aggregation for fetched records.
9
25
  * Groups records by `groupBy` field and applies the aggregation function
10
26
  * to the `field` values in each group.
11
27
  */
12
28
  export declare function aggregateRecords(records: any[], aggregate: {
13
- field: string;
29
+ field?: string;
14
30
  function: string;
15
31
  groupBy: string;
16
32
  }): any[];