@meshmakers/octo-meshboard 3.5.590 → 3.5.610

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.
package/README.md CHANGED
@@ -544,6 +544,7 @@ interface PieChartWidgetConfig {
544
544
  categoryColors?: Record<string, string>; // AB#5622
545
545
  labelPosition?: 'inside' | 'outside' | 'none'; // AB#5622
546
546
  hideLabelsBelowPercent?: number; // AB#5622
547
+ categoryLabels?: Record<string, string>; // AB#7235, see "Chart value labels"
547
548
  }
548
549
  ```
549
550
 
@@ -584,6 +585,8 @@ interface BarChartWidgetConfig {
584
585
  showLegend?: boolean;
585
586
  legendPosition?: 'top' | 'bottom' | 'left' | 'right';
586
587
  filters?: WidgetFilterConfig[];
588
+ categoryLabels?: Record<string, string>; // AB#7235, see "Chart value labels"
589
+ seriesLabels?: Record<string, string>; // AB#7235, dynamic series mode
587
590
  }
588
591
  ```
589
592
 
@@ -602,6 +605,7 @@ interface LineChartWidgetConfig {
602
605
  valueField: string;
603
606
  unitField?: string;
604
607
  excludedSeriesGroupValues?: string[]; // series group values left out (see below)
608
+ seriesLabels?: Record<string, string>; // AB#7235, see "Chart value labels"
605
609
  // ... legend, markers, filters, additionalSeries, primarySeries, stacked, bucketMinutes
606
610
  }
607
611
  ```
@@ -636,6 +640,48 @@ row filter on the group column fails). Board JSON of a widget config:
636
640
  - In the dialog: *Field Mapping → Excluded series*, shown once a series group field is set. Choosing another
637
641
  series group field or another query clears the list.
638
642
 
643
+ ### Chart value labels (`categoryLabels` / `seriesLabels`, AB#7235)
644
+
645
+ A query often groups by a code - an OBIS code, a material number, a cost centre. A pie, bar or line
646
+ chart can show a readable name instead of the code. The names are part of the widget's `Config`, a plain
647
+ map from the raw value to the text to show, so a board reads the same in every host application:
648
+
649
+ ```json
650
+ "categoryLabels": { "1-1:2.9.0 G.03": "Feed-in", "1-1:2.9.0 P.01T": "Surplus" }
651
+ ```
652
+
653
+ | Widget | Key | Renames |
654
+ |--------|-----|---------|
655
+ | `pieChart` | `categoryLabels` | the slices: data labels, legend, tooltip |
656
+ | `barChart` | `categoryLabels` | the categories: axis labels, tooltip |
657
+ | `barChart` | `seriesLabels` | the dynamic series of `seriesGroupField`: legend, tooltip |
658
+ | `lineChart` | `seriesLabels` | the lines of `seriesGroupField`: legend, tooltip |
659
+
660
+ Which text a value gets:
661
+
662
+ 1. the widget entry for the raw value (matched exactly, case included; the dialog removes blanks around a value when saving, and a row without a name is not saved);
663
+ 2. the host's `MESHBOARD_LABEL_RESOLVER` result - only the pie chart asks the resolver, bar and line
664
+ charts never did;
665
+ 3. today's text: the raw value, for a pie slice the humanized category (`RESOLVE_FAILED` -> "Resolve failed"),
666
+ for a date category the formatted date.
667
+
668
+ A value without an entry, no key at all and an empty map all show exactly what the chart showed before.
669
+
670
+ - **Display only.** Queries, filters, a KPI's `queryCategoryValue`, the grouping into series,
671
+ `excludedSeriesGroupValues` and the pie's `categoryColors` keep matching the raw value. A name that equals a
672
+ `categoryColors` key does not pull that colour onto the slice.
673
+ - **Series stay distinct.** Chart series are keyed by their name: when two raw series values get the same name,
674
+ the series whose raw value differs from the name is shown as `Name (raw value)`. Two categories with the same name are shown as they are in a single-query chart; in the multi-source bar chart the repeated name gets a numbered suffix (`Name`, `Name (2)`), so every category keeps its own bar and tooltip.
675
+ - **Series of other queries keep their own labels.** `seriesLabels` renames only the series that come from the
676
+ primary query's `seriesGroupField`; `additionalSeries` (label), a static value-field list (`name`) and formula
677
+ series are not touched.
678
+ - **Persistence.** Both keys are written to the board JSON only when they have at least one entry with a value and a
679
+ non-blank name; charts without them save and load unchanged.
680
+ - **Config dialogs.** The pie, bar and line dialogs have a *Category Names* / *Series Names* section
681
+ (`mm-value-labels-editor`, see its README): one row per raw value, an empty list shows a hint, a value listed
682
+ twice is flagged. Rows without a value or without a name are dropped on Save, so an unfinished row never
683
+ replaces a complete one. The bar chart dialog offers *Series Names* in dynamic series mode.
684
+
639
685
  ### Stats Grid Widget
640
686
  Displays multiple KPIs in a grid layout.
641
687