@datama/studio-skill-instructions 1.0.0 → 1.1.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.
@@ -5,46 +5,48 @@ Finds outliers in a time series: the measure over time with its expected range,
5
5
  ## When
6
6
 
7
7
  - "Find anomalies in daily orders", "which days were unusual", "monitor the last points", "did anything abnormal happen last week".
8
- - Needs a **date** dimension (the solution is unavailable otherwise) and at least one metric. More periods give a better baseline (dozens of points at least).
8
+ - Needs a **date** column at a regular grain (one row per day × segment, for instance) and dozens of periods for a reliable baseline.
9
9
 
10
- ## Recipe
11
-
12
- 1. `source`: rows with a date column at a regular grain (one row per day × segment, for instance), `dimensions` (the date first), `metrics`.
13
- 2. Optional `pins.marketEquation` to choose the main KPI and its steps ([market-equation.md](../market-equation.md)).
14
- 3. Module `{"module": "detect.anomaly", "inputs": {…}}`; `"detect.anomaly"` alone uses every default (observed volatility on the whole series).
10
+ ## Minimal
15
11
 
16
12
  ```json
17
- {
18
- "stories": {"story-orders-anomalies": {
19
- "title": "Unusual days in orders",
20
- "modules": [{"module": "detect.anomaly", "inputs": {"detectionMethod": "observed-volatility", "lastPointsOnlyEnabled": true, "lastPointsCount": 7}}]
21
- }},
22
- "activeStory": "story-orders-anomalies"
23
- }
13
+ {"solution": "detect", "metrics": ["Sessions", "Orders"], "title": "Unusual months in orders", "language": "en-US"}
24
14
  ```
25
15
 
26
- ## Module inputs
16
+ Monitoring the latest points only: add `"lastPointsOnlyEnabled": true, "lastPointsCount": 7`.
17
+
18
+ ## Business rules
19
+
20
+ - Detection runs on the main KPI and on every step: get the equation right ([market-equation.md](../market-equation.md)).
21
+ - One grain per page: never mix days and months in the same column.
22
+ - Pick the method from the question: a sudden change → `variation-volatility`; a business threshold ("below 1 000 orders", "a drop of more than 20 %") → the matching `*-threshold` with `detectionThreshold`; a seasonal series → `forecast`; otherwise the default.
23
+
24
+ ## Inputs
27
25
 
