Skip to content

Instantly share code, notes, and snippets.

@AndyMoreland
Created August 5, 2014 01:29
Show Gist options
  • Save AndyMoreland/8f22472a6a9a1fe8be90 to your computer and use it in GitHub Desktop.
Save AndyMoreland/8f22472a6a9a1fe8be90 to your computer and use it in GitHub Desktop.
module.exports =
class LineView extends VisualizationView
tagName: 'div'
_renderToContext: (context) =>
@_drawLines context, @reportPresenter.getLineData()
_drawLines: (context, data) ->
x = @axisProvider.getXScale(@renderBounds)
y = @axisProvider.getYScale(@renderBounds)
line = d3.svg.line()
.x (d) -> x(d.key)
.y (d) -> y(d.value)
context
.selectAll('.series')
.data(data)
.enter()
.append 'path'
.attr 'class', 'series'
.attr 'd', line
.attr 'fill', 'none' # remove
.attr 'stroke', 'black' # remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment