Skip to content

Commit

Permalink
Update README and add some styling for submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
jmforsythe committed Jun 28, 2023
1 parent fa16d71 commit ebbb7a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*Map showing the files in cpython that Guido van Rossum changed the most;
full SVG image available in repo*

## Now with submodule support
## Website now available

A version of this program is now available for use at [heatmap.jonathanforsythe.co.uk](https://heatmap.jonathanforsythe.co.uk)
Expand Down Expand Up @@ -83,9 +84,6 @@ These times are with `minimum size drawn = 0`, on very large repositories, so th

## Wanted features

### Submodule tracking
Currently the only submodule changes that can be seen are the top level commit pointer changes. In the future would like to recursively explore submodules and add their files to the database.

### Faster database generation
Currently done using git log which can take a very long time for large repos. Will look into any other ways of getting needed information on files.

Expand Down
4 changes: 4 additions & 0 deletions static/javascript/treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ function handle_row(row, x, y, width, height, parent_path, level, SVG_ROOT) {
const row_width = height != 0 ? row_area / height : 0
const box_height = row_width != 0 ? box_area / row_width : 0
let el = {"text": val.name, "area": box_area, "x": x, "y": y, "width": row_width, "height": box_height, "parent": parent_path, "level": level}
if ("submodule" in val && val.submodule == true) el.submodule = true;
if (NEST && "children" in val) el.children = squarify(x, y, row_width, box_height, val.children, `${parent_path}/${val.name}`, level+1, SVG_ROOT)
out.push(el)
y += box_height
} else {
const row_height = width != 0 ? row_area / width : 0
const box_width = row_height != 0 ? box_area / row_height : 0
let el = {"text": val.name, "area": box_area, "x": x, "y": y, "width": box_width, "height": row_height, "parent": parent_path, "level": level}
if ("submodule" in val && val.submodule == true) el.submodule = true;
if (NEST && "children" in val) el.children = squarify(x, y, box_width, row_height, val.children, `${parent_path}/${val.name}`, level+1, SVG_ROOT)
out.push(el)
x += box_width
Expand All @@ -108,6 +110,7 @@ function handle_row(row, x, y, width, height, parent_path, level, SVG_ROOT) {
// Turns our object into an svg element
function get_box_text_element(obj) {
const is_leaf = !("children" in obj)
const is_submodule = "submodule" in obj && obj.submodule == true

let element = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
let box = document.createElementNS('http://www.w3.org/2000/svg', 'rect')
Expand All @@ -120,6 +123,7 @@ function get_box_text_element(obj) {
element.setAttribute("height", `${obj.height}`)
element.classList.add(`svg_level_${obj.level}`)
if (is_leaf) element.classList.add("svg_leaf")
if (is_submodule) element.classList.add("svg_submodule")
const path = `${obj.parent}/${obj.text}`
element.setAttribute("id", `svg_path_${path}`)

Expand Down
4 changes: 4 additions & 0 deletions static/javascript/treemap_style.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const SVG_STYLE = `
stroke: lightblue;
}
.svg_submodule .svg_box_selected {
stroke: orange;
}
.svg_text {
visibility: hidden;
font-family: monospace;
Expand Down

0 comments on commit ebbb7a7

Please sign in to comment.