28
- All optional. Defaults: [generated/solutions.md](../generated/solutions.md#detect).
26
+ All optional. Defaults: `python3 scripts/datama.py settings detect`.
29
27
 
30
28
  | Key | Values | Meaning |
31
29
  | --- | --- | --- |
32
- | `detectionMethod` | `observed-volatility` · `variation-volatility` · `relative-variation-threshold` · `absolute-variation-threshold` · `absolute-value-threshold` · `forecast` | Volatility of the values, volatility of point-to-point variations, a threshold on the variation (% or value), a threshold on the value, or the gap to a forecast |
30
+ | `detectionMethod` | `observed-volatility` · `variation-volatility` · `relative-variation-threshold` · `absolute-variation-threshold` · `absolute-value-threshold` · `forecast` | Volatility of the values, of point-to-point variations, a threshold on the variation (% or value), on the value, or the gap to a forecast |
33
31
  | `detectionThreshold` | number | Threshold of the `*-threshold` methods (percent for `relative-variation-threshold`, measure unit otherwise) |
34
32
  | `confidence` | number (%), default `95` | Confidence of the volatility and forecast bands |
35
33
  | `confidenceInterval` | boolean, default `true` | Draw the expected band |
36
34
  | `flagWhenAbove` / `flagWhenBelow` | boolean, default `true` | Flag spikes, drops, or both |
37
35
  | `minImpactThreshold` | number, default `0.5` | Minimum impact for a segment to be reported |
38
- | `lastPointsOnlyEnabled` | boolean, default `false` | Evaluate only the most recent points (monitoring) |
39
- | `lastPointsCount` | integer | Number of recent points evaluated with `lastPointsOnlyEnabled` |
40
- | `baselineMode` | `"all"` | Points used to learn the baseline |
41
- | `segmentChartMode` | `"overlay"` · `"split"` | Selected segments superimposed, or stacked one chart per segment |
36
+ | `lastPointsOnlyEnabled` / `lastPointsCount` | boolean / integer | Evaluate only the most recent points |
37
+ | `segmentChartMode` | `"overlay"` · `"split"` | Selected segments superimposed, or one chart per segment |
42
38
  | `displayDenominator` | boolean | Also plot the denominator of a ratio step |
43
39
  | `computeMainKpi` | boolean, default `true` | Detect on the main KPI as well as on the steps |
44
40
 
45
- Detection settings can be shared by several Detect modules through `pins.detection` ([studio-stories.md](../studio-stories.md#pins)).
41
+ ## Advanced
42
+
43
+ Drops of more than 20 % only, shared by every module of the story:
44
+
45
+ ```json
46
+ {"solution": "detect", "metrics": ["Sessions", "Orders"], "shared": {"detectionMethod": "relative-variation-threshold", "detectionThreshold": 20},
47
+ "flagWhenAbove": false, "language": "en-US"}
48
+ ```
46
49
 
47
50
  ## Checks
48
51
 
49
- - A date column exists and its values parse as dates (ISO `YYYY-MM-DD` recommended).
50
- - One grain per page: do not mix days and months in the same column.
52
+ - A date column exists and parses as dates (ISO `YYYY-MM-DD`).
@@ -1,101 +1,84 @@
1
1
  # Explore (`explore.dimensions`)
2
2
 
3
- Breaks one or two measures down across one or two dimensions, with an optional comparison: bar, line, area, combo, mekko and scatter charts, plus a generated title and comment. Zero settings already give a board-ready chart; every setting below is optional.
3
+ Breaks one or two measures down across one or two dimensions, with an optional comparison: bar, line, area, combo, mekko and scatter charts, plus a generated title and comment. Zero settings already give a board-ready chart.
4
4
 
5
5
  ## When
6
6
 
7
- - "Break down revenue by country", "sessions by device and channel", "orders by week", "show the funnel step by country", "distribution of X across Y".
8
- - A two-side "why did it change" question is Compare, not Explore. Explore can still **show** a comparison (two periods side by side, deltas).
7
+ - "Break down revenue by country", "sessions by device and channel", "orders by week", "conversion rate by country", "distribution of X across Y".
8
+ - A "why did it change" question is Compare. Explore still **shows** a comparison (two periods side by side, deltas).
9
9
 
10
- ## Recipe
11
-
12
- 1. `source`: rows + `dimensions` + `metrics` ([studio-instantiation.md](../studio-instantiation.md)).
13
- 2. Optional `pins.comparison` to compare two periods or segments ([studio-stories.md](../studio-stories.md#comparisons)).
14
- 3. Optional `pins.marketEquation` when ratios between metrics must be plottable ([market-equation.md](../market-equation.md)).
15
- 4. Module `{"module": "explore.dimensions", "inputs": {bindings + chart spec}}`.
10
+ ## Minimal
16
11
 
17
12
  ```json
18
- {
19
- "stories": {"story-sessions-by-country": {
20
- "title": "Sessions by country and channel",
21
- "modules": [{"module": "explore.dimensions", "inputs": {
22
- "primary": "Country", "secondary": "Channel", "metric1": "Session", "metric2": "",
23
- "chart.category": "bar", "chart.layout": "stacked", "trace": "bar", "view": "bar"
24
- }}]
25
- }},
26
- "activeStory": "story-sessions-by-country"
27
- }
13
+ {"solution": "explore", "metrics": ["Sessions", "Orders", "Revenue"], "primary": "Country", "secondary": "Channel", "metric1": "Sessions",
14
+ "chart.category": "bar", "chart.layout": "stacked", "title": "Sessions by country and channel", "language": "en-US"}
28
15
  ```
29
16
 
17
+ ## Business rules
18
+
19
+ - A rate or an average is a **step name** of the equation (`"Orders per Sessions"`), never a summed column: order `metrics` so the step exists, or declare it in `steps` ([market-equation.md](../market-equation.md)).
20
+ - `stacked` / `percent` need an additive measure (a volume); a ratio falls back to `clustered`.
21
+ - A trend needs the date as `primary` and a `line`; several series with a `secondary`.
22
+
30
23
  ## Bindings
31
24
 
32
25
  | Key | Value | Meaning |
33
26
  | --- | --- | --- |
34
- | `primary` | dimension name, or `"Comparison Dimension"` | D1: the axis of the chart. Default: chosen automatically |
35
- | `secondary` | dimension name, `"Comparison Dimension"` or `""` | D2: series (colors / stacks). `""` = none |
36
- | `metric1` | measure name | M1: main measure (bars, line, area, height of a mekko, X of a scatter) |
37
- | `metric2` | measure name or `""` | M2: second measure (line on a right axis in a combo, width of a mekko, Y of a scatter) |
38
- | `metric3` | measure name or `""` | M3: bubble area (scatter `bubble` only) |
39
-
40
- A **measure name** is, verbatim:
27
+ | `primary` | dimension, or `"Comparison Dimension"` | D1: the axis. Default: chosen automatically |
28
+ | `secondary` | dimension, `"Comparison Dimension"` or `""` | D2: series (colors, stacks). `""` = none |
29
+ | `metric1` | measure | M1: bars, line, area, mekko height, scatter X |
30
+ | `metric2` | measure or `""` | M2: right-axis line in a combo, mekko width, scatter Y |
31
+ | `metric3` | measure or `""` | M3: bubble area (scatter `bubble`) |
41
32
 
42
- - a metric column (`"Revenue"`),
43
- - a market-equation step name (`"Checkout per Session"`, also those of the automatic equation),
44
- - with a comparison only: a delta `"<measure> Δ"` or a relative change `"<measure> % Change"` (`"Revenue Δ"`, `"Checkout per Session % Change"`). Positive deltas use the rise color, negative ones the drop color.
33
+ A **measure** is, verbatim: a metric column (`"Revenue"`), a step name (`"Orders per Sessions"`, automatic steps included), or, with a comparison, `"<measure> Δ"` / `"<measure> % Change"`. `"Comparison Dimension"` is the Start / End sides: as `secondary`, one bar per period for each D1 value. Without `context`, these measures compare the older half of the dates with the newer half.
45
34
 
46
- `"Comparison Dimension"` stands for the Start / End sides of the comparison pin: as `secondary`, each D1 value gets one bar per period; as `primary`, one group per period.
35
+ ## Chart
47
36
 
48
- ## Chart spec
37
+ `chart.category` alone is enough (the build syncs `trace` and `view`).
49
38
 
50
- Write `chart.category` and keep `trace` and `view` equal to it (they are synced from it, and a disagreeing `trace` wins on load).
51
-
52
- | Key | Values | Default | Meaning |
53
- | --- | --- | --- | --- |
54
- | `chart.category` | `bar` · `line` · `area` · `combo` · `mekko` · `scatter` | `bar` | Chart type. `combo` = M1 bars + M2 line; allowed with a single metric |
55
- | `chart.layout` | `clustered` · `stacked` · `percent` · `overlay` | `clustered` | Series layout. `stacked` / `percent` need a D2 and an additive measure (a ratio falls back to `clustered`). Mekko: `clustered` = Bar Mekko (width = share of M2, height = M1), `percent` = Marimekko 100 % |
56
- | `chart.variant` | `""` · `moves` · `bubble` | `""` | Scatter only. `moves`: one arrow per segment from Start to End (needs a comparison). `bubble`: M1 across, M2 up, M3 area |
57
- | `chart.orientation` | `vertical` · `horizontal` | `vertical` | Bar orientation (`horizontal` currently renders vertical) |
58
- | `chart.comparisonAxis` | `aligned` · `all` | `aligned` | When D1 is the compared dimension: one position per compared pair, or every value colored Start / End / Other |
59
- | `chart.dualAxis` | `""` · `shared` · `split` | `""` (auto) | With M2: one chart with a right axis, or M2 in its own chart below |
60
- | `chart.metric2Shape` | `""` · `ticks` · `bars` | `""` (auto) | Shape of M2 on a bar chart |
61
- | `chart.alignZeros` | boolean | `true` | Both value axes share the zero height |
62
- | `chart.barOpacity` | `""` or number in (0, 1] | `""` (auto) | Bar fill opacity |
63
- | `chart.overlapWidth` | `""` or number | `""` (0.55) | Width share of the front bar in `overlay` |
64
-
65
- Pick the chart from the question:
39
+ | Key | Values | Meaning |
40
+ | --- | --- | --- |
41
+ | `chart.category` | `bar` · `line` · `area` · `combo` · `mekko` · `scatter` | `combo` = M1 bars + M2 line |
42
+ | `chart.layout` | `clustered` · `stacked` · `percent` · `overlay` | Mekko: `clustered` = Bar Mekko (width = share of M2, height = M1), `percent` = Marimekko 100 % |
43
+ | `chart.variant` | `""` · `moves` · `bubble` | Scatter: `moves` = one arrow per segment from Start to End (comparison); `bubble` = M3 area |
44
+ | `chart.comparisonAxis` | `aligned` · `all` | D1 is the compared dimension: one position per pair, or every value colored Start / End / Other |
45
+ | `chart.dualAxis` | `""` · `shared` · `split` | With M2: right axis, or M2 in its own chart below |
46
+ | `chart.metric2Shape` | `""` · `ticks` · `bars` | Shape of M2 on a bar chart |
47
+ | `chart.alignZeros` | boolean, default `true` | Both value axes share the zero |
48
+ | `chart.barOpacity` / `chart.overlapWidth` | number | Bar opacity / front-bar width in `overlay` |
49
+ | `clusteringThreshold` · `clusteringMethod` · `clusteringBins` · `metricForClustering` | as in Compare | Small D1 / D2 values grouped into "Other" |
66
50
 
67
51
  | Ask | Spec |
68
52
  | --- | --- |
69
- | Ranking / comparison of values across categories | `bar` + `clustered` |
70
- | Composition of a total by a second dimension | `bar` + `stacked` (shares: `percent`) |
71
- | Trend over time | `line` (D1 = date); several series with a D2 |
72
- | Volume and rate together | `combo` with M1 = volume, M2 = ratio |
73
- | Share by two dimensions at once | `mekko` + `percent` |
74
- | Size and rate of each segment | `mekko` + `clustered` (height = ratio M1, width = volume M2) |
75
- | Correlation of two measures | `scatter` + `bubble` (M3 optional) |
76
- | How segments moved between two periods | `scatter` + `moves` with a comparison pin |
77
- | Period vs period per category | comparison pin, `secondary: "Comparison Dimension"`, `bar` + `clustered` |
78
-
79
- ## Other inputs
53
+ | Ranking across categories | `bar` + `clustered` |
54
+ | Composition of a total | `bar` + `stacked` (shares: `percent`) |
55
+ | Trend over time | `line`, D1 = date |
56
+ | Volume and rate together | `combo`, M1 = volume, M2 = step name of the rate |
57
+ | Share by two dimensions | `mekko` + `percent` |
58
+ | Size and rate of each segment | `mekko` + `clustered` (M1 = rate, M2 = volume) |
59
+ | Correlation of two measures | `scatter` + `bubble` |
60
+ | How segments moved between two periods | `scatter` + `moves`, with `context` / `start` / `end` |
61
+ | Period vs period per category | `context` / `start` / `end`, `secondary: "Comparison Dimension"`, `bar` + `clustered` |
80
62
 
81
- | Key | Values | Meaning |
82
- | --- | --- | --- |
83
- | `clusteringThreshold` | number 0–100 (%), default `2` | Small D1 / D2 values grouped into "Other" |
84
- | `clusteringMethod` | `"threshold"` · `"tail"` | Grouping rule |
85
- | `clusteringBins` | integer 2–20, default `5` | Bins for numeric dimensions |
86
- | `metricForClustering` | metric column | Metric weighing the segments |
63
+ ## Advanced
87
64
 
88
- Defaults of every input: [generated/solutions.md](../generated/solutions.md#explore).
65
+ Deltas by country between two years:
89
66
 
90
- ## Chart tuning
67
+ ```json
68
+ {"solution": "explore", "metrics": ["Sessions", "Orders", "Revenue"], "context": "Year", "start": ["2024"], "end": ["2025"],
69
+ "primary": "Country", "metric1": "Revenue Δ", "chart.category": "bar", "language": "en-US"}
70
+ ```
91
71
 
92
- Without `configuration.plotter`, a new Explore chart starts on the Datama look (style preset, value labels on bars, comment beside the chart). **Any** non-empty `configuration.plotter` is treated as a saved chart and keeps its own look instead, so add one only for a precise need (value lines, an axis option) and expect to restate the look you want ([plotter/embedded.md](../plotter/embedded.md)). For colors, use the theme ([theming.md](../theming.md)).
72
+ Volume and conversion rate in one chart:
73
+
74
+ ```json
75
+ {"solution": "explore", "metrics": ["Sessions", "Orders"], "primary": "Channel", "metric1": "Sessions", "metric2": "Orders per Sessions",
76
+ "chart.category": "combo", "language": "en-US"}
77
+ ```
93
78
 
94
- Average and value lines (`configuration.plotter.annotations.valueLines`) are described in [plotter/annotations.md](../plotter/annotations.md).
79
+ Axis, legend, labels and average lines: the `plotter` key ([chart.md](../chart.md)). Any `plotter` replaces the default Explore look: add one only for a precise need. Colors: the theme ([theming.md](../theming.md)).
95
80
 
96
81
  ## Checks
97
82
 
98
- - `primary` and `secondary` are dimension names of the source (or `"Comparison Dimension"` with a comparison pin).
99
- - `metric1` / `metric2` / `metric3` are measure names that exist verbatim.
100
- - `Δ` / `% Change` measures, `moves` and `"Comparison Dimension"` require a comparison pin.
101
- - `trace` and `view` equal `chart.category`.
83
+ - `primary` / `secondary` are dimensions of the data (or `"Comparison Dimension"`).
84
+ - `metric1` / `metric2` / `metric3` exist verbatim as columns or step names.
@@ -1,41 +1,32 @@
1
1
  # Pivot (`pivot.tree`)
2
2
 
3
- "Where is my KPI the most dispersed right now?" — Compare without a comparison: Pivot scores every dimension on how unevenly the main KPI spreads across its segments, and shows the decomposition as a tree of cards (market-equation steps, then the most dispersed dimensions).
3
+ "Where is my KPI the most dispersed right now?": Pivot scores every dimension on how unevenly the main KPI spreads across its segments, and shows the decomposition as a tree of cards (equation steps, then the most dispersed dimensions).
4
4
 
5
5
  ## When
6
6
 
7
- - "Where is conversion the most uneven?", "which dimension explains the most variance in basket size", "show me the KPI tree", "pivot table of revenue by segments".
8
- - No two sides needed. When the user wants a change between two periods, use Compare.
7
+ - "Where is conversion the most uneven?", "which dimension explains the most variance in basket size", "show me the KPI tree".
8
+ - No two sides. A change between two periods is Compare.
9
9
 
10
- ## Recipe
11
-
12
- 1. `source`: rows + `dimensions` + `metrics` ([studio-instantiation.md](../studio-instantiation.md)).
13
- 2. Optional `pins.marketEquation` to define the KPI tree ([market-equation.md](../market-equation.md)).
14
- 3. Module `"pivot.tree"`, or with inputs:
10
+ ## Minimal
15
11
 
16
12
  ```json
17
- {
18
- "stories": {"story-conversion-dispersion": {
19
- "title": "Where is conversion the most uneven?",
20
- "modules": [{"module": "pivot.tree", "inputs": {"view": "tree-default", "hierarchyExplorationMethod": "top", "hierarchyTopLeaves": 3}}]
21
- }},
22
- "activeStory": "story-conversion-dispersion"
23
- }
13
+ {"solution": "pivot", "metrics": ["Sessions", "Orders"], "formula": "[2]", "totalStepName": "Conversion rate", "totalStepUnit": "%",
14
+ "title": "Where is conversion the most uneven?", "language": "en-US"}
24
15
  ```
25
16
 
26
- ## Module inputs
17
+ ## Business rules
18
+
19
+ - The tree decomposes `totalStepName`: name the KPI the user asks about ([market-equation.md](../market-equation.md)).
20
+ - Dispersion is only meaningful on a ratio KPI (conversion, basket, cost per unit); on a pure volume, suggest Explore.
27
21
 
28
- All optional. Defaults: [generated/solutions.md](../generated/solutions.md#pivot).
22
+ ## Inputs
23
+
24
+ All optional. Defaults: `python3 scripts/datama.py settings pivot`.
29
25
 
30
26
  | Key | Values | Meaning |
31
27
  | --- | --- | --- |
32
- | `view` | `"tree-default"` · `"waterfall-default"` | Tree of cards (dispersion), or the Compare waterfall when a comparison is set |
28
+ | `view` | `"tree-default"` · `"waterfall-default"` | Tree of cards, or the Compare waterfall when a comparison is set |
33
29
  | `hierarchyExplorationMethod` | `"hierarchy"` · `"top"` | Expand along the dimension order, or pick the most contributing leaves |
34
30
  | `hierarchyTopLeaves` | integer ≥ 1 | Leaves per node with `top` |
35
- | `clusteringThreshold` | number 0–100 (%), default `2` | Small segments grouped into "Other" |
36
- | `clusteringMethod` | `"threshold"` · `"tail"` | Grouping rule |
37
- | `clusteringBins` | integer 2–20, default `5` | Bins for numeric dimensions |
38
- | `metricForClustering` | metric column | Metric weighing the segments |
39
- | `totalStepName` / `totalStepUnit` / `totalStepEmoji` | string | Main KPI label (prefer `pins.marketEquation`) |
40
-
41
- Tree card typography (`treeCardMainKpiRatio`, `treeCardSubKpiRatio`, `treeCardTitleRatio`) works as in Compare ([compare.md](compare.md#tree-view-view-tree-default)).
31
+ | `clusteringThreshold` · `clusteringMethod` · `clusteringBins` · `metricForClustering` | as in Compare | Small segments grouped into "Other" |
32
+ | `treeCardMainKpiRatio` / `treeCardSubKpiRatio` / `treeCardTitleRatio` | `0.75` · `1` · `1.25` | Font size of the card headline / sub lines / title |
@@ -6,7 +6,7 @@
6
6
  var THEME = {"colors": {"palette": "modern"}};
7
7
  ```
8
8
 
9
- Every palette, preset and application color key is listed with its exact values in [generated/theme.md](generated/theme.md). A name absent from that file does not exist.
9
+ Every palette, preset and application color key is listed with its exact values by `python3 scripts/datama.py settings theme [word]`. A name absent from that list does not exist.
10
10
 
11
11
  ## `colors.palette`: named palette
12
12
 
@@ -47,7 +47,7 @@ When a **drop is good news** (costs, churn, complaints), swap the two: `Up` red,
47
47
 
48
48
  ## `colors.application`: page chrome
49
49
 
50
- Same keys as the in-app Colors editor ([generated/theme.md](generated/theme.md#application-colors-themecolorsapplication)). Values are `#RRGGBB`.
50
+ Same keys as the in-app Colors editor (`datama.py settings theme application`). Values are `#RRGGBB`.
51
51
 
52
52
  ```json
53
53
  {"colors": {
@@ -67,13 +67,23 @@ A preset is the whole chart look in one key; it also applies its own palette. It
67
67
  - Compare: module input `"stylePreset": "<key>"` ([solutions/compare.md](solutions/compare.md)).
68
68
  - Explore: starts on its own default preset; keep it unless the user asks for a precise chart change.
69
69
 
70
- Keys, labels and paired palettes: [generated/theme.md](generated/theme.md#style-presets-configurationplotterstylepreset). "Looks like a deck" → `presentation`; "board-ready, minimal" → `modern`; "product analytics dashboard" → `dashboard`; "corporate Excel" → `excel`. A preset activates its paired palette: for a color-only request, use `THEME` alone and leave the preset untouched.
70
+ Keys, labels and paired palettes: `datama.py settings theme stylePreset`. "Looks like a deck" → `presentation`; "board-ready, minimal" → `modern`; "product analytics dashboard" → `dashboard`; "corporate Excel" → `excel`. A preset activates its paired palette: for a color-only request, use `THEME` alone and leave the preset untouched.
71
+
72
+ ## Story canvas (`appearance`)
73
+
74
+ A story key of the configuration, not part of `THEME`. Omit it for the default flat look. The Datama "slide" card look:
75
+
76
+ ```json
77
+ {"appearance": {"paddingY": 20, "paddingX": 24, "modulePaddingY": 16, "modulePaddingX": 16, "background": "#EEF2F2", "border": true, "radius": 12,
78
+ "borderWidth": 1, "borderColor": "#C8D6D6", "shadow": true, "shadowSize": 5, "shadowAlign": "center", "shadowColor": "#000000", "shadowOpacity": 25}}
79
+ ```
80
+
81
+ Colors accept `#rgb`, `#rrggbb`, `rgb(...)`, `rgba(...)` or `transparent`; numbers are pixels, opacity in percent.
71
82
 
72
83
  ## Not theming
73
84
 
74
85
  | Ask | Where |
75
86
  | --- | --- |
76
- | Chart type, layout, series | Explore chart spec ([solutions/explore.md](solutions/explore.md)) |
77
- | Axis, legend, labels, padding of a chart | `configuration.plotter` ([plotter/embedded.md](plotter/embedded.md)) |
78
- | Story canvas (cards, background of the story) | Story `appearance` ([studio-stories.md](studio-stories.md#appearance)) |
87
+ | Chart type, layout, series | Explore chart keys ([solutions/explore.md](solutions/explore.md)) |
88
+ | Axis, legend, labels, padding of a chart | The `plotter` key ([chart.md](chart.md)) |
79
89
  | Logo, fonts of the whole app | Configurable in the Datama app, not exposed to this skill |
@@ -1,54 +0,0 @@
1
- # Plotter annotations: difference arrows, CAGR, value lines
2
-
3
- Chart decorations stored in the Plotter configuration under `annotations`. They hold **semantic anchors** (row ids, trace keys, series), never pixels: values and positions are recomputed on every render, and an annotation whose anchor is not visible is hidden, not deleted.
4
-
5
- Add an annotation only when the user asks for it ("show the gap between Q1 and Q4", "add the average line"). One annotation answers a question; five are noise.
6
-
7
- ## Where to write them
8
-
9
- | Page | Location |
10
- | --- | --- |
11
- | Compare module | Prefer the module input `waterfallDifferenceArrows` ([solutions/compare.md](../solutions/compare.md#custom-pillars-and-difference-arrows)): it takes bar labels, not row ids |
12
- | Explore module | `configuration.plotter.annotations.valueLines` on the module slot ([plotter/embedded.md](embedded.md)) |
13
- | Plotter template | `CONFIGURATION.annotations` |
14
-
15
- ## Value lines
16
-
17
- Dotted reference line at an element value, or at an average, with its label past the end of the plot.
18
-
19
- ```json
20
- {"annotations": {"valueLines": [
21
- {"id": "average-sessions", "trace": "Session", "kind": "average"},
22
- {"id": "average-tablet", "trace": "Session", "kind": "average", "series": "Tablet"}
23
- ]}}
24
- ```
25
-
26
- | Key | Value | Meaning |
27
- | --- | --- | --- |
28
- | `id` | string | Unique id |
29
- | `trace` | string | Trace key: in Explore, the measure name; in a Plotter page, the trace `name` (or `type:x.value:y.value` without a name) |
30
- | `kind` | `"average"` · `"value"` | Mean of the plotted elements (stack totals when stacked), or the value of one element |
31
- | `series` | string | `average` of one series only (one value of the D2 / `x.stack`) |
32
- | `key` | string | `value` lines: stable id of the anchor element |
33
-
34
- ## Difference arrows
35
-
36
- Think-cell style arrows between two elements of the same trace.
37
-
38
- ```json
39
- {"annotations": {"differences": [
40
- {"id": "q1-vs-q4", "trace": "Revenue", "from": {"key": "<row id>"}, "to": {"key": "<row id>"}, "kind": "total", "mode": "both", "direction": "to"}
41
- ]}}
42
- ```
43
-
44
- | Key | Value | Meaning |
45
- | --- | --- | --- |
46
- | `trace` | string | Trace key, as for value lines |
47
- | `from.key` / `to.key` | string | Stable ids of the two elements. In a Plotter page, give each row an `id` field in `DATA` and use it here |
48
- | `kind` | `level` · `total` · `cagr` | Adjacent elements, a bracket spanning the elements between, or the compound growth rate per period (years between date values, else one period per slot) |
49
- | `mode` | `percent` · `absolute` · `both` | Label content (ignored by `cagr`) |
50
- | `direction` | `to` · `from` · `both` | Arrow head placement; `both` = unsigned gap |
51
- | `position` | 0 … 1 | Placement of a `level` arrow between the two elements |
52
- | `lift` | 0 … 1 | Elevation of a `total` arrow above its automatic lane |
53
-
54
- Supported on `bars`, `waterfall`, `lines`, `scatter` and `areas` traces.
@@ -1,37 +0,0 @@
1
- # Tuning the chart of a Studio module (`configuration.plotter`)
2
-
3
- Every Studio module draws with Plotter. Its chart state is saved on the module slot under `configuration.plotter`: a **partial** Plotter configuration deep-merged over the defaults. Use it for precise chart requests the solution inputs do not cover (axis, legend, labels, padding, annotations).
4
-
5
- ```json
6
- {"module": "compare.waterfall", "inputs": {}, "configuration": {"plotter": {"reverse": true, "legends": {"display": true}}}}
7
- ```
8
-
9
- ## Rules
10
-
11
- - Write only the keys that change. Every valid key, its type and its default: [generated/plotter-configuration.md](../generated/plotter-configuration.md). A key not listed there does not exist.
12
- - Prefer solution inputs first: Compare `stylePreset`, `chartTitle`, `waterfallValueLabels`, `view`; Explore chart spec. They are tested together with the solution layout.
13
- - Explore: any non-empty `configuration.plotter` is read as a saved chart and skips Explore's default look (preset, value labels on bars). Add one only when needed.
14
- - Never store pixel positions or computed values: annotations use semantic anchors ([annotations.md](annotations.md)).
15
- - Keys owned by the solution layout (`layout`, `views`, `traces`, `customViews`) are rebuilt by the module; leave them out.
16
-
17
- ## Frequent requests
18
-
19
- | Request | Partial configuration |
20
- | --- | --- |
21
- | Horizontal bars / swap axes | `{"reverse": true}` |
22
- | Show the legend at the bottom | `{"legends": {"display": true, "position": "bottom"}}` |
23
- | Hide the measure axis | `{"axis": {"y": {"hidden": true}}}` |
24
- | Compact numbers on axis ticks (K / M) | `{"axis": {"ticks": {"texts": {"format": {"compact": true}}}}}` |
25
- | Two decimals on axis ticks | `{"axis": {"ticks": {"texts": {"format": {"decimals": 2}}}}}` |
26
- | Bigger chart margins | `{"plot": {"padding": {"top": 30, "right": 20, "bottom": 30, "left": 20}}}` |
27
- | No bar gradient | `{"bars": {"gradient": {"display": false}}}` |
28
- | Bar value labels | `{"bars": {"labels": {"display": true}}}` |
29
- | Hide the waterfall connectors | `{"waterfall": {"links": {"display": false}}}` |
30
- | Bigger header title | `{"header": {"title": {"size": 22}}}` |
31
- | No animations | `{"behaviors": {"transitionDuration": 0}}` |
32
-
33
- Check every path against [generated/plotter-configuration.md](../generated/plotter-configuration.md) before writing it: branch names and defaults there are the reference for this bundle.
34
-
35
- ## Table view
36
-
37
- Every Plotter chart also offers a table view (`table.enabled`, default on). Its columns, pagination and styling live under `configuration.plotter.table`; leave them to the solution unless the user asks for a table change.
@@ -1,142 +0,0 @@
1
- # Plotter alone (Plotter template)
2
-
3
- The Plotter template draws one chart (or several switchable views) from rows you prepare. Plotter computes nothing: aggregate, sort and derive every value before inlining it.
4
-
5
- ## Template variables
6
-
7
- | Variable | Format | Content |
8
- | --- | --- | --- |
9
- | `DATA` | JSON array | One flat object per plotted element (already aggregated) |
10
- | `LAYER` | JavaScript object literal | Views and traces (below). Functions are allowed for `color`, `if`, `label` |
11
- | `CONFIGURATION` | JSON object or `null` | Partial Plotter configuration, merged over the defaults ([generated/plotter-configuration.md](../generated/plotter-configuration.md)) |
12
- | `PALETTE` | JSON array or `null` | Hex colors `[net, up, down, start, end, series…]` (named palettes: [generated/theme.md](../generated/theme.md)) |
13
- | `TITLE` / `SUBTITLE` | JSON string or `null` | Header title and subtitle |
14
-
15
- The template runs, in order: `new Plotter({id, parent, data: DATA, palette: PALETTE})`, `init({...LAYER, configuration: Plotter.loadConfiguration(CONFIGURATION)})`, `render()`.
16
-
17
- ## Data
18
-
19
- - Dimension values are strings (`"France"`, `"2025-01"`); sort the rows in the order the axis must show them (chronological for time).
20
- - Measures are numbers; `null` for a missing value.
21
- - One row per (D1 × D2) element: for a stacked chart of Sessions by Country × Channel, one row per country and channel.
22
-
23
- ```json
24
- [
25
- {"Country": "France", "Channel": "SEA", "Session": 5556},
26
- {"Country": "France", "Channel": "SEO", "Session": 5300},
27
- {"Country": "Germany", "Channel": "SEA", "Session": 4120}
28
- ]
29
- ```
30
-
31
- ## Layer
32
-
33
- Single view:
34
-
35
- ```js
36
- {
37
- traces: [
38
- {type: "bars", x: {value: "Country", stack: "Channel", position: "bottom"}, y: {value: "Session", position: "left", start: 0}, stacked: true}
39
- ]
40
- }
41
- ```
42
-
43
- Several views switchable from the chart toolbar (`trace` = view shown first):
44
-
45
- ```js
46
- {
47
- traces: {
48
- "bars-default": {label: "Bars", group: "Charts", traces: [/* traces */]},
49
- "lines-default": {label: "Lines", group: "Charts", traces: [/* traces */]}
50
- },
51
- trace: "bars-default"
52
- }
53
- ```
54
-
55
- A table view of `DATA` is always available too (`configuration.table.enabled`, default `true`).
56
-
57
- ## Trace
58
-
59
- Every trace needs `type`, `x` and `y`. Trace types available in this bundle are listed at the top of [generated/plotter-configuration.md](../generated/plotter-configuration.md#trace-types).
60
-
61
- | Key | Value | Meaning |
62
- | --- | --- | --- |
63
- | `type` | `bars` · `lines` · `areas` · `scatter` · `mekko` · `mekko100` · `bubble` · `events` · `waterfall` · `tree` | Mark type |
64
- | `x` / `y` | `{value, position, stack?, start?, unit?, hidden?, type?}` | Axis binding: `value` = column, `position` = `bottom` · `top` · `left` · `right` |
65
- | `x.stack` | column | Series column on the dimension axis (one bar / line per value) |
66
- | `y.start` | number | Force the measure axis to start at this value (usually `0`) |
67
- | `y.unit` | string | Unit appended to values (`"€"`, `"%"`) |
68
- | `y.upper` / `y.lower` | column | Range bars and bands |
69
- | `name` | string | Series name in legends and hovers |
70
- | `color` | hex string · `{seriesValue: hex}` · `function (row) {...}` | Fixed color, map per series value, or a function returning a hex or a series key |
71
- | `colors` | `{key: hex}` | Palette used when `color` returns a key |
72
- | `stacked` | boolean | Stack the `x.stack` series |
73
- | `overlay` | boolean | Overlap series instead of placing them side by side |
74
- | `relative` | boolean | Normalize to percentages (100 % charts) |
75
- | `opacity` | number 0–1 | Mark opacity |
76
- | `legend` | boolean | `false` hides this trace in the legend |
77
- | `if` | `function (row) {...}` | Keep only matching rows for this trace |
78
- | `width` | number | Line width (`lines`) |
79
- | `dots` | `{hidden, opacity, sizingRatio}` | Line points (`lines`, `areas`) |
80
- | `curve` | `default` · `linear` · `step` · `step-before` · `step-after` · `natural` · `cardinal` | Line interpolation |
81
- | `as` | `dot` · `circle` · `square` · `line-h` · `line-v` · `icons` | Scatter mark shape |
82
-
83
- Without `color`, each series value of `x.stack` (or each `x.value`) gets the next palette color.
84
-
85
- Type-specific notes:
86
-
87
- - `mekko`: three bindings, `x` = dimension (`stack` = series), `y` = width measure on a horizontal position (`bottom`), `y2` = height measure on a vertical position (`left`).
88
- - `waterfall` and `tree` expect hierarchical rows built by Datama: use Studio Compare or Pivot instead.
89
- - `events` draws calendar events on a time axis (`calendar: {on, type, events}`); rarely needed outside Studio.
90
-
91
- ## Recipes
92
-
93
- Stacked bars:
94
-
95
- ```js
96
- {traces: [{type: "bars", x: {value: "Country", stack: "Channel", position: "bottom"}, y: {value: "Session", position: "left", start: 0}, stacked: true}]}
97
- ```
98
-
99
- Trend with one line per device:
100
-
101
- ```js
102
- {traces: [{type: "lines", x: {value: "Date", stack: "Device", position: "bottom"}, y: {value: "Session", position: "left", start: 0}, width: 2, curve: "linear"}]}
103
- ```
104
-
105
- Combo, volume bars and rate line on a second axis:
106
-
107
- ```js
108
- {traces: [
109
- {type: "bars", name: "Session", x: {value: "Month", position: "bottom"}, y: {value: "Session", position: "left", start: 0}, color: "#1B2A4A"},
110
- {type: "lines", name: "Conversion", x: {value: "Month", position: "bottom"}, y: {value: "Conversion", position: "right", start: 0, unit: "%"}, color: "#F2A93B", width: 2}
111
- ]}
112
- ```
113
-
114
- Horizontal ranking: same bars trace with `CONFIGURATION = {"reverse": true}`.
115
-
116
- Highlight one category:
117
-
118
- ```js
119
- {traces: [{type: "bars", x: {value: "Country", position: "bottom"}, y: {value: "Revenue", position: "left", start: 0}, color: function (row) { return row.Country === "France" ? "#D64545" : "#B0B7C3"; }}]}
120
- ```
121
-
122
- ## Configuration
123
-
124
- `CONFIGURATION` is a partial tree: write only what changes. Common keys (full list with defaults in [generated/plotter-configuration.md](../generated/plotter-configuration.md)):
125
-
126
- | Need | Partial configuration |
127
- | --- | --- |
128
- | Swap axes (horizontal bars) | `{"reverse": true}` |
129
- | Legend at the bottom / hidden | `{"legends": {"position": "bottom"}}` · `{"legends": {"display": false}}` |
130
- | Value labels on bars | `{"bars": {"labels": {"display": true}}}` |
131
- | Flat bars | `{"bars": {"gradient": {"display": false}}}` |
132
- | Compact tick numbers | `{"axis": {"ticks": {"texts": {"format": {"compact": true}}}}}` |
133
- | No animation | `{"behaviors": {"transitionDuration": 0}}` |
134
- | Wider margins | `{"plot": {"padding": {"top": 30, "right": 20, "bottom": 30, "left": 20}}}` |
135
-
136
- Arrows and reference lines: [annotations.md](annotations.md).
137
-
138
- ## Checks
139
-
140
- - Every `x.value`, `x.stack`, `y.value` names a key present in `DATA`.
141
- - `LAYER` is a valid JavaScript object literal (functions allowed, no trailing code).
142
- - `CONFIGURATION` paths exist in [generated/plotter-configuration.md](../generated/plotter-configuration.md).