January 5, 2021
Pfmindmap – Solving a Fundamental Problem of Discussion Interfaces

The Problem

Discussions are exponential, but discussion interfaces are linear. Anything you say can elicit multiple responses to it. Let’s say the average point elicits 3 responses. 5 levels in, we are at 243 branches of subject matter. This is how discussions break down. Does this sound familiar? Think about debates you’ve had. Many branches of subject matter arise. It’s hard to tend after them all. It’s hard to be clear about which one is being addressed. It’s hard to review what has been addressed and what hasn’t.

Typical discussion interfaces are a vertical stack of posts. Platforms try to accomodate the perpetually-diverging nature of discussion as well as they can, with various user interface components, such as navigation buttons and expand/collapse controls. But, in the end, you’re looking at a vertical stack of posts, and only a few posts are on-screen at a time. The user is made to keep track of the overall structure, themselves, mentally.

Pfmindmap

Pfmindmap is a JavaScript module that visualizes a discussion as a “mind map,” the kind of diagram that draws links between items that are arranged and organized in 2D space. Pfmindmap produces a natural-looking tree that makes good use of screen real estate, by employing a force-directed layout.

The interface is navigated like map interface: zoom & pan.

It is helpful to to see the entire structure of the conversation. The user can spot where discussion is happening, then zoom in to read it. Pfmindmap helps people review, present, and understand information.

Twidgel

One website that uses pfmindmap is Twidgel. Twidgel is toolkit website for tools that interface with the Twitter API. The Twidgel Tweet Reply Map visualizes Twitter conversations as mind map diagrams. Twitter data is well-suited to being visualized as a tree, because replies can, themselves, be replied to, and there is no limit to the number reply levels. There are often lengthy discussions happening within the replies of a Tweet.

The Twidgel “Tweet Reply Map” tool continues populating, in real time, as new content is added to the conversation, and you can click on a Tweet, to open it in a new tab, in Twitter. In this way, it functions as a new kind of discussion interface for Twitter content.

Implementation

The pfmindmap interface is easy to install in a webpage. The implementing webpage provides:

  1. A container element for the visualization to go in
  2. An element creator function, to create an element for each item
  3. A populator function to populate each item element with its data

You can send whatever data you want, and make your items look however you want. The module just needs unique IDs for each item, and the reply-to IDs, and it needs to know which item is the root node.

Here’s a complete example. Put the repo in a directory named “pfmindmap” along with this HTML file. You may have to run it in a web server, to avoid the CORS error.

<html>
<head>
    <style>
        .item-to-clone { cursor: default; }
        .item-to-clone:active { cursor: grabbing; }
    </style>
</head>
<body>
    <div id="container-div" style="min-height:100vh;"></div>

    <div style="display:none;">
        <div class="item-to-clone" style="border: 1px solid black; background: white; border-radius: 5px; min-height: 50px; padding: 10px;"></div>
    </div>

    <script type="module">
        import pfmindmap from './pfmindmap/pfmindmap.js';
        
        var data = [
            { 'id': '8843784378', 'reply_to_id': '', 'message': 'wazaaa', 'is_first': true },
            { 'id': '8064783478', 'reply_to_id': '8843784378', 'message': 'first level reply' },
            { 'id': '4785784534', 'reply_to_id': '8843784378', 'message': 'another first level reply' },
            { 'id': '4398489489', 'reply_to_id': '4785784534', 'message': 'second level reply text' },
            { 'id': '6734894958', 'reply_to_id': '4785784534', 'message': 'another 2nd level reply' },
            { 'id': '6733494934', 'reply_to_id': '6734894958', 'message': 'a 3rd level reply' },
            { 'id': '6734894923', 'reply_to_id': '6734894958', 'message': 'another 3rd level reply' },
            { 'id': '6734894912', 'reply_to_id': '6734894923', 'message': '4th level reply' },
            { 'id': '4783489548', 'reply_to_id': '8843784378', 'message': 'this is another first level reply' }
        ];
        var itemCreator = () => {
            return document.querySelector('.item-to-clone').cloneNode(true);
        };
        var itemPopulator = (item, data) => { 
            item.innerHTML = data["message"];
            return item; 
        };
        var pfmm = new pfmindmap(document.querySelector("#container-div"), itemCreator, itemPopulator, { 'item_width': 300 });
        pfmm.receiveItems(data);
        pfmm.updateSimulationData();
        pfmm.zoomTo(0.3);
    </script>
</body>
</html>

Detailed docs are at the GitHub readme.

Acknowledgements

This module is powered by D3, a data visualization JavaScript library. It also utilizes the Observable runtime, which provides a reactive, data-flow environment. I recommend visiting ObservableHQ, a website for sharing D3 and other visualizations.

License

Pfmindmap is free, open source, and has a permissive license (BSD 2 clause).

Notes

  • This article refers to pfmindmap v1.4

Links

Related Articles

Share this page