Envisioning LogoEnvisioning App (1.0.3)
Configuration

Filters

Configure data filtering options for the sidebar

Overview

Filters allow users to refine the displayed data using the sidebar. They are configured in the settings.filters array.

import type { Config } from "@envisioning/app";

const settings: Config["settings"] = {
  filters: [
    {
      type: "SELECTION",
      label: { en: "Category" },
      joinKey: "collection",
    },
    {
      type: "RANGE",
      label: { en: "Metrics" },
      sliders: [
        { joinKey: "trl" },
        { joinKey: "cost" },
      ],
    },
  ],
  // ...
};

Filter Types

Selection Filter

Checkbox/radio selection from tag or cluster values:

{
  type: "SELECTION",
  label: { en: "Collection" },
  joinKey: "collection",
}
PropertyTypeRequiredDescription
type"SELECTION"YesFilter type
labelI18nYesDisplay label
joinKeystringYesSchema join key

Range Filter

Slider for numeric metric ranges:

{
  type: "RANGE",
  label: { en: "Metrics" },
  sliders: [
    {
      joinKey: "trl",
      resultLabel: "{block.currentValue} - {block.label}",
    },
    {
      joinKey: "cost",
      resultLabel: "{block.currentValue} - {block.label}",
    },
  ],
}
PropertyTypeRequiredDescription
type"RANGE"YesFilter type
labelI18nYesSection label
slidersarrayYesSlider configurations

Range Slider Properties

PropertyTypeRequiredDescription
joinKeystringYesSchema join key for the metric
resultLabelstringNoTemplate for selected value display
helpSettingsobjectNoHelp tooltip configuration

Result Label Templates

{
  joinKey: "trl",
  resultLabel: "{block.currentValue} - {block.label}",
}

Available template variables:

  • {block.currentValue} - Currently selected value
  • {block.label} - Metric label from schema
  • {block.min} - Minimum value
  • {block.max} - Maximum value

Selection Filter Examples

Filter by Cluster

{
  type: "SELECTION",
  label: { en: "Collection" },
  joinKey: "collection",
}

Users can select one or more collections to filter entities.

Filter by Tag

{
  type: "SELECTION",
  label: { en: "Categories" },
  joinKey: "category",
}

Users can select tags to show only matching entities.


Range Filter Examples

Single Metric Range

{
  type: "RANGE",
  label: { en: "TRL Range" },
  sliders: [
    {
      joinKey: "trl",
      resultLabel: "TRL {block.currentValue}",
    },
  ],
}

Multiple Metrics

{
  type: "RANGE",
  label: { en: "Metrics" },
  sliders: [
    {
      joinKey: "trl",
      resultLabel: "{block.currentValue} - {block.label}",
    },
    {
      joinKey: "cost",
      resultLabel: "{block.currentValue} - {block.label}",
    },
    {
      joinKey: "skills",
      resultLabel: "{block.currentValue} - {block.label}",
    },
    {
      joinKey: "socialAcceptance",
      resultLabel: "{block.currentValue} - {block.label}",
    },
  ],
}

Help Settings

Add help tooltips to range sliders:

{
  joinKey: "trl",
  resultLabel: "{block.currentValue}",
  helpSettings: {
    title: { en: "Technology Readiness Level" },
    description: { en: "Measures the maturity of a technology." },
    link: "https://example.com/trl-explained",
  },
}

Complete Example

import type { Config } from "@envisioning/app";

export const settings: Config["settings"] = {
  // ...other settings

  filters: [
    // Range filter with multiple metrics
    {
      type: "RANGE",
      label: { en: "Metrics" },
      sliders: [
        {
          joinKey: "trl",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "cost",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "skills",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "socialAcceptance",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "policyAndRegulation",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "ndcImpact",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "energyCost",
          resultLabel: "{block.currentValue} - {block.label}",
        },
        {
          joinKey: "fundingOpportunities",
          resultLabel: "{block.currentValue} - {block.label}",
        },
      ],
    },

    // Selection filter for clusters
    {
      type: "SELECTION",
      label: { en: "Collection" },
      joinKey: "collection",
    },
  ],
};

How Filters Work

  1. Selection Filters - Show checkboxes for each value in the schema object. Selecting values shows only entities that match.

  2. Range Filters - Show sliders for metric ranges. Moving sliders filters entities to those within the selected range.

  3. Filter Combination - Multiple filters are combined with AND logic. Entities must match all active filters to be displayed.


Schema Requirements

Filters require corresponding schema definitions:

// Schema for selection filter
collection: {
  type: "cluster",
  src: "allCollections",
  // ...
}

// Schema for range filter
trl: {
  type: "metric",
  src: "self",
  metricDomain: [1, 9],
  // ...
}

The joinKey in filters must match:

  • A schema object key for selection filters
  • A metric schema key for range filters
  • An entity join key that connects to the filter target

On this page