treemap

Pretty treemap with memory efficient input streaming and output streaming for the SVG image

https://github.com/mazenalkhatib/treemap

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Pretty treemap with memory efficient input streaming and output streaming for the SVG image

Basic Info
  • Host: GitHub
  • Owner: MazenAlkhatib
  • License: mit
  • Language: Go
  • Default Branch: main
  • Size: 1.27 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 3
Created 11 months ago · Last pushed 11 months ago
Metadata Files
Readme License Citation Security

README.md

Memory efficient Treemaps

Uses "Squarified Treemaps" (Mark Bruls, Kees Huizing, and Jarke J. van Wijk., 2000) algorithm.

The original code was copied from Nikolay Dubina's treemap repo (Check resources)

bash $ go install github.com/MazenAlKhatib/treemap/cmd/treemap@latest $ treemap -input your_csv_file -output-path your/output/path -w 1024 -h 1024

example

Different colorscheme bash $ treemap -color RdYlGn example-RdYlGn

Tree-Hue coloring $ treemap -color balanced example-balanced

Without color bash $ treemap -color none example-no-color

Format

</ delimitered path>,<size>

Algorithms

  • Squarified algorithm for treemap layout problem. This is very common algorithm used in Plotly and most of visualization packages. "Squarified Treemaps", Mark Bruls, Kees Huizing, and Jarke J. van Wijk, 2000
  • Tree-Hue Color algorithm for generating colors for nodes in treemap. The idea is to represent hierarchical structure by recursively painting similar hue to subtrees. Nikolay Dubina, 2021

Contributions

Are much appreciated!

References

  • Nikolay Dubina: https://github.com/nikolaydubina/treemap (Original Repo and code)
  • Plotly treemaps: https://plotly.com/python/treemaps/
  • go-colorful: https://github.com/lucasb-eyer/go-colorful
  • D3 treemap is using Squerified: https://github.com/d3/d3-hierarchy
  • Interactive treemap: https://github.com/vasturiano/treemap-chart
  • Squerified in Rust: https://github.com/bacongobbler/treemap-rs
  • Squerified in JavaScript: https://github.com/clementbat/treemap
  • Squerified in Python: https://github.com/laserson/squarify
  • Treemap Go tool: https://github.com/willpoint/treemap
  • Plotly color scales: https://plotly.com/python/builtin-colorscales
  • Plotly color scales source: https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotlyutils/colors/colorbrewer.py
  • Colorbrewer project, that is used in Plotly: http://colorbrewer2.org

Appendix A: Long Roots

When roots have one child multiple times it takes extra vertical space, which is very useful for narrow final dimensions.

example-long-roots

Can collapse them into one node example-long-roots-collapse

Long roots without collapsing somewhere deep inside

Long roots with collapsing somewhere deep inside

Appendix B: Known Issues

The entire treemap is a black box when viewed from Jenkins

It's convenient to create treemap svg reports in a Jenkins jobs, because you can browse the job's "artifacts" from your browser. However, out of the box, Jenkin's Content Security Policy prevents inline styles from being applied. Instead of your treemap, you'll see a giant black rectangle.

If you look at the javascript console in the developer tools, you will see: Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self'".

You can relax Jenkin's CSP rules by following the examples at: * Jenkins error - Blocked script execution in . because the document's frame is sandboxed and the 'allow-scripts' permission is not set * https://stackoverflow.com/questions/35783964/jenkins-html-publisher-plugin-no-css-is-displayed-when-report-is-viewed-in-j

Owner

  • Name: Mazen Al Khatib
  • Login: MazenAlkhatib
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you reference this library in publication, please cite it as below.
title: Memory efficient Treemap Visualization in Go
abstract: Implementation of treemap visualization in Go
authors:
- family-names: Al Khatib
  given-names: Mazen
version: 1.0
date-released: 2025-03-26
license: MIT
repository-code: https://github.com/MazenAlkhatib/treemap
url: https://github.com/MazenAlkhatib/treemap

GitHub Events

Total
  • Release event: 3
  • Delete event: 1
  • Push event: 15
  • Pull request event: 1
  • Create event: 5
Last Year
  • Release event: 3
  • Delete event: 1
  • Push event: 15
  • Pull request event: 1
  • Create event: 5

Packages

  • Total packages: 3
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 9
proxy.golang.org: github.com/MazenAlkhatib/treemap
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.6%
Average: 5.8%
Dependent repos count: 6.0%
Last synced: 6 months ago
proxy.golang.org: github.com/mazenalkhatib/treemap
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.6%
Average: 5.8%
Dependent repos count: 6.0%
Last synced: 6 months ago
proxy.golang.org: github.com/MazenAlKhatib/treemap
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.6%
Average: 5.8%
Dependent repos count: 6.0%
Last synced: 6 months ago