diff --git a/js/menu/filter/filter.js b/js/menu/filter/filter.js index d2821893..2178bc51 100644 --- a/js/menu/filter/filter.js +++ b/js/menu/filter/filter.js @@ -34,7 +34,32 @@ const filters = document.getElementById("filters"); const apply = document.getElementById("filter-apply"); const reset = document.getElementById("filter-reset"); -let parametersRange = ["momentum", "vertex", "time", "mass", "charge"]; +let parametersRange = [ + { + property: "momentum", + unit: "GeV", + }, + { + property: "mass", + unit: "GeV", + }, + { + property: "charge", + unit: "e", + }, + { + property: "vertex", + unit: "mm", + }, + { + property: "time", + unit: "ns", + }, +]; + +parametersRange = parametersRange.sort((a, b) => + a.property.localeCompare(b.property) +); parametersRange = parametersRange.map((parameter) => new Range(parameter)); diff --git a/js/menu/filter/parameters.js b/js/menu/filter/parameters.js index 76b52e37..60f4a4f5 100644 --- a/js/menu/filter/parameters.js +++ b/js/menu/filter/parameters.js @@ -29,14 +29,15 @@ export class Range extends FilterParameter { min; max; - constructor(property) { + constructor({ property, unit }) { super(property); + this.unit = unit; } render(container) { const title = document.createElement("div"); const label = document.createElement("label"); - label.textContent = this.property; + label.textContent = `${this.property} (${this.unit})`; title.appendChild(label); const content = document.createElement("div");