@matdata/yasgui-chart-plugin 1.1.0 → 1.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.
package/README.md CHANGED
@@ -13,7 +13,7 @@ A YASGUI (YASR) plugin that visualises SPARQL **SELECT** results as charts: bar
13
13
  - **🪄 Automatic choice**: a label/IRI column plus numbers gives a bar chart, a date column plus numbers a line chart, numbers against numbers a scatter plot, and a single numeric column a histogram
14
14
  - **🎛️ Controls**: pick the chart type and the category, value and series columns. The choice is saved per tab; a different query (other variables) starts from the automatic chart again
15
15
  - **🧮 Long results**: a second category-like column (e.g. `?country ?type ?count`) is split into series automatically; rows that repeat a category are summed
16
- - **🏷️ Readable labels**: IRIs are shown with their label column (`?x` with `?xLabel`) or as prefixed names
16
+ - **🏷️ Readable labels**: IRIs are shown with their label column (`?x` with `?xLabel`) or as prefixed names (can be turned off)
17
17
  - **🔎 Ctrl+click describe**: Ctrl+click a bar, slice or point to see the triples of its IRI (Ctrl+Shift+click for the triples where it is the object). Newer MatGUI versions show them in the shared describe panel; older YASR versions get the plugin's own modal, the same as the table and geo plugins
18
18
  - **🌓 Light and dark theme**: follows the YASGUI theme and switches live. The first series uses the theme's brand colour (`--yasgui-brand`) and the hovered item the highlight colour (`--yasgui-highlight`), with MatData blue and amber as fallbacks
19
19
  - **🖼️ Export**: download the chart as PNG or SVG
@@ -80,9 +80,10 @@ ORDER BY DESC(?operationalPoints)
80
80
  | **Values** / **Size** | Numeric column(s) to plot; pie, donut and histogram use one |
81
81
  | **Series** | Column whose values split the data into series (grouped or stacked bars, several lines) |
82
82
  | **Automatic chart** (**Auto**) | Go back to the automatic chart for these results |
83
+ | **Shorten IRIs with prefixes** (**Prefixes**) | On by default: IRIs without a label column show as prefixed names (`ex:Germany`), using the query's prefixes and a few well-known ones such as `wd:` and `rdfs:`. Turn it off to see the full IRIs |
83
84
  | **Download PNG** / **Download SVG** (**PNG** / **SVG**) | Download the chart |
84
85
 
85
- In newer MatGUI versions the pickers sit in the shared plugin toolbar under the results header, and the automatic chart and downloads are in the **View settings** menu at the far right. With older YASR versions the plugin draws its own toolbar above the chart, with **Auto**, **PNG** and **SVG** buttons.
86
+ In newer MatGUI versions the pickers sit in the shared plugin toolbar under the results header, and the automatic chart, IRI shortening and downloads are in the **View settings** menu at the far right. With older YASR versions the plugin draws its own toolbar above the chart, with **Auto**, **Prefixes**, **PNG** and **SVG** buttons.
86
87
 
87
88
  The YASR download button also saves the chart as PNG.
88
89
 
@@ -40,6 +40,11 @@ declare class ChartPlugin {
40
40
  private getYasqe;
41
41
  /** Prefixes of the Yasr config, overridden by those declared in the query */
42
42
  private getPrefixes;
43
+ /**
44
+ * Prefixes used to show IRIs in the chart: well-known ones, then those of
45
+ * Yasr and the query. None when the user turned shortening off.
46
+ */
47
+ private getLabelPrefixes;
43
48
  /** Build the toolbar and chart for the current results and settings */
44
49
  private render;
45
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ChartPlugin.d.ts","sourceRoot":"","sources":["../src/ChartPlugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0BH,OAAO,KAAK,EACV,kBAAkB,EAKlB,IAAI,EACL,MAAM,SAAS,CAAC;AAoBjB,cAAM,WAAW;IACf,sEAAsE;IACtE,QAAQ,SAAK;IACb,KAAK,SAAW;IAChB,aAAa,SAAgE;IAE7E,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAAoC;IAClD,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,aAAa,CAAiC;IACtD,OAA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C,WAAW;IAgBnB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAKxB,uEAAuE;IACvE,OAAO,CAAC,MAAM;IAqGd;;;OAGG;IACH,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,gBAAgB;IAQxB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;;;;OAMG;YACW,mBAAmB;IAgDjC,OAAO,CAAC,QAAQ;IAKhB,2DAA2D;IAC3D,aAAa,IAAI,MAAM,GAAG,IAAI;IAS9B,yEAAyE;IACzE,YAAY,IAAI,MAAM,GAAG,IAAI;IAkB7B,OAAO,CAAC,WAAW;IAqBnB,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM;;;;;;IAU1B,OAAO,CAAC,YAAY;IA0BpB,OAAO,CAAC,OAAO;IAMf,OAAO,IAAI,IAAI;CAKhB;AAED,eAAe,WAAW,CAAC"}
@@ -18,12 +18,16 @@ export interface ToolbarCallbacks {
18
18
  onChange: (settings: ChartSettings) => void;
19
19
  onReset: () => void;
20
20
  onExport: (format: 'png' | 'svg') => void;
21
+ /** Show IRIs as prefixed names (true) or in full (false) */
22
+ onShortenIris: (shortenIris: boolean) => void;
21
23
  }
22
24
  export interface ToolbarState {
23
25
  columns: ColumnInfo[];
24
26
  resolved: ResolvedChartSettings;
25
27
  /** True when the user has saved choices (so "Auto" can reset them) */
26
28
  customised: boolean;
29
+ /** IRIs are shown as prefixed names */
30
+ shortenIris: boolean;
27
31
  }
28
32
  /**
29
33
  * Render the plugin's own toolbar for the current columns and settings.
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAI5C,OAAO,KAAK,EAAE,aAAa,EAAa,qBAAqB,EAAE,M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C;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;IACpB,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;CACtB;AAuMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,GAAG,WAAW,CAuC3F;AA+GD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,gBAAgB,GAC1B,WAAW,EAAE,CAWf;AAED,8FAA8F;AAC9F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAY9E"}
package/dist/icons.d.ts CHANGED
@@ -13,6 +13,8 @@ declare const ICON_PATHS: {
13
13
  readonly 'chevrons-left': "<path d=\"m11 17-5-5 5-5\"/><path d=\"m18 17-5-5 5-5\"/>";
14
14
  readonly x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>";
15
15
  readonly download: string;
16
+ readonly square: "<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/>";
17
+ readonly 'square-check': "<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"m9 12 2 2 4-4\"/>";
16
18
  readonly 'rotate-ccw': "<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/>";
17
19
  };
18
20
  export type IconName = keyof typeof ICON_PATHS;
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,QAAA,MAAM,UAAU;;;;;;;;;;CAkBN,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C,iFAAiF;AACjF,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,SAAK,EAAE,WAAW,SAAO,GAAG,MAAM,CAO7E;AAED,qCAAqC;AACrC,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAIpF"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,QAAA,MAAM,UAAU;;;;;;;;;;;;CAoBN,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C,iFAAiF;AACjF,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,SAAK,EAAE,WAAW,SAAO,GAAG,MAAM,CAO7E;AAED,qCAAqC;AACrC,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAIpF"}
@@ -23,6 +23,10 @@ export declare const MAX_AUTO_SERIES = 12;
23
23
  export declare function isChartType(value: unknown): value is ChartType;
24
24
  /** Read saved settings defensively: storage may hold anything */
25
25
  export declare function sanitizeSettings(raw: unknown): ChartSettings;
26
+ /** Whether the user picked chart choices for these results (display options aside) */
27
+ export declare function isCustomised(saved: ChartSettings): boolean;
28
+ /** Display options that hold for any results */
29
+ export declare function displayOptions(saved: ChartSettings): ChartSettings;
26
30
  /**
27
31
  * The saved choices that apply to results with these variables: choices made
28
32
  * for a different query (other variables) are ignored.
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UA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;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAa5D;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAE1D;AAED,gDAAgD;AAChD,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAElE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAItF;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAEtE;AA2BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,UAAU,EAAE,EACrB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAqDvB"}
package/dist/types.d.ts CHANGED
@@ -99,6 +99,12 @@ export interface ChartSettings {
99
99
  columns?: string[];
100
100
  /** Column whose distinct values split the data into series (long format); `""` for none */
101
101
  series?: string;
102
+ /**
103
+ * Show IRIs as prefixed names (`ex:Germany`) on the axes, legend and
104
+ * tooltips; `false` shows the full IRIs. Default `true`. A display option:
105
+ * it is kept for other results and by "Automatic chart".
106
+ */
107
+ shortenIris?: boolean;
102
108
  }
103
109
  /** Fully resolved chart choices, after applying the automatic defaults */
104
110
  export interface ResolvedChartSettings {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,SAAS;IACxB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7D,KAAK,EAAE,MAA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5 5-5"/>',
47224
47224
  x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
47225
47225
  download: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',
47226
+ square: '<rect width="18" height="18" x="3" y="3" rx="2"/>',
47227
+ "square-check": '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="m9 12 2 2 4-4"/>',
47226
47228
  "rotate-ccw": '<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>'
47227
47229
  };
47228
47230
  function iconSvg(name, size = 16, strokeWidth = 1.75) {
@@ -47262,12 +47264,19 @@ function sanitizeSettings(raw) {
47262
47264
  if (typeof r.series === "string") settings.series = r.series;
47263
47265
  if (Array.isArray(r.columns))
47264
47266
  settings.columns = r.columns.filter((v) => typeof v === "string");
47267
+ if (typeof r.shortenIris === "boolean") settings.shortenIris = r.shortenIris;
47265
47268
  return settings;
47266
47269
  }
47270
+ function isCustomised(saved) {
47271
+ return Object.keys(saved).some((key) => key !== "columns" && key !== "shortenIris");
47272
+ }
47273
+ function displayOptions(saved) {
47274
+ return saved.shortenIris === void 0 ? {} : { shortenIris: saved.shortenIris };
47275
+ }
47267
47276
  function settingsForColumns(saved, vars) {
47268
47277
  if (!saved.columns) return saved;
47269
47278
  const same = saved.columns.length === vars.length && saved.columns.every((v, i) => v === vars[i]);
47270
- return same ? saved : {};
47279
+ return same ? saved : displayOptions(saved);
47271
47280
  }
47272
47281
  function categoryCandidates(columns) {
47273
47282
  return columns.filter((c) => !c.isLabel && c.bound > 0);
@@ -47503,6 +47512,14 @@ function renderToolbar(state, callbacks) {
47503
47512
  const spacer = document.createElement("div");
47504
47513
  spacer.className = "chart-toolbar-spacer";
47505
47514
  toolbar.appendChild(spacer);
47515
+ const shorten = button(
47516
+ "chart-shorten-iris",
47517
+ "Prefixes",
47518
+ "Show IRIs as prefixed names",
47519
+ () => callbacks.onShortenIris(!state.shortenIris)
47520
+ );
47521
+ shorten.setAttribute("aria-pressed", String(state.shortenIris));
47522
+ toolbar.appendChild(shorten);
47506
47523
  toolbar.appendChild(
47507
47524
  button(
47508
47525
  "chart-export-png",
@@ -47571,6 +47588,16 @@ function renderViewSettings(state, callbacks) {
47571
47588
  );
47572
47589
  reset.disabled = !state.customised;
47573
47590
  menu.appendChild(reset);
47591
+ const shorten = menuItem(
47592
+ "chart-shorten-iris",
47593
+ state.shortenIris ? "square-check" : "square",
47594
+ "Shorten IRIs with prefixes",
47595
+ "Show IRIs as prefixed names, such as ex:Germany",
47596
+ run(() => callbacks.onShortenIris(!state.shortenIris))
47597
+ );
47598
+ shorten.setAttribute("role", "menuitemcheckbox");
47599
+ shorten.setAttribute("aria-checked", String(state.shortenIris));
47600
+ menu.appendChild(shorten);
47574
47601
  const separator = document.createElement("div");
47575
47602
  separator.className = "chart-view-settings-separator";
47576
47603
  separator.setAttribute("role", "separator");
@@ -50877,6 +50904,18 @@ var DescribeModal = class {
50877
50904
  };
50878
50905
 
50879
50906
  // src/ChartPlugin.ts
50907
+ var COMMON_PREFIXES = {
50908
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
50909
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#",
50910
+ owl: "http://www.w3.org/2002/07/owl#",
50911
+ xsd: "http://www.w3.org/2001/XMLSchema#",
50912
+ foaf: "http://xmlns.com/foaf/0.1/",
50913
+ dc: "http://purl.org/dc/elements/1.1/",
50914
+ dcterms: "http://purl.org/dc/terms/",
50915
+ skos: "http://www.w3.org/2004/02/skos/core#",
50916
+ schema: "http://schema.org/",
50917
+ wd: "http://www.wikidata.org/entity/"
50918
+ };
50880
50919
  use([
50881
50920
  install2,
50882
50921
  install,
@@ -50996,6 +51035,14 @@ var ChartPlugin = class {
50996
51035
  }
50997
51036
  return prefixes;
50998
51037
  }
51038
+ /**
51039
+ * Prefixes used to show IRIs in the chart: well-known ones, then those of
51040
+ * Yasr and the query. None when the user turned shortening off.
51041
+ */
51042
+ getLabelPrefixes() {
51043
+ if (this.saved.shortenIris === false) return {};
51044
+ return { ...COMMON_PREFIXES, ...this.getPrefixes() };
51045
+ }
50999
51046
  /** Build the toolbar and chart for the current results and settings */
51000
51047
  render() {
51001
51048
  var _a2;
@@ -51006,17 +51053,19 @@ var ChartPlugin = class {
51006
51053
  const allRows = this.results.results.bindings;
51007
51054
  const rows = allRows.length > maxRows ? allRows.slice(0, maxRows) : allRows;
51008
51055
  this.resolved = resolveSettings(this.columns, this.saved, rows.length);
51009
- this.data = buildChartData(rows, this.columns, this.resolved, this.getPrefixes());
51056
+ this.data = buildChartData(rows, this.columns, this.resolved, this.getLabelPrefixes());
51010
51057
  const wrapper = document.createElement("div");
51011
51058
  wrapper.className = "yasgui-chart-plugin";
51012
51059
  const toolbarState = {
51013
51060
  columns: this.columns,
51014
51061
  resolved: this.resolved,
51015
- customised: Object.keys(this.saved).length > 0
51062
+ customised: isCustomised(this.saved),
51063
+ shortenIris: this.saved.shortenIris !== false
51016
51064
  };
51017
51065
  const toolbarCallbacks = {
51018
- onChange: (settings) => this.updateSettings(settings),
51019
- onReset: () => this.updateSettings({}),
51066
+ onChange: (settings) => this.updateSettings({ ...displayOptions(this.saved), ...settings }),
51067
+ onReset: () => this.updateSettings(displayOptions(this.saved)),
51068
+ onShortenIris: (shortenIris) => this.updateSettings({ ...this.saved, shortenIris }),
51020
51069
  onExport: (format2) => this.exportImage(format2)
51021
51070
  };
51022
51071
  const slot = getHostToolbar(this.yasr);
@@ -51101,8 +51150,7 @@ var ChartPlugin = class {
51101
51150
  }
51102
51151
  updateSettings(settings) {
51103
51152
  this.saved = sanitizeSettings(settings);
51104
- if (Object.keys(this.saved).length > 0 && this.results)
51105
- this.saved.columns = [...this.results.head.vars];
51153
+ if (isCustomised(this.saved) && this.results) this.saved.columns = [...this.results.head.vars];
51106
51154
  if (typeof this.yasr.storePluginConfig === "function") {
51107
51155
  try {
51108
51156
  this.yasr.storePluginConfig(this.getPluginName(), this.saved);