Skip to content

Commit

Permalink
Clean useless code and update draw.js
Browse files Browse the repository at this point in the history
  • Loading branch information
adonis0147 committed Mar 16, 2017
1 parent 2ede7bb commit 5352958
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 60 deletions.
19 changes: 0 additions & 19 deletions pages/preference.html

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/main/menu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const {app, Menu, MenuItem} = require('electron')
const viewer = require('./viewer.js')
const preference = require('./preference.js')

const template = [
{
Expand All @@ -11,11 +10,6 @@ const template = [
accelerator: 'CmdOrCtrl+O',
click() { viewer.openFile() }
},
{ type: 'separator' },
{
label: 'Preferences...',
click() { preference.openWindow(main_win) }
},
],
},
{
Expand Down Expand Up @@ -52,11 +46,6 @@ if (process.platform === 'darwin') {
submenu: [
{ role: 'about' },
{ type: 'separator' },
{
label: 'Preferences...',
click() { openPreferenceWindow() }
},
{ type: 'separator' },
{
role: 'services',
submenu: [],
Expand Down
26 changes: 0 additions & 26 deletions scripts/main/preference.js

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/main/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function parse(data) {
}

function calAverageTime(data) {
data['time per call'] = data['total time'] / data['calls']
data['time per call'] = data['total time'] / (data['calls'] + 1e-6)
if (data.children) {
data.children.forEach(calAverageTime)
}
Expand Down
9 changes: 6 additions & 3 deletions scripts/renderer/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function updateLabels(source, nodes) {
label_enter.append('text')
.attr('y', -(NODE_SIZE.height / 2 + 5))
.attr('text-anchor', 'middle')
.text((d) => { return `${current_key}: ${d.data[current_key]}` })
.text((d) => { return `${current_key}: ${d.data[current_key].toFixed(2)}` })

let label_update = label_enter.merge(label)

Expand All @@ -233,14 +233,17 @@ function updateColor() {
.style('fill', (d) => {
let percent = d.data[current_key] / root.data[current_key]
let h = Math.floor((1 - percent) * 60 + 1e-6)
return hsv2rgb(h, 1, 1)
if (percent < 1e-4)
return 'white'
else
return hsv2rgb(h, 1, 1)
})
}

function onUpdateKey(key) {
current_key = key
d3.selectAll('g.label text')
.text((d) => { return `${current_key}: ${d.data[current_key]}` })
.text((d) => { return `${current_key}: ${d.data[current_key].toFixed(2)}` })
if (blackboard)
updateColor()
}
Expand Down

0 comments on commit 5352958

Please sign in to comment.