From be5590f411d197a65d6a3cfb89648c0cd42bfe7b Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sat, 11 Apr 2015 15:06:41 +0200 Subject: [PATCH] Add highlighting of tasks in same module in taskoverview and a docs-serve tox target --- docs/_static/taskoverview.coffee | 14 +++++++++++--- docs/_static/taskoverview.less | 5 +++++ tox.ini | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/_static/taskoverview.coffee b/docs/_static/taskoverview.coffee index 4be9fe3..ccae87d 100644 --- a/docs/_static/taskoverview.coffee +++ b/docs/_static/taskoverview.coffee @@ -118,15 +118,23 @@ class window.TaskOverview .selectAll('line').data(layout.links()).enter() .append('line').attr('marker-end', 'url(#right-arrowhead)') + mouseOver = (d) -> + labels.classed 'hover', (l) -> d is l + nodes.classed 'highlight', (n) -> d.module is n.module + + mouseOut = (d) -> + labels.classed 'hover', no + nodes.classed 'highlight', no + nodes = @svg.append('g').attr('class', 'nodes') .selectAll('g.partition').data(groups).enter() .append('g').attr('class', 'partition') .selectAll('circle').data((d) -> d.values).enter() .append('circle').attr('r', (d) -> d.radius) - .style('fill', (d, i) -> nodeColors(d[nodeColorKey])) + .style('fill', (d) -> nodeColors(d[nodeColorKey])) .call(layout.drag) - .on('mouseover', (d) -> (labels.filter (l) -> d is l).classed 'hover', true) - .on('mouseout', (d) -> (labels.filter (l) -> d is l).classed 'hover', false) + .on('mouseover', mouseOver) + .on('mouseout', mouseOut) labels = @svg.append('g').attr('class', 'node-labels') .selectAll('g.partition').data(groups).enter() diff --git a/docs/_static/taskoverview.less b/docs/_static/taskoverview.less index 2903816..8c1e67c 100644 --- a/docs/_static/taskoverview.less +++ b/docs/_static/taskoverview.less @@ -6,6 +6,11 @@ } g.nodes circle { stroke: #000000; + &.highlight { + stroke: #555599; + stroke-width: 2.5px; + fill: #EEAAAA !important; + } opacity: .9; stroke-width: 1.5px; } diff --git a/tox.ini b/tox.ini index 0d736c1..17db141 100644 --- a/tox.ini +++ b/tox.ini @@ -21,3 +21,7 @@ deps = commands = ./taskoverview.py --output docs/_static/graph.json sphinx-build -b html -d docs/_build/html/doctrees docs docs/_build/html + +[testenv:docs-serve] +changedir = docs/_build/html +commands = python -m SimpleHTTPServer 8080