Skip to content

Commit

Permalink
Fixed growth aggregator, added configurable color
Browse files Browse the repository at this point in the history
  • Loading branch information
lbovet committed Jan 10, 2016
1 parent 5c14963 commit cce0919
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ aggregators =
count: (x) -> x.length
growth: (x, context) ->
value = aggregators.last(x)
result = Math.max(value - (context.previous || value),0)
if value > result
context.previous = value
previous = if context.previous isnt undefined then context.previous else value
diff = value - previous
result = Math.max(diff,0)
context.previous = value
return result

turtle = (config) ->
Expand Down Expand Up @@ -108,7 +109,7 @@ turtle = (config) ->
factor = (Date.now()-t0)/1000/pos
conf = config?.metrics?[subTitle]
graph.setContent zibar s,
color: colors[index % colors.length]
color: conf?.color || colors[index % colors.length]
height: conf?.height || graph.height-3
yAxis: conf?.yAxis
marks: style.marks
Expand Down

0 comments on commit cce0919

Please sign in to comment.