dc/d3 line chart crashing down to 0 on the y axis after filtering

前端 未结 2 2144
北恋
北恋 2020-12-22 02:03

When I apply a dimension filter to a dc.js graph, there are ugly lines where the line plummets towards the y axis.

2条回答
  •  无人及你
    2020-12-22 02:25

    You can call defined directly on the dc created chart.

    chart
      .chart((c) ->
        dc.lineChart(c)
          .interpolate('linear')
          .defined((d) ->
            return !isNaN(d.y)
          )
      )
    

    The condition !isNan(d.y) can be anything you like that evaluates to true/false.

    Note that the d passed by defined is a d3 object and is worth inspecting.

提交回复
热议问题