Skip to content

Commit

Permalink
Remove maxColumnWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
tothandras committed Sep 2, 2014
1 parent ab5ff3a commit 12a9b3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions www/waterfall_view/src/module/main.module.coffee
Expand Up @@ -30,8 +30,6 @@ class Waterfall extends Controller

# Minimum builder column width (px)
minColumnWidth: cfg.minColumnWidth or 40
# Maximum builder column width (px)
maxColumnWidth: cfg.maxColumnWidth or 80

# Y axis time format (new line: ^)
timeFormat: cfg.timeFormat or '%x^%I:%M'
Expand Down Expand Up @@ -141,25 +139,21 @@ class Waterfall extends Controller
# Set the content width
###
setWidth: ->
if @c.minColumnWidth > 0 and @c.maxColumnWidth > 0 and @c.minColumnWidth <= @c.maxColumnWidth
if @c.minColumnWidth > 0
columnWidth = (@$window.innerWidth - @c.margin.right - @c.margin.left) / @builders.length

narrower = columnWidth <= @c.maxColumnWidth
wider = @c.minColumnWidth <= columnWidth

width =
if narrower and wider then '100%'
else if narrower
"#{@builders.length * @c.minColumnWidth + @c.margin.right + @c.margin.left}px"
if wider then '100%'
else
"#{@builders.length * @c.maxColumnWidth + @c.margin.right + @c.margin.left}px"
"#{@builders.length * @c.minColumnWidth + @c.margin.right + @c.margin.left}px"

@waterfall.select('.inner-content').style('width', width)
@waterfall.select('.header-content').style('width', width)

else
@$log.error "Bad column width configuration\n\t min: #{@c.minColumnWidth}\n\t max: #{@c.maxColumnWidth}"
width = 40
@$log.error "Bad column width configuration\n\t min: #{@c.minColumnWidth}"

###
# Get the container height
Expand Down
2 changes: 1 addition & 1 deletion www/waterfall_view/src/module/scale/scale.service.coffee
Expand Up @@ -7,7 +7,7 @@ class ScaleService extends Factory
getX: (builders, width) ->
@d3.scale.ordinal()
.domain(builders.map (builder) -> builder.builderid)
.rangeRoundBands([0, width], 0.1)
.rangeRoundBands([0, width], width / (builders.length * 400))

# Returns y scale
getY: (groups, gap, height) ->
Expand Down

0 comments on commit 12a9b3a

Please sign in to comment.