Search
Dashboard Layouts

MindFusion.Dashboards provides two distinct layout systems for organizing widgets across the screen, defined by the DashboardLayout enumeration:

1. DashboardLayout.Grid (GridLayout):
A 2D grid matrix where widgets occupy specific cells and can span multiple columns and rows. Ideal for enterprise BI, operational portals, and executive cards.

2. DashboardLayout.Diagram (DiagramLayout):
A freeform positioning layout based on the MindFusion.Diagramming engine, allowing widgets to float as interactive nodes connected by diagram links.

Grid Layout System

The Grid layout is the default and most widely used layout. It subdivides the dashboard canvas into a uniform matrix of columns and rows. Its key configuration properties are:

  • columnCount: The number of vertical columns in the grid (default is 6).
  • rowCount: The number of horizontal rows in the grid.
  • padding: The spacing in pixels between adjacent widget cards.
  • autoGrow: A Boolean property indicating whether row heights expand automatically to accommodate their contents.

Adding Widgets to the Grid

To position a widget within the grid, call the addWidget method on either the DashboardView or the Dashboard model:

JavaScript  Copy Code

// Syntax:
// dashView.addWidget(widget, column, row, columnSpan, rowSpan);

// Example: Place a KPI card at Column 0, Row 0 (occupying 1 column and 1 row)
var kpi = new MindFusion.Dashboards.KpiWidget();
dashView.addWidget(kpi, 0, 0, 1, 1);

// Example: Place a trend chart at Column 1, Row 0 (spanning 3 columns and 2 rows)
var chart = new MindFusion.Dashboards.ChartWidget();
dashView.addWidget(chart, 1, 0, 3, 2);

// Example: Place a DataViews Grid spanning all 6 columns at Row 2
var grid = new MindFusion.Dashboards.GridWidget();
dashView.addWidget(grid, 0, 2, 6, 3);

Widget Containers

Every widget placed on the dashboard is wrapped inside a DashboardWidgetContainer DOM element.

The container handles:

  • Card background and borders: Applies the active theme's card styling (pure white surfaces in standard and light themes, dark slate navy in dark theme).
  • Focus and selection: In DashboardMode.Edit, clicking a container applies the mfc-active CSS class, displaying a focus border and loading the widget's properties into the PropertyGrid.
  • Empty cell indicators: Unoccupied cells are rendered with dashed borders, providing clear drop targets for dragging items from the DashboardPalette.

Removing and Clearing Widgets

To remove a specific widget from the dashboard:

JavaScript  Copy Code

dashboard.removeWidget(widget);

To wipe all widgets from the dashboard:

JavaScript  Copy Code

dashboard.clearAll();

The Diagram Layout System

When layout mode is set to DashboardLayout.Diagram, the dashboard hosts an internal MindFusion.Diagramming surface.

In this mode:

  • Each widget is wrapped inside a ControlNode.
  • Widgets can be freely positioned at arbitrary (x, y) coordinates.
  • Widgets can be connected using DiagramLink instances to represent data flows, pipeline hierarchies, and network relationships.