From 0c878c5e7da508ce14f4298dec2ba913deaad041 Mon Sep 17 00:00:00 2001 From: Justin Palmer Date: Wed, 30 Jan 2013 09:00:40 -0800 Subject: [PATCH] put editor stats in the document flow so it doesn't overlap the status bar --- .../editor-stats/src/editor-stats-view.coffee | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/packages/editor-stats/src/editor-stats-view.coffee b/src/packages/editor-stats/src/editor-stats-view.coffee index 996968724..037c449b2 100644 --- a/src/packages/editor-stats/src/editor-stats-view.coffee +++ b/src/packages/editor-stats/src/editor-stats-view.coffee @@ -5,7 +5,7 @@ _ = require 'underscore' module.exports = class EditorStatsView extends ScrollView - hours = 6 + hours = 2 time = (date) -> date.setTime(date.getTime() + 6e4) @@ -17,6 +17,9 @@ class EditorStatsView extends ScrollView x = d3.scale.ordinal().domain d3.range(hours * 60) y = d3.scale.linear() + xaxis = d3.svg.axis().scale(x) + .orient('top') + @activate: (rootView, state) -> @instance = new EditorStatsView(rootView, state?.eventLog) @@ -32,6 +35,7 @@ class EditorStatsView extends ScrollView super @command 'core:cancel', @detach + @statusBar = @rootView.find '.status-bar' date = new Date() future = new Date(date.getTime() + (36e5 * hours)) @@ -40,19 +44,19 @@ class EditorStatsView extends ScrollView while date < future @eventlog[time(date)] = 0 - console.log @eventlog @rootView.on 'keydown', @track @rootView.on 'mouseup', @track draw: -> - w = @.width() + w = @statusBar.width() h = @.height() - [pt, pl, pb, pr] = [5,0,0,0] + [pt, pl, pb, pr] = [15,0,0,0] data = d3.entries @eventlog - x.rangeRoundBands [0, w - pl - pr], 0.1 + x.rangeRoundBands [0, w - pl - pr], 0.2 y.range [h, 0] + xaxis.tickSize(-h - pt - pb, 50) vis = d3.select(@.get(0)).append('svg') .attr('width', w) @@ -60,6 +64,10 @@ class EditorStatsView extends ScrollView .append('g') .attr('transform', "translate(#{pl},#{pt})") + vis.append('g') + .attr('class', 'x axis') + .call(xaxis) + bars = vis.selectAll('rect.bar') .data(data) .enter().append('rect') @@ -94,7 +102,7 @@ class EditorStatsView extends ScrollView @attach() attach: -> - @rootView.append @ + @.insertBefore @statusBar @focus() @draw()