NashTech Insights

Data Visualization in Mind Maps Using Angular

Alka Vats
Alka Vats
Table of Contents

Mind maps are a popular way to visualize and organize information, ideas, and concepts. They provide a visual representation that makes it easier to understand complex relationships and hierarchies. In this blog post, we’ll explore how to create data visualization in mind maps using Angular. We’ll cover various visualization techniques and provide practical examples to help you get started.

If you want to learn one more angular feature, you can refer here.


Before we dive into data visualization in mind maps, make sure you have the following prerequisites:

1.Node.js and npm: Ensure you have Node.js and npm (Node Package Manager) installed on your system. You can download them from

2. Angular CLI: Install the Angular CLI globally by running the following command:

npm install -g @angular/cli

3. Angular Project: Create a new Angular project or use an existing one. You can create a new project using the following command:

ng new data-visualization-mindmap

Using Diagram Libraries

To create data visualization in mind maps, we’ll need a diagram library. In this example, we’ll use the ngx-diagram library, which is a powerful and flexible diagramming library for Angular. Install it and its dependencies as follows:

npm install ngx-diagram-core ngx-diagram-theme-default

Creating the Mind Map Component

Next, let’s create a mind map component where we’ll build our data visualization. Generate a new component using the Angular CLI:

ng generate component mind-map

Now, open the mind-map.component.ts file and add the necessary imports:

import { Component } from '@angular/core';
import { DiagramItem, DiagramModel, DiagramService } from 'ngx-diagram-core';

  selector: 'app-mind-map',
  templateUrl: './mind-map.component.html',
  styleUrls: ['./mind-map.component.css'],
export class MindMapComponent {
  constructor(private diagramService: DiagramService) {

  createMindMap() {
    const root = new DiagramItem({ id: 'root', text: 'Root' });

    const child1 = new DiagramItem({ id: 'child1', text: 'Child 1' });
    const child2 = new DiagramItem({ id: 'child2', text: 'Child 2' });


    const model = new DiagramModel();


In the code above, we create a basic mind map structure with a root node and two child nodes. You can extend this structure as needed for your data visualization.

Adding Data Visualization

Now, let’s explore various data visualization techniques you can use within your mind map:

1. Node Styling

You can visualize data by customizing the styling of nodes based on your data attributes. For example, you can change the color or shape of nodes to represent different categories of data. Here’s an example of how to style nodes based on data:

const importantNode = new DiagramItem({ id: 'important', text: 'Important Node' });
importantNode.setStyle({ backgroundColor: 'red', color: 'white' });

2. Icons and Images

You can use icons or images within nodes to represent data. For instance, you can add icons to indicate the status of a task or an image to represent a person in your mind map. Here’s an example of adding an icon to a node:

const taskNode = new DiagramItem({ id: 'task', text: 'Task Node' });
taskNode.setIcon('fa fa-check');

3. Tooltips

Tooltips provide additional information when users hover over nodes. You can use tooltips to display data or descriptions related to a node. Here’s an example of adding a tooltip to a node:

const infoNode = new DiagramItem({ id: 'info', text: 'Info Node' });
infoNode.setTooltip('Additional information goes here.');

4. Connections and Relationships

Visualizing connections and relationships between nodes is crucial for data visualization. You can use connectors to represent these relationships. For example, you can use different line styles or colors for connectors to indicate the type of relationship. Here’s an example of adding a connector with a custom style:

const parent = new DiagramItem({ id: 'parent', text: 'Parent Node' });
const child = new DiagramItem({ id: 'child', text: 'Child Node' });

const connector = parent.connectTo(child);
connector.setConnectorStyle({ stroke: 'blue' });

5. Data Binding

To visualize dynamic data, you can bind data to nodes and connectors. For instance, you can create nodes and connectors based on data from an API or a database. Here’s an example of data binding:

const data = [
  { id: '1', text: 'Node 1' },
  { id: '2', text: 'Node 2' },
  // Add more data items as needed

data.forEach((item) => {
  const node = new DiagramItem({ id:, text: item.text });

// Create connectors based on data relationships


Data visualization in mind maps can enhance the understanding and presentation of complex information and relationships. In this guide, we’ve explored how to create data visualization in mind maps using Angular and the ngx-diagram library. You can further customize and expand these visualization techniques to meet your specific data visualization needs. Whether you’re building a project management tool, a knowledge management system, or any application that benefits from visualizing hierarchical data, mind maps offer a powerful and intuitive way to represent information.

Finally, for more such posts, please follow our LinkedIn page- FrontEnd Competency.

Alka Vats

Alka Vats

Alka Vats is a Software Consultant at Nashtech. She is passionate about web development. She is recognized as a good team player, a dedicated and responsible professional, and a technology enthusiast. She is a quick learner & curious to learn new technologies. Her hobbies include reading books, watching movies, and traveling.

Leave a Comment

Your email address will not be published. Required fields are marked *

Suggested Article