app/assets/javascripts/plasticine/line.coffee in plasticine-1.2.4 vs app/assets/javascripts/plasticine/line.coffee in plasticine-1.2.5
- old
+ new
@@ -1,10 +1,7 @@
class @PlasticineLine
constructor: (@holder) ->
- @holder = $('.plasticine-line')
- @holder.on('resize', (e) => @resizeX())
-
PlasticineHelpers.setLocale()
@xScale = d3.scaleBand()
@setXScaleRange()
@yScale = d3.scaleLinear().range([@holder.height(), @holder.data('lines-top-padding')])
@@ -64,16 +61,17 @@
@lines = @svg.append('g').attr('class', "elements #{@chartLayout}").selectAll('.element').data(series)
@refreshLines()
@drawXAxis()
@drawLegend(data)
+
d3.select(window).on("resize." + @holder.attr("id"), () => @resizeX())
refreshLines: () ->
self = this
- $('g.element').remove()
+ @holder.find('g.element').remove()
element = @lines.enter().append('g').attr('class', "element")
element.append("path")
.attr('class', 'line')
.attr('d', (d) => if @chartLayout == 'area' then @chartPath(d) else @chartPath(d.dots))