Skip to main content

New Diagram Type, Treemap

Β· 2 min read
Ilfat Galiev
Software Engineer

Exciting News! Treemap Diagrams Now Available in Mermaid Chart Visuals for Power BI πŸ“Š

I have just rolled out an update to Mermaid Chart Visuals for Power BI The amazing developers at Mermaid have introduced a powerful new diagram type, the Treemap.

What are Treemap diagrams?​

For those new to them, Treemap diagrams are way to visualize hierarchical data. A set of nested rectangles where the size of each rectangle is proportional to its value. This makes it incredibly easy to see which categories are the most significant.

Dynamic Data Binding with Handlebars.js​

To make this even more powerful, the new visual leverages Handlebars.js for data binding. This allows you to use templating to dynamically generate the Treemap syntax directly from your Power BI data. Instead of manually writing out the hierarchy, you can create a template that automatically builds the diagram based on the fields and measures in your dataset, making your reports fully interactive and data-driven.

Code sample:

{{ var 'cat1' (map 'Country' table.rows) }}
{{ var 'cat2' (map 'Segment' table.rows) }}
{{ var 'measure1' (map 'Sales' table.rows) }}
{{ scaleBand 'Category1' (val 'cat1') (val 'cat1')}}
{{ scaleBand 'Category2' (val 'cat2') (val 'cat2')}}
{{ scaleBand 'Measure1' (val 'cat2') (val 'measure1')}}
```mermaid
treemap-beta
{{#each (getScale 'Category2' 'domain') as |cat2 cat1index| }}
"{{cat2}}"
{{#each (getScale 'Category1' 'domain') as |cat1 cat2index|}}
{{#each ../../table.rows as |row rowindex|}}{{#if (eq row.Country cat1)}}{{#if (eq row.Segment cat2)}}"{{cat1}}":{{row.[ Sales]}}
{{else}}{{/if}}{{else}}{{/if}}{{/each}}{{/each}}
{{/each}}
```

Result:

Treemap visual in Power BI

The source code may seem complex, but I'm working on new helper functions to create a hierarchical data structure to solve this problem

Simple, Powerful, and Customizable​

One of the best things about the new Treemap diagram is its "refreshingly simple" syntax. With just a few lines of code, you can create a stunning and insightful visualization. Plus, with features like custom styling, value formatting, and theme customization, you have all the tools you need to make your data stories clear and compelling.

For a deeper dive into the technical details and to see more examples, we highly recommend checking out the original announcement from the Mermaid team.

Read the original blog post here: Mermaid supports Treemap Diagrams now!!!

Visual updates and development notes

Β· One min read
Ilfat Galiev
Software Engineer

✨ Charticulator Updates​

I've made several improvements to the Charticulator custom visual for Power BI:

  • βœ… Unified the behavior of the Import Template and Open Chart actions.
  • πŸ› οΈ Fixed an issue where the visual wouldn't load a template into the editor if chart columns were not mapped.
  • 🎨 Power BI Theme Support: The editor now respects the Power BI Desktop dark theme (Preview feature).
  • 🧹 New Feature: Added a convenient button for deleting scales directly from the scales panel.
  • 🎯 Bug Fix: The visual now correctly applies Power BI theme colors when rendering.

πŸ“Œ Apache ECharts Visual​

Minor but useful updates for the Apache ECharts visual:

  • 🧩 The built-in editor layout has been updatedβ€”Save and Apply buttons are now pinned to the top of the viewport for better accessibility.

    New Apache ECharts Visual editor layout

  • πŸ“Š The visual now supports D3.js formatting options for enhanced data presentation flexibility.

Markdown & Mermaid Diagrams Visual for Power BI – Update 1.4.0

Β· One min read
Ilfat Galiev
Software Engineer

The latest 1.4.0 update of the Markdown & Mermaid Diagrams visual introduces exciting new features and enhancements:

✨ New Features​

πŸ“Œ Custom Styling with the styles Block​

You can now define custom styles for text elements using the new styles block.

All content within this block is added as a <style> tag in the final HTML render.

Example:

h1 {
color: red;
}

This will make all <h1> headings appear in red.

πŸ›  New Handlebars.js Helper Functions​

We've added several new helper functions for the Handlebars.js templating engine, including:

  • Equal (eq)
  • Not Equal (ne)
  • Less Than (lt)
  • Less Than or Equal (lte)
  • Greater Than (gt)
  • Greater Than or Equal (gte)
  • Logical AND (and)
  • Logical OR (or)

πŸ“– Read the full Handlebars.js helpers documentation β†’

πŸ” Improved Debugging: View Source on Render Failure​

If rendering fails, the visual now displays the source configuration of the chart. This helps you quickly identify and fix any issues.

⚑ Increased Diagram Rendering Limit​

The maxEdges configuration parameter has been set to 30,000, allowing the visual to render diagrams with up to 30,000 nodes.

A New Chapter

Β· One min read
Ilfat Galiev
Software Engineer

This post summarizes my work on the Charticulator App and Power BI visual for 2024. It includes an overview of the new features and a brief history of the project. The project is live, and my focus moving forward will be on improving the documentation and creating tutorials to showcase how to use the new features. Currently, the documentation is outdated and does not cover the latest updates.

Charticulator GeoJSON sublayout

Β· One min read
Ilfat Galiev
Software Engineer

GeoJSON is a format for encoding a variety of geographic data structures.

{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}

The Charticulator has sub-layout features that allow to authors arrange Glyphs on Plot Segments.

Usually Charticulator uses x or y axes to determine positions of each Glyph.

Sub-layouts is one approach to integrate third party layouts like d3-geo, d3-hierarchy/tree, d3-hierarchy/pack e.t.c.

Geo sublayout

The d3-geo package uses to render GeoJSON into SVG path as part of Plot Segment and positioning Glyphs by given latitude, longitude column bindings.

Geo sublayout

Geo sub-layout has properties to load GeoJSON file, to specify expression for geo coordinate columns, projections, center of map, rotations, scale and translates rendering SVG on Plot Segment.

Charticulator Treemap sublayout

Β· One min read
Ilfat Galiev
Software Engineer

The Charticulator is going to get new Treemap sub-layout for cartesian Plot Segment in the next version 1.5.0.0 of the visual.

Treemap sub-layout in Charticulator

The sub-layout has Inner padding, Outer padding, attributes to configure visual appearance.

Treemap sub-layout attributes

Value Expression sets values for nodes.

Data Expressions set grouping of data by given columns.

The feature powered by D3.js library

The Charticulator binds glyphs to tree leaves.

Charticulator dataset list

Β· One min read
Ilfat Galiev
Software Engineer

The Charticulator application has a new dataset list that allows you to import datasets with a single click to create a chart from scratch.

Dataset list

The chart list view also supports quick filtering of datasets by name.

If you want to see data samples on list, contact with me. But make sure that dataset is allowed to copy and using doesn't breaks laws or agreements.

Charticulator Visual charts list

Β· One min read
Ilfat Galiev
Software Engineer

The next version of the Editor visual (1.3.0.0) will support importing pre build charts and templates from public source.

Importing chart in the visual

On importing chart the visual imports data and rewrites current data passed from Power BI.

Then on saving imported chart the visual opens mapping view to map chart columns to current data passed from Power BI.

On importing template the visual opens data mapping view to map current data passed from Power BI to template columns.

Charticulator data editor

Β· One min read
Ilfat Galiev
Software Engineer

The Charticulator App can allow to import data from *.csv files, but there is no opportunities to pre edit, enter or edit data on chart development phase.

Charticulator data editor​

The PR48 closes this gap. Powered by ReactGrid component brings feature to edit current data, creating table from scratch, inserting rows and columns.

Table editor

Wide view​

The layout of current charts are changed from vertical list to grid to display private and publicly available charts.

Charts list

On PR48 page you can find link to deployment of the latest development branch.

Charticulator Gallery

Β· One min read
Ilfat Galiev
Software Engineer

The Charticulator App now has a built-in list of charts (gallery) that can be imported with a single click.

Gallery

There are only few examples in the diagram list so far, but it will be updated soon, and will also support importing templates. If you want to add your own examples, feel free to contact me.

Chart filter​

The list of charts has a filter of charts by name and type (private, charts that are stored in the browser's indexed database, and public, which are downloaded from a CDN).