Method: Spoom::Coverage::D3::Timeline#area

Defined in:
lib/spoom/coverage/d3/timeline.rb

#area(y:, color: "#ccc", curve: "curveCatmullRom.alpha(1)") ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/spoom/coverage/d3/timeline.rb', line 187

def area(y:, color: "#ccc", curve: "curveCatmullRom.alpha(1)")
  <<~HTML
    svg_#{id}.append("path")
      .datum(data_#{id}.filter((d) => #{y}))
      .attr("class", "area")
      .attr("d", d3.area()
        .defined((d) => #{y})
        .x((d) => xScale_#{id}(parseDate(d.timestamp)))
        .y0(yScale_#{id}(0))
        .y1((d) => yScale_#{id}(#{y}))
        .curve(d3.#{curve}))
      .attr("fill", "#{color}")
  HTML
end