Skip to main content

Interactive visualization dashboards for the MCDA Python ecosystem

Project description

mcda-viz

Visualization library for the MCDA Python ecosystem. Provides interactive Dash dashboards and Plotly plots for exploring and presenting MCDA results.

Built on mcda-core, maintained by the SMG research group at ULB.

Installation

pip install mcda-viz

Python ≥ 3.9.

Quick start

PROMETHEE dashboard

from mcda_core import PerformanceTable
from promethee import PrometheeII
from promethee.preferences.parameters import ParametersPromethee
from mcda_viz import PrometheeDashboard

table = PerformanceTable(...)
params = ParametersPromethee(...)
result = PrometheeII(table, params)
PrometheeDashboard(result, title="My analysis").run(debug=True)

MAUT dashboard

from mcda_methods import MAUT
from mcda_viz import MAUTAnalysisDashboard

maut = MAUT(table, params)
MAUTAnalysisDashboard(maut, title="MAUT Analysis").run(debug=True)

See example_dashboards/ for complete runnable examples with real datasets.

What's included

Dashboards

class description
PrometheeDashboard GAIA plane + net flows parallel coordinates plot; live recomputation when weights or preference functions change
MAUTAnalysisDashboard Parallel coordinates in evaluation and utility space; criterion-wise A vs B comparison; utility function plots

Both dashboards include:

  • Alternative filter / ranking checklist (doubles as a selection panel)
  • Highlight panel — assign any CSS colour to any alternative
  • Weight sliders with automatic normalisation

Plots

Standalone Plotly figure builders — usable outside of a dashboard:

class / function description
GaiaPlanePlot PCA biplot of mono-criterion net flows (PROMETHEE GAIA)
ParallelPlot Parallel coordinates for raw performance tables or utility space
MAUTComparisonPlot Criterion-wise weighted utility difference between two alternatives
build_maut_utility_plots List of piecewise-linear utility function curves, one per criterion

All plot classes expose a build_figure() method returning a plotly.graph_objects.Figure.

from mcda_viz import GaiaPlanePlot
import numpy as np

plot = GaiaPlanePlot(
    mono_criterion_net_flows=np.array(...),   # shape (n_alternatives, n_criteria)
    weights=np.array([0.3, 0.4, 0.3]),
    criteria_names=["cost", "quality", "CO2"],
    alternative_names=["A", "B", "C", "D"],
    visible_alternatives=["A", "B", "C"],     # optional subset
    highlight={"A": "red"},                   # optional colour map
)
fig = plot.build_figure()   # plotly Figure — display in notebook or export

Components (building blocks for custom dashboards)

Each panel inside the built-in dashboards is a standalone DashboardComponent subclass. You can assemble them freely to build your own dashboard:

component description
AlternativeSelectorComponent A / B dropdown for pairwise comparison
AlternativeFilterComponent Text-based alternative filter
ComparisonDescriptionComponent Textual summary of A vs B weighted utility difference
CriterionPlotsComponent Scrollable row of criterion utility function plots
GaiaPlanePlotComponent GAIA plane wrapped as a Dash component
HighlightComponent Colour picker — assign colours to alternatives
LegendComponent Colour legend panel
ParallelPlotComponent Parallel coordinates wrapped as a Dash component
ParametersComponent Weight sliders and preference function selectors (PROMETHEE)
RankingChecklistComponent Ranked list with checkboxes for filtering
RankingComponent Read-only ranked list
StoreComponent Invisible dcc.Store for shared dashboard state

Architecture

src/mcda_viz/
├── dashboards/
│   ├── core/          # BaseDashboard, DashboardComponent, DashboardState, shared IDs
│   ├── components/    # Reusable Dash components
│   ├── maut_analysis_dashboard.py
│   └── promethee_dashboard.py
├── plots/             # Pure Plotly figure builders
└── base/              # Shared plot utilities

DashboardState is a lightweight container (alternative names, criterion names, and optionally scores and ranking) instantiated once per dashboard and injected into every component that needs it.

BaseDashboard provides shared callbacks (highlight apply/reset, weight normalisation) and a Dash app factory. Subclass it to build a custom dashboard:

import dash_bootstrap_components as dbc
from dash import html
from mcda_viz import BaseDashboard, DashboardState, HighlightComponent, StoreComponent

class MyDashboard(BaseDashboard):
    def __init__(self, alternative_names, criteria_names):
        self.state = DashboardState(
            alternative_names=alternative_names,
            criteria_names=criteria_names,
        )
        self.app = self._create_app("My Dashboard")
        self.store_component = StoreComponent()
        self.highlight_component = HighlightComponent(self.state)
        self.app.layout = dbc.Container([
            self.store_component.layout(),
            self._header_row(),
            self.highlight_component.layout(),
        ])
        self._register_highlight_callback(self.app)

    def run(self, **kwargs):
        self.app.run(**kwargs)

Ecosystem

Part of the modular MCDA Python ecosystem built on mcda-core. See mcda-core for the full list of compatible libraries.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcda_viz-0.1.0.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcda_viz-0.1.0-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file mcda_viz-0.1.0.tar.gz.

File metadata

  • Download URL: mcda_viz-0.1.0.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mcda_viz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f74ed3f8b514d1cfffe6761dfcbaa03dd9b4650696351170b69981efbb594939
MD5 0b8b7697fd16409facefa9d88b253ffc
BLAKE2b-256 f6327768b3c6c07ed501e71969e25e4d4abfc27723e12bc64cf17ab96cc25210

See more details on using hashes here.

File details

Details for the file mcda_viz-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcda_viz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mcda_viz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03b2ade0834aa4be1ccc687efea773f8d25e535f8312be180d39480ac618df98
MD5 720f5cdb9d0dcf91b85a38f77874235b
BLAKE2b-256 c2da80684b32af891f47fc0f352a5e2488f0d464c2caeb86c2f7c28b3d60a61e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page