standing out more

This commit is contained in:
Radek Stepan 2013-08-20 00:06:02 +01:00
parent ccce66c4af
commit 4cbb4b04a1
9 changed files with 129 additions and 76 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -29,6 +29,7 @@
"templates/progress.eco" "templates/progress.eco"
], ],
"styles": [ "styles": [
"styles/fonts.css",
"styles/app.styl" "styles/app.styl"
] ]
} }

View File

@ -81,7 +81,7 @@ module.exports =
# Get available space. # Get available space.
{ height, width } = document.querySelector('#graph').getBoundingClientRect() { height, width } = document.querySelector('#graph').getBoundingClientRect()
margin = { top: 20, right: 20, bottom: 20, left: 20 } margin = { top: 20, right: 30, bottom: 30, left: 30 }
width -= margin.left + margin.right width -= margin.left + margin.right
height -= margin.top + margin.bottom height -= margin.top + margin.bottom
@ -106,7 +106,7 @@ module.exports =
# Line generator. # Line generator.
line = d3.svg.line() line = d3.svg.line()
.interpolate("precise") .interpolate("linear")
.x( (d) -> x(d.date) ) .x( (d) -> x(d.date) )
.y( (d) -> y(d.points) ) .y( (d) -> y(d.points) )
@ -144,14 +144,29 @@ module.exports =
.attr("class", "ideal line") .attr("class", "ideal line")
.attr("d", line(ideal)) .attr("d", line(ideal))
# Add an actual line drop shadow.
svg.append("path")
.attr("class", "actual line shadow")
.attr("d", line.y( (d) -> y(d.points) + 4 )(actual))
# Add the actual line path. # Add the actual line path.
svg.append("path") svg.append("path")
.attr("class", "actual line") .attr("class", "actual line")
.attr("d", line(actual)) .attr("d", line.y( (d) -> y(d.points) )(actual))
# Collect the tooltip here. # Collect the tooltip here.
tooltip = null tooltip = null
# Add circle shadows.
svg.selectAll('circle.shadow')
.data(actual[1...])
.enter()
.append('svg:circle')
.attr("cx", ({ date }) -> x date )
.attr("cy", ({ points }) -> y(points) + 4 )
.attr("r", ({ radius }) -> 5 )
.attr('class', 'shadow')
# Show when we closed an issue. # Show when we closed an issue.
svg.selectAll("a.issue") svg.selectAll("a.issue")
.data(actual[1...]) # skip the starting point .data(actual[1...]) # skip the starting point

View File

@ -67,7 +67,7 @@ class exports.Repo
) )
], (err, values) -> ], (err, values) ->
# Render the body. # Render the body.
render 'body', 'graph' render 'body', 'graph', name: self.repo
# Render the progress. # Render the progress.
render '#progress', 'progress', { progress } render '#progress', 'progress', { progress }

View File

@ -1,11 +1,13 @@
$closed = #4ACAB4 $closed = #4DAF7C
$opened = #FE5D55 $opened = #E55F3A
$grey = #CBC8C3 $grey = #E2E2E2
$ideal = $grey $ideal = $grey
body body
background: #31323A font-family: 'Source Sans Pro', sans-serif
background: linear-gradient(135deg, #d7bcab 0%, #cc9485 100%)
padding: 100px padding: 100px
color: #64584C
ul ul
list-style-type: none list-style-type: none
@ -15,31 +17,104 @@ ul
padding: 0 padding: 0
h2 h2
font-size: 14px font-size: 16px
text-transform: uppercase text-transform: uppercase
.box .box
background: #43444f background: #FFF
color: #FFF
box-shadow: 2px 4px 6px rgba(0,0,0,0.2) box-shadow: 2px 4px 6px rgba(0,0,0,0.2)
&.generic, &.info, &.error, &.success &.generic, &.info, &.error, &.success
border-top: 4px solid #E2E2E2 border-top: 4px solid #EAC85D
padding: 20px padding: 20px
width: 50% width: 50%
margin: 0 auto margin: 0 auto
&.info &.info
border-top-color: #96CFFB border-top-color: #5F90B0
&.error &.error
border-top-color: #FE5D55 border-top-color: #E45E39
&.success &.success
border-top-color: #4ACAB4 border-top-color: #4DB07A
a a
color: #64584C
h1
margin: 0
padding: 10px 30px
color: #FFF color: #FFF
background: #55BC75
font-size: 20px
text-transform: uppercase
#graph
background: #55BC75
height: 200px
position: relative
#tooltip
position: absolute
top: 0
left: 0
svg
path
&.line
fill: none
stroke-width: 1px
clip-path: url(#clip)
&.actual
stroke-width: 4px
stroke: #FFF
&.shadow
stroke-width: 5px
stroke: rgba(#000, 0.25)
&.ideal
stroke: #3D9E68
stroke-dasharray: 5,5
&.area
clip-path: url(#clip)
fill: #4DAF7C
line
&.today
stroke: rgba(#FFF, 0.75)
stroke-width: 1px
circle
fill: #FFF
stroke: transparent
stroke-width: 15px
cursor: pointer
&.shadow
fill: rgba(#000, 0.25)
.axis
shape-rendering: crispEdges
&.x
line
stroke: #3D9E68
text
font-weight: bold
fill: #FFF
path
display: none
&.y
line, path
fill: none
stroke: #000
#progress #progress
padding: 20px padding: 20px
@ -79,64 +154,4 @@ h2
&.opened &.opened
float: right float: right
color: $opened color: $opened
#graph
background: #FFF
height: 200px
position: relative
#tooltip
position: absolute
top: 0
left: 0
svg
path
&.line
fill: none
stroke: $grey
stroke-width: 1px
clip-path: url(#clip)
&.actual
stroke-width: 2px
stroke: $closed
&.ideal
stroke: $ideal
&.area
clip-path: url(#clip)
fill: lighten($grey, 90%)
line
&.today
stroke: $grey
stroke-width: 2px
stroke-dasharray: 5,5
circle
fill: $closed
stroke: transparent
stroke-width: 20px
cursor: pointer
.axis
shape-rendering: crispEdges
&.x
line
stroke: #EBEBE9
text
font-weight: bold
fill: $grey
path
display: none
&.y
line, path
fill: none
stroke: #000

21
src/styles/fonts.css Normal file
View File

@ -0,0 +1,21 @@
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro'), local('SourceSansPro-Regular'),
url('/fonts/SourceSansPro-Regular.woff') format('woff');
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 600;
src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'),
url('/fonts/SourceSansPro-Semibold.woff') format('woff');
}
@font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 700;
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'),
url('/fonts/SourceSansPro-Bold.woff') format('woff');
}

View File

@ -1,4 +1,5 @@
<div class="box"> <div class="box">
<h1><%- @name %></h2>
<div id="graph"> <div id="graph">
<div id="tooltip"></div> <div id="tooltip"></div>
</div> </div>