mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Make command heatmap take up all available space
This commit is contained in:
@@ -86,6 +86,28 @@ class CommandLogger extends ScrollView
|
||||
@div style: "height:#{node.dy - 1}px;width:#{node.dx - 1}px", =>
|
||||
@span node.name
|
||||
|
||||
updateCategoryHeader: (node) ->
|
||||
@categoryHeader.text("#{node.name} Commands")
|
||||
reduceRunCount = (previous, current) ->
|
||||
if current.size?
|
||||
previous + current.size
|
||||
else if current.children?.length > 0
|
||||
current.children.reduce(reduceRunCount, previous)
|
||||
else
|
||||
previous
|
||||
runCount = node.children.reduce(reduceRunCount, 0)
|
||||
reduceCommandCount = (previous, current) ->
|
||||
if current.children?.length > 0
|
||||
current.children.reduce(reduceCommandCount, previous)
|
||||
else
|
||||
previous + 1
|
||||
commandCount = node.children.reduce(reduceCommandCount, 0)
|
||||
@categorySummary.text("#{_.pluralize(commandCount, 'command')}, #{_.pluralize(runCount, 'invocation')}")
|
||||
|
||||
updateTreeMapSize: ->
|
||||
@treeMap.width(@width() - 20)
|
||||
@treeMap.height(@height() - @categoryHeader.outerHeight() - @categorySummary.outerHeight() - 20)
|
||||
|
||||
addTreeMap: ->
|
||||
root =
|
||||
name: 'All'
|
||||
@@ -94,33 +116,17 @@ class CommandLogger extends ScrollView
|
||||
|
||||
@treeMap.empty()
|
||||
|
||||
@updateCategoryHeader(root)
|
||||
@updateTreeMapSize()
|
||||
w = @treeMap.width()
|
||||
h = @treeMap.height()
|
||||
|
||||
x = d3.scale.linear().range([0, w])
|
||||
y = d3.scale.linear().range([0, h])
|
||||
color = d3.scale.category20()
|
||||
|
||||
updateCategoryHeader = (node) =>
|
||||
@categoryHeader.text("#{node.name} Commands")
|
||||
reduceRunCount = (previous, current) ->
|
||||
if current.size?
|
||||
previous + current.size
|
||||
else if current.children?.length > 0
|
||||
current.children.reduce(reduceRunCount, previous)
|
||||
else
|
||||
previous
|
||||
runCount = node.children.reduce(reduceRunCount, 0)
|
||||
reduceCommandCount = (previous, current) ->
|
||||
if current.children?.length > 0
|
||||
current.children.reduce(reduceCommandCount, previous)
|
||||
else
|
||||
previous + 1
|
||||
commandCount = node.children.reduce(reduceCommandCount, 0)
|
||||
@categorySummary.text("#{_.pluralize(commandCount, 'command')}, #{_.pluralize(runCount, 'invocation')}")
|
||||
updateCategoryHeader(root)
|
||||
|
||||
zoom = (d) ->
|
||||
updateCategoryHeader(d)
|
||||
zoom = (d) =>
|
||||
@updateCategoryHeader(d)
|
||||
kx = w / d.dx
|
||||
ky = h / d.dy
|
||||
x.domain([d.x, d.x + d.dx])
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
color: #eee;
|
||||
overflow: auto;
|
||||
z-index: 99;
|
||||
padding: 20px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.command-logger .category-header {
|
||||
@@ -25,9 +26,6 @@
|
||||
|
||||
.command-logger .tree-map {
|
||||
margin: auto;
|
||||
position: relative;
|
||||
width: 960px;
|
||||
height: 700px;
|
||||
background-color: #efefef;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